Add docbok documentation for 4.8{4,5,6}.{1.2}
[exim-website.git] / docbook / 4.84.1 / spec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>
16 26 Feb 2016
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.84.1</revnumber>
22 <date>26 Feb 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.84.1 of Exim.
206 Substantive changes from the 4.83 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.84.1</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.84.1-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" revisionflag="changed">
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 negociated 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 <indexterm role="concept">
10439 <primary>MX record</primary>
10440 <secondary>in <command>dnsdb</command> lookup</secondary>
10441 </indexterm>
10442 <indexterm role="concept">
10443 <primary>SRV record</primary>
10444 <secondary>in <command>dnsdb</command> lookup</secondary>
10445 </indexterm>
10446 For an MX lookup, both the preference value and the host name are returned for
10447 each record, separated by a space. For an SRV lookup, the priority, weight,
10448 port, and host name are returned for each record, separated by spaces.
10449 </para>
10450 <para>
10451 For any record type, if multiple records are found (or, for A6 lookups, if a
10452 single record leads to multiple addresses), the data is returned as a
10453 concatenation, with newline as the default separator. The order, of course,
10454 depends on the DNS resolver. You can specify a different separator character
10455 between multiple records by putting a right angle-bracket followed immediately
10456 by the new separator at the start of the query. For example:
10457 </para>
10458 <literallayout class="monospaced">
10459 ${lookup dnsdb{&gt;: a=host1.example}}
10460 </literallayout>
10461 <para>
10462 It is permitted to specify a space as the separator character. Further
10463 white space is ignored.
10464 </para>
10465 <para>
10466 <indexterm role="concept">
10467 <primary>TXT record</primary>
10468 <secondary>in <command>dnsdb</command> lookup</secondary>
10469 </indexterm>
10470 <indexterm role="concept">
10471 <primary>SPF record</primary>
10472 <secondary>in <command>dnsdb</command> lookup</secondary>
10473 </indexterm>
10474 For TXT records with multiple items of data, only the first item is returned,
10475 unless a separator for them is specified using a comma after the separator
10476 character followed immediately by the TXT record item separator. To concatenate
10477 items without a separator, use a semicolon instead. For SPF records the
10478 default behaviour is to concatenate multiple items without using a separator.
10479 </para>
10480 <literallayout class="monospaced">
10481 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10482 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10483 ${lookup dnsdb{spf=example.org}}
10484 </literallayout>
10485 <para>
10486 It is permitted to specify a space as the separator character. Further
10487 white space is ignored.
10488 </para>
10489 </section>
10490 <section id="SECID66">
10491 <title>Pseudo dnsdb record types</title>
10492 <para>
10493 <indexterm role="concept">
10494 <primary>MX record</primary>
10495 <secondary>in <command>dnsdb</command> lookup</secondary>
10496 </indexterm>
10497 By default, both the preference value and the host name are returned for
10498 each MX record, separated by a space. If you want only host names, you can use
10499 the pseudo-type MXH:
10500 </para>
10501 <literallayout class="monospaced">
10502 ${lookup dnsdb{mxh=a.b.example}}
10503 </literallayout>
10504 <para>
10505 In this case, the preference values are omitted, and just the host names are
10506 returned.
10507 </para>
10508 <para>
10509 <indexterm role="concept">
10510 <primary>name server for enclosing domain</primary>
10511 </indexterm>
10512 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10513 records on the given domain, but if none are found, it removes the first
10514 component of the domain name, and tries again. This process continues until NS
10515 records are found or there are no more components left (or there is a DNS
10516 error). In other words, it may return the name servers for a top-level domain,
10517 but it never returns the root name servers. If there are no NS records for the
10518 top-level domain, the lookup fails. Consider these examples:
10519 </para>
10520 <literallayout class="monospaced">
10521 ${lookup dnsdb{zns=xxx.quercite.com}}
10522 ${lookup dnsdb{zns=xxx.edu}}
10523 </literallayout>
10524 <para>
10525 Assuming that in each case there are no NS records for the full domain name,
10526 the first returns the name servers for <option>quercite.com</option>, and the second returns
10527 the name servers for <option>edu</option>.
10528 </para>
10529 <para>
10530 You should be careful about how you use this lookup because, unless the
10531 top-level domain does not exist, the lookup always returns some host names. The
10532 sort of use to which this might be put is for seeing if the name servers for a
10533 given domain are on a blacklist. You can probably assume that the name servers
10534 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10535 such a list.
10536 </para>
10537 <para>
10538 <indexterm role="concept">
10539 <primary>CSA</primary>
10540 <secondary>in <command>dnsdb</command> lookup</secondary>
10541 </indexterm>
10542 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10543 records according to the CSA rules, which are described in section
10544 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10545 not sufficient because of the extra parent domain search behaviour of CSA. The
10546 result of a successful lookup such as:
10547 </para>
10548 <literallayout class="monospaced">
10549 ${lookup dnsdb {csa=$sender_helo_name}}
10550 </literallayout>
10551 <para>
10552 has two space-separated fields: an authorization code and a target host name.
10553 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10554 authorization required but absent, or <quote>?</quote> for unknown.
10555 </para>
10556 <para>
10557 <indexterm role="concept">
10558 <primary>A+</primary>
10559 <secondary>in <command>dnsdb</command> lookup</secondary>
10560 </indexterm>
10561 The pseudo-type A+ performs an A6 lookup (if configured) followed by an AAAA
10562 and then an A lookup.  All results are returned; defer processing
10563 (see below) is handled separately for each lookup.  Example:
10564 </para>
10565 <literallayout class="monospaced">
10566 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10567 </literallayout>
10568 </section>
10569 <section id="SECID67">
10570 <title>Multiple dnsdb lookups</title>
10571 <para>
10572 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10573 However, you can specify a list of domains or IP addresses in a single
10574 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10575 the default separator, but with the ability to change this. For example:
10576 </para>
10577 <literallayout class="monospaced">
10578 ${lookup dnsdb{one.domain.com:two.domain.com}}
10579 ${lookup dnsdb{a=one.host.com:two.host.com}}
10580 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10581 </literallayout>
10582 <para>
10583 In order to retain backwards compatibility, there is one special case: if
10584 the lookup type is PTR and no change of separator is specified, Exim looks
10585 to see if the rest of the string is precisely one IPv6 address. In this
10586 case, it does not treat it as a list.
10587 </para>
10588 <para>
10589 The data from each lookup is concatenated, with newline separators by default,
10590 in the same way that multiple DNS records for a single item are handled. A
10591 different separator can be specified, as described above.
10592 </para>
10593 <para>
10594 Modifiers for <command>dnsdb</command> lookups are givien by optional keywords,
10595 each followed by a comma,
10596 that may appear before the record type.
10597 </para>
10598 <para>
10599 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10600 temporary DNS error for any of them, the behaviour is controlled by
10601 a defer-option modifier.
10602 The possible keywords are
10603 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10604 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10605 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10606 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10607 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10608 error causes the whole lookup to defer only if none of the other lookups
10609 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10610 </para>
10611 <literallayout class="monospaced">
10612 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10613 ${lookup dnsdb{a=one.host.com:two.host.com}}
10614 </literallayout>
10615 <para>
10616 Thus, in the default case, as long as at least one of the DNS lookups
10617 yields some data, the lookup succeeds.
10618 </para>
10619 <para>
10620 <indexterm role="concept">
10621 <primary>DNSSEC</primary>
10622 <secondary>dns lookup</secondary>
10623 </indexterm>
10624 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10625 The possible keywords are
10626 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10627 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10628 with the lookup.
10629 With <quote>strict</quote> a response from the DNS resolver that
10630 is not labelled as authenticated data
10631 is treated as equivalent to a temporary DNS error.
10632 The default is <quote>never</quote>.
10633 </para>
10634 <para>
10635 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10636 </para>
10637 </section>
10638 <section id="SECTldap">
10639 <title>More about LDAP</title>
10640 <para>
10641 <indexterm role="concept">
10642 <primary>LDAP</primary>
10643 <secondary>lookup, more about</secondary>
10644 </indexterm>
10645 <indexterm role="concept">
10646 <primary>lookup</primary>
10647 <secondary>LDAP</secondary>
10648 </indexterm>
10649 <indexterm role="concept">
10650 <primary>Solaris</primary>
10651 <secondary>LDAP</secondary>
10652 </indexterm>
10653 The original LDAP implementation came from the University of Michigan; this has
10654 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10655 implementation comes from Netscape, and Solaris 7 and subsequent releases
10656 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10657 the lookup function level, their error handling is different. For this reason
10658 it is necessary to set a compile-time variable when building Exim with LDAP, to
10659 indicate which LDAP library is in use. One of the following should appear in
10660 your <filename>Local/Makefile</filename>:
10661 </para>
10662 <literallayout class="monospaced">
10663 LDAP_LIB_TYPE=UMICHIGAN
10664 LDAP_LIB_TYPE=OPENLDAP1
10665 LDAP_LIB_TYPE=OPENLDAP2
10666 LDAP_LIB_TYPE=NETSCAPE
10667 LDAP_LIB_TYPE=SOLARIS
10668 </literallayout>
10669 <para>
10670 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10671 same interface as the University of Michigan version.
10672 </para>
10673 <para>
10674 There are three LDAP lookup types in Exim. These behave slightly differently in
10675 the way they handle the results of a query:
10676 </para>
10677 <itemizedlist>
10678 <listitem>
10679 <para>
10680 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10681 gives an error.
10682 </para>
10683 </listitem>
10684 <listitem>
10685 <para>
10686 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10687 Distinguished Name that is returned rather than any attribute values.
10688 </para>
10689 </listitem>
10690 <listitem>
10691 <para>
10692 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10693 from all of them are returned.
10694 </para>
10695 </listitem>
10696 </itemizedlist>
10697 <para>
10698 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10699 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10700 the data returned by a successful lookup is described in the next section.
10701 First we explain how LDAP queries are coded.
10702 </para>
10703 </section>
10704 <section id="SECTforldaque">
10705 <title>Format of LDAP queries</title>
10706 <para>
10707 <indexterm role="concept">
10708 <primary>LDAP</primary>
10709 <secondary>query format</secondary>
10710 </indexterm>
10711 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10712 the configuration of a <command>redirect</command> router one might have this setting:
10713 </para>
10714 <literallayout class="monospaced">
10715 data = ${lookup ldap \
10716   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10717   c=UK?mailbox?base?}}
10718 </literallayout>
10719 <para>
10720 <indexterm role="concept">
10721 <primary>LDAP</primary>
10722 <secondary>with TLS</secondary>
10723 </indexterm>
10724 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10725 secure (encrypted) LDAP connections. The second of these ensures that an
10726 encrypted TLS connection is used.
10727 </para>
10728 <para>
10729 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10730 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10731 See the <option>ldap_start_tls</option> option.
10732 </para>
10733 <para>
10734 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10735 controlled. Every part of the TLS configuration can be configured by settings in
10736 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10737 your system, some of the initialization may have required setting options in
10738 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10739 certificates. This revealed a nuance where the current UID that exim was
10740 running as could affect which config files it read. With Exim 4.83, these
10741 methods become optional, only taking effect if not specifically set in
10742 <filename>exim.conf</filename>.
10743 </para>
10744 </section>
10745 <section id="SECID68">
10746 <title>LDAP quoting</title>
10747 <para>
10748 <indexterm role="concept">
10749 <primary>LDAP</primary>
10750 <secondary>quoting</secondary>
10751 </indexterm>
10752 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10753 and the second because the LDAP query is represented as a URL. Furthermore,
10754 within an LDAP query, two different kinds of quoting are required. For this
10755 reason, there are two different LDAP-specific quoting operators.
10756 </para>
10757 <para>
10758 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10759 filter specifications. Conceptually, it first does the following conversions on
10760 the string:
10761 </para>
10762 <literallayout class="monospaced">
10763 *   =&gt;   \2A
10764 (   =&gt;   \28
10765 )   =&gt;   \29
10766 \   =&gt;   \5C
10767 </literallayout>
10768 <para>
10769 in accordance with RFC 2254. The resulting string is then quoted according
10770 to the rules for URLs, that is, all non-alphanumeric characters except
10771 </para>
10772 <literallayout class="monospaced">
10773 ! $ ' - . _ ( ) * +
10774 </literallayout>
10775 <para>
10776 are converted to their hex values, preceded by a percent sign. For example:
10777 </para>
10778 <literallayout class="monospaced">
10779 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10780 </literallayout>
10781 <para>
10782 yields
10783 </para>
10784 <literallayout class="monospaced">
10785 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10786 </literallayout>
10787 <para>
10788 Removing the URL quoting, this is (with a leading and a trailing space):
10789 </para>
10790 <literallayout class="monospaced">
10791 a\28bc\29\2A, a&lt;yz&gt;;
10792 </literallayout>
10793 <para>
10794 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10795 base DN specifications in queries. Conceptually, it first converts the string
10796 by inserting a backslash in front of any of the following characters:
10797 </para>
10798 <literallayout class="monospaced">
10799 , + " \ &lt; &gt; ;
10800 </literallayout>
10801 <para>
10802 It also inserts a backslash before any leading spaces or # characters, and
10803 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10804 is then quoted according to the rules for URLs. For example:
10805 </para>
10806 <literallayout class="monospaced">
10807 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10808 </literallayout>
10809 <para>
10810 yields
10811 </para>
10812 <literallayout class="monospaced">
10813 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10814 </literallayout>
10815 <para>
10816 Removing the URL quoting, this is (with a trailing space):
10817 </para>
10818 <literallayout class="monospaced">
10819 \ a(bc)*\, a\&lt;yz\&gt;\;\
10820 </literallayout>
10821 <para>
10822 There are some further comments about quoting in the section on LDAP
10823 authentication below.
10824 </para>
10825 </section>
10826 <section id="SECID69">
10827 <title>LDAP connections</title>
10828 <para>
10829 <indexterm role="concept">
10830 <primary>LDAP</primary>
10831 <secondary>connections</secondary>
10832 </indexterm>
10833 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10834 is in use, via a Unix domain socket. The example given above does not specify
10835 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10836 by starting it with
10837 </para>
10838 <literallayout class="monospaced">
10839 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10840 </literallayout>
10841 <para>
10842 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10843 used. When no server is specified in a query, a list of default servers is
10844 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10845 colon-separated list of servers which are tried in turn until one successfully
10846 handles a query, or there is a serious error. Successful handling either
10847 returns the requested data, or indicates that it does not exist. Serious errors
10848 are syntactical, or multiple values when only a single value is expected.
10849 Errors which cause the next server to be tried are connection failures, bind
10850 failures, and timeouts.
10851 </para>
10852 <para>
10853 For each server name in the list, a port number can be given. The standard way
10854 of specifying a host and port is to use a colon separator (RFC 1738). Because
10855 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10856 doubled. For example
10857 </para>
10858 <literallayout class="monospaced">
10859 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10860 </literallayout>
10861 <para>
10862 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10863 to the LDAP library with no server name, and the library&#x2019;s default (normally
10864 the local host) is used.
10865 </para>
10866 <para>
10867 If you are using the OpenLDAP library, you can connect to an LDAP server using
10868 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10869 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10870 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10871 not available.
10872 </para>
10873 <para>
10874 For this type of connection, instead of a host name for the server, a pathname
10875 for the socket is required, and the port number is not relevant. The pathname
10876 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10877 the query. In the former case, you can have settings such as
10878 </para>
10879 <literallayout class="monospaced">
10880 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10881 </literallayout>
10882 <para>
10883 When the pathname is given in the query, you have to escape the slashes as
10884 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10885 </para>
10886 <literallayout class="monospaced">
10887 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10888 </literallayout>
10889 <para>
10890 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10891 a pathname, it uses the Unix domain socket code, even if the query actually
10892 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10893 socket connection. This behaviour means that you can use a setting of
10894 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10895 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10896 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10897 backup host.
10898 </para>
10899 <para>
10900 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10901 specified, an error is diagnosed. However, if there are more items in
10902 <option>ldap_default_servers</option>, they are tried. In other words:
10903 </para>
10904 <itemizedlist>
10905 <listitem>
10906 <para>
10907 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10908 interface.
10909 </para>
10910 </listitem>
10911 <listitem>
10912 <para>
10913 Using <literal>ldapi</literal> with a host name causes an error.
10914 </para>
10915 </listitem>
10916 </itemizedlist>
10917 <para>
10918 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10919 <option>ldap_default_servers</option>, does whatever the library does by default.
10920 </para>
10921 </section>
10922 <section id="SECID70">
10923 <title>LDAP authentication and control information</title>
10924 <para>
10925 <indexterm role="concept">
10926 <primary>LDAP</primary>
10927 <secondary>authentication</secondary>
10928 </indexterm>
10929 The LDAP URL syntax provides no way of passing authentication and other control
10930 information to the server. To make this possible, the URL in an LDAP query may
10931 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10932 spaces. If a value contains spaces it must be enclosed in double quotes, and
10933 when double quotes are used, backslash is interpreted in the usual way inside
10934 them. The following names are recognized:
10935 </para>
10936 <literallayout>
10937 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10938 <literal>NETTIME    </literal>  set a timeout for a network operation
10939 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10940 <literal>PASS       </literal>  set the password, likewise
10941 <literal>REFERRALS  </literal>  set the referrals parameter
10942 <literal>SERVERS    </literal>  set alternate server list for this query only
10943 <literal>SIZE       </literal>  set the limit for the number of entries returned
10944 <literal>TIME       </literal>  set the maximum waiting time for a query
10945 </literallayout>
10946 <para>
10947 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10948 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10949 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10950 library from trying to follow referrals issued by the LDAP server.
10951 </para>
10952 <para>
10953 The name CONNECT is an obsolete name for NETTIME, retained for
10954 backwards compatibility. This timeout (specified as a number of seconds) is
10955 enforced from the client end for operations that can be carried out over a
10956 network. Specifically, it applies to network connections and calls to the
10957 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10958 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10959 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10960 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10961 Netscape SDK; for OpenLDAP no action is taken.
10962 </para>
10963 <para>
10964 The TIME parameter (also a number of seconds) is passed to the server to
10965 set a server-side limit on the time taken to complete a search.
10966 </para>
10967 <para>
10968 The SERVERS parameter allows you to specify an alternate list of ldap servers
10969 to use for an individual lookup.  The global ldap_servers option provides a
10970 default list of ldap servers, and a single lookup can specify a single ldap
10971 server to use.  But when you need to do a lookup with a list of servers that is
10972 different than the default list (maybe different order, maybe a completely
10973 different set of servers), the SERVERS parameter allows you to specify this
10974 alternate list.
10975 </para>
10976 <para>
10977 Here is an example of an LDAP query in an Exim lookup that uses some of these
10978 values. This is a single line, folded to fit on the page:
10979 </para>
10980 <literallayout class="monospaced">
10981 ${lookup ldap
10982   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10983   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10984   {$value}fail}
10985 </literallayout>
10986 <para>
10987 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10988 any of the auxiliary data. Exim configuration settings that include lookups
10989 which contain password information should be preceded by <quote>hide</quote> to prevent
10990 non-admin users from using the <option>-bP</option> option to see their values.
10991 </para>
10992 <para>
10993 The auxiliary data items may be given in any order. The default is no
10994 connection timeout (the system timeout is used), no user or password, no limit
10995 on the number of entries returned, and no time limit on queries.
10996 </para>
10997 <para>
10998 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10999 removes any URL quoting that it may contain before passing it LDAP. Apparently
11000 some libraries do this for themselves, but some do not. Removing the URL
11001 quoting has two advantages:
11002 </para>
11003 <itemizedlist>
11004 <listitem>
11005 <para>
11006 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11007 DNs as with DNs inside actual queries.
11008 </para>
11009 </listitem>
11010 <listitem>
11011 <para>
11012 It permits spaces inside USER= DNs.
11013 </para>
11014 </listitem>
11015 </itemizedlist>
11016 <para>
11017 For example, a setting such as
11018 </para>
11019 <literallayout class="monospaced">
11020 USER=cn=${quote_ldap_dn:$1}
11021 </literallayout>
11022 <para>
11023 should work even if <varname>$1</varname> contains spaces.
11024 </para>
11025 <para>
11026 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11027 expansion operator, rather than the LDAP quote operators. The only reason this
11028 field needs quoting is to ensure that it conforms to the Exim syntax, which
11029 does not allow unquoted spaces. For example:
11030 </para>
11031 <literallayout class="monospaced">
11032 PASS=${quote:$3}
11033 </literallayout>
11034 <para>
11035 The LDAP authentication mechanism can be used to check passwords as part of
11036 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11037 <xref linkend="CHAPexpand"/>.
11038 </para>
11039 </section>
11040 <section id="SECID71">
11041 <title>Format of data returned by LDAP</title>
11042 <para>
11043 <indexterm role="concept">
11044 <primary>LDAP</primary>
11045 <secondary>returned data formats</secondary>
11046 </indexterm>
11047 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11048 as a sequence of values, for example
11049 </para>
11050 <literallayout class="monospaced">
11051 cn=manager, o=University of Cambridge, c=UK
11052 </literallayout>
11053 <para>
11054 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11055 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11056 the result between the data from different entries. It is possible for multiple
11057 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11058 you know that whatever values are returned all came from a single entry in the
11059 directory.
11060 </para>
11061 <para>
11062 In the common case where you specify a single attribute in your LDAP query, the
11063 result is not quoted, and does not contain the attribute name. If the attribute
11064 has multiple values, they are separated by commas.
11065 </para>
11066 <para>
11067 If you specify multiple attributes, the result contains space-separated, quoted
11068 strings, each preceded by the attribute name and an equals sign. Within the
11069 quotes, the quote character, backslash, and newline are escaped with
11070 backslashes, and commas are used to separate multiple values for the attribute.
11071 Apart from the escaping, the string within quotes takes the same form as the
11072 output when a single attribute is requested. Specifying no attributes is the
11073 same as specifying all of an entry&#x2019;s attributes.
11074 </para>
11075 <para>
11076 Here are some examples of the output format. The first line of each pair is an
11077 LDAP query, and the second is the data that is returned. The attribute called
11078 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
11079 </para>
11080 <literallayout class="monospaced">
11081 ldap:///o=base?attr1?sub?(uid=fred)
11082 value1.1, value1.2
11083
11084 ldap:///o=base?attr2?sub?(uid=fred)
11085 value two
11086
11087 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11088 attr1="value1.1, value1.2" attr2="value two"
11089
11090 ldap:///o=base??sub?(uid=fred)
11091 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
11092 </literallayout>
11093 <para>
11094 The <option>extract</option> operator in string expansions can be used to pick out
11095 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
11096 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11097 results of LDAP lookups.
11098 </para>
11099 </section>
11100 <section id="SECTnisplus">
11101 <title>More about NIS+</title>
11102 <para>
11103 <indexterm role="concept">
11104 <primary>NIS+ lookup type</primary>
11105 </indexterm>
11106 <indexterm role="concept">
11107 <primary>lookup</primary>
11108 <secondary>NIS+</secondary>
11109 </indexterm>
11110 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11111 and field name. If this is given, the result of a successful query is the
11112 contents of the named field; otherwise the result consists of a concatenation
11113 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11114 values containing spaces are quoted. For example, the query
11115 </para>
11116 <literallayout class="monospaced">
11117 [name=mg1456],passwd.org_dir
11118 </literallayout>
11119 <para>
11120 might return the string
11121 </para>
11122 <literallayout class="monospaced">
11123 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11124 home=/home/mg1456 shell=/bin/bash shadow=""
11125 </literallayout>
11126 <para>
11127 (split over two lines here to fit on the page), whereas
11128 </para>
11129 <literallayout class="monospaced">
11130 [name=mg1456],passwd.org_dir:gcos
11131 </literallayout>
11132 <para>
11133 would just return
11134 </para>
11135 <literallayout class="monospaced">
11136 Martin Guerre
11137 </literallayout>
11138 <para>
11139 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11140 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11141 operator is to double any quote characters within the text.
11142 </para>
11143 </section>
11144 <section id="SECTsql">
11145 <title>SQL lookups</title>
11146 <para>
11147 <indexterm role="concept">
11148 <primary>SQL lookup types</primary>
11149 </indexterm>
11150 <indexterm role="concept">
11151 <primary>MySQL</primary>
11152 <secondary>lookup type</secondary>
11153 </indexterm>
11154 <indexterm role="concept">
11155 <primary>PostgreSQL lookup type</primary>
11156 </indexterm>
11157 <indexterm role="concept">
11158 <primary>lookup</primary>
11159 <secondary>MySQL</secondary>
11160 </indexterm>
11161 <indexterm role="concept">
11162 <primary>lookup</primary>
11163 <secondary>PostgreSQL</secondary>
11164 </indexterm>
11165 <indexterm role="concept">
11166 <primary>Oracle</primary>
11167 <secondary>lookup type</secondary>
11168 </indexterm>
11169 <indexterm role="concept">
11170 <primary>lookup</primary>
11171 <secondary>Oracle</secondary>
11172 </indexterm>
11173 <indexterm role="concept">
11174 <primary>InterBase lookup type</primary>
11175 </indexterm>
11176 <indexterm role="concept">
11177 <primary>lookup</primary>
11178 <secondary>InterBase</secondary>
11179 </indexterm>
11180 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11181 databases. Queries for these databases contain SQL statements, so an example
11182 might be
11183 </para>
11184 <literallayout class="monospaced">
11185 ${lookup mysql{select mailbox from users where id='userx'}\
11186   {$value}fail}
11187 </literallayout>
11188 <para>
11189 If the result of the query contains more than one field, the data for each
11190 field in the row is returned, preceded by its name, so the result of
11191 </para>
11192 <literallayout class="monospaced">
11193 ${lookup pgsql{select home,name from users where id='userx'}\
11194   {$value}}
11195 </literallayout>
11196 <para>
11197 might be
11198 </para>
11199 <literallayout class="monospaced">
11200 home=/home/userx name="Mister X"
11201 </literallayout>
11202 <para>
11203 Empty values and values containing spaces are double quoted, with embedded
11204 quotes escaped by a backslash. If the result of the query contains just one
11205 field, the value is passed back verbatim, without a field name, for example:
11206 </para>
11207 <literallayout class="monospaced">
11208 Mister X
11209 </literallayout>
11210 <para>
11211 If the result of the query yields more than one row, it is all concatenated,
11212 with a newline between the data for each row.
11213 </para>
11214 </section>
11215 <section id="SECID72">
11216 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11217 <para>
11218 <indexterm role="concept">
11219 <primary>MySQL</primary>
11220 <secondary>lookup type</secondary>
11221 </indexterm>
11222 <indexterm role="concept">
11223 <primary>PostgreSQL lookup type</primary>
11224 </indexterm>
11225 <indexterm role="concept">
11226 <primary>lookup</primary>
11227 <secondary>MySQL</secondary>
11228 </indexterm>
11229 <indexterm role="concept">
11230 <primary>lookup</primary>
11231 <secondary>PostgreSQL</secondary>
11232 </indexterm>
11233 <indexterm role="concept">
11234 <primary>Oracle</primary>
11235 <secondary>lookup type</secondary>
11236 </indexterm>
11237 <indexterm role="concept">
11238 <primary>lookup</primary>
11239 <secondary>Oracle</secondary>
11240 </indexterm>
11241 <indexterm role="concept">
11242 <primary>InterBase lookup type</primary>
11243 </indexterm>
11244 <indexterm role="concept">
11245 <primary>lookup</primary>
11246 <secondary>InterBase</secondary>
11247 </indexterm>
11248 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11249 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11250 option (as appropriate) must be set to a colon-separated list of server
11251 information.
11252 (For MySQL and PostgreSQL only, the global option need not be set if all
11253 queries contain their own server information &ndash; see section
11254 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11255 items: host name, database name, user name, and password. In the case of
11256 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11257 name field is not used and should be empty. For example:
11258 </para>
11259 <literallayout class="monospaced">
11260 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11261 </literallayout>
11262 <para>
11263 Because password data is sensitive, you should always precede the setting with
11264 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11265 option. Here is an example where two MySQL servers are listed:
11266 </para>
11267 <literallayout class="monospaced">
11268 hide mysql_servers = localhost/users/root/secret:\
11269                      otherhost/users/root/othersecret
11270 </literallayout>
11271 <para>
11272 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11273 because this is a colon-separated list, the colon has to be doubled. For each
11274 query, these parameter groups are tried in order until a connection is made and
11275 a query is successfully processed. The result of a query may be that no data is
11276 found, but that is still a successful query. In other words, the list of
11277 servers provides a backup facility, not a list of different places to look.
11278 </para>
11279 <para>
11280 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11281 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11282 respectively, and the characters single-quote, double-quote, and backslash
11283 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11284 addition, escapes the percent and underscore characters. This cannot be done
11285 for MySQL because these escapes are not recognized in contexts where these
11286 characters are not special.
11287 </para>
11288 </section>
11289 <section id="SECTspeserque">
11290 <title>Specifying the server in the query</title>
11291 <para>
11292 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11293 it is possible to specify a list of servers with an individual query. This is
11294 done by starting the query with
11295 </para>
11296 <literallayout>
11297 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11298 </literallayout>
11299 <para>
11300 Each item in the list may take one of two forms:
11301 </para>
11302 <orderedlist numeration="arabic">
11303 <listitem>
11304 <para>
11305 If it contains no slashes it is assumed to be just a host name. The appropriate
11306 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11307 of the same name, and the remaining parameters (database, user, password) are
11308 taken from there.
11309 </para>
11310 </listitem>
11311 <listitem>
11312 <para>
11313 If it contains any slashes, it is taken as a complete parameter set.
11314 </para>
11315 </listitem>
11316 </orderedlist>
11317 <para>
11318 The list of servers is used in exactly the same way as the global list.
11319 Once a connection to a server has happened and a query has been
11320 successfully executed, processing of the lookup ceases.
11321 </para>
11322 <para>
11323 This feature is intended for use in master/slave situations where updates
11324 are occurring and you want to update the master rather than a slave. If the
11325 master is in the list as a backup for reading, you might have a global setting
11326 like this:
11327 </para>
11328 <literallayout class="monospaced">
11329 mysql_servers = slave1/db/name/pw:\
11330                 slave2/db/name/pw:\
11331                 master/db/name/pw
11332 </literallayout>
11333 <para>
11334 In an updating lookup, you could then write:
11335 </para>
11336 <literallayout class="monospaced">
11337 ${lookup mysql{servers=master; UPDATE ...} }
11338 </literallayout>
11339 <para>
11340 That query would then be sent only to the master server. If, on the other hand,
11341 the master is not to be used for reading, and so is not present in the global
11342 option, you can still update it by a query of this form:
11343 </para>
11344 <literallayout class="monospaced">
11345 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11346 </literallayout>
11347 </section>
11348 <section id="SECID73">
11349 <title>Special MySQL features</title>
11350 <para>
11351 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11352 causes a connection to the server on the local host by means of a Unix domain
11353 socket. An alternate socket can be specified in parentheses. The full syntax of
11354 each item in <option>mysql_servers</option> is:
11355 </para>
11356 <literallayout>
11357 &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;
11358 </literallayout>
11359 <para>
11360 Any of the three sub-parts of the first field can be omitted. For normal use on
11361 the local host it can be left blank or set to just <quote>localhost</quote>.
11362 </para>
11363 <para>
11364 No database need be supplied &ndash; but if it is absent here, it must be given in
11365 the queries.
11366 </para>
11367 <para>
11368 If a MySQL query is issued that does not request any data (an insert, update,
11369 or delete command), the result of the lookup is the number of rows affected.
11370 </para>
11371 <para>
11372 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11373 anything (for example, setting a field to the value it already has), the result
11374 is zero because no rows are affected.
11375 </para>
11376 </section>
11377 <section id="SECID74">
11378 <title>Special PostgreSQL features</title>
11379 <para>
11380 PostgreSQL lookups can also use Unix domain socket connections to the database.
11381 This is usually faster and costs less CPU time than a TCP/IP connection.
11382 However it can be used only if the mail server runs on the same machine as the
11383 database server. A configuration line for PostgreSQL via Unix domain sockets
11384 looks like this:
11385 </para>
11386 <literallayout class="monospaced">
11387 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11388 </literallayout>
11389 <para>
11390 In other words, instead of supplying a host name, a path to the socket is
11391 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11392 visually confused with the delimiters for the other server parameters.
11393 </para>
11394 <para>
11395 If a PostgreSQL query is issued that does not request any data (an insert,
11396 update, or delete command), the result of the lookup is the number of rows
11397 affected.
11398 </para>
11399 </section>
11400 <section id="SECTsqlite">
11401 <title>More about SQLite</title>
11402 <para>
11403 <indexterm role="concept">
11404 <primary>lookup</primary>
11405 <secondary>SQLite</secondary>
11406 </indexterm>
11407 <indexterm role="concept">
11408 <primary>sqlite lookup type</primary>
11409 </indexterm>
11410 SQLite is different to the other SQL lookups because a file name is required in
11411 addition to the SQL query. An SQLite database is a single file, and there is no
11412 daemon as in the other SQL databases. The interface to Exim requires the name
11413 of the file, as an absolute path, to be given at the start of the query. It is
11414 separated from the query by white space. This means that the path name cannot
11415 contain white space. Here is a lookup expansion example:
11416 </para>
11417 <literallayout class="monospaced">
11418 ${lookup sqlite {/some/thing/sqlitedb \
11419   select name from aliases where id='userx';}}
11420 </literallayout>
11421 <para>
11422 In a list, the syntax is similar. For example:
11423 </para>
11424 <literallayout class="monospaced">
11425 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11426    select * from relays where ip='$sender_host_address';
11427 </literallayout>
11428 <para>
11429 The only character affected by the <option>quote_sqlite</option> operator is a single
11430 quote, which it doubles.
11431 </para>
11432 <para>
11433 The SQLite library handles multiple simultaneous accesses to the database
11434 internally. Multiple readers are permitted, but only one process can
11435 update at once. Attempts to access the database while it is being updated
11436 are rejected after a timeout period, during which the SQLite library
11437 waits for the lock to be released. In Exim, the default timeout is set
11438 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11439 option.
11440 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11441 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11442 </para>
11443 </section>
11444 </chapter>
11445
11446 <chapter id="CHAPdomhosaddlists">
11447 <title>Domain, host, address, and local part lists</title>
11448 <titleabbrev>Domain, host, and address lists</titleabbrev>
11449 <para>
11450 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11451 <primary>lists of domains; hosts; etc.</primary>
11452 </indexterm>
11453 A number of Exim configuration options contain lists of domains, hosts,
11454 email addresses, or local parts. For example, the <option>hold_domains</option> option
11455 contains a list of domains whose delivery is currently suspended. These lists
11456 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11457 arguments to expansion conditions such as <option>match_domain</option>.
11458 </para>
11459 <para>
11460 Each item in one of these lists is a pattern to be matched against a domain,
11461 host, email address, or local part, respectively. In the sections below, the
11462 different types of pattern for each case are described, but first we cover some
11463 general facilities that apply to all four kinds of list.
11464 </para>
11465 <section id="SECTlistexpand">
11466 <title>Expansion of lists</title>
11467 <para>
11468 <indexterm role="concept">
11469 <primary>expansion</primary>
11470 <secondary>of lists</secondary>
11471 </indexterm>
11472 Each list is expanded as a single string before it is used. The result of
11473 expansion must be a list, possibly containing empty items, which is split up
11474 into separate items for matching. By default, colon is the separator character,
11475 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11476 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11477 discusses the way to specify empty list items.
11478 </para>
11479 <para>
11480 If the string expansion is forced to fail, Exim behaves as if the item it is
11481 testing (domain, host, address, or local part) is not in the list. Other
11482 expansion failures cause temporary errors.
11483 </para>
11484 <para>
11485 If an item in a list is a regular expression, backslashes, dollars and possibly
11486 other special characters in the expression must be protected against
11487 misinterpretation by the string expander. The easiest way to do this is to use
11488 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11489 expression should not be expanded. For example, in an ACL you might have:
11490 </para>
11491 <literallayout class="monospaced">
11492 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11493                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11494 </literallayout>
11495 <para>
11496 The first item is a regular expression that is protected from expansion by
11497 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11498 senders based on the receiving domain.
11499 </para>
11500 </section>
11501 <section id="SECID76">
11502 <title>Negated items in lists</title>
11503 <para>
11504 <indexterm role="concept">
11505 <primary>list</primary>
11506 <secondary>negation</secondary>
11507 </indexterm>
11508 <indexterm role="concept">
11509 <primary>negation</primary>
11510 <secondary>in lists</secondary>
11511 </indexterm>
11512 Items in a list may be positive or negative. Negative items are indicated by a
11513 leading exclamation mark, which may be followed by optional white space. A list
11514 defines a set of items (domains, etc). When Exim processes one of these lists,
11515 it is trying to find out whether a domain, host, address, or local part
11516 (respectively) is in the set that is defined by the list. It works like this:
11517 </para>
11518 <para>
11519 The list is scanned from left to right. If a positive item is matched, the
11520 subject that is being checked is in the set; if a negative item is matched, the
11521 subject is not in the set. If the end of the list is reached without the
11522 subject having matched any of the patterns, it is in the set if the last item
11523 was a negative one, but not if it was a positive one. For example, the list in
11524 </para>
11525 <literallayout class="monospaced">
11526 domainlist relay_to_domains = !a.b.c : *.b.c
11527 </literallayout>
11528 <para>
11529 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11530 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11531 list is positive. However, if the setting were
11532 </para>
11533 <literallayout class="monospaced">
11534 domainlist relay_to_domains = !a.b.c
11535 </literallayout>
11536 <para>
11537 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11538 list is negative. In other words, a list that ends with a negative item behaves
11539 as if it had an extra item <literal>:*</literal> on the end.
11540 </para>
11541 <para>
11542 Another way of thinking about positive and negative items in lists is to read
11543 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11544 item.
11545 </para>
11546 </section>
11547 <section id="SECTfilnamlis">
11548 <title>File names in lists</title>
11549 <para>
11550 <indexterm role="concept">
11551 <primary>list</primary>
11552 <secondary>file name in</secondary>
11553 </indexterm>
11554 If an item in a domain, host, address, or local part list is an absolute file
11555 name (beginning with a slash character), each line of the file is read and
11556 processed as if it were an independent item in the list, except that further
11557 file names are not allowed,
11558 and no expansion of the data from the file takes place.
11559 Empty lines in the file are ignored, and the file may also contain comment
11560 lines:
11561 </para>
11562 <itemizedlist>
11563 <listitem>
11564 <para>
11565 For domain and host lists, if a # character appears anywhere in a line of the
11566 file, it and all following characters are ignored.
11567 </para>
11568 </listitem>
11569 <listitem>
11570 <para>
11571 Because local parts may legitimately contain # characters, a comment in an
11572 address list or local part list file is recognized only if # is preceded by
11573 white space or the start of the line. For example:
11574 </para>
11575 <literallayout class="monospaced">
11576 not#comment@x.y.z   # but this is a comment
11577 </literallayout>
11578 </listitem>
11579 </itemizedlist>
11580 <para>
11581 Putting a file name in a list has the same effect as inserting each line of the
11582 file as an item in the list (blank lines and comments excepted). However, there
11583 is one important difference: the file is read each time the list is processed,
11584 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11585 </para>
11586 <para>
11587 If a file name is preceded by an exclamation mark, the sense of any match
11588 within the file is inverted. For example, if
11589 </para>
11590 <literallayout class="monospaced">
11591 hold_domains = !/etc/nohold-domains
11592 </literallayout>
11593 <para>
11594 and the file contains the lines
11595 </para>
11596 <literallayout class="monospaced">
11597 !a.b.c
11598 *.b.c
11599 </literallayout>
11600 <para>
11601 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11602 any domain matching <literal>*.b.c</literal> is not.
11603 </para>
11604 </section>
11605 <section id="SECID77">
11606 <title>An lsearch file is not an out-of-line list</title>
11607 <para>
11608 As will be described in the sections that follow, lookups can be used in lists
11609 to provide indexed methods of checking list membership. There has been some
11610 confusion about the way <command>lsearch</command> lookups work in lists. Because
11611 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11612 sometimes thought that it is allowed to contain wild cards and other kinds of
11613 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11614 always fixed strings, just as for any other single-key lookup type.
11615 </para>
11616 <para>
11617 If you want to use a file to contain wild-card patterns that form part of a
11618 list, just give the file name on its own, without a search type, as described
11619 in the previous section. You could also use the <command>wildlsearch</command> or
11620 <command>nwildlsearch</command>, but there is no advantage in doing this.
11621 </para>
11622 </section>
11623 <section id="SECTnamedlists">
11624 <title>Named lists</title>
11625 <para>
11626 <indexterm role="concept">
11627 <primary>named lists</primary>
11628 </indexterm>
11629 <indexterm role="concept">
11630 <primary>list</primary>
11631 <secondary>named</secondary>
11632 </indexterm>
11633 A list of domains, hosts, email addresses, or local parts can be given a name
11634 which is then used to refer to the list elsewhere in the configuration. This is
11635 particularly convenient if the same list is required in several different
11636 places. It also allows lists to be given meaningful names, which can improve
11637 the readability of the configuration. For example, it is conventional to define
11638 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11639 locally on a host, using a configuration line such as
11640 </para>
11641 <literallayout class="monospaced">
11642 domainlist local_domains = localhost:my.dom.example
11643 </literallayout>
11644 <para>
11645 Named lists are referenced by giving their name preceded by a plus sign, so,
11646 for example, a router that is intended to handle local domains would be
11647 configured with the line
11648 </para>
11649 <literallayout class="monospaced">
11650 domains = +local_domains
11651 </literallayout>
11652 <para>
11653 The first router in a configuration is often one that handles all domains
11654 except the local ones, using a configuration with a negated item like this:
11655 </para>
11656 <literallayout class="monospaced">
11657 dnslookup:
11658   driver = dnslookup
11659   domains = ! +local_domains
11660   transport = remote_smtp
11661   no_more
11662 </literallayout>
11663 <para>
11664 The four kinds of named list are created by configuration lines starting with
11665 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11666 respectively. Then there follows the name that you are defining, followed by an
11667 equals sign and the list itself. For example:
11668 </para>
11669 <literallayout class="monospaced">
11670 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11671 addresslist bad_senders = cdb;/etc/badsenders
11672 </literallayout>
11673 <para>
11674 A named list may refer to other named lists:
11675 </para>
11676 <literallayout class="monospaced">
11677 domainlist  dom1 = first.example : second.example
11678 domainlist  dom2 = +dom1 : third.example
11679 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11680 </literallayout>
11681 <para>
11682 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11683 effect may not be what you intended, because the negation does not propagate
11684 out to the higher level. For example, consider:
11685 </para>
11686 <literallayout class="monospaced">
11687 domainlist  dom1 = !a.b
11688 domainlist  dom2 = +dom1 : *.b
11689 </literallayout>
11690 <para>
11691 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11692 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11693 means it matches the second list as well. The effect is not the same as
11694 </para>
11695 <literallayout class="monospaced">
11696 domainlist  dom2 = !a.b : *.b
11697 </literallayout>
11698 <para>
11699 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11700 referenced lists if you can.
11701 </para>
11702 <para>
11703 Named lists may have a performance advantage. When Exim is routing an
11704 address or checking an incoming message, it caches the result of tests on named
11705 lists. So, if you have a setting such as
11706 </para>
11707 <literallayout class="monospaced">
11708 domains = +local_domains
11709 </literallayout>
11710 <para>
11711 on several of your routers
11712 or in several ACL statements,
11713 the actual test is done only for the first one. However, the caching works only
11714 if there are no expansions within the list itself or any sublists that it
11715 references. In other words, caching happens only for lists that are known to be
11716 the same each time they are referenced.
11717 </para>
11718 <para>
11719 By default, there may be up to 16 named lists of each type. This limit can be
11720 extended by changing a compile-time variable. The use of domain and host lists
11721 is recommended for concepts such as local domains, relay domains, and relay
11722 hosts. The default configuration is set up like this.
11723 </para>
11724 </section>
11725 <section id="SECID78">
11726 <title>Named lists compared with macros</title>
11727 <para>
11728 <indexterm role="concept">
11729 <primary>list</primary>
11730 <secondary>named compared with macro</secondary>
11731 </indexterm>
11732 <indexterm role="concept">
11733 <primary>macro</primary>
11734 <secondary>compared with named list</secondary>
11735 </indexterm>
11736 At first sight, named lists might seem to be no different from macros in the
11737 configuration file. However, macros are just textual substitutions. If you
11738 write
11739 </para>
11740 <literallayout class="monospaced">
11741 ALIST = host1 : host2
11742 auth_advertise_hosts = !ALIST
11743 </literallayout>
11744 <para>
11745 it probably won&#x2019;t do what you want, because that is exactly the same as
11746 </para>
11747 <literallayout class="monospaced">
11748 auth_advertise_hosts = !host1 : host2
11749 </literallayout>
11750 <para>
11751 Notice that the second host name is not negated. However, if you use a host
11752 list, and write
11753 </para>
11754 <literallayout class="monospaced">
11755 hostlist alist = host1 : host2
11756 auth_advertise_hosts = ! +alist
11757 </literallayout>
11758 <para>
11759 the negation applies to the whole list, and so that is equivalent to
11760 </para>
11761 <literallayout class="monospaced">
11762 auth_advertise_hosts = !host1 : !host2
11763 </literallayout>
11764 </section>
11765 <section id="SECID79">
11766 <title>Named list caching</title>
11767 <para>
11768 <indexterm role="concept">
11769 <primary>list</primary>
11770 <secondary>caching of named</secondary>
11771 </indexterm>
11772 <indexterm role="concept">
11773 <primary>caching</primary>
11774 <secondary>named lists</secondary>
11775 </indexterm>
11776 While processing a message, Exim caches the result of checking a named list if
11777 it is sure that the list is the same each time. In practice, this means that
11778 the cache operates only if the list contains no $ characters, which guarantees
11779 that it will not change when it is expanded. Sometimes, however, you may have
11780 an expanded list that you know will be the same each time within a given
11781 message. For example:
11782 </para>
11783 <literallayout class="monospaced">
11784 domainlist special_domains = \
11785            ${lookup{$sender_host_address}cdb{/some/file}}
11786 </literallayout>
11787 <para>
11788 This provides a list of domains that depends only on the sending host&#x2019;s IP
11789 address. If this domain list is referenced a number of times (for example,
11790 in several ACL lines, or in several routers) the result of the check is not
11791 cached by default, because Exim does not know that it is going to be the
11792 same list each time.
11793 </para>
11794 <para>
11795 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11796 cache the result anyway. For example:
11797 </para>
11798 <literallayout class="monospaced">
11799 domainlist_cache special_domains = ${lookup{...
11800 </literallayout>
11801 <para>
11802 If you do this, you should be absolutely sure that caching is going to do
11803 the right thing in all cases. When in doubt, leave it out.
11804 </para>
11805 </section>
11806 <section id="SECTdomainlist">
11807 <title>Domain lists</title>
11808 <para>
11809 <indexterm role="concept">
11810 <primary>domain list</primary>
11811 <secondary>patterns for</secondary>
11812 </indexterm>
11813 <indexterm role="concept">
11814 <primary>list</primary>
11815 <secondary>domain list</secondary>
11816 </indexterm>
11817 Domain lists contain patterns that are to be matched against a mail domain.
11818 The following types of item may appear in domain lists:
11819 </para>
11820 <itemizedlist>
11821 <listitem>
11822 <para>
11823 <indexterm role="concept">
11824 <primary>primary host name</primary>
11825 </indexterm>
11826 <indexterm role="concept">
11827 <primary>host name</primary>
11828 <secondary>matched in domain list</secondary>
11829 </indexterm>
11830 <indexterm role="option">
11831 <primary><option>primary_hostname</option></primary>
11832 </indexterm>
11833 <indexterm role="concept">
11834 <primary>domain list</primary>
11835 <secondary>matching primary host name</secondary>
11836 </indexterm>
11837 <indexterm role="concept">
11838 <primary>@ in a domain list</primary>
11839 </indexterm>
11840 If a pattern consists of a single @ character, it matches the local host name,
11841 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11842 possible to use the same configuration file on several different hosts that
11843 differ only in their names.
11844 </para>
11845 </listitem>
11846 <listitem>
11847 <para>
11848 <indexterm role="concept">
11849 <primary>@[] in a domain list</primary>
11850 </indexterm>
11851 <indexterm role="concept">
11852 <primary>domain list</primary>
11853 <secondary>matching local IP interfaces</secondary>
11854 </indexterm>
11855 <indexterm role="concept">
11856 <primary>domain literal</primary>
11857 </indexterm>
11858 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11859 in square brackets (as in an email address that contains a domain literal), but
11860 only if that IP address is recognized as local for email routing purposes. The
11861 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11862 control which of a host&#x2019;s several IP addresses are treated as local.
11863 In today&#x2019;s Internet, the use of domain literals is controversial.
11864 </para>
11865 </listitem>
11866 <listitem>
11867 <para>
11868 <indexterm role="concept">
11869 <primary>@mx_any</primary>
11870 </indexterm>
11871 <indexterm role="concept">
11872 <primary>@mx_primary</primary>
11873 </indexterm>
11874 <indexterm role="concept">
11875 <primary>@mx_secondary</primary>
11876 </indexterm>
11877 <indexterm role="concept">
11878 <primary>domain list</primary>
11879 <secondary>matching MX pointers to local host</secondary>
11880 </indexterm>
11881 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11882 has an MX record pointing to the local host or to any host that is listed in
11883 <indexterm role="option">
11884 <primary><option>hosts_treat_as_local</option></primary>
11885 </indexterm>
11886 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11887 are similar, except that the first matches only when a primary MX target is the
11888 local host, and the second only when no primary MX target is the local host,
11889 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11890 preference value &ndash; there may of course be more than one of them.
11891 </para>
11892 <para>
11893 The MX lookup that takes place when matching a pattern of this type is
11894 performed with the resolver options for widening names turned off. Thus, for
11895 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11896 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11897 options of the <command>dnslookup</command> router for a discussion of domain widening.
11898 </para>
11899 <para>
11900 Sometimes you may want to ignore certain IP addresses when using one of these
11901 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11902 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11903 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11904 on a router). For example:
11905 </para>
11906 <literallayout class="monospaced">
11907 domains = @mx_any/ignore=127.0.0.1
11908 </literallayout>
11909 <para>
11910 This example matches any domain that has an MX record pointing to one of
11911 the local host&#x2019;s IP addresses other than 127.0.0.1.
11912 </para>
11913 <para>
11914 The list of IP addresses is in fact processed by the same code that processes
11915 host lists, so it may contain CIDR-coded network specifications and it may also
11916 contain negative items.
11917 </para>
11918 <para>
11919 Because the list of IP addresses is a sublist within a domain list, you have to
11920 be careful about delimiters if there is more than one address. Like any other
11921 list, the default delimiter can be changed. Thus, you might have:
11922 </para>
11923 <literallayout class="monospaced">
11924 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11925           an.other.domain : ...
11926 </literallayout>
11927 <para>
11928 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11929 involved, it is easiest to change the delimiter for the main list as well:
11930 </para>
11931 <literallayout class="monospaced">
11932 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11933           an.other.domain ? ...
11934 </literallayout>
11935 </listitem>
11936 <listitem>
11937 <para>
11938 <indexterm role="concept">
11939 <primary>asterisk</primary>
11940 <secondary>in domain list</secondary>
11941 </indexterm>
11942 <indexterm role="concept">
11943 <primary>domain list</primary>
11944 <secondary>asterisk in</secondary>
11945 </indexterm>
11946 <indexterm role="concept">
11947 <primary>domain list</primary>
11948 <secondary>matching <quote>ends with</quote></secondary>
11949 </indexterm>
11950 If a pattern starts with an asterisk, the remaining characters of the pattern
11951 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11952 domain lists differs from its use in partial matching lookups. In a domain
11953 list, the character following the asterisk need not be a dot, whereas partial
11954 matching works only in terms of dot-separated components. For example, a domain
11955 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11956 <emphasis>cipher.key.ex</emphasis>.
11957 </para>
11958 </listitem>
11959 <listitem>
11960 <para>
11961 <indexterm role="concept">
11962 <primary>regular expressions</primary>
11963 <secondary>in domain list</secondary>
11964 </indexterm>
11965 <indexterm role="concept">
11966 <primary>domain list</primary>
11967 <secondary>matching regular expression</secondary>
11968 </indexterm>
11969 If a pattern starts with a circumflex character, it is treated as a regular
11970 expression, and matched against the domain using a regular expression matching
11971 function. The circumflex is treated as part of the regular expression.
11972 Email domains are case-independent, so this regular expression match is by
11973 default case-independent, but you can make it case-dependent by starting it
11974 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11975 are given in chapter <xref linkend="CHAPregexp"/>.
11976 </para>
11977 <para>
11978 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11979 must escape any backslash and dollar characters in the regular expression, or
11980 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11981 it is not to be expanded (unless you really do want to build a regular
11982 expression by expansion, of course).
11983 </para>
11984 </listitem>
11985 <listitem>
11986 <para>
11987 <indexterm role="concept">
11988 <primary>lookup</primary>
11989 <secondary>in domain list</secondary>
11990 </indexterm>
11991 <indexterm role="concept">
11992 <primary>domain list</primary>
11993 <secondary>matching by lookup</secondary>
11994 </indexterm>
11995 If a pattern starts with the name of a single-key lookup type followed by a
11996 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11997 must be a file name in a suitable format for the lookup type. For example, for
11998 <quote>cdb;</quote> it must be an absolute path:
11999 </para>
12000 <literallayout class="monospaced">
12001 domains = cdb;/etc/mail/local_domains.cdb
12002 </literallayout>
12003 <para>
12004 The appropriate type of lookup is done on the file using the domain name as the
12005 key. In most cases, the data that is looked up is not used; Exim is interested
12006 only in whether or not the key is present in the file. However, when a lookup
12007 is used for the <option>domains</option> option on a router
12008 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12009 <varname>$domain_data</varname> variable and can be referred to in other router options or
12010 other statements in the same ACL.
12011 </para>
12012 </listitem>
12013 <listitem>
12014 <para>
12015 Any of the single-key lookup type names may be preceded by
12016 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12017 </para>
12018 <literallayout class="monospaced">
12019 domains = partial-dbm;/partial/domains
12020 </literallayout>
12021 <para>
12022 This causes partial matching logic to be invoked; a description of how this
12023 works is given in section <xref linkend="SECTpartiallookup"/>.
12024 </para>
12025 </listitem>
12026 <listitem>
12027 <para>
12028 <indexterm role="concept">
12029 <primary>asterisk</primary>
12030 <secondary>in lookup type</secondary>
12031 </indexterm>
12032 Any of the single-key lookup types may be followed by an asterisk. This causes
12033 a default lookup for a key consisting of a single asterisk to be done if the
12034 original lookup fails. This is not a useful feature when using a domain list to
12035 select particular domains (because any domain would match), but it might have
12036 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12037 expansion variable.
12038 </para>
12039 </listitem>
12040 <listitem>
12041 <para>
12042 If the pattern starts with the name of a query-style lookup type followed by a
12043 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12044 pattern must be an appropriate query for the lookup type, as described in
12045 chapter <xref linkend="CHAPfdlookup"/>. For example:
12046 </para>
12047 <literallayout class="monospaced">
12048 hold_domains = mysql;select domain from holdlist \
12049   where domain = '${quote_mysql:$domain}';
12050 </literallayout>
12051 <para>
12052 In most cases, the data that is looked up is not used (so for an SQL query, for
12053 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12054 whether or not the query succeeds. However, when a lookup is used for the
12055 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12056 variable and can be referred to in other options.
12057 </para>
12058 </listitem>
12059 <listitem>
12060 <para>
12061 <indexterm role="concept">
12062 <primary>domain list</primary>
12063 <secondary>matching literal domain name</secondary>
12064 </indexterm>
12065 If none of the above cases apply, a caseless textual comparison is made
12066 between the pattern and the domain.
12067 </para>
12068 </listitem>
12069 </itemizedlist>
12070 <para>
12071 Here is an example that uses several different kinds of pattern:
12072 </para>
12073 <literallayout class="monospaced">
12074 domainlist funny_domains = \
12075   @ : \
12076   lib.unseen.edu : \
12077   *.foundation.fict.example : \
12078   \N^[1-2]\d{3}\.fict\.example$\N : \
12079   partial-dbm;/opt/data/penguin/book : \
12080   nis;domains.byname : \
12081   nisplus;[name=$domain,status=local],domains.org_dir
12082 </literallayout>
12083 <para>
12084 There are obvious processing trade-offs among the various matching modes. Using
12085 an asterisk is faster than a regular expression, and listing a few names
12086 explicitly probably is too. The use of a file or database lookup is expensive,
12087 but may be the only option if hundreds of names are required. Because the
12088 patterns are tested in order, it makes sense to put the most commonly matched
12089 patterns earlier.
12090 </para>
12091 </section>
12092 <section id="SECThostlist">
12093 <title>Host lists</title>
12094 <para>
12095 <indexterm role="concept">
12096 <primary>host list</primary>
12097 <secondary>patterns in</secondary>
12098 </indexterm>
12099 <indexterm role="concept">
12100 <primary>list</primary>
12101 <secondary>host list</secondary>
12102 </indexterm>
12103 Host lists are used to control what remote hosts are allowed to do. For
12104 example, some hosts may be allowed to use the local host as a relay, and some
12105 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12106 two different ways, by name or by IP address. In a host list, some types of
12107 pattern are matched to a host name, and some are matched to an IP address.
12108 You need to be particularly careful with this when single-key lookups are
12109 involved, to ensure that the right value is being used as the key.
12110 </para>
12111 </section>
12112 <section id="SECID80">
12113 <title>Special host list patterns</title>
12114 <para>
12115 <indexterm role="concept">
12116 <primary>empty item in hosts list</primary>
12117 </indexterm>
12118 <indexterm role="concept">
12119 <primary>host list</primary>
12120 <secondary>empty string in</secondary>
12121 </indexterm>
12122 If a host list item is the empty string, it matches only when no remote host is
12123 involved. This is the case when a message is being received from a local
12124 process using SMTP on the standard input, that is, when a TCP/IP connection is
12125 not used.
12126 </para>
12127 <para>
12128 <indexterm role="concept">
12129 <primary>asterisk</primary>
12130 <secondary>in host list</secondary>
12131 </indexterm>
12132 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12133 the IP address nor the name is actually inspected.
12134 </para>
12135 </section>
12136 <section id="SECThoslispatip">
12137 <title>Host list patterns that match by IP address</title>
12138 <para>
12139 <indexterm role="concept">
12140 <primary>host list</primary>
12141 <secondary>matching IP addresses</secondary>
12142 </indexterm>
12143 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12144 the incoming address actually appears in the IPv6 host as
12145 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12146 list, it is converted into a traditional IPv4 address first. (Not all operating
12147 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12148 concerns.)
12149 </para>
12150 <para>
12151 The following types of pattern in a host list check the remote host by
12152 inspecting its IP address:
12153 </para>
12154 <itemizedlist>
12155 <listitem>
12156 <para>
12157 If the pattern is a plain domain name (not a regular expression, not starting
12158 with *, not a lookup of any kind), Exim calls the operating system function
12159 to find the associated IP address(es). Exim uses the newer
12160 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12161 This typically causes a forward DNS lookup of the name. The result is compared
12162 with the IP address of the subject host.
12163 </para>
12164 <para>
12165 If there is a temporary problem (such as a DNS timeout) with the host name
12166 lookup, a temporary error occurs. For example, if the list is being used in an
12167 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12168 temporary SMTP error code. If no IP address can be found for the host name,
12169 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12170 </para>
12171 </listitem>
12172 <listitem>
12173 <para>
12174 <indexterm role="concept">
12175 <primary>@ in a host list</primary>
12176 </indexterm>
12177 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12178 domain name, as just described.
12179 </para>
12180 </listitem>
12181 <listitem>
12182 <para>
12183 If the pattern is an IP address, it is matched against the IP address of the
12184 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12185 IPv6 addresses can be given in colon-separated format, but the colons have to
12186 be doubled so as not to be taken as item separators when the default list
12187 separator is used. IPv6 addresses are recognized even when Exim is compiled
12188 without IPv6 support. This means that if they appear in a host list on an
12189 IPv4-only host, Exim will not treat them as host names. They are just addresses
12190 that can never match a client host.
12191 </para>
12192 </listitem>
12193 <listitem>
12194 <para>
12195 <indexterm role="concept">
12196 <primary>@[] in a host list</primary>
12197 </indexterm>
12198 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12199 the local host. For example, if the local host is an IPv4 host with one
12200 interface address 10.45.23.56, these two ACL statements have the same effect:
12201 </para>
12202 <literallayout class="monospaced">
12203 accept hosts = 127.0.0.1 : 10.45.23.56
12204 accept hosts = @[]
12205 </literallayout>
12206 </listitem>
12207 <listitem>
12208 <para>
12209 <indexterm role="concept">
12210 <primary>CIDR notation</primary>
12211 </indexterm>
12212 If the pattern is an IP address followed by a slash and a mask length (for
12213 example 10.11.42.0/24), it is matched against the IP address of the subject
12214 host under the given mask. This allows, an entire network of hosts to be
12215 included (or excluded) by a single item. The mask uses CIDR notation; it
12216 specifies the number of address bits that must match, starting from the most
12217 significant end of the address.
12218 </para>
12219 <para>
12220 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12221 of a range of addresses. It is the number of bits in the network portion of the
12222 address. The above example specifies a 24-bit netmask, so it matches all 256
12223 addresses in the 10.11.42.0 network. An item such as
12224 </para>
12225 <literallayout class="monospaced">
12226 192.168.23.236/31
12227 </literallayout>
12228 <para>
12229 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12230 32 for an IPv4 address is the same as no mask at all; just a single address
12231 matches.
12232 </para>
12233 <para>
12234 Here is another example which shows an IPv4 and an IPv6 network:
12235 </para>
12236 <literallayout class="monospaced">
12237 recipient_unqualified_hosts = 192.168.0.0/16: \
12238                               3ffe::ffff::836f::::/48
12239 </literallayout>
12240 <para>
12241 The doubling of list separator characters applies only when these items
12242 appear inline in a host list. It is not required when indirecting via a file.
12243 For example:
12244 </para>
12245 <literallayout class="monospaced">
12246 recipient_unqualified_hosts = /opt/exim/unqualnets
12247 </literallayout>
12248 <para>
12249 could make use of a file containing
12250 </para>
12251 <literallayout class="monospaced">
12252 172.16.0.0/12
12253 3ffe:ffff:836f::/48
12254 </literallayout>
12255 <para>
12256 to have exactly the same effect as the previous example. When listing IPv6
12257 addresses inline, it is usually more convenient to use the facility for
12258 changing separator characters. This list contains the same two networks:
12259 </para>
12260 <literallayout class="monospaced">
12261 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12262                                  3ffe:ffff:836f::/48
12263 </literallayout>
12264 <para>
12265 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12266 list.
12267 </para>
12268 </listitem>
12269 </itemizedlist>
12270 </section>
12271 <section id="SECThoslispatsikey">
12272 <title>Host list patterns for single-key lookups by host address</title>
12273 <para>
12274 <indexterm role="concept">
12275 <primary>host list</primary>
12276 <secondary>lookup of IP address</secondary>
12277 </indexterm>
12278 When a host is to be identified by a single-key lookup of its complete IP
12279 address, the pattern takes this form:
12280 </para>
12281 <literallayout>
12282 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12283 </literallayout>
12284 <para>
12285 For example:
12286 </para>
12287 <literallayout class="monospaced">
12288 hosts_lookup = net-cdb;/hosts-by-ip.db
12289 </literallayout>
12290 <para>
12291 The text form of the IP address of the subject host is used as the lookup key.
12292 IPv6 addresses are converted to an unabbreviated form, using lower case
12293 letters, with dots as separators because colon is the key terminator in
12294 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12295 quoting the keys, but this is a facility that was added later.] The data
12296 returned by the lookup is not used.
12297 </para>
12298 <para>
12299 <indexterm role="concept">
12300 <primary>IP address</primary>
12301 <secondary>masking</secondary>
12302 </indexterm>
12303 <indexterm role="concept">
12304 <primary>host list</primary>
12305 <secondary>masked IP address</secondary>
12306 </indexterm>
12307 Single-key lookups can also be performed using masked IP addresses, using
12308 patterns of this form:
12309 </para>
12310 <literallayout>
12311 <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>
12312 </literallayout>
12313 <para>
12314 For example:
12315 </para>
12316 <literallayout class="monospaced">
12317 net24-dbm;/networks.db
12318 </literallayout>
12319 <para>
12320 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12321 length. A textual string is constructed from the masked value, followed by the
12322 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12323 is 192.168.34.6, the key that is looked up for the above example is
12324 <quote>192.168.34.0/24</quote>.
12325 </para>
12326 <para>
12327 When an IPv6 address is converted to a string, dots are normally used instead
12328 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12329 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12330 to quote keys was made available in <command>lsearch</command> files. However, the more
12331 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12332 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12333 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12334 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12335 addresses are always used.
12336 </para>
12337 <para>
12338 Ideally, it would be nice to tidy up this anomalous situation by changing to
12339 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12340 However, this would be an incompatible change that might break some existing
12341 configurations.
12342 </para>
12343 <para>
12344 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12345 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12346 the former case the key strings include the mask value, whereas in the latter
12347 case the IP address is used on its own.
12348 </para>
12349 </section>
12350 <section id="SECThoslispatnam">
12351 <title>Host list patterns that match by host name</title>
12352 <para>
12353 <indexterm role="concept">
12354 <primary>host</primary>
12355 <secondary>lookup failures</secondary>
12356 </indexterm>
12357 <indexterm role="concept">
12358 <primary>unknown host name</primary>
12359 </indexterm>
12360 <indexterm role="concept">
12361 <primary>host list</primary>
12362 <secondary>matching host name</secondary>
12363 </indexterm>
12364 There are several types of pattern that require Exim to know the name of the
12365 remote host. These are either wildcard patterns or lookups by name. (If a
12366 complete hostname is given without any wildcarding, it is used to find an IP
12367 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12368 above.)
12369 </para>
12370 <para>
12371 If the remote host name is not already known when Exim encounters one of these
12372 patterns, it has to be found from the IP address.
12373 Although many sites on the Internet are conscientious about maintaining reverse
12374 DNS data for their hosts, there are also many that do not do this.
12375 Consequently, a name cannot always be found, and this may lead to unwanted
12376 effects. Take care when configuring host lists with wildcarded name patterns.
12377 Consider what will happen if a name cannot be found.
12378 </para>
12379 <para>
12380 Because of the problems of determining host names from IP addresses, matching
12381 against host names is not as common as matching against IP addresses.
12382 </para>
12383 <para>
12384 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12385 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12386 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12387 are done can be changed by setting the <option>host_lookup_order</option> option. For
12388 security, once Exim has found one or more names, it looks up the IP addresses
12389 for these names and compares them with the IP address that it started with.
12390 Only those names whose IP addresses match are accepted. Any other names are
12391 discarded. If no names are left, Exim behaves as if the host name cannot be
12392 found. In the most common case there is only one name and one IP address.
12393 </para>
12394 <para>
12395 There are some options that control what happens if a host name cannot be
12396 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12397 </para>
12398 <para>
12399 <indexterm role="concept">
12400 <primary>host</primary>
12401 <secondary>alias for</secondary>
12402 </indexterm>
12403 <indexterm role="concept">
12404 <primary>alias for host</primary>
12405 </indexterm>
12406 As a result of aliasing, hosts may have more than one name. When processing any
12407 of the following types of pattern, all the host&#x2019;s names are checked:
12408 </para>
12409 <itemizedlist>
12410 <listitem>
12411 <para>
12412 <indexterm role="concept">
12413 <primary>asterisk</primary>
12414 <secondary>in host list</secondary>
12415 </indexterm>
12416 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12417 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12418 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12419 requirement. Other kinds of wildcarding require the use of a regular
12420 expression.
12421 </para>
12422 </listitem>
12423 <listitem>
12424 <para>
12425 <indexterm role="concept">
12426 <primary>regular expressions</primary>
12427 <secondary>in host list</secondary>
12428 </indexterm>
12429 <indexterm role="concept">
12430 <primary>host list</primary>
12431 <secondary>regular expression in</secondary>
12432 </indexterm>
12433 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12434 matched against the host name. Host names are case-independent, so this regular
12435 expression match is by default case-independent, but you can make it
12436 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12437 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12438 example,
12439 </para>
12440 <literallayout class="monospaced">
12441 ^(a|b)\.c\.d$
12442 </literallayout>
12443 <para>
12444 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12445 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12446 that backslash and dollar characters are not misinterpreted as part of the
12447 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12448 part of the string as non-expandable. For example:
12449 </para>
12450 <literallayout class="monospaced">
12451 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12452 </literallayout>
12453 <para>
12454 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12455 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12456 example. Without it, a match at the start of the host name is all that is
12457 required.
12458 </para>
12459 </listitem>
12460 </itemizedlist>
12461 </section>
12462 <section id="SECTbehipnot">
12463 <title>Behaviour when an IP address or name cannot be found</title>
12464 <para>
12465 <indexterm role="concept">
12466 <primary>host</primary>
12467 <secondary>lookup failures, permanent</secondary>
12468 </indexterm>
12469 While processing a host list, Exim may need to look up an IP address from a
12470 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12471 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12472 behaviour when it fails to find the information it is seeking is the same.
12473 </para>
12474 <para>
12475 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12476 apply to temporary DNS errors, whose handling is described in the next section.
12477 </para>
12478 <para>
12479 <indexterm role="concept">
12480 <primary><literal>+include_unknown</literal></primary>
12481 </indexterm>
12482 <indexterm role="concept">
12483 <primary><literal>+ignore_unknown</literal></primary>
12484 </indexterm>
12485 Exim parses a host list from left to right. If it encounters a permanent
12486 lookup failure in any item in the host list before it has found a match,
12487 Exim treats it as a failure and the default behavior is as if the host
12488 does not match the list. This may not always be what you want to happen.
12489 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12490 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12491 not recognized in an indirected file).
12492 </para>
12493 <itemizedlist>
12494 <listitem>
12495 <para>
12496 If any item that follows <literal>+include_unknown</literal> requires information that
12497 cannot found, Exim behaves as if the host does match the list. For example,
12498 </para>
12499 <literallayout class="monospaced">
12500 host_reject_connection = +include_unknown:*.enemy.ex
12501 </literallayout>
12502 <para>
12503 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12504 any hosts whose name it cannot find.
12505 </para>
12506 </listitem>
12507 <listitem>
12508 <para>
12509 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12510 be found, Exim ignores that item and proceeds to the rest of the list. For
12511 example:
12512 </para>
12513 <literallayout class="monospaced">
12514 accept hosts = +ignore_unknown : friend.example : \
12515                192.168.4.5
12516 </literallayout>
12517 <para>
12518 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12519 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12520 name can be found for 192.168.4.5, it is rejected.
12521 </para>
12522 </listitem>
12523 </itemizedlist>
12524 <para>
12525 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12526 list. The effect of each one lasts until the next, or until the end of the
12527 list.
12528 </para>
12529 </section>
12530 <section id="SECTmixwilhos">
12531 <title>Mixing wildcarded host names and addresses in host lists</title>
12532 <para>
12533 <indexterm role="concept">
12534 <primary>host list</primary>
12535 <secondary>mixing names and addresses in</secondary>
12536 </indexterm>
12537 </para>
12538 <para>
12539 This section explains the host/ip processing logic with the same concepts
12540 as the previous section, but specifically addresses what happens when a
12541 wildcarded hostname is one of the items in the hostlist.
12542 </para>
12543 <itemizedlist>
12544 <listitem>
12545 <para>
12546 If you have name lookups or wildcarded host names and
12547 IP addresses in the same host list, you should normally put the IP
12548 addresses first. For example, in an ACL you could have:
12549 </para>
12550 <literallayout class="monospaced">
12551 accept hosts = 10.9.8.7 : *.friend.example
12552 </literallayout>
12553 <para>
12554 The reason you normally would order it this way lies in the
12555 left-to-right way that Exim processes lists.  It can test IP addresses
12556 without doing any DNS lookups, but when it reaches an item that requires
12557 a host name, it fails if it cannot find a host name to compare with the
12558 pattern. If the above list is given in the opposite order, the
12559 <option>accept</option> statement fails for a host whose name cannot be found, even
12560 if its IP address is 10.9.8.7.
12561 </para>
12562 </listitem>
12563 <listitem>
12564 <para>
12565 If you really do want to do the name check first, and still recognize the IP
12566 address, you can rewrite the ACL like this:
12567 </para>
12568 <literallayout class="monospaced">
12569 accept hosts = *.friend.example
12570 accept hosts = 10.9.8.7
12571 </literallayout>
12572 <para>
12573 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12574 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12575 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12576 this section.
12577 </para>
12578 </listitem>
12579 </itemizedlist>
12580 </section>
12581 <section id="SECTtemdnserr">
12582 <title>Temporary DNS errors when looking up host information</title>
12583 <para>
12584 <indexterm role="concept">
12585 <primary>host</primary>
12586 <secondary>lookup failures, temporary</secondary>
12587 </indexterm>
12588 <indexterm role="concept">
12589 <primary><literal>+include_defer</literal></primary>
12590 </indexterm>
12591 <indexterm role="concept">
12592 <primary><literal>+ignore_defer</literal></primary>
12593 </indexterm>
12594 A temporary DNS lookup failure normally causes a defer action (except when
12595 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12596 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12597 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12598 section. These options should be used with care, probably only in non-critical
12599 host lists such as whitelists.
12600 </para>
12601 </section>
12602 <section id="SECThoslispatnamsk">
12603 <title>Host list patterns for single-key lookups by host name</title>
12604 <para>
12605 <indexterm role="concept">
12606 <primary>unknown host name</primary>
12607 </indexterm>
12608 <indexterm role="concept">
12609 <primary>host list</primary>
12610 <secondary>matching host name</secondary>
12611 </indexterm>
12612 If a pattern is of the form
12613 </para>
12614 <literallayout>
12615 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12616 </literallayout>
12617 <para>
12618 for example
12619 </para>
12620 <literallayout class="monospaced">
12621 dbm;/host/accept/list
12622 </literallayout>
12623 <para>
12624 a single-key lookup is performed, using the host name as its key. If the
12625 lookup succeeds, the host matches the item. The actual data that is looked up
12626 is not used.
12627 </para>
12628 <para>
12629 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12630 keys in the file, not IP addresses. If you want to do lookups based on IP
12631 addresses, you must precede the search type with <quote>net-</quote> (see section
12632 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12633 two items in the same list, one doing an address lookup and one doing a name
12634 lookup, both using the same file.
12635 </para>
12636 </section>
12637 <section id="SECID81">
12638 <title>Host list patterns for query-style lookups</title>
12639 <para>
12640 If a pattern is of the form
12641 </para>
12642 <literallayout>
12643 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12644 </literallayout>
12645 <para>
12646 the query is obeyed, and if it succeeds, the host matches the item. The actual
12647 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12648 <varname>$sender_host_name</varname> can be used in the query. For example:
12649 </para>
12650 <literallayout class="monospaced">
12651 hosts_lookup = pgsql;\
12652   select ip from hostlist where ip='$sender_host_address'
12653 </literallayout>
12654 <para>
12655 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12656 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12657 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12658 operator.
12659 </para>
12660 <para>
12661 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12662 looks up the host name if it has not already done so. (See section
12663 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12664 </para>
12665 <para>
12666 Historical note: prior to release 4.30, Exim would always attempt to find a
12667 host name before running the query, unless the search type was preceded by
12668 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12669 still recognized for query-style lookups, but its presence or absence has no
12670 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12671 See section <xref linkend="SECThoslispatsikey"/>.)
12672 </para>
12673 </section>
12674 <section id="SECTaddresslist">
12675 <title>Address lists</title>
12676 <para>
12677 <indexterm role="concept">
12678 <primary>list</primary>
12679 <secondary>address list</secondary>
12680 </indexterm>
12681 <indexterm role="concept">
12682 <primary>address list</primary>
12683 <secondary>empty item</secondary>
12684 </indexterm>
12685 <indexterm role="concept">
12686 <primary>address list</primary>
12687 <secondary>patterns</secondary>
12688 </indexterm>
12689 Address lists contain patterns that are matched against mail addresses. There
12690 is one special case to be considered: the sender address of a bounce message is
12691 always empty. You can test for this by providing an empty item in an address
12692 list. For example, you can set up a router to process bounce messages by
12693 using this option setting:
12694 </para>
12695 <literallayout class="monospaced">
12696 senders = :
12697 </literallayout>
12698 <para>
12699 The presence of the colon creates an empty item. If you do not provide any
12700 data, the list is empty and matches nothing. The empty sender can also be
12701 detected by a regular expression that matches an empty string,
12702 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12703 </para>
12704 <para>
12705 Non-empty items in an address list can be straightforward email addresses. For
12706 example:
12707 </para>
12708 <literallayout class="monospaced">
12709 senders = jbc@askone.example : hs@anacreon.example
12710 </literallayout>
12711 <para>
12712 A certain amount of wildcarding is permitted. If a pattern contains an @
12713 character, but is not a regular expression and does not begin with a
12714 semicolon-terminated lookup type (described below), the local part of the
12715 subject address is compared with the local part of the pattern, which may start
12716 with an asterisk. If the local parts match, the domain is checked in exactly
12717 the same way as for a pattern in a domain list. For example, the domain can be
12718 wildcarded, refer to a named list, or be a lookup:
12719 </para>
12720 <literallayout class="monospaced">
12721 deny senders = *@*.spamming.site:\
12722                *@+hostile_domains:\
12723                bozo@partial-lsearch;/list/of/dodgy/sites:\
12724                *@dbm;/bad/domains.db
12725 </literallayout>
12726 <para>
12727 <indexterm role="concept">
12728 <primary>local part</primary>
12729 <secondary>starting with !</secondary>
12730 </indexterm>
12731 <indexterm role="concept">
12732 <primary>address list</primary>
12733 <secondary>local part starting with !</secondary>
12734 </indexterm>
12735 If a local part that begins with an exclamation mark is required, it has to be
12736 specified using a regular expression, because otherwise the exclamation mark is
12737 treated as a sign of negation, as is standard in lists.
12738 </para>
12739 <para>
12740 If a non-empty pattern that is not a regular expression or a lookup does not
12741 contain an @ character, it is matched against the domain part of the subject
12742 address. The only two formats that are recognized this way are a literal
12743 domain, or a domain pattern that starts with *. In both these cases, the effect
12744 is the same as if <literal>*@</literal> preceded the pattern. For example:
12745 </para>
12746 <literallayout class="monospaced">
12747 deny senders = enemy.domain : *.enemy.domain
12748 </literallayout>
12749 <para>
12750 The following kinds of more complicated address list pattern can match any
12751 address, including the empty address that is characteristic of bounce message
12752 senders:
12753 </para>
12754 <itemizedlist>
12755 <listitem>
12756 <para>
12757 <indexterm role="concept">
12758 <primary>regular expressions</primary>
12759 <secondary>in address list</secondary>
12760 </indexterm>
12761 <indexterm role="concept">
12762 <primary>address list</primary>
12763 <secondary>regular expression in</secondary>
12764 </indexterm>
12765 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12766 done against the complete address, with the pattern as the regular expression.
12767 You must take care that backslash and dollar characters are not misinterpreted
12768 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12769 to mark that part of the string as non-expandable. For example:
12770 </para>
12771 <literallayout class="monospaced">
12772 deny senders = \N^.*this.*@example\.com$\N : \
12773                \N^\d{8}.+@spamhaus.example$\N : ...
12774 </literallayout>
12775 <para>
12776 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12777 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12778 </para>
12779 </listitem>
12780 <listitem>
12781 <para>
12782 <indexterm role="concept">
12783 <primary>address list</primary>
12784 <secondary>lookup for complete address</secondary>
12785 </indexterm>
12786 Complete addresses can be looked up by using a pattern that starts with a
12787 lookup type terminated by a semicolon, followed by the data for the lookup. For
12788 example:
12789 </para>
12790 <literallayout class="monospaced">
12791 deny senders = cdb;/etc/blocked.senders : \
12792   mysql;select address from blocked where \
12793   address='${quote_mysql:$sender_address}'
12794 </literallayout>
12795 <para>
12796 Both query-style and single-key lookup types can be used. For a single-key
12797 lookup type, Exim uses the complete address as the key. However, empty keys are
12798 not supported for single-key lookups, so a match against the empty address
12799 always fails. This restriction does not apply to query-style lookups.
12800 </para>
12801 <para>
12802 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12803 cannot be used, and is ignored if specified, with an entry being written to the
12804 panic log.
12805 <indexterm role="concept">
12806 <primary>*@ with single-key lookup</primary>
12807 </indexterm>
12808 However, you can configure lookup defaults, as described in section
12809 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12810 default. For example, with this lookup:
12811 </para>
12812 <literallayout class="monospaced">
12813 accept senders = lsearch*@;/some/file
12814 </literallayout>
12815 <para>
12816 the file could contains lines like this:
12817 </para>
12818 <literallayout class="monospaced">
12819 user1@domain1.example
12820 *@domain2.example
12821 </literallayout>
12822 <para>
12823 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12824 that are tried is:
12825 </para>
12826 <literallayout class="monospaced">
12827 nimrod@jaeger.example
12828 *@jaeger.example
12829 *
12830 </literallayout>
12831 <para>
12832 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12833 would mean that every address matches, thus rendering the test useless.
12834 </para>
12835 <para>
12836 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12837 </para>
12838 <literallayout class="monospaced">
12839 deny recipients = dbm*@;/some/file
12840 deny recipients = *@dbm;/some/file
12841 </literallayout>
12842 <para>
12843 The first does a whole address lookup, with defaulting, as just described,
12844 because it starts with a lookup type. The second matches the local part and
12845 domain independently, as described in a bullet point below.
12846 </para>
12847 </listitem>
12848 </itemizedlist>
12849 <para>
12850 The following kinds of address list pattern can match only non-empty addresses.
12851 If the subject address is empty, a match against any of these pattern types
12852 always fails.
12853 </para>
12854 <itemizedlist>
12855 <listitem>
12856 <para>
12857 <indexterm role="concept">
12858 <primary>@@ with single-key lookup</primary>
12859 </indexterm>
12860 <indexterm role="concept">
12861 <primary>address list</primary>
12862 <secondary>@@ lookup type</secondary>
12863 </indexterm>
12864 <indexterm role="concept">
12865 <primary>address list</primary>
12866 <secondary>split local part and domain</secondary>
12867 </indexterm>
12868 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12869 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12870 split into a local part and a domain. The domain is looked up in the file. If
12871 it is not found, there is no match. If it is found, the data that is looked up
12872 from the file is treated as a colon-separated list of local part patterns, each
12873 of which is matched against the subject local part in turn.
12874 </para>
12875 <para>
12876 <indexterm role="concept">
12877 <primary>asterisk</primary>
12878 <secondary>in address list</secondary>
12879 </indexterm>
12880 The lookup may be a partial one, and/or one involving a search for a default
12881 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12882 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12883 even be further lookups. They may also be independently negated. For example,
12884 with
12885 </para>
12886 <literallayout class="monospaced">
12887 deny senders = @@dbm;/etc/reject-by-domain
12888 </literallayout>
12889 <para>
12890 the data from which the DBM file is built could contain lines like
12891 </para>
12892 <literallayout class="monospaced">
12893 baddomain.com:  !postmaster : *
12894 </literallayout>
12895 <para>
12896 to reject all senders except <option>postmaster</option> from that domain.
12897 </para>
12898 <para>
12899 <indexterm role="concept">
12900 <primary>local part</primary>
12901 <secondary>starting with !</secondary>
12902 </indexterm>
12903 If a local part that actually begins with an exclamation mark is required, it
12904 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12905 may be split over several lines by indenting the second and subsequent lines,
12906 but the separating colon must still be included at line breaks. White space
12907 surrounding the colons is ignored. For example:
12908 </para>
12909 <literallayout class="monospaced">
12910 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12911   spammer3 : spammer4
12912 </literallayout>
12913 <para>
12914 As in all colon-separated lists in Exim, a colon can be included in an item by
12915 doubling.
12916 </para>
12917 <para>
12918 If the last item in the list starts with a right angle-bracket, the remainder
12919 of the item is taken as a new key to look up in order to obtain a continuation
12920 list of local parts. The new key can be any sequence of characters. Thus one
12921 might have entries like
12922 </para>
12923 <literallayout class="monospaced">
12924 aol.com: spammer1 : spammer 2 : &gt;*
12925 xyz.com: spammer3 : &gt;*
12926 *:       ^\d{8}$
12927 </literallayout>
12928 <para>
12929 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12930 local parts for all domains, in addition to the specific local parts listed for
12931 each domain. Of course, using this feature costs another lookup each time a
12932 chain is followed, but the effort needed to maintain the data is reduced.
12933 </para>
12934 <para>
12935 <indexterm role="concept">
12936 <primary>loop</primary>
12937 <secondary>in lookups</secondary>
12938 </indexterm>
12939 It is possible to construct loops using this facility, and in order to catch
12940 them, the chains may be no more than fifty items long.
12941 </para>
12942 </listitem>
12943 <listitem>
12944 <para>
12945 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12946 lookup, but in this case, the chaining facility is not available. The lookup
12947 can only return a single list of local parts.
12948 </para>
12949 </listitem>
12950 </itemizedlist>
12951 <para>
12952 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12953 in these two examples:
12954 </para>
12955 <literallayout class="monospaced">
12956 senders = +my_list
12957 senders = *@+my_list
12958 </literallayout>
12959 <para>
12960 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12961 example it is a named domain list.
12962 </para>
12963 </section>
12964 <section id="SECTcasletadd">
12965 <title>Case of letters in address lists</title>
12966 <para>
12967 <indexterm role="concept">
12968 <primary>case of local parts</primary>
12969 </indexterm>
12970 <indexterm role="concept">
12971 <primary>address list</primary>
12972 <secondary>case forcing</secondary>
12973 </indexterm>
12974 <indexterm role="concept">
12975 <primary>case forcing in address lists</primary>
12976 </indexterm>
12977 Domains in email addresses are always handled caselessly, but for local parts
12978 case may be significant on some systems (see <option>caseful_local_part</option> for how
12979 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12980 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12981 blocking lists should be done in a case-independent manner. Since most address
12982 lists in Exim are used for this kind of control, Exim attempts to do this by
12983 default.
12984 </para>
12985 <para>
12986 The domain portion of an address is always lowercased before matching it to an
12987 address list. The local part is lowercased by default, and any string
12988 comparisons that take place are done caselessly. This means that the data in
12989 the address list itself, in files included as plain file names, and in any file
12990 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12991 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12992 works caselessly) must be in lower case, because these lookups are not
12993 case-independent.
12994 </para>
12995 <para>
12996 <indexterm role="concept">
12997 <primary><literal>+caseful</literal></primary>
12998 </indexterm>
12999 To allow for the possibility of caseful address list matching, if an item in
13000 an address list is the string <quote>+caseful</quote>, the original case of the local
13001 part is restored for any comparisons that follow, and string comparisons are no
13002 longer case-independent. This does not affect the domain, which remains in
13003 lower case. However, although independent matches on the domain alone are still
13004 performed caselessly, regular expressions that match against an entire address
13005 become case-sensitive after <quote>+caseful</quote> has been seen.
13006 </para>
13007 </section>
13008 <section id="SECTlocparlis">
13009 <title>Local part lists</title>
13010 <para>
13011 <indexterm role="concept">
13012 <primary>list</primary>
13013 <secondary>local part list</secondary>
13014 </indexterm>
13015 <indexterm role="concept">
13016 <primary>local part</primary>
13017 <secondary>list</secondary>
13018 </indexterm>
13019 Case-sensitivity in local part lists is handled in the same way as for address
13020 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13021 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13022 set false, the subject is lowercased and the matching is initially
13023 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13024 matching in the local part list, but not elsewhere in the router. If
13025 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13026 option is case-sensitive from the start.
13027 </para>
13028 <para>
13029 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13030 comments are handled in the same way as address lists &ndash; they are recognized
13031 only if the # is preceded by white space or the start of the line.
13032 Otherwise, local part lists are matched in the same way as domain lists, except
13033 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13034 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13035 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13036 types.
13037 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13038 </para>
13039 </section>
13040 </chapter>
13041
13042 <chapter id="CHAPexpand">
13043 <title>String expansions</title>
13044 <para>
13045 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13046 <primary>expansion</primary>
13047 <secondary>of strings</secondary>
13048 </indexterm>
13049 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13050 them are expanded every time they are used; others are expanded only once.
13051 </para>
13052 <para>
13053 When a string is being expanded it is copied verbatim from left to right except
13054 when a dollar or backslash character is encountered. A dollar specifies the
13055 start of a portion of the string that is interpreted and replaced as described
13056 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13057 escape character, as described in the following section.
13058 </para>
13059 <para>
13060 Whether a string is expanded depends upon the context.  Usually this is solely
13061 dependent upon the option for which a value is sought; in this documentation,
13062 options for which string expansion is performed are marked with &dagger; after
13063 the data type.  ACL rules always expand strings.  A couple of expansion
13064 conditions do not expand some of the brace-delimited branches, for security
13065 reasons.
13066 </para>
13067 <section id="SECTlittext">
13068 <title>Literal text in expanded strings</title>
13069 <para>
13070 <indexterm role="concept">
13071 <primary>expansion</primary>
13072 <secondary>including literal text</secondary>
13073 </indexterm>
13074 An uninterpreted dollar can be included in an expanded string by putting a
13075 backslash in front of it. A backslash can be used to prevent any special
13076 character being treated specially in an expansion, including backslash itself.
13077 If the string appears in quotes in the configuration file, two backslashes are
13078 required because the quotes themselves cause interpretation of backslashes when
13079 the string is read in (see section <xref linkend="SECTstrings"/>).
13080 </para>
13081 <para>
13082 <indexterm role="concept">
13083 <primary>expansion</primary>
13084 <secondary>non-expandable substrings</secondary>
13085 </indexterm>
13086 A portion of the string can specified as non-expandable by placing it between
13087 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13088 expressions, which often contain backslashes and dollar signs. For example:
13089 </para>
13090 <literallayout class="monospaced">
13091 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13092 </literallayout>
13093 <para>
13094 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13095 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13096 string.
13097 </para>
13098 </section>
13099 <section id="SECID82">
13100 <title>Character escape sequences in expanded strings</title>
13101 <para>
13102 <indexterm role="concept">
13103 <primary>expansion</primary>
13104 <secondary>escape sequences</secondary>
13105 </indexterm>
13106 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13107 expanded string is recognized as an escape sequence for the character newline,
13108 carriage return, or tab, respectively. A backslash followed by up to three
13109 octal digits is recognized as an octal encoding for a single character, and a
13110 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13111 encoding.
13112 </para>
13113 <para>
13114 These escape sequences are also recognized in quoted strings when they are read
13115 in. Their interpretation in expansions as well is useful for unquoted strings,
13116 and for other cases such as looked-up strings that are then expanded.
13117 </para>
13118 </section>
13119 <section id="SECID83">
13120 <title>Testing string expansions</title>
13121 <para>
13122 <indexterm role="concept">
13123 <primary>expansion</primary>
13124 <secondary>testing</secondary>
13125 </indexterm>
13126 <indexterm role="concept">
13127 <primary>testing</primary>
13128 <secondary>string expansion</secondary>
13129 </indexterm>
13130 <indexterm role="option">
13131 <primary><option>-be</option></primary>
13132 </indexterm>
13133 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13134 takes the command arguments, or lines from the standard input if there are no
13135 arguments, runs them through the string expansion code, and writes the results
13136 to the standard output. Variables based on configuration values are set up, but
13137 since no message is being processed, variables such as <varname>$local_part</varname> have no
13138 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13139 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13140 and <option>nhash</option>.
13141 </para>
13142 <para>
13143 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13144 instead runs under the uid and gid it was called with, to prevent users from
13145 using <option>-be</option> for reading files to which they do not have access.
13146 </para>
13147 <para>
13148 <indexterm role="option">
13149 <primary><option>-bem</option></primary>
13150 </indexterm>
13151 If you want to test expansions that include variables whose values are taken
13152 from a message, there are two other options that can be used. The <option>-bem</option>
13153 option is like <option>-be</option> except that it is followed by a file name. The file is
13154 read as a message before doing the test expansions. For example:
13155 </para>
13156 <literallayout class="monospaced">
13157 exim -bem /tmp/test.message '$h_subject:'
13158 </literallayout>
13159 <para>
13160 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13161 Exim message identifier. For example:
13162 </para>
13163 <literallayout class="monospaced">
13164 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13165 </literallayout>
13166 <para>
13167 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13168 is therefore restricted to admin users.
13169 </para>
13170 </section>
13171 <section id="SECTforexpfai">
13172 <title>Forced expansion failure</title>
13173 <para>
13174 <indexterm role="concept">
13175 <primary>expansion</primary>
13176 <secondary>forced failure</secondary>
13177 </indexterm>
13178 A number of expansions that are described in the following section have
13179 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13180 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13181 used depends on some condition that is evaluated as part of the expansion. If,
13182 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13183 the entire string expansion fails in a way that can be detected by the code
13184 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13185 its consequences depend on the circumstances. In some cases it is no different
13186 from any other expansion failure, but in others a different action may be
13187 taken. Such variations are mentioned in the documentation of the option that is
13188 being expanded.
13189 </para>
13190 </section>
13191 <section id="SECTexpansionitems">
13192 <title>Expansion items</title>
13193 <para>
13194 The following items are recognized in expanded strings. White space may be used
13195 between sub-items that are keywords or substrings enclosed in braces inside an
13196 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13197 white space is significant.
13198 </para>
13199 <variablelist>
13200 <varlistentry>
13201 <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>
13202 <listitem>
13203 <para>
13204 <indexterm role="concept">
13205 <primary>expansion</primary>
13206 <secondary>variables</secondary>
13207 </indexterm>
13208 Substitute the contents of the named variable, for example:
13209 </para>
13210 <literallayout class="monospaced">
13211 $local_part
13212 ${domain}
13213 </literallayout>
13214 <para>
13215 The second form can be used to separate the name from subsequent alphanumeric
13216 characters. This form (using braces) is available only for variables; it does
13217 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13218 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13219 given, the expansion fails.
13220 </para>
13221 </listitem></varlistentry>
13222 <varlistentry>
13223 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13224 <listitem>
13225 <para>
13226 <indexterm role="concept">
13227 <primary>expansion</primary>
13228 <secondary>operators</secondary>
13229 </indexterm>
13230 The string is first itself expanded, and then the operation specified by
13231 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13232 </para>
13233 <literallayout class="monospaced">
13234 ${lc:$local_part}
13235 </literallayout>
13236 <para>
13237 The string starts with the first character after the colon, which may be
13238 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13239 below. The operator notation is used for simple expansion items that have just
13240 one argument, because it reduces the number of braces and therefore makes the
13241 string easier to understand.
13242 </para>
13243 </listitem></varlistentry>
13244 <varlistentry>
13245 <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>
13246 <listitem>
13247 <para>
13248 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13249 expansion item below.
13250 </para>
13251 </listitem></varlistentry>
13252 <varlistentry>
13253 <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>
13254 <listitem>
13255 <para>
13256 <indexterm role="concept">
13257 <primary>expansion</primary>
13258 <secondary>calling an acl</secondary>
13259 </indexterm>
13260 <indexterm role="concept">
13261 <primary><option>acl</option></primary>
13262 <secondary>call from expansion</secondary>
13263 </indexterm>
13264 The name and zero to nine argument strings are first expanded separately.  The expanded
13265 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13266 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13267 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13268 and may use the variables; if another acl expansion is used the values
13269 are restored after it returns.  If the ACL sets
13270 a value using a "message =" modifier and returns accept or deny, the value becomes
13271 the result of the expansion.
13272 If no message is set and the ACL returns accept or deny
13273 the expansion result is an empty string.
13274 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13275 </para>
13276 </listitem></varlistentry>
13277 <varlistentry>
13278 <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>
13279 <listitem>
13280 <para>
13281 <indexterm role="concept">
13282 <primary>expansion</primary>
13283 <secondary>extracting cerificate fields</secondary>
13284 </indexterm>
13285 <indexterm role="concept">
13286 <primary><option>certextract</option></primary>
13287 <secondary>certificate fields</secondary>
13288 </indexterm>
13289 <indexterm role="concept">
13290 <primary>certificate</primary>
13291 <secondary>extracting fields</secondary>
13292 </indexterm>
13293 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13294 The field name is expanded and used to retrive the relevant field from
13295 the certificate.  Supported fields are:
13296 </para>
13297 <literallayout>
13298 <literal>version        </literal>
13299 <literal>serial_number  </literal>
13300 <literal>subject        </literal> RFC4514 DN
13301 <literal>issuer         </literal> RFC4514 DN
13302 <literal>notbefore      </literal> time
13303 <literal>notafter       </literal> time
13304 <literal>sig_algorithm  </literal>
13305 <literal>signature      </literal>
13306 <literal>subj_altname   </literal> tagged list
13307 <literal>ocsp_uri       </literal> list
13308 <literal>crl_uri        </literal> list
13309 </literallayout>
13310 <para>
13311 If the field is found,
13312 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13313 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13314 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13315 is restored to any previous value it might have had.
13316 </para>
13317 <para>
13318 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13319 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13320 extracted is used.
13321 </para>
13322 <para>
13323 Some field names take optional modifiers, appended and separated by commas.
13324 </para>
13325 <para>
13326 The field selectors marked as "RFC4514" above
13327 output a Distinguished Name string which is
13328 not quite
13329 parseable by Exim as a comma-separated tagged list
13330 (the exceptions being elements containin commas).
13331 RDN elements of a single type may be selected by
13332 a modifier of the type label; if so the expansion
13333 result is a list (newline-separated by default).
13334 The separator may be changed by another modifer of
13335 a right angle-bracket followed immediately by the new separator.
13336 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13337 </para>
13338 <para>
13339 The field selectors marked as "time" above
13340 may output a number of seconds since epoch
13341 if the modifier "int" is used.
13342 </para>
13343 <para>
13344 The field selectors marked as "list" above return a list,
13345 newline-separated by default,
13346 (embedded separator characters in elements are doubled).
13347 The separator may be changed by a modifier of
13348 a right angle-bracket followed immediately by the new separator.
13349 </para>
13350 <para>
13351 The field selectors marked as "tagged" above
13352 prefix each list element with a type string and an equals sign.
13353 Elements of only one type may be selected by a modifier
13354 which is one of "dns", "uri" or "mail";
13355 if so the elenment tags are omitted.
13356 </para>
13357 <para>
13358 If not otherwise noted field values are presented in human-readable form.
13359 </para>
13360 </listitem></varlistentry>
13361 <varlistentry>
13362 <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>
13363 <listitem>
13364 <para>
13365 <indexterm role="concept">
13366 <primary><option>dlfunc</option></primary>
13367 </indexterm>
13368 This expansion dynamically loads and then calls a locally-written C function.
13369 This functionality is available only if Exim is compiled with
13370 </para>
13371 <literallayout class="monospaced">
13372 EXPAND_DLFUNC=yes
13373 </literallayout>
13374 <para>
13375 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13376 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13377 (but of course Exim does start new processes frequently).
13378 </para>
13379 <para>
13380 There may be from zero to eight arguments to the function. When compiling
13381 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13382 included. The Exim variables and functions that are defined by that API
13383 are also available for dynamically loaded functions. The function itself
13384 must have the following type:
13385 </para>
13386 <literallayout class="monospaced">
13387 int dlfunction(uschar **yield, int argc, uschar *argv[])
13388 </literallayout>
13389 <para>
13390 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13391 function should return one of the following values:
13392 </para>
13393 <para>
13394 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13395 into the expanded string that is being built.
13396 </para>
13397 <para>
13398 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13399 from <emphasis>yield</emphasis>, if it is set.
13400 </para>
13401 <para>
13402 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13403 taken from <emphasis>yield</emphasis> if it is set.
13404 </para>
13405 <para>
13406 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13407 </para>
13408 <para>
13409 When compiling a function that is to be used in this way with gcc,
13410 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13411 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13412 </para>
13413 </listitem></varlistentry>
13414 <varlistentry>
13415 <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>
13416 <listitem>
13417 <para>
13418 <indexterm role="concept">
13419 <primary>expansion</primary>
13420 <secondary>extracting substrings by key</secondary>
13421 </indexterm>
13422 <indexterm role="concept">
13423 <primary><option>extract</option></primary>
13424 <secondary>substrings by key</secondary>
13425 </indexterm>
13426 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13427 white space is removed from the key (but not from any of the strings). The key
13428 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13429 form:
13430 </para>
13431 <literallayout>
13432 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13433 </literallayout>
13434 <para>
13435 <indexterm role="variable">
13436 <primary><varname>$value</varname></primary>
13437 </indexterm>
13438 where the equals signs and spaces (but not both) are optional. If any of the
13439 values contain white space, they must be enclosed in double quotes, and any
13440 values that are enclosed in double quotes are subject to escape processing as
13441 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13442 for the value that corresponds to the key. The search is case-insensitive. If
13443 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13444 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13445 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13446 is restored to any previous value it might have had.
13447 </para>
13448 <para>
13449 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13450 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13451 extracted is used. Thus, for example, these two expansions are identical, and
13452 yield <quote>2001</quote>:
13453 </para>
13454 <literallayout class="monospaced">
13455 ${extract{gid}{uid=1984 gid=2001}}
13456 ${extract{gid}{uid=1984 gid=2001}{$value}}
13457 </literallayout>
13458 <para>
13459 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13460 appear, for example:
13461 </para>
13462 <literallayout class="monospaced">
13463 ${extract{Z}{A=... B=...}{$value} fail }
13464 </literallayout>
13465 <para>
13466 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13467 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13468 </para>
13469 </listitem></varlistentry>
13470 <varlistentry>
13471 <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>
13472 <listitem>
13473 <para>
13474 <indexterm role="concept">
13475 <primary>expansion</primary>
13476 <secondary>extracting substrings by number</secondary>
13477 </indexterm>
13478 <indexterm role="concept">
13479 <primary><option>extract</option></primary>
13480 <secondary>substrings by number</secondary>
13481 </indexterm>
13482 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13483 apart from leading and trailing white space, which is ignored.
13484 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13485 behaves in the same way, except that, instead of extracting a named field, it
13486 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13487 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13488 &lt;<emphasis>string3</emphasis>&gt; as before.
13489 </para>
13490 <para>
13491 The fields in the string are separated by any one of the characters in the
13492 separator string. These may include space or tab characters.
13493 The first field is numbered one. If the number is negative, the fields are
13494 counted from the end of the string, with the rightmost one numbered -1. If the
13495 number given is zero, the entire string is returned. If the modulus of the
13496 number is greater than the number of fields in the string, the result is the
13497 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13498 provided. For example:
13499 </para>
13500 <literallayout class="monospaced">
13501 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13502 </literallayout>
13503 <para>
13504 yields <quote>42</quote>, and
13505 </para>
13506 <literallayout class="monospaced">
13507 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13508 </literallayout>
13509 <para>
13510 yields <quote>99</quote>. Two successive separators mean that the field between them is
13511 empty (for example, the fifth field above).
13512 </para>
13513 </listitem></varlistentry>
13514 <varlistentry>
13515 <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>
13516 <listitem>
13517 <para>
13518 <indexterm role="concept">
13519 <primary>list</primary>
13520 <secondary>selecting by condition</secondary>
13521 </indexterm>
13522 <indexterm role="concept">
13523 <primary>expansion</primary>
13524 <secondary>selecting from list by condition</secondary>
13525 </indexterm>
13526 <indexterm role="variable">
13527 <primary><varname>$item</varname></primary>
13528 </indexterm>
13529 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13530 default, but the separator can be changed in the usual way. For each item
13531 in this list, its value is place in <varname>$item</varname>, and then the condition is
13532 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13533 item in a new list; if the condition is false, the item is discarded. The
13534 separator used for the output list is the same as the one used for the
13535 input, but a separator setting is not included in the output. For example:
13536 </para>
13537 <literallayout class="monospaced">
13538 ${filter{a:b:c}{!eq{$item}{b}}
13539 </literallayout>
13540 <para>
13541 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13542 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13543 </para>
13544 </listitem></varlistentry>
13545 <varlistentry>
13546 <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>
13547 <listitem>
13548 <para>
13549 <indexterm role="concept">
13550 <primary>hash function</primary>
13551 <secondary>textual</secondary>
13552 </indexterm>
13553 <indexterm role="concept">
13554 <primary>expansion</primary>
13555 <secondary>textual hash</secondary>
13556 </indexterm>
13557 This is a textual hashing function, and was the first to be implemented in
13558 early versions of Exim. In current releases, there are other hashing functions
13559 (numeric, MD5, and SHA-1), which are described below.
13560 </para>
13561 <para>
13562 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13563 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13564 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13565 use the simpler operator notation that avoids some of the braces:
13566 </para>
13567 <literallayout class="monospaced">
13568 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13569 </literallayout>
13570 <para>
13571 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13572 or equal to the length of the string, the expansion item returns the string.
13573 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13574 function to the string. The new string consists of characters taken from the
13575 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13576 </para>
13577 <literallayout class="monospaced">
13578 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13579 </literallayout>
13580 <para>
13581 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13582 letters appear. For example:
13583 </para>
13584 <literallayout>
13585 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13586 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13587 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13588 </literallayout>
13589 </listitem></varlistentry>
13590 <varlistentry>
13591 <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>
13592 <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>
13593 <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>
13594 <listitem>
13595 <para>
13596 <indexterm role="concept">
13597 <primary>expansion</primary>
13598 <secondary>header insertion</secondary>
13599 </indexterm>
13600 <indexterm role="variable">
13601 <primary><varname>$header_</varname></primary>
13602 </indexterm>
13603 <indexterm role="variable">
13604 <primary><varname>$bheader_</varname></primary>
13605 </indexterm>
13606 <indexterm role="variable">
13607 <primary><varname>$rheader_</varname></primary>
13608 </indexterm>
13609 <indexterm role="concept">
13610 <primary>header lines</primary>
13611 <secondary>in expansion strings</secondary>
13612 </indexterm>
13613 <indexterm role="concept">
13614 <primary>header lines</primary>
13615 <secondary>character sets</secondary>
13616 </indexterm>
13617 <indexterm role="concept">
13618 <primary>header lines</primary>
13619 <secondary>decoding</secondary>
13620 </indexterm>
13621 Substitute the contents of the named message header line, for example
13622 </para>
13623 <literallayout class="monospaced">
13624 $header_reply-to:
13625 </literallayout>
13626 <para>
13627 The newline that terminates a header line is not included in the expansion, but
13628 internal newlines (caused by splitting the header line over several physical
13629 lines) may be present.
13630 </para>
13631 <para>
13632 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13633 the data in the header line is interpreted.
13634 </para>
13635 <itemizedlist>
13636 <listitem>
13637 <para>
13638 <indexterm role="concept">
13639 <primary>white space</primary>
13640 <secondary>in header lines</secondary>
13641 </indexterm>
13642 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13643 processing at all, and without the removal of leading and trailing white space.
13644 </para>
13645 </listitem>
13646 <listitem>
13647 <para>
13648 <indexterm role="concept">
13649 <primary>base64 encoding</primary>
13650 <secondary>in header lines</secondary>
13651 </indexterm>
13652 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13653 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13654 character set translation. If decoding of what looks superficially like a MIME
13655 <quote>word</quote> fails, the raw string is returned. If decoding
13656 <indexterm role="concept">
13657 <primary>binary zero</primary>
13658 <secondary>in header line</secondary>
13659 </indexterm>
13660 produces a binary zero character, it is replaced by a question mark &ndash; this is
13661 what Exim does for binary zeros that are actually received in header lines.
13662 </para>
13663 </listitem>
13664 <listitem>
13665 <para>
13666 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13667 standard character set. This is an attempt to produce the same string as would
13668 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13669 returned. Translation is attempted only on operating systems that support the
13670 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13671 a system Makefile or in <filename>Local/Makefile</filename>.
13672 </para>
13673 </listitem>
13674 </itemizedlist>
13675 <para>
13676 In a filter file, the target character set for <option>header</option> can be specified by a
13677 command of the following form:
13678 </para>
13679 <literallayout class="monospaced">
13680 headers charset "UTF-8"
13681 </literallayout>
13682 <para>
13683 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13684 subsequently obeyed filter commands. In the absence of this command, the target
13685 character set in a filter is taken from the setting of the <option>headers_charset</option>
13686 option in the runtime configuration. The value of this option defaults to the
13687 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13688 ISO-8859-1.
13689 </para>
13690 <para>
13691 Header names follow the syntax of RFC 2822, which states that they may contain
13692 any printing characters except space and colon. Consequently, curly brackets
13693 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13694 if they were variables. Attempting to do so causes a syntax error.
13695 </para>
13696 <para>
13697 Only header lines that are common to all copies of a message are visible to
13698 this mechanism. These are the original header lines that are received with the
13699 message, and any that are added by an ACL statement or by a system
13700 filter. Header lines that are added to a particular copy of a message by a
13701 router or transport are not accessible.
13702 </para>
13703 <para>
13704 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13705 before the DATA ACL, because the header structure is not set up until the
13706 message is received. Header lines that are added in a RCPT ACL (for example)
13707 are saved until the message&#x2019;s incoming header lines are available, at which
13708 point they are added. When a DATA ACL is running, however, header lines added
13709 by earlier ACLs are visible.
13710 </para>
13711 <para>
13712 Upper case and lower case letters are synonymous in header names. If the
13713 following character is white space, the terminating colon may be omitted, but
13714 this is not recommended, because you may then forget it when it is needed. When
13715 white space terminates the header name, it is included in the expanded string.
13716 If the message does not contain the given header, the expansion item is
13717 replaced by an empty string. (See the <option>def</option> condition in section
13718 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13719 </para>
13720 <para>
13721 If there is more than one header with the same name, they are all concatenated
13722 to form the substitution string, up to a maximum length of 64K. Unless
13723 <option>rheader</option> is being used, leading and trailing white space is removed from
13724 each header before concatenation, and a completely empty header is ignored. A
13725 newline character is then inserted between non-empty headers, but there is no
13726 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13727 those headers that contain lists of addresses, a comma is also inserted at the
13728 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13729 </para>
13730 </listitem></varlistentry>
13731 <varlistentry>
13732 <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>
13733 <listitem>
13734 <para>
13735 <indexterm role="concept">
13736 <primary>expansion</primary>
13737 <secondary>hmac hashing</secondary>
13738 </indexterm>
13739 <indexterm role="concept">
13740 <primary><option>hmac</option></primary>
13741 </indexterm>
13742 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13743 shared secret and some text into a message authentication code, as specified in
13744 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13745 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13746 cryptographic hash, allowing for authentication that is not possible with MD5
13747 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13748 present. For example:
13749 </para>
13750 <literallayout class="monospaced">
13751 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13752 </literallayout>
13753 <para>
13754 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13755 produces:
13756 </para>
13757 <literallayout class="monospaced">
13758 dd97e3ba5d1a61b5006108f8c8252953
13759 </literallayout>
13760 <para>
13761 As an example of how this might be used, you might put in the main part of
13762 an Exim configuration:
13763 </para>
13764 <literallayout class="monospaced">
13765 SPAMSCAN_SECRET=cohgheeLei2thahw
13766 </literallayout>
13767 <para>
13768 In a router or a transport you could then have:
13769 </para>
13770 <literallayout class="monospaced">
13771 headers_add = \
13772   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13773   ${hmac{md5}{SPAMSCAN_SECRET}\
13774   {${primary_hostname},${message_exim_id},$h_message-id:}}
13775 </literallayout>
13776 <para>
13777 Then given a message, you can check where it was scanned by looking at the
13778 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13779 this header line is authentic by recomputing the authentication code from the
13780 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13781 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13782 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13783 </para>
13784 </listitem></varlistentry>
13785 <varlistentry>
13786 <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>
13787 <listitem>
13788 <para>
13789 <indexterm role="concept">
13790 <primary>expansion</primary>
13791 <secondary>conditional</secondary>
13792 </indexterm>
13793 <indexterm role="concept">
13794 <primary><option>if</option>, expansion item</primary>
13795 </indexterm>
13796 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13797 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13798 in section <xref linkend="SECTexpcond"/> below. For example:
13799 </para>
13800 <literallayout class="monospaced">
13801 ${if eq {$local_part}{postmaster} {yes}{no} }
13802 </literallayout>
13803 <para>
13804 The second string need not be present; if it is not and the condition is not
13805 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13806 be present instead of the second string (without any curly brackets). In this
13807 case, the expansion is forced to fail if the condition is not true (see section
13808 <xref linkend="SECTforexpfai"/>).
13809 </para>
13810 <para>
13811 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13812 is true, and the empty string if the condition is false. This makes it less
13813 cumbersome to write custom ACL and router conditions. For example, instead of
13814 </para>
13815 <literallayout class="monospaced">
13816 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13817 </literallayout>
13818 <para>
13819 you can use
13820 </para>
13821 <literallayout class="monospaced">
13822 condition = ${if &gt;{$acl_m4}{3}}
13823 </literallayout>
13824 </listitem></varlistentry>
13825 <varlistentry>
13826 <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>
13827 <listitem>
13828 <para>
13829 <indexterm role="concept">
13830 <primary>expansion</primary>
13831 <secondary>string truncation</secondary>
13832 </indexterm>
13833 <indexterm role="concept">
13834 <primary><option>length</option> expansion item</primary>
13835 </indexterm>
13836 The <option>length</option> item is used to extract the initial portion of a string. Both
13837 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13838 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13839 change when expanded, you can use the simpler operator notation that avoids
13840 some of the braces:
13841 </para>
13842 <literallayout class="monospaced">
13843 ${length_&lt;n&gt;:&lt;string&gt;}
13844 </literallayout>
13845 <para>
13846 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13847 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13848 <option>strlen</option>, which gives the length of a string.
13849 </para>
13850 </listitem></varlistentry>
13851 <varlistentry>
13852 <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>
13853 <listitem>
13854 <para>
13855 <indexterm role="concept">
13856 <primary>expansion</primary>
13857 <secondary>extracting list elements by number</secondary>
13858 </indexterm>
13859 <indexterm role="concept">
13860 <primary><option>listextract</option></primary>
13861 <secondary>extract list elements by number</secondary>
13862 </indexterm>
13863 <indexterm role="concept">
13864 <primary>list</primary>
13865 <secondary>extracting elements by number</secondary>
13866 </indexterm>
13867 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13868 apart from an optional leading minus,
13869 and leading and trailing white space (which is ignored).
13870 </para>
13871 <para>
13872 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13873 default, but the separator can be changed in the usual way.
13874 </para>
13875 <para>
13876 The first field of the list is numbered one.
13877 If the number is negative, the fields are
13878 counted from the end of the list, with the rightmost one numbered -1.
13879 The numbered element of the list is extracted and placed in <varname>$value</varname>,
13880 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
13881 </para>
13882 <para>
13883 If the modulus of the
13884 number is zero or greater than the number of fields in the string,
13885 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
13886 </para>
13887 <para>
13888 For example:
13889 </para>
13890 <literallayout class="monospaced">
13891 ${listextract{2}{x:42:99}}
13892 </literallayout>
13893 <para>
13894 yields <quote>42</quote>, and
13895 </para>
13896 <literallayout class="monospaced">
13897 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
13898 </literallayout>
13899 <para>
13900 yields <quote>result: 99</quote>.
13901 </para>
13902 <para>
13903 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
13904 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13905 extracted is used.
13906 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
13907 </para>
13908 </listitem></varlistentry>
13909 <varlistentry>
13910 <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>
13911 <listitem>
13912 <para>
13913 This is the first of one of two different types of lookup item, which are both
13914 described in the next item.
13915 </para>
13916 </listitem></varlistentry>
13917 <varlistentry>
13918 <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>
13919 <listitem>
13920 <para>
13921 <indexterm role="concept">
13922 <primary>expansion</primary>
13923 <secondary>lookup in</secondary>
13924 </indexterm>
13925 <indexterm role="concept">
13926 <primary>file</primary>
13927 <secondary>lookups</secondary>
13928 </indexterm>
13929 <indexterm role="concept">
13930 <primary>lookup</primary>
13931 <secondary>in expanded string</secondary>
13932 </indexterm>
13933 The two forms of lookup item specify data lookups in files and databases, as
13934 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13935 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13936 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13937 </para>
13938 <para>
13939 If there is any white space in a lookup item which is part of a filter command,
13940 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13941 other place where white space is significant, the lookup item must be enclosed
13942 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13943 out by the system administrator.
13944 </para>
13945 <para>
13946 <indexterm role="variable">
13947 <primary><varname>$value</varname></primary>
13948 </indexterm>
13949 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13950 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13951 lookup. Afterwards it reverts to the value it had previously (at the outer
13952 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13953 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13954 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13955 lookup, thus providing a mechanism for looking up a default value when the
13956 original lookup fails.
13957 </para>
13958 <para>
13959 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13960 data for the outer lookup while the parameters of the second lookup are
13961 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13962 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13963 appear, and in this case, if the lookup fails, the entire expansion is forced
13964 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13965 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13966 successful lookup, and nothing in the case of failure.
13967 </para>
13968 <para>
13969 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13970 search type in order to do partial matching, and * or *@ may follow a search
13971 type to request default lookups if the key does not match (see sections
13972 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13973 </para>
13974 <para>
13975 <indexterm role="concept">
13976 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13977 <secondary>in lookup expansion</secondary>
13978 </indexterm>
13979 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13980 and non-wild parts of the key during the expansion of the replacement text.
13981 They return to their previous values at the end of the lookup item.
13982 </para>
13983 <para>
13984 This example looks up the postmaster alias in the conventional alias file:
13985 </para>
13986 <literallayout class="monospaced">
13987 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13988 </literallayout>
13989 <para>
13990 This example uses NIS+ to look up the full name of the user corresponding to
13991 the local part of an address, forcing the expansion to fail if it is not found:
13992 </para>
13993 <literallayout class="monospaced">
13994 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13995   {$value}fail}
13996 </literallayout>
13997 </listitem></varlistentry>
13998 <varlistentry>
13999 <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>
14000 <listitem>
14001 <para>
14002 <indexterm role="concept">
14003 <primary>expansion</primary>
14004 <secondary>list creation</secondary>
14005 </indexterm>
14006 <indexterm role="variable">
14007 <primary><varname>$item</varname></primary>
14008 </indexterm>
14009 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14010 default, but the separator can be changed in the usual way. For each item
14011 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14012 expanded and added to the output as an item in a new list. The separator used
14013 for the output list is the same as the one used for the input, but a separator
14014 setting is not included in the output. For example:
14015 </para>
14016 <literallayout class="monospaced">
14017 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14018 </literallayout>
14019 <para>
14020 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14021 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14022 and <emphasis role="bold">reduce</emphasis> expansion items.
14023 </para>
14024 </listitem></varlistentry>
14025 <varlistentry>
14026 <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>
14027 <listitem>
14028 <para>
14029 <indexterm role="concept">
14030 <primary>expansion</primary>
14031 <secondary>numeric hash</secondary>
14032 </indexterm>
14033 <indexterm role="concept">
14034 <primary>hash function</primary>
14035 <secondary>numeric</secondary>
14036 </indexterm>
14037 The three strings are expanded; the first two must yield numbers. Call them
14038 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14039 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14040 can use the simpler operator notation that avoids some of the braces:
14041 </para>
14042 <literallayout class="monospaced">
14043 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14044 </literallayout>
14045 <para>
14046 The second number is optional (in both notations). If there is only one number,
14047 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14048 processed by a div/mod hash function that returns two numbers, separated by a
14049 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14050 example,
14051 </para>
14052 <literallayout class="monospaced">
14053 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14054 </literallayout>
14055 <para>
14056 returns the string <quote>6/33</quote>.
14057 </para>
14058 </listitem></varlistentry>
14059 <varlistentry>
14060 <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>
14061 <listitem>
14062 <para>
14063 <indexterm role="concept">
14064 <primary>Perl</primary>
14065 <secondary>use in expanded string</secondary>
14066 </indexterm>
14067 <indexterm role="concept">
14068 <primary>expansion</primary>
14069 <secondary>calling Perl from</secondary>
14070 </indexterm>
14071 This item is available only if Exim has been built to include an embedded Perl
14072 interpreter. The subroutine name and the arguments are first separately
14073 expanded, and then the Perl subroutine is called with those arguments. No
14074 additional arguments need be given; the maximum number permitted, including the
14075 name of the subroutine, is nine.
14076 </para>
14077 <para>
14078 The return value of the subroutine is inserted into the expanded string, unless
14079 the return value is <option>undef</option>. In that case, the expansion fails in the same
14080 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14081 Whatever you return is evaluated in a scalar context. For example, if you
14082 return the name of a Perl vector, the return value is the size of the vector,
14083 not its contents.
14084 </para>
14085 <para>
14086 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14087 with the error message that was passed to <option>die</option>. More details of the embedded
14088 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14089 </para>
14090 <para>
14091 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14092 out the use of this expansion item in filter files.
14093 </para>
14094 </listitem></varlistentry>
14095 <varlistentry>
14096 <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>
14097 <listitem>
14098 <para>
14099 <indexterm role="concept">
14100 <primary><option>prvs</option> expansion item</primary>
14101 </indexterm>
14102 The first argument is a complete email address and the second is secret
14103 keystring. The third argument, specifying a key number, is optional. If absent,
14104 it defaults to 0. The result of the expansion is a prvs-signed email address,
14105 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14106 as part of a bounce address tag validation (BATV) scheme. For more discussion
14107 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14108 </para>
14109 </listitem></varlistentry>
14110 <varlistentry>
14111 <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>
14112 <listitem>
14113 <para>
14114 <indexterm role="concept">
14115 <primary><option>prvscheck</option> expansion item</primary>
14116 </indexterm>
14117 This expansion item is the complement of the <option>prvs</option> item. It is used for
14118 checking prvs-signed addresses. If the expansion of the first argument does not
14119 yield a syntactically valid prvs-signed address, the whole item expands to the
14120 empty string. When the first argument does expand to a syntactically valid
14121 prvs-signed address, the second argument is expanded, with the prvs-decoded
14122 version of the address and the key number extracted from the address in the
14123 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14124 </para>
14125 <para>
14126 These two variables can be used in the expansion of the second argument to
14127 retrieve the secret. The validity of the prvs-signed address is then checked
14128 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14129 which is empty for failure or <quote>1</quote> for success.
14130 </para>
14131 <para>
14132 The third argument is optional; if it is missing, it defaults to an empty
14133 string. This argument is now expanded. If the result is an empty string, the
14134 result of the expansion is the decoded version of the address. This is the case
14135 whether or not the signature was valid. Otherwise, the result of the expansion
14136 is the expansion of the third argument.
14137 </para>
14138 <para>
14139 All three variables can be used in the expansion of the third argument.
14140 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14141 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14142 </para>
14143 </listitem></varlistentry>
14144 <varlistentry>
14145 <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>
14146 <listitem>
14147 <para>
14148 <indexterm role="concept">
14149 <primary>expansion</primary>
14150 <secondary>inserting an entire file</secondary>
14151 </indexterm>
14152 <indexterm role="concept">
14153 <primary>file</primary>
14154 <secondary>inserting into expansion</secondary>
14155 </indexterm>
14156 <indexterm role="concept">
14157 <primary><option>readfile</option> expansion item</primary>
14158 </indexterm>
14159 The file name and end-of-line string are first expanded separately. The file is
14160 then read, and its contents replace the entire item. All newline characters in
14161 the file are replaced by the end-of-line string if it is present. Otherwise,
14162 newlines are left in the string.
14163 String expansion is not applied to the contents of the file. If you want this,
14164 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14165 the string expansion fails.
14166 </para>
14167 <para>
14168 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14169 locks out the use of this expansion item in filter files.
14170 </para>
14171 </listitem></varlistentry>
14172 <varlistentry>
14173 <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>
14174 <listitem>
14175 <para>
14176 <indexterm role="concept">
14177 <primary>expansion</primary>
14178 <secondary>inserting from a socket</secondary>
14179 </indexterm>
14180 <indexterm role="concept">
14181 <primary>socket, use of in expansion</primary>
14182 </indexterm>
14183 <indexterm role="concept">
14184 <primary><option>readsocket</option> expansion item</primary>
14185 </indexterm>
14186 This item inserts data from a Unix domain or Internet socket into the expanded
14187 string. The minimal way of using it uses just two arguments, as in these
14188 examples:
14189 </para>
14190 <literallayout class="monospaced">
14191 ${readsocket{/socket/name}{request string}}
14192 ${readsocket{inet:some.host:1234}{request string}}
14193 </literallayout>
14194 <para>
14195 For a Unix domain socket, the first substring must be the path to the socket.
14196 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14197 a host name or IP address, followed by a colon and a port, which can be a
14198 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14199 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14200 example:
14201 </para>
14202 <literallayout class="monospaced">
14203 ${readsocket{inet:[::1]:1234}{request string}}
14204 </literallayout>
14205 <para>
14206 Only a single host name may be given, but if looking it up yields more than
14207 one IP address, they are each tried in turn until a connection is made. For
14208 both kinds of socket, Exim makes a connection, writes the request string
14209 (unless it is an empty string) and reads from the socket until an end-of-file
14210 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14211 extend what can be done. Firstly, you can vary the timeout. For example:
14212 </para>
14213 <literallayout class="monospaced">
14214 ${readsocket{/socket/name}{request string}{3s}}
14215 </literallayout>
14216 <para>
14217 A fourth argument allows you to change any newlines that are in the data
14218 that is read, in the same way as for <option>readfile</option> (see above). This example
14219 turns them into spaces:
14220 </para>
14221 <literallayout class="monospaced">
14222 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14223 </literallayout>
14224 <para>
14225 As with all expansions, the substrings are expanded before the processing
14226 happens. Errors in these sub-expansions cause the expansion to fail. In
14227 addition, the following errors can occur:
14228 </para>
14229 <itemizedlist>
14230 <listitem>
14231 <para>
14232 Failure to create a socket file descriptor;
14233 </para>
14234 </listitem>
14235 <listitem>
14236 <para>
14237 Failure to connect the socket;
14238 </para>
14239 </listitem>
14240 <listitem>
14241 <para>
14242 Failure to write the request string;
14243 </para>
14244 </listitem>
14245 <listitem>
14246 <para>
14247 Timeout on reading from the socket.
14248 </para>
14249 </listitem>
14250 </itemizedlist>
14251 <para>
14252 By default, any of these errors causes the expansion to fail. However, if
14253 you supply a fifth substring, it is expanded and used when any of the above
14254 errors occurs. For example:
14255 </para>
14256 <literallayout class="monospaced">
14257 ${readsocket{/socket/name}{request string}{3s}{\n}\
14258   {socket failure}}
14259 </literallayout>
14260 <para>
14261 You can test for the existence of a Unix domain socket by wrapping this
14262 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14263 and the actual opening of the socket, so it is safer to use the fifth argument
14264 if you want to be absolutely sure of avoiding an expansion error for a
14265 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14266 </para>
14267 <para>
14268 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14269 locks out the use of this expansion item in filter files.
14270 </para>
14271 </listitem></varlistentry>
14272 <varlistentry>
14273 <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>
14274 <listitem>
14275 <para>
14276 <indexterm role="concept">
14277 <primary>expansion</primary>
14278 <secondary>reducing a list to a scalar</secondary>
14279 </indexterm>
14280 <indexterm role="concept">
14281 <primary>list</primary>
14282 <secondary>reducing to a scalar</secondary>
14283 </indexterm>
14284 <indexterm role="variable">
14285 <primary><varname>$value</varname></primary>
14286 </indexterm>
14287 <indexterm role="variable">
14288 <primary><varname>$item</varname></primary>
14289 </indexterm>
14290 This operation reduces a list to a single, scalar string. After expansion,
14291 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14292 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14293 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14294 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14295 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14296 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14297 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14298 number of ways. For example, to add up a list of numbers:
14299 </para>
14300 <literallayout class="monospaced">
14301 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14302 </literallayout>
14303 <para>
14304 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14305 can be found:
14306 </para>
14307 <literallayout class="monospaced">
14308 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14309 </literallayout>
14310 <para>
14311 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14312 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14313 expansion items.
14314 </para>
14315 </listitem></varlistentry>
14316 <varlistentry>
14317 <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>
14318 <listitem>
14319 <para>
14320 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14321 expansion item above.
14322 </para>
14323 </listitem></varlistentry>
14324 <varlistentry>
14325 <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>
14326 <listitem>
14327 <para>
14328 <indexterm role="concept">
14329 <primary>expansion</primary>
14330 <secondary>running a command</secondary>
14331 </indexterm>
14332 <indexterm role="concept">
14333 <primary><option>run</option> expansion item</primary>
14334 </indexterm>
14335 The command and its arguments are first expanded as one string. The string is
14336 split apart into individual arguments by spaces, and then the command is run
14337 in a separate process, but under the same uid and gid.  As in other command
14338 executions from Exim, a shell is not used by default. If the command requires
14339 a shell, you must explicitly code it.
14340 </para>
14341 <para>
14342 Since the arguments are split by spaces, when there is a variable expansion
14343 which has an empty result, it will cause the situation that the argument will
14344 simply be omitted when the program is actually executed by Exim. If the
14345 script/program requires a specific number of arguments and the expanded
14346 variable could possibly result in this empty expansion, the variable must be
14347 quoted. This is more difficult if the expanded variable itself could result
14348 in a string containing quotes, because it would interfere with the quotes
14349 around the command arguments. A possible guard against this is to wrap the
14350 variable in the <option>sg</option> operator to change any quote marks to some other
14351 character.
14352 </para>
14353 <para>
14354 The standard input for the command exists, but is empty. The standard output
14355 and standard error are set to the same file descriptor.
14356 <indexterm role="concept">
14357 <primary>return code</primary>
14358 <secondary>from <option>run</option> expansion</secondary>
14359 </indexterm>
14360 <indexterm role="variable">
14361 <primary><varname>$value</varname></primary>
14362 </indexterm>
14363 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14364 and replaces the entire item; during this expansion, the standard output/error
14365 from the command is in the variable <varname>$value</varname>. If the command fails,
14366 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14367 expansion, the standard output/error from the command is in the variable
14368 <varname>$value</varname>.
14369 </para>
14370 <para>
14371 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14372 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14373 command does not succeed. If both strings are omitted, the result is contents
14374 of the standard output/error on success, and nothing on failure.
14375 </para>
14376 <para>
14377 <indexterm role="variable">
14378 <primary><varname>$run_in_acl</varname></primary>
14379 </indexterm>
14380 The standard output/error of the command is put in the variable <varname>$value</varname>.
14381 In this ACL example, the output of a command is logged for the admin to
14382 troubleshoot:
14383 </para>
14384 <literallayout class="monospaced">
14385 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14386       log_message  = Output of id: $value
14387 </literallayout>
14388 <para>
14389 If the command requires shell idioms, such as the &gt; redirect operator, the
14390 shell must be invoked directly, such as with:
14391 </para>
14392 <literallayout class="monospaced">
14393 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14394 </literallayout>
14395 <para>
14396 <indexterm role="variable">
14397 <primary><varname>$runrc</varname></primary>
14398 </indexterm>
14399 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14400 remains set afterwards, so in a filter file you can do things like this:
14401 </para>
14402 <literallayout class="monospaced">
14403 if "${run{x y z}{}}$runrc" is 1 then ...
14404   elif $runrc is 2 then ...
14405   ...
14406 endif
14407 </literallayout>
14408 <para>
14409 If execution of the command fails (for example, the command does not exist),
14410 the return code is 127 &ndash; the same code that shells use for non-existent
14411 commands.
14412 </para>
14413 <para>
14414 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14415 option values are expanded, except for those preconditions whose order of
14416 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14417 by the expansion of one option, and use it in another.
14418 </para>
14419 <para>
14420 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14421 out the use of this expansion item in filter files.
14422 </para>
14423 </listitem></varlistentry>
14424 <varlistentry>
14425 <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>
14426 <listitem>
14427 <para>
14428 <indexterm role="concept">
14429 <primary>expansion</primary>
14430 <secondary>string substitution</secondary>
14431 </indexterm>
14432 <indexterm role="concept">
14433 <primary><option>sg</option> expansion item</primary>
14434 </indexterm>
14435 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14436 option; hence its name. However, unlike the Perl equivalent, Exim does not
14437 modify the subject string; instead it returns the modified string for insertion
14438 into the overall expansion. The item takes three arguments: the subject string,
14439 a regular expression, and a substitution string. For example:
14440 </para>
14441 <literallayout class="monospaced">
14442 ${sg{abcdefabcdef}{abc}{xyz}}
14443 </literallayout>
14444 <para>
14445 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14446 if any $ or \ characters are required in the regular expression or in the
14447 substitution string, they have to be escaped. For example:
14448 </para>
14449 <literallayout class="monospaced">
14450 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14451 </literallayout>
14452 <para>
14453 yields <quote>defabc</quote>, and
14454 </para>
14455 <literallayout class="monospaced">
14456 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14457 </literallayout>
14458 <para>
14459 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14460 the regular expression from string expansion.
14461 </para>
14462 </listitem></varlistentry>
14463 <varlistentry>
14464 <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>
14465 <listitem>
14466 <para>
14467 <indexterm role="concept">
14468 <primary><option>substr</option> expansion item</primary>
14469 </indexterm>
14470 <indexterm role="concept">
14471 <primary>substring extraction</primary>
14472 </indexterm>
14473 <indexterm role="concept">
14474 <primary>expansion</primary>
14475 <secondary>substring extraction</secondary>
14476 </indexterm>
14477 The three strings are expanded; the first two must yield numbers. Call them
14478 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14479 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14480 can use the simpler operator notation that avoids some of the braces:
14481 </para>
14482 <literallayout class="monospaced">
14483 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14484 </literallayout>
14485 <para>
14486 The second number is optional (in both notations).
14487 If it is absent in the simpler format, the preceding underscore must also be
14488 omitted.
14489 </para>
14490 <para>
14491 The <option>substr</option> item can be used to extract more general substrings than
14492 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14493 length required. For example
14494 </para>
14495 <literallayout class="monospaced">
14496 ${substr{3}{2}{$local_part}}
14497 </literallayout>
14498 <para>
14499 If the starting offset is greater than the string length the result is the
14500 null string; if the length plus starting offset is greater than the string
14501 length, the result is the right-hand part of the string, starting from the
14502 given offset. The first character in the string has offset zero.
14503 </para>
14504 <para>
14505 The <option>substr</option> expansion item can take negative offset values to count
14506 from the right-hand end of its operand. The last character is offset -1, the
14507 second-last is offset -2, and so on. Thus, for example,
14508 </para>
14509 <literallayout class="monospaced">
14510 ${substr{-5}{2}{1234567}}
14511 </literallayout>
14512 <para>
14513 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14514 length of the string, the substring starts at the beginning of the string, and
14515 the length is reduced by the amount of overshoot. Thus, for example,
14516 </para>
14517 <literallayout class="monospaced">
14518 ${substr{-5}{2}{12}}
14519 </literallayout>
14520 <para>
14521 yields an empty string, but
14522 </para>
14523 <literallayout class="monospaced">
14524 ${substr{-3}{2}{12}}
14525 </literallayout>
14526 <para>
14527 yields <quote>1</quote>.
14528 </para>
14529 <para>
14530 When the second number is omitted from <option>substr</option>, the remainder of the string
14531 is taken if the offset is positive. If it is negative, all characters in the
14532 string preceding the offset point are taken. For example, an offset of -1 and
14533 no length, as in these semantically identical examples:
14534 </para>
14535 <literallayout class="monospaced">
14536 ${substr_-1:abcde}
14537 ${substr{-1}{abcde}}
14538 </literallayout>
14539 <para>
14540 yields all but the last character of the string, that is, <quote>abcd</quote>.
14541 </para>
14542 </listitem></varlistentry>
14543 <varlistentry>
14544 <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>
14545 <listitem>
14546 <para>
14547 <indexterm role="concept">
14548 <primary>expansion</primary>
14549 <secondary>character translation</secondary>
14550 </indexterm>
14551 <indexterm role="concept">
14552 <primary><option>tr</option> expansion item</primary>
14553 </indexterm>
14554 This item does single-character translation on its subject string. The second
14555 argument is a list of characters to be translated in the subject string. Each
14556 matching character is replaced by the corresponding character from the
14557 replacement list. For example
14558 </para>
14559 <literallayout class="monospaced">
14560 ${tr{abcdea}{ac}{13}}
14561 </literallayout>
14562 <para>
14563 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14564 last occurrence is used. If the third string is shorter than the second, its
14565 last character is replicated. However, if it is empty, no translation takes
14566 place.
14567 </para>
14568 </listitem></varlistentry>
14569 </variablelist>
14570 </section>
14571 <section id="SECTexpop">
14572 <title>Expansion operators</title>
14573 <para>
14574 <indexterm role="concept">
14575 <primary>expansion</primary>
14576 <secondary>operators</secondary>
14577 </indexterm>
14578 For expansion items that perform transformations on a single argument string,
14579 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14580 The substring is first expanded before the operation is applied to it. The
14581 following operations can be performed:
14582 </para>
14583 <variablelist>
14584 <varlistentry>
14585 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14586 <listitem>
14587 <para>
14588 <indexterm role="concept">
14589 <primary>expansion</primary>
14590 <secondary>RFC 2822 address handling</secondary>
14591 </indexterm>
14592 <indexterm role="concept">
14593 <primary><option>address</option> expansion item</primary>
14594 </indexterm>
14595 The string is interpreted as an RFC 2822 address, as it might appear in a
14596 header line, and the effective address is extracted from it. If the string does
14597 not parse successfully, the result is empty.
14598 </para>
14599 </listitem></varlistentry>
14600 <varlistentry>
14601 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14602 <listitem>
14603 <para>
14604 <indexterm role="concept">
14605 <primary>expansion</primary>
14606 <secondary>RFC 2822 address handling</secondary>
14607 </indexterm>
14608 <indexterm role="concept">
14609 <primary><option>addresses</option> expansion item</primary>
14610 </indexterm>
14611 The string (after expansion) is interpreted as a list of addresses in RFC
14612 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14613 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14614 result of the expansion is a colon-separated list, with appropriate
14615 doubling of colons should any happen to be present in the email addresses.
14616 Syntactically invalid RFC2822 address items are omitted from the output.
14617 </para>
14618 <para>
14619 It is possible to specify a character other than colon for the output
14620 separator by starting the string with &gt; followed by the new separator
14621 character. For example:
14622 </para>
14623 <literallayout class="monospaced">
14624 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14625 </literallayout>
14626 <para>
14627 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14628 expansion item, which extracts the working address from a single RFC2822
14629 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14630 processing lists.
14631 </para>
14632 <para>
14633 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14634 a strict interpretation of header line formatting.  Exim parses the bare,
14635 unquoted portion of an email address and if it finds a comma, treats it as an
14636 email address seperator. For the example header line:
14637 </para>
14638 <literallayout class="monospaced">
14639 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14640 </literallayout>
14641 <para>
14642 The first example below demonstrates that Q-encoded email addresses are parsed
14643 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14644 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14645 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14646 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14647 The third example shows that the presence of a comma is skipped when it is
14648 quoted.
14649 </para>
14650 <literallayout class="monospaced">
14651 # exim -be '${addresses:From: \
14652 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14653 user@example.com
14654 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14655 Last:user@example.com
14656 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14657 user@example.com
14658 </literallayout>
14659 </listitem></varlistentry>
14660 <varlistentry>
14661 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14662 <listitem>
14663 <para>
14664 <indexterm role="concept">
14665 <primary><option>base62</option> expansion item</primary>
14666 </indexterm>
14667 <indexterm role="concept">
14668 <primary>expansion</primary>
14669 <secondary>conversion to base 62</secondary>
14670 </indexterm>
14671 The string must consist entirely of decimal digits. The number is converted to
14672 base 62 and output as a string of six characters, including leading zeros. In
14673 the few operating environments where Exim uses base 36 instead of base 62 for
14674 its message identifiers (because those systems do not have case-sensitive file
14675 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14676 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14677 </para>
14678 </listitem></varlistentry>
14679 <varlistentry>
14680 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14681 <listitem>
14682 <para>
14683 <indexterm role="concept">
14684 <primary><option>base62d</option> expansion item</primary>
14685 </indexterm>
14686 <indexterm role="concept">
14687 <primary>expansion</primary>
14688 <secondary>conversion to base 62</secondary>
14689 </indexterm>
14690 The string must consist entirely of base-62 digits, or, in operating
14691 environments where Exim uses base 36 instead of base 62 for its message
14692 identifiers, base-36 digits. The number is converted to decimal and output as a
14693 string.
14694 </para>
14695 </listitem></varlistentry>
14696 <varlistentry>
14697 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14698 <listitem>
14699 <para>
14700 <indexterm role="concept">
14701 <primary>domain</primary>
14702 <secondary>extraction</secondary>
14703 </indexterm>
14704 <indexterm role="concept">
14705 <primary>expansion</primary>
14706 <secondary>domain extraction</secondary>
14707 </indexterm>
14708 The string is interpreted as an RFC 2822 address and the domain is extracted
14709 from it. If the string does not parse successfully, the result is empty.
14710 </para>
14711 </listitem></varlistentry>
14712 <varlistentry>
14713 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14714 <listitem>
14715 <para>
14716 <indexterm role="concept">
14717 <primary>expansion</primary>
14718 <secondary>escaping non-printing characters</secondary>
14719 </indexterm>
14720 <indexterm role="concept">
14721 <primary><option>escape</option> expansion item</primary>
14722 </indexterm>
14723 If the string contains any non-printing characters, they are converted to
14724 escape sequences starting with a backslash. Whether characters with the most
14725 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14726 is controlled by the <option>print_topbitchars</option> option.
14727 </para>
14728 </listitem></varlistentry>
14729 <varlistentry>
14730 <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>
14731 <listitem>
14732 <para>
14733 <indexterm role="concept">
14734 <primary>expansion</primary>
14735 <secondary>expression evaluation</secondary>
14736 </indexterm>
14737 <indexterm role="concept">
14738 <primary>expansion</primary>
14739 <secondary>arithmetic expression</secondary>
14740 </indexterm>
14741 <indexterm role="concept">
14742 <primary><option>eval</option> expansion item</primary>
14743 </indexterm>
14744 These items supports simple arithmetic and bitwise logical operations in
14745 expansion strings. The string (after expansion) must be a conventional
14746 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14747 logical operators, and parentheses. All operations are carried out using
14748 integer arithmetic. The operator priorities are as follows (the same as in the
14749 C programming language):
14750 </para>
14751 <informaltable frame="none">
14752 <tgroup cols="2" colsep="0" rowsep="0">
14753 <colspec colwidth="70pt" align="left"/>
14754 <colspec colwidth="300pt" align="left"/>
14755 <tbody>
14756 <row>
14757 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14758 <entry>not (~), negate (-)</entry>
14759 </row>
14760 <row>
14761 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14762 <entry>multiply (*), divide (/), remainder (%)</entry>
14763 </row>
14764 <row>
14765 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14766 <entry>plus (+), minus (-)</entry>
14767 </row>
14768 <row>
14769 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14770 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14771 </row>
14772 <row>
14773 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14774 <entry>and (&amp;)</entry>
14775 </row>
14776 <row>
14777 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14778 <entry>xor (^)</entry>
14779 </row>
14780 <row>
14781 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14782 <entry>or (|)</entry>
14783 </row>
14784 </tbody>
14785 </tgroup>
14786 </informaltable>
14787 <para>
14788 Binary operators with the same priority are evaluated from left to right. White
14789 space is permitted before or after operators.
14790 </para>
14791 <para>
14792 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14793 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14794 decimal, even if they start with a leading zero; hexadecimal numbers are not
14795 permitted. This can be useful when processing numbers extracted from dates or
14796 times, which often do have leading zeros.
14797 </para>
14798 <para>
14799 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14800 or 1024*1024*1024,
14801 respectively. Negative numbers are supported. The result of the computation is
14802 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14803 </para>
14804 <literallayout>
14805 <literal>${eval:1+1}            </literal>  yields 2
14806 <literal>${eval:1+2*3}          </literal>  yields 7
14807 <literal>${eval:(1+2)*3}        </literal>  yields 9
14808 <literal>${eval:2+42%5}         </literal>  yields 4
14809 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14810 <literal>${eval:0xc|5}          </literal>  yields 13
14811 <literal>${eval:0xc^5}          </literal>  yields 9
14812 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14813 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14814 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14815 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14816 </literallayout>
14817 <para>
14818 As a more realistic example, in an ACL you might have
14819 </para>
14820 <literallayout class="monospaced">
14821 deny   message = Too many bad recipients
14822        condition =                    \
14823          ${if and {                   \
14824            {&gt;{$rcpt_count}{10}}       \
14825            {                          \
14826            &lt;                          \
14827              {$recipients_count}      \
14828              {${eval:$rcpt_count/2}}  \
14829            }                          \
14830          }{yes}{no}}
14831 </literallayout>
14832 <para>
14833 The condition is true if there have been more than 10 RCPT commands and
14834 fewer than half of them have resulted in a valid recipient.
14835 </para>
14836 </listitem></varlistentry>
14837 <varlistentry>
14838 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14839 <listitem>
14840 <para>
14841 <indexterm role="concept">
14842 <primary>expansion</primary>
14843 <secondary>re-expansion of substring</secondary>
14844 </indexterm>
14845 The <option>expand</option> operator causes a string to be expanded for a second time. For
14846 example,
14847 </para>
14848 <literallayout class="monospaced">
14849 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14850 </literallayout>
14851 <para>
14852 first looks up a string in a file while expanding the operand for <option>expand</option>,
14853 and then re-expands what it has found.
14854 </para>
14855 </listitem></varlistentry>
14856 <varlistentry>
14857 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14858 <listitem>
14859 <para>
14860 <indexterm role="concept">
14861 <primary>Unicode</primary>
14862 </indexterm>
14863 <indexterm role="concept">
14864 <primary>UTF-8</primary>
14865 <secondary>conversion from</secondary>
14866 </indexterm>
14867 <indexterm role="concept">
14868 <primary>expansion</primary>
14869 <secondary>UTF-8 conversion</secondary>
14870 </indexterm>
14871 <indexterm role="concept">
14872 <primary><option>from_utf8</option> expansion item</primary>
14873 </indexterm>
14874 The world is slowly moving towards Unicode, although there are no standards for
14875 email yet. However, other applications (including some databases) are starting
14876 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14877 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14878 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14879 the result is an undefined sequence of bytes.
14880 </para>
14881 <para>
14882 Unicode code points with values less than 256 are compatible with ASCII and
14883 ISO-8859-1 (also known as Latin-1).
14884 For example, character 169 is the copyright symbol in both cases, though the
14885 way it is encoded is different. In UTF-8, more than one byte is needed for
14886 characters with code values greater than 127, whereas ISO-8859-1 is a
14887 single-byte encoding (but thereby limited to 256 characters). This makes
14888 translation from UTF-8 to ISO-8859-1 straightforward.
14889 </para>
14890 </listitem></varlistentry>
14891 <varlistentry>
14892 <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>
14893 <listitem>
14894 <para>
14895 <indexterm role="concept">
14896 <primary>hash function</primary>
14897 <secondary>textual</secondary>
14898 </indexterm>
14899 <indexterm role="concept">
14900 <primary>expansion</primary>
14901 <secondary>textual hash</secondary>
14902 </indexterm>
14903 The <option>hash</option> operator is a simpler interface to the hashing function that can
14904 be used when the two parameters are fixed numbers (as opposed to strings that
14905 change when expanded). The effect is the same as
14906 </para>
14907 <literallayout class="monospaced">
14908 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14909 </literallayout>
14910 <para>
14911 See the description of the general <option>hash</option> item above for details. The
14912 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14913 </para>
14914 </listitem></varlistentry>
14915 <varlistentry>
14916 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14917 <listitem>
14918 <para>
14919 <indexterm role="concept">
14920 <primary>base64 encoding</primary>
14921 <secondary>conversion from hex</secondary>
14922 </indexterm>
14923 <indexterm role="concept">
14924 <primary>expansion</primary>
14925 <secondary>hex to base64</secondary>
14926 </indexterm>
14927 <indexterm role="concept">
14928 <primary><option>hex2b64</option> expansion item</primary>
14929 </indexterm>
14930 This operator converts a hex string into one that is base64 encoded. This can
14931 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14932 </para>
14933 </listitem></varlistentry>
14934 <varlistentry>
14935 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14936 <listitem>
14937 <para>
14938 <indexterm role="concept">
14939 <primary>quoting</primary>
14940 <secondary>hex-encoded unprintable characters</secondary>
14941 </indexterm>
14942 <indexterm role="concept">
14943 <primary><option>hexquote</option> expansion item</primary>
14944 </indexterm>
14945 This operator converts non-printable characters in a string into a hex
14946 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
14947 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
14948 byte value 127 is converted to <literal>\x7f</literal>.
14949 </para>
14950 </listitem></varlistentry>
14951 <varlistentry>
14952 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14953 <listitem>
14954 <para>
14955 <indexterm role="concept">
14956 <primary>case forcing in strings</primary>
14957 </indexterm>
14958 <indexterm role="concept">
14959 <primary>string</primary>
14960 <secondary>case forcing</secondary>
14961 </indexterm>
14962 <indexterm role="concept">
14963 <primary>lower casing</primary>
14964 </indexterm>
14965 <indexterm role="concept">
14966 <primary>expansion</primary>
14967 <secondary>case forcing</secondary>
14968 </indexterm>
14969 <indexterm role="concept">
14970 <primary><option>lc</option> expansion item</primary>
14971 </indexterm>
14972 This forces the letters in the string into lower-case, for example:
14973 </para>
14974 <literallayout class="monospaced">
14975 ${lc:$local_part}
14976 </literallayout>
14977 </listitem></varlistentry>
14978 <varlistentry>
14979 <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>
14980 <listitem>
14981 <para>
14982 <indexterm role="concept">
14983 <primary>expansion</primary>
14984 <secondary>string truncation</secondary>
14985 </indexterm>
14986 <indexterm role="concept">
14987 <primary><option>length</option> expansion item</primary>
14988 </indexterm>
14989 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14990 can be used when the parameter is a fixed number (as opposed to a string that
14991 changes when expanded). The effect is the same as
14992 </para>
14993 <literallayout class="monospaced">
14994 ${length{&lt;number&gt;}{&lt;string&gt;}}
14995 </literallayout>
14996 <para>
14997 See the description of the general <option>length</option> item above for details. Note that
14998 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14999 when <option>length</option> is used as an operator.
15000 </para>
15001 </listitem></varlistentry>
15002 <varlistentry>
15003 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15004 <listitem>
15005 <para>
15006 <indexterm role="concept">
15007 <primary>expansion</primary>
15008 <secondary>list item count</secondary>
15009 </indexterm>
15010 <indexterm role="concept">
15011 <primary>list</primary>
15012 <secondary>item count</secondary>
15013 </indexterm>
15014 <indexterm role="concept">
15015 <primary>list</primary>
15016 <secondary>count of items</secondary>
15017 </indexterm>
15018 <indexterm role="concept">
15019 <primary><option>listcount</option> expansion item</primary>
15020 </indexterm>
15021 The string is interpreted as a list and the number of items is returned.
15022 </para>
15023 </listitem></varlistentry>
15024 <varlistentry>
15025 <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>
15026 <listitem>
15027 <para>
15028 <indexterm role="concept">
15029 <primary>expansion</primary>
15030 <secondary>named list</secondary>
15031 </indexterm>
15032 <indexterm role="concept">
15033 <primary><option>listnamed</option> expansion item</primary>
15034 </indexterm>
15035 The name is interpreted as a named list and the content of the list is returned,
15036 expanding any referenced lists, re-quoting as needed for colon-separation.
15037 If the optional type is given it must be one of "a", "d", "h" or "l"
15038 and selects address-, domain-, host- or localpart- lists to search among respectively.
15039 Otherwise all types are searched in an undefined order and the first
15040 matching list is returned.
15041 </para>
15042 </listitem></varlistentry>
15043 <varlistentry>
15044 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15045 <listitem>
15046 <para>
15047 <indexterm role="concept">
15048 <primary>expansion</primary>
15049 <secondary>local part extraction</secondary>
15050 </indexterm>
15051 <indexterm role="concept">
15052 <primary><option>local_part</option> expansion item</primary>
15053 </indexterm>
15054 The string is interpreted as an RFC 2822 address and the local part is
15055 extracted from it. If the string does not parse successfully, the result is
15056 empty.
15057 </para>
15058 </listitem></varlistentry>
15059 <varlistentry>
15060 <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>
15061 <listitem>
15062 <para>
15063 <indexterm role="concept">
15064 <primary>masked IP address</primary>
15065 </indexterm>
15066 <indexterm role="concept">
15067 <primary>IP address</primary>
15068 <secondary>masking</secondary>
15069 </indexterm>
15070 <indexterm role="concept">
15071 <primary>CIDR notation</primary>
15072 </indexterm>
15073 <indexterm role="concept">
15074 <primary>expansion</primary>
15075 <secondary>IP address masking</secondary>
15076 </indexterm>
15077 <indexterm role="concept">
15078 <primary><option>mask</option> expansion item</primary>
15079 </indexterm>
15080 If the form of the string to be operated on is not an IP address followed by a
15081 slash and an integer (that is, a network address in CIDR notation), the
15082 expansion fails. Otherwise, this operator converts the IP address to binary,
15083 masks off the least significant bits according to the bit count, and converts
15084 the result back to text, with mask appended. For example,
15085 </para>
15086 <literallayout class="monospaced">
15087 ${mask:10.111.131.206/28}
15088 </literallayout>
15089 <para>
15090 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15091 be mostly used for looking up masked addresses in files, the result for an IPv6
15092 address uses dots to separate components instead of colons, because colon
15093 terminates a key string in lsearch files. So, for example,
15094 </para>
15095 <literallayout class="monospaced">
15096 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15097 </literallayout>
15098 <para>
15099 returns the string
15100 </para>
15101 <literallayout class="monospaced">
15102 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15103 </literallayout>
15104 <para>
15105 Letters in IPv6 addresses are always output in lower case.
15106 </para>
15107 </listitem></varlistentry>
15108 <varlistentry>
15109 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15110 <listitem>
15111 <para>
15112 <indexterm role="concept">
15113 <primary>MD5 hash</primary>
15114 </indexterm>
15115 <indexterm role="concept">
15116 <primary>expansion</primary>
15117 <secondary>MD5 hash</secondary>
15118 </indexterm>
15119 <indexterm role="concept">
15120 <primary>certificate fingerprint</primary>
15121 </indexterm>
15122 <indexterm role="concept">
15123 <primary><option>md5</option> expansion item</primary>
15124 </indexterm>
15125 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15126 as a 32-digit hexadecimal number, in which any letters are in lower case.
15127 </para>
15128 </listitem></varlistentry>
15129 <varlistentry>
15130 <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>
15131 <listitem>
15132 <para>
15133 <indexterm role="concept">
15134 <primary>expansion</primary>
15135 <secondary>numeric hash</secondary>
15136 </indexterm>
15137 <indexterm role="concept">
15138 <primary>hash function</primary>
15139 <secondary>numeric</secondary>
15140 </indexterm>
15141 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15142 that can be used when the two parameters are fixed numbers (as opposed to
15143 strings that change when expanded). The effect is the same as
15144 </para>
15145 <literallayout class="monospaced">
15146 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15147 </literallayout>
15148 <para>
15149 See the description of the general <option>nhash</option> item above for details.
15150 </para>
15151 </listitem></varlistentry>
15152 <varlistentry>
15153 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15154 <listitem>
15155 <para>
15156 <indexterm role="concept">
15157 <primary>quoting</primary>
15158 <secondary>in string expansions</secondary>
15159 </indexterm>
15160 <indexterm role="concept">
15161 <primary>expansion</primary>
15162 <secondary>quoting</secondary>
15163 </indexterm>
15164 <indexterm role="concept">
15165 <primary><option>quote</option> expansion item</primary>
15166 </indexterm>
15167 The <option>quote</option> operator puts its argument into double quotes if it
15168 is an empty string or
15169 contains anything other than letters, digits, underscores, dots, and hyphens.
15170 Any occurrences of double quotes and backslashes are escaped with a backslash.
15171 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15172 respectively For example,
15173 </para>
15174 <literallayout class="monospaced">
15175 ${quote:ab"*"cd}
15176 </literallayout>
15177 <para>
15178 becomes
15179 </para>
15180 <literallayout class="monospaced">
15181 "ab\"*\"cd"
15182 </literallayout>
15183 <para>
15184 The place where this is useful is when the argument is a substitution from a
15185 variable or a message header.
15186 </para>
15187 </listitem></varlistentry>
15188 <varlistentry>
15189 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15190 <listitem>
15191 <para>
15192 <indexterm role="concept">
15193 <primary><option>quote_local_part</option> expansion item</primary>
15194 </indexterm>
15195 This operator is like <option>quote</option>, except that it quotes the string only if
15196 required to do so by the rules of RFC 2822 for quoting local parts. For
15197 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15198 If you are creating a new email address from the contents of <varname>$local_part</varname>
15199 (or any other unknown data), you should always use this operator.
15200 </para>
15201 </listitem></varlistentry>
15202 <varlistentry>
15203 <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>
15204 <listitem>
15205 <para>
15206 <indexterm role="concept">
15207 <primary>quoting</primary>
15208 <secondary>lookup-specific</secondary>
15209 </indexterm>
15210 This operator applies lookup-specific quoting rules to the string. Each
15211 query-style lookup type has its own quoting rules which are described with
15212 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15213 </para>
15214 <literallayout class="monospaced">
15215 ${quote_ldap:two * two}
15216 </literallayout>
15217 <para>
15218 returns
15219 </para>
15220 <literallayout class="monospaced">
15221 two%20%5C2A%20two
15222 </literallayout>
15223 <para>
15224 For single-key lookup types, no quoting is ever necessary and this operator
15225 yields an unchanged string.
15226 </para>
15227 </listitem></varlistentry>
15228 <varlistentry>
15229 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15230 <listitem>
15231 <para>
15232 <indexterm role="concept">
15233 <primary>random number</primary>
15234 </indexterm>
15235 This operator returns a somewhat random number which is less than the
15236 supplied number and is at least 0.  The quality of this randomness depends
15237 on how Exim was built; the values are not suitable for keying material.
15238 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15239 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15240 for versions of GnuTLS with that function.
15241 Otherwise, the implementation may be arc4random(), random() seeded by
15242 srandomdev() or srandom(), or a custom implementation even weaker than
15243 random().
15244 </para>
15245 </listitem></varlistentry>
15246 <varlistentry>
15247 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15248 <listitem>
15249 <para>
15250 <indexterm role="concept">
15251 <primary>expansion</primary>
15252 <secondary>IP address</secondary>
15253 </indexterm>
15254 This operator reverses an IP address; for IPv4 addresses, the result is in
15255 dotted-quad decimal form, while for IPv6 addreses the result is in
15256 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15257 for DNS.  For example,
15258 </para>
15259 <literallayout class="monospaced">
15260 ${reverse_ip:192.0.2.4}
15261 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15262 </literallayout>
15263 <para>
15264 returns
15265 </para>
15266 <literallayout class="monospaced">
15267 4.2.0.192
15268 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
15269 </literallayout>
15270 </listitem></varlistentry>
15271 <varlistentry>
15272 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15273 <listitem>
15274 <para>
15275 <indexterm role="concept">
15276 <primary>expansion</primary>
15277 <secondary>RFC 2047</secondary>
15278 </indexterm>
15279 <indexterm role="concept">
15280 <primary>RFC 2047</primary>
15281 <secondary>expansion operator</secondary>
15282 </indexterm>
15283 <indexterm role="concept">
15284 <primary><option>rfc2047</option> expansion item</primary>
15285 </indexterm>
15286 This operator encodes text according to the rules of RFC 2047. This is an
15287 encoding that is used in header lines to encode non-ASCII characters. It is
15288 assumed that the input string is in the encoding specified by the
15289 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15290 contains only characters in the range 33&ndash;126, and no instances of the
15291 characters
15292 </para>
15293 <literallayout class="monospaced">
15294 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15295 </literallayout>
15296 <para>
15297 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15298 string, using as many <quote>encoded words</quote> as necessary to encode all the
15299 characters.
15300 </para>
15301 </listitem></varlistentry>
15302 <varlistentry>
15303 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15304 <listitem>
15305 <para>
15306 <indexterm role="concept">
15307 <primary>expansion</primary>
15308 <secondary>RFC 2047</secondary>
15309 </indexterm>
15310 <indexterm role="concept">
15311 <primary>RFC 2047</primary>
15312 <secondary>decoding</secondary>
15313 </indexterm>
15314 <indexterm role="concept">
15315 <primary><option>rfc2047d</option> expansion item</primary>
15316 </indexterm>
15317 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15318 bytes are replaced by question marks. Characters are converted into the
15319 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15320 not recognized unless <option>check_rfc2047_length</option> is set false.
15321 </para>
15322 <para>
15323 <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
15324 access a header line, RFC 2047 decoding is done automatically. You do not need
15325 to use this operator as well.
15326 </para>
15327 </listitem></varlistentry>
15328 <varlistentry>
15329 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15330 <listitem>
15331 <para>
15332 <indexterm role="concept">
15333 <primary>quoting</primary>
15334 <secondary>in regular expressions</secondary>
15335 </indexterm>
15336 <indexterm role="concept">
15337 <primary>regular expressions</primary>
15338 <secondary>quoting</secondary>
15339 </indexterm>
15340 <indexterm role="concept">
15341 <primary><option>rxquote</option> expansion item</primary>
15342 </indexterm>
15343 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15344 characters in its argument. This is useful when substituting the values of
15345 variables or headers inside regular expressions.
15346 </para>
15347 </listitem></varlistentry>
15348 <varlistentry>
15349 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15350 <listitem>
15351 <para>
15352 <indexterm role="concept">
15353 <primary>SHA-1 hash</primary>
15354 </indexterm>
15355 <indexterm role="concept">
15356 <primary>expansion</primary>
15357 <secondary>SHA-1 hashing</secondary>
15358 </indexterm>
15359 <indexterm role="concept">
15360 <primary>certificate fingerprint</primary>
15361 </indexterm>
15362 <indexterm role="concept">
15363 <primary><option>sha2</option> expansion item</primary>
15364 </indexterm>
15365 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15366 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15367 </para>
15368 </listitem></varlistentry>
15369 <varlistentry>
15370 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15371 <listitem>
15372 <para>
15373 <indexterm role="concept">
15374 <primary>SHA-256 hash</primary>
15375 </indexterm>
15376 <indexterm role="concept">
15377 <primary>certificate fingerprint</primary>
15378 </indexterm>
15379 <indexterm role="concept">
15380 <primary>expansion</primary>
15381 <secondary>SHA-256 hashing</secondary>
15382 </indexterm>
15383 <indexterm role="concept">
15384 <primary><option>sha256</option> expansion item</primary>
15385 </indexterm>
15386 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15387 certificate,
15388 and returns
15389 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15390 Only arguments which are a single variable of certificate type are supported.
15391 </para>
15392 </listitem></varlistentry>
15393 <varlistentry>
15394 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15395 <listitem>
15396 <para>
15397 <indexterm role="concept">
15398 <primary>expansion</primary>
15399 <secondary>statting a file</secondary>
15400 </indexterm>
15401 <indexterm role="concept">
15402 <primary>file</primary>
15403 <secondary>extracting characteristics</secondary>
15404 </indexterm>
15405 <indexterm role="concept">
15406 <primary><option>stat</option> expansion item</primary>
15407 </indexterm>
15408 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15409 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15410 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15411 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15412 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15413 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15414 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15415 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15416 can extract individual fields using the <option>extract</option> expansion item.
15417 </para>
15418 <para>
15419 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15420 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15421 systems for files larger than 2GB.
15422 </para>
15423 </listitem></varlistentry>
15424 <varlistentry>
15425 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15426 <listitem>
15427 <para>
15428 <indexterm role="concept">
15429 <primary>expansion</primary>
15430 <secondary>base64 encoding</secondary>
15431 </indexterm>
15432 <indexterm role="concept">
15433 <primary>base64 encoding</primary>
15434 <secondary>in string expansion</secondary>
15435 </indexterm>
15436 <indexterm role="concept">
15437 <primary><option>str2b64</option> expansion item</primary>
15438 </indexterm>
15439 This operator converts a string into one that is base64 encoded.
15440 </para>
15441 </listitem></varlistentry>
15442 <varlistentry>
15443 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15444 <listitem>
15445 <para>
15446 <indexterm role="concept">
15447 <primary>expansion</primary>
15448 <secondary>string length</secondary>
15449 </indexterm>
15450 <indexterm role="concept">
15451 <primary>string</primary>
15452 <secondary>length in expansion</secondary>
15453 </indexterm>
15454 <indexterm role="concept">
15455 <primary><option>strlen</option> expansion item</primary>
15456 </indexterm>
15457 The item is replace by the length of the expanded string, expressed as a
15458 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15459 </para>
15460 </listitem></varlistentry>
15461 <varlistentry>
15462 <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>
15463 <listitem>
15464 <para>
15465 <indexterm role="concept">
15466 <primary><option>substr</option> expansion item</primary>
15467 </indexterm>
15468 <indexterm role="concept">
15469 <primary>substring extraction</primary>
15470 </indexterm>
15471 <indexterm role="concept">
15472 <primary>expansion</primary>
15473 <secondary>substring expansion</secondary>
15474 </indexterm>
15475 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15476 can be used when the two parameters are fixed numbers (as opposed to strings
15477 that change when expanded). The effect is the same as
15478 </para>
15479 <literallayout class="monospaced">
15480 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15481 </literallayout>
15482 <para>
15483 See the description of the general <option>substr</option> item above for details. The
15484 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15485 </para>
15486 </listitem></varlistentry>
15487 <varlistentry>
15488 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15489 <listitem>
15490 <para>
15491 <indexterm role="concept">
15492 <primary><option>time_eval</option> expansion item</primary>
15493 </indexterm>
15494 <indexterm role="concept">
15495 <primary>time interval</primary>
15496 <secondary>decoding</secondary>
15497 </indexterm>
15498 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15499 seconds.
15500 </para>
15501 </listitem></varlistentry>
15502 <varlistentry>
15503 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15504 <listitem>
15505 <para>
15506 <indexterm role="concept">
15507 <primary><option>time_interval</option> expansion item</primary>
15508 </indexterm>
15509 <indexterm role="concept">
15510 <primary>time interval</primary>
15511 <secondary>formatting</secondary>
15512 </indexterm>
15513 The argument (after sub-expansion) must be a sequence of decimal digits that
15514 represents an interval of time as a number of seconds. It is converted into a
15515 number of larger units and output in Exim&#x2019;s normal time format, for example,
15516 <literal>1w3d4h2m6s</literal>.
15517 </para>
15518 </listitem></varlistentry>
15519 <varlistentry>
15520 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15521 <listitem>
15522 <para>
15523 <indexterm role="concept">
15524 <primary>case forcing in strings</primary>
15525 </indexterm>
15526 <indexterm role="concept">
15527 <primary>string</primary>
15528 <secondary>case forcing</secondary>
15529 </indexterm>
15530 <indexterm role="concept">
15531 <primary>upper casing</primary>
15532 </indexterm>
15533 <indexterm role="concept">
15534 <primary>expansion</primary>
15535 <secondary>case forcing</secondary>
15536 </indexterm>
15537 <indexterm role="concept">
15538 <primary><option>uc</option> expansion item</primary>
15539 </indexterm>
15540 This forces the letters in the string into upper-case.
15541 </para>
15542 </listitem></varlistentry>
15543 <varlistentry>
15544 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15545 <listitem>
15546 <para>
15547 <indexterm role="concept">
15548 <primary>correction of invalid utf-8 sequences in strings</primary>
15549 </indexterm>
15550 <indexterm role="concept">
15551 <primary>utf-8</primary>
15552 <secondary>utf-8 sequences</secondary>
15553 </indexterm>
15554 <indexterm role="concept">
15555 <primary>incorrect utf-8</primary>
15556 </indexterm>
15557 <indexterm role="concept">
15558 <primary>expansion</primary>
15559 <secondary>utf-8 forcing</secondary>
15560 </indexterm>
15561 <indexterm role="concept">
15562 <primary><option>utf8clean</option> expansion item</primary>
15563 </indexterm>
15564 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
15565 </para>
15566 </listitem></varlistentry>
15567 </variablelist>
15568 </section>
15569 <section id="SECTexpcond">
15570 <title>Expansion conditions</title>
15571 <para>
15572 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15573 <primary>expansion</primary>
15574 <secondary>conditions</secondary>
15575 </indexterm>
15576 The following conditions are available for testing by the <option>${if</option> construct
15577 while expanding strings:
15578 </para>
15579 <variablelist>
15580 <varlistentry>
15581 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15582 <listitem>
15583 <para>
15584 <indexterm role="concept">
15585 <primary>expansion</primary>
15586 <secondary>negating a condition</secondary>
15587 </indexterm>
15588 <indexterm role="concept">
15589 <primary>negation</primary>
15590 <secondary>in expansion condition</secondary>
15591 </indexterm>
15592 Preceding any condition with an exclamation mark negates the result of the
15593 condition.
15594 </para>
15595 </listitem></varlistentry>
15596 <varlistentry>
15597 <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>
15598 <listitem>
15599 <para>
15600 <indexterm role="concept">
15601 <primary>numeric comparison</primary>
15602 </indexterm>
15603 <indexterm role="concept">
15604 <primary>expansion</primary>
15605 <secondary>numeric comparison</secondary>
15606 </indexterm>
15607 There are a number of symbolic operators for doing numeric comparisons. They
15608 are:
15609 </para>
15610 <literallayout>
15611 <literal>=   </literal>   equal
15612 <literal>==  </literal>   equal
15613 <literal>&gt;   </literal>   greater
15614 <literal>&gt;=  </literal>   greater or equal
15615 <literal>&lt;   </literal>   less
15616 <literal>&lt;=  </literal>   less or equal
15617 </literallayout>
15618 <para>
15619 For example:
15620 </para>
15621 <literallayout class="monospaced">
15622 ${if &gt;{$message_size}{10M} ...
15623 </literallayout>
15624 <para>
15625 Note that the general negation operator provides for inequality testing. The
15626 two strings must take the form of optionally signed decimal integers,
15627 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15628 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15629 As a special case, the numerical value of an empty string is taken as
15630 zero.
15631 </para>
15632 <para>
15633 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15634 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15635 10M, not if 10M is larger than <varname>$message_size</varname>.
15636 </para>
15637 </listitem></varlistentry>
15638 <varlistentry>
15639 <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>
15640 <listitem>
15641 <para>
15642 <indexterm role="concept">
15643 <primary>expansion</primary>
15644 <secondary>calling an acl</secondary>
15645 </indexterm>
15646 <indexterm role="concept">
15647 <primary><option>acl</option></primary>
15648 <secondary>expansion condition</secondary>
15649 </indexterm>
15650 The name and zero to nine argument strings are first expanded separately.  The expanded
15651 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15652 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15653 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15654 and may use the variables; if another acl expansion is used the values
15655 are restored after it returns.  If the ACL sets
15656 a value using a "message =" modifier the variable $value becomes
15657 the result of the expansion, otherwise it is empty.
15658 If the ACL returns accept the condition is true; if deny, false.
15659 If the ACL returns defer the result is a forced-fail.
15660 </para>
15661 </listitem></varlistentry>
15662 <varlistentry>
15663 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15664 <listitem>
15665 <para>
15666 <indexterm role="concept">
15667 <primary>expansion</primary>
15668 <secondary>boolean parsing</secondary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary><option>bool</option> expansion condition</primary>
15672 </indexterm>
15673 This condition turns a string holding a true or false representation into
15674 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15675 (case-insensitively); also integer numbers map to true if non-zero,
15676 false if zero.
15677 An empty string is treated as false.
15678 Leading and trailing whitespace is ignored;
15679 thus a string consisting only of whitespace is false.
15680 All other string values will result in expansion failure.
15681 </para>
15682 <para>
15683 When combined with ACL variables, this expansion condition will let you
15684 make decisions in one place and act on those decisions in another place.
15685 For example:
15686 </para>
15687 <literallayout class="monospaced">
15688 ${if bool{$acl_m_privileged_sender} ...
15689 </literallayout>
15690 </listitem></varlistentry>
15691 <varlistentry>
15692 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15693 <listitem>
15694 <para>
15695 <indexterm role="concept">
15696 <primary>expansion</primary>
15697 <secondary>boolean parsing</secondary>
15698 </indexterm>
15699 <indexterm role="concept">
15700 <primary><option>bool_lax</option> expansion condition</primary>
15701 </indexterm>
15702 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15703 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15704 loose definition that the Router <option>condition</option> option uses.  The empty string
15705 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15706 true.  Leading and trailing whitespace is ignored.
15707 </para>
15708 <para>
15709 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15710 </para>
15711 </listitem></varlistentry>
15712 <varlistentry>
15713 <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>
15714 <listitem>
15715 <para>
15716 <indexterm role="concept">
15717 <primary>expansion</primary>
15718 <secondary>encrypted comparison</secondary>
15719 </indexterm>
15720 <indexterm role="concept">
15721 <primary>encrypted strings, comparing</primary>
15722 </indexterm>
15723 <indexterm role="concept">
15724 <primary><option>crypteq</option> expansion condition</primary>
15725 </indexterm>
15726 This condition is included in the Exim binary if it is built to support any
15727 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15728 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15729 included in the binary.
15730 </para>
15731 <para>
15732 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15733 compared against the second, which is already encrypted. The second string may
15734 be in the LDAP form for storing encrypted strings, which starts with the
15735 encryption type in curly brackets, followed by the data. If the second string
15736 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15737 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15738 Typically this will be a field from a password file. An example of an encrypted
15739 string in LDAP form is:
15740 </para>
15741 <literallayout class="monospaced">
15742 {md5}CY9rzUYh03PK3k6DJie09g==
15743 </literallayout>
15744 <para>
15745 If such a string appears directly in an expansion, the curly brackets have to
15746 be quoted, because they are part of the expansion syntax. For example:
15747 </para>
15748 <literallayout class="monospaced">
15749 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15750 </literallayout>
15751 <para>
15752 The following encryption types (whose names are matched case-independently) are
15753 supported:
15754 </para>
15755 <itemizedlist>
15756 <listitem>
15757 <para>
15758 <indexterm role="concept">
15759 <primary>MD5 hash</primary>
15760 </indexterm>
15761 <indexterm role="concept">
15762 <primary>base64 encoding</primary>
15763 <secondary>in encrypted password</secondary>
15764 </indexterm>
15765 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15766 printable characters to compare with the remainder of the second string. If the
15767 length of the comparison string is 24, Exim assumes that it is base64 encoded
15768 (as in the above example). If the length is 32, Exim assumes that it is a
15769 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15770 comparison fails.
15771 </para>
15772 </listitem>
15773 <listitem>
15774 <para>
15775 <indexterm role="concept">
15776 <primary>SHA-1 hash</primary>
15777 </indexterm>
15778 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15779 printable characters to compare with the remainder of the second string. If the
15780 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15781 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15782 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15783 </para>
15784 </listitem>
15785 <listitem>
15786 <para>
15787 <indexterm role="concept">
15788 <primary><function>crypt()</function></primary>
15789 </indexterm>
15790 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15791 only the first eight characters of the password. However, in modern operating
15792 systems this is no longer true, and in many cases the entire password is used,
15793 whatever its length.
15794 </para>
15795 </listitem>
15796 <listitem>
15797 <para>
15798 <indexterm role="concept">
15799 <primary><function>crypt16()</function></primary>
15800 </indexterm>
15801 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15802 use up to 16 characters of the password in some operating systems. Again, in
15803 modern operating systems, more characters may be used.
15804 </para>
15805 </listitem>
15806 </itemizedlist>
15807 <para>
15808 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15809 <function>crypt()</function>. For operating systems that have their own version, setting
15810 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15811 operating system version instead of its own. This option is set by default in
15812 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15813 support <function>crypt16()</function>.
15814 </para>
15815 <para>
15816 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15817 it was not using the same algorithm as some operating systems&#x2019; versions. It
15818 turns out that as well as <function>crypt16()</function> there is a function called
15819 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15820 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15821 </para>
15822 <para>
15823 However, since there is now a move away from the traditional <function>crypt()</function>
15824 functions towards using SHA1 and other algorithms, tidying up this area of
15825 Exim is seen as very low priority.
15826 </para>
15827 <para>
15828 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15829 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15830 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15831 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15832 function by specifying it explicitly in curly brackets.
15833 </para>
15834 </listitem></varlistentry>
15835 <varlistentry>
15836 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15837 <listitem>
15838 <para>
15839 <indexterm role="concept">
15840 <primary>expansion</primary>
15841 <secondary>checking for empty variable</secondary>
15842 </indexterm>
15843 <indexterm role="concept">
15844 <primary><option>def</option> expansion condition</primary>
15845 </indexterm>
15846 The <option>def</option> condition must be followed by the name of one of the expansion
15847 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15848 variable does not contain the empty string. For example:
15849 </para>
15850 <literallayout class="monospaced">
15851 ${if def:sender_ident {from $sender_ident}}
15852 </literallayout>
15853 <para>
15854 Note that the variable name is given without a leading <option>$</option> character. If the
15855 variable does not exist, the expansion fails.
15856 </para>
15857 </listitem></varlistentry>
15858 <varlistentry>
15859 <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>
15860 <listitem>
15861 <para>
15862 <indexterm role="concept">
15863 <primary>expansion</primary>
15864 <secondary>checking header line existence</secondary>
15865 </indexterm>
15866 This condition is true if a message is being processed and the named header
15867 exists in the message. For example,
15868 </para>
15869 <literallayout class="monospaced">
15870 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15871 </literallayout>
15872 <para>
15873 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15874 the header name must be terminated by a colon if white space does not follow.
15875 </para>
15876 </listitem></varlistentry>
15877 <varlistentry>
15878 <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>
15879 <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>
15880 <listitem>
15881 <para>
15882 <indexterm role="concept">
15883 <primary>string</primary>
15884 <secondary>comparison</secondary>
15885 </indexterm>
15886 <indexterm role="concept">
15887 <primary>expansion</primary>
15888 <secondary>string comparison</secondary>
15889 </indexterm>
15890 <indexterm role="concept">
15891 <primary><option>eq</option> expansion condition</primary>
15892 </indexterm>
15893 <indexterm role="concept">
15894 <primary><option>eqi</option> expansion condition</primary>
15895 </indexterm>
15896 The two substrings are first expanded. The condition is true if the two
15897 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15898 letters, whereas for <option>eqi</option> the comparison is case-independent.
15899 </para>
15900 </listitem></varlistentry>
15901 <varlistentry>
15902 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15903 <listitem>
15904 <para>
15905 <indexterm role="concept">
15906 <primary>expansion</primary>
15907 <secondary>file existence test</secondary>
15908 </indexterm>
15909 <indexterm role="concept">
15910 <primary>file</primary>
15911 <secondary>existence test</secondary>
15912 </indexterm>
15913 <indexterm role="concept">
15914 <primary><option>exists</option>, expansion condition</primary>
15915 </indexterm>
15916 The substring is first expanded and then interpreted as an absolute path. The
15917 condition is true if the named file (or directory) exists. The existence test
15918 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15919 users&#x2019; filter files may be locked out by the system administrator.
15920 </para>
15921 </listitem></varlistentry>
15922 <varlistentry>
15923 <term><emphasis role="bold">first_delivery</emphasis></term>
15924 <listitem>
15925 <para>
15926 <indexterm role="concept">
15927 <primary>delivery</primary>
15928 <secondary>first</secondary>
15929 </indexterm>
15930 <indexterm role="concept">
15931 <primary>first delivery</primary>
15932 </indexterm>
15933 <indexterm role="concept">
15934 <primary>expansion</primary>
15935 <secondary>first delivery test</secondary>
15936 </indexterm>
15937 <indexterm role="concept">
15938 <primary><option>first_delivery</option> expansion condition</primary>
15939 </indexterm>
15940 This condition, which has no data, is true during a message&#x2019;s first delivery
15941 attempt. It is false during any subsequent delivery attempts.
15942 </para>
15943 </listitem></varlistentry>
15944 <varlistentry>
15945 <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>
15946 <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>
15947 <listitem>
15948 <para>
15949 <indexterm role="concept">
15950 <primary>list</primary>
15951 <secondary>iterative conditions</secondary>
15952 </indexterm>
15953 <indexterm role="concept">
15954 <primary>expansion</primary>
15955 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15956 </indexterm>
15957 <indexterm role="concept">
15958 <primary>expansion</primary>
15959 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15960 </indexterm>
15961 <indexterm role="variable">
15962 <primary><varname>$item</varname></primary>
15963 </indexterm>
15964 These conditions iterate over a list. The first argument is expanded to form
15965 the list. By default, the list separator is a colon, but it can be changed by
15966 the normal method. The second argument is interpreted as a condition that is to
15967 be applied to each item in the list in turn. During the interpretation of the
15968 condition, the current list item is placed in a variable called <varname>$item</varname>.
15969 </para>
15970 <itemizedlist>
15971 <listitem>
15972 <para>
15973 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15974 the result of the whole condition is true. If the condition is false for all
15975 items in the list, the overall condition is false.
15976 </para>
15977 </listitem>
15978 <listitem>
15979 <para>
15980 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15981 and the result of the whole condition is false. If the condition is true for
15982 all items in the list, the overall condition is true.
15983 </para>
15984 </listitem>
15985 </itemizedlist>
15986 <para>
15987 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15988 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15989 that the condition must be false for at least one item. In this example, the
15990 list separator is changed to a comma:
15991 </para>
15992 <literallayout class="monospaced">
15993 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15994 </literallayout>
15995 <para>
15996 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15997 being processed, to enable these expansion items to be nested.
15998 </para>
15999 <para>
16000 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16001 </para>
16002 </listitem></varlistentry>
16003 <varlistentry>
16004 <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>
16005 <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>
16006 <listitem>
16007 <para>
16008 <indexterm role="concept">
16009 <primary>string</primary>
16010 <secondary>comparison</secondary>
16011 </indexterm>
16012 <indexterm role="concept">
16013 <primary>expansion</primary>
16014 <secondary>string comparison</secondary>
16015 </indexterm>
16016 <indexterm role="concept">
16017 <primary><option>ge</option> expansion condition</primary>
16018 </indexterm>
16019 <indexterm role="concept">
16020 <primary><option>gei</option> expansion condition</primary>
16021 </indexterm>
16022 The two substrings are first expanded. The condition is true if the first
16023 string is lexically greater than or equal to the second string. For <option>ge</option> the
16024 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16025 case-independent.
16026 </para>
16027 </listitem></varlistentry>
16028 <varlistentry>
16029 <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>
16030 <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>
16031 <listitem>
16032 <para>
16033 <indexterm role="concept">
16034 <primary>string</primary>
16035 <secondary>comparison</secondary>
16036 </indexterm>
16037 <indexterm role="concept">
16038 <primary>expansion</primary>
16039 <secondary>string comparison</secondary>
16040 </indexterm>
16041 <indexterm role="concept">
16042 <primary><option>gt</option> expansion condition</primary>
16043 </indexterm>
16044 <indexterm role="concept">
16045 <primary><option>gti</option> expansion condition</primary>
16046 </indexterm>
16047 The two substrings are first expanded. The condition is true if the first
16048 string is lexically greater than the second string. For <option>gt</option> the comparison
16049 includes the case of letters, whereas for <option>gti</option> the comparison is
16050 case-independent.
16051 </para>
16052 </listitem></varlistentry>
16053 <varlistentry>
16054 <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>
16055 <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>
16056 <listitem>
16057 <para>
16058 <indexterm role="concept">
16059 <primary>string</primary>
16060 <secondary>comparison</secondary>
16061 </indexterm>
16062 <indexterm role="concept">
16063 <primary>list</primary>
16064 <secondary>iterative conditions</secondary>
16065 </indexterm>
16066 Both strings are expanded; the second string is treated as a list of simple
16067 strings; if the first string is a member of the second, then the condition
16068 is true.
16069 </para>
16070 <para>
16071 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16072 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16073 </para>
16074 <literallayout class="monospaced">
16075 ${if inlist{needle}{foo:needle:bar}}
16076   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16077 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16078   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16079 </literallayout>
16080 </listitem></varlistentry>
16081 <varlistentry>
16082 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16083 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16084 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16085 <listitem>
16086 <para>
16087 <indexterm role="concept">
16088 <primary>IP address</primary>
16089 <secondary>testing string format</secondary>
16090 </indexterm>
16091 <indexterm role="concept">
16092 <primary>string</primary>
16093 <secondary>testing for IP address</secondary>
16094 </indexterm>
16095 <indexterm role="concept">
16096 <primary><option>isip</option> expansion condition</primary>
16097 </indexterm>
16098 <indexterm role="concept">
16099 <primary><option>isip4</option> expansion condition</primary>
16100 </indexterm>
16101 <indexterm role="concept">
16102 <primary><option>isip6</option> expansion condition</primary>
16103 </indexterm>
16104 The substring is first expanded, and then tested to see if it has the form of
16105 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16106 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16107 </para>
16108 <para>
16109 For an IPv4 address, the test is for four dot-separated components, each of
16110 which consists of from one to three digits. For an IPv6 address, up to eight
16111 colon-separated components are permitted, each containing from one to four
16112 hexadecimal digits. There may be fewer than eight components if an empty
16113 component (adjacent colons) is present. Only one empty component is permitted.
16114 </para>
16115 <para>
16116 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16117 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16118 check. The main use of these tests is to distinguish between IP addresses and
16119 host names, or between IPv4 and IPv6 addresses. For example, you could use
16120 </para>
16121 <literallayout class="monospaced">
16122 ${if isip4{$sender_host_address}...
16123 </literallayout>
16124 <para>
16125 to test which IP version an incoming SMTP connection is using.
16126 </para>
16127 </listitem></varlistentry>
16128 <varlistentry>
16129 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16130 <listitem>
16131 <para>
16132 <indexterm role="concept">
16133 <primary>LDAP</primary>
16134 <secondary>use for authentication</secondary>
16135 </indexterm>
16136 <indexterm role="concept">
16137 <primary>expansion</primary>
16138 <secondary>LDAP authentication test</secondary>
16139 </indexterm>
16140 <indexterm role="concept">
16141 <primary><option>ldapauth</option> expansion condition</primary>
16142 </indexterm>
16143 This condition supports user authentication using LDAP. See section
16144 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16145 queries. For this use, the query must contain a user name and password. The
16146 query itself is not used, and can be empty. The condition is true if the
16147 password is not empty, and the user name and password are accepted by the LDAP
16148 server. An empty password is rejected without calling LDAP because LDAP binds
16149 with an empty password are considered anonymous regardless of the username, and
16150 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16151 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16152 this can be used.
16153 </para>
16154 </listitem></varlistentry>
16155 <varlistentry>
16156 <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>
16157 <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>
16158 <listitem>
16159 <para>
16160 <indexterm role="concept">
16161 <primary>string</primary>
16162 <secondary>comparison</secondary>
16163 </indexterm>
16164 <indexterm role="concept">
16165 <primary>expansion</primary>
16166 <secondary>string comparison</secondary>
16167 </indexterm>
16168 <indexterm role="concept">
16169 <primary><option>le</option> expansion condition</primary>
16170 </indexterm>
16171 <indexterm role="concept">
16172 <primary><option>lei</option> expansion condition</primary>
16173 </indexterm>
16174 The two substrings are first expanded. The condition is true if the first
16175 string is lexically less than or equal to the second string. For <option>le</option> the
16176 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16177 case-independent.
16178 </para>
16179 </listitem></varlistentry>
16180 <varlistentry>
16181 <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>
16182 <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>
16183 <listitem>
16184 <para>
16185 <indexterm role="concept">
16186 <primary>string</primary>
16187 <secondary>comparison</secondary>
16188 </indexterm>
16189 <indexterm role="concept">
16190 <primary>expansion</primary>
16191 <secondary>string comparison</secondary>
16192 </indexterm>
16193 <indexterm role="concept">
16194 <primary><option>lt</option> expansion condition</primary>
16195 </indexterm>
16196 <indexterm role="concept">
16197 <primary><option>lti</option> expansion condition</primary>
16198 </indexterm>
16199 The two substrings are first expanded. The condition is true if the first
16200 string is lexically less than the second string. For <option>lt</option> the comparison
16201 includes the case of letters, whereas for <option>lti</option> the comparison is
16202 case-independent.
16203 </para>
16204 </listitem></varlistentry>
16205 <varlistentry>
16206 <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>
16207 <listitem>
16208 <para>
16209 <indexterm role="concept">
16210 <primary>expansion</primary>
16211 <secondary>regular expression comparison</secondary>
16212 </indexterm>
16213 <indexterm role="concept">
16214 <primary>regular expressions</primary>
16215 <secondary>match in expanded string</secondary>
16216 </indexterm>
16217 <indexterm role="concept">
16218 <primary><option>match</option> expansion condition</primary>
16219 </indexterm>
16220 The two substrings are first expanded. The second is then treated as a regular
16221 expression and applied to the first. Because of the pre-expansion, if the
16222 regular expression contains dollar, or backslash characters, they must be
16223 escaped. Care must also be taken if the regular expression contains braces
16224 (curly brackets). A closing brace must be escaped so that it is not taken as a
16225 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16226 <literal>\N</literal> feature to disable expansion of the regular expression.
16227 For example,
16228 </para>
16229 <literallayout class="monospaced">
16230 ${if match {$local_part}{\N^\d{3}\N} ...
16231 </literallayout>
16232 <para>
16233 If the whole expansion string is in double quotes, further escaping of
16234 backslashes is also required.
16235 </para>
16236 <para>
16237 The condition is true if the regular expression match succeeds.
16238 The regular expression is not required to begin with a circumflex
16239 metacharacter, but if there is no circumflex, the expression is not anchored,
16240 and it may match anywhere in the subject, not just at the start. If you want
16241 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16242 metacharacter at an appropriate point.
16243 </para>
16244 <para>
16245 <indexterm role="concept">
16246 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16247 <secondary>in <option>if</option> expansion</secondary>
16248 </indexterm>
16249 At the start of an <option>if</option> expansion the values of the numeric variable
16250 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16251 succeeds causes them to be reset to the substrings of that condition and they
16252 will have these values during the expansion of the success string. At the end
16253 of the <option>if</option> expansion, the previous values are restored. After testing a
16254 combination of conditions using <option>or</option>, the subsequent values of the numeric
16255 variables are those of the condition that succeeded.
16256 </para>
16257 </listitem></varlistentry>
16258 <varlistentry>
16259 <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>
16260 <listitem>
16261 <para>
16262 <indexterm role="concept">
16263 <primary><option>match_address</option> expansion condition</primary>
16264 </indexterm>
16265 See <emphasis role="bold">match_local_part</emphasis>.
16266 </para>
16267 </listitem></varlistentry>
16268 <varlistentry>
16269 <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>
16270 <listitem>
16271 <para>
16272 <indexterm role="concept">
16273 <primary><option>match_domain</option> expansion condition</primary>
16274 </indexterm>
16275 See <emphasis role="bold">match_local_part</emphasis>.
16276 </para>
16277 </listitem></varlistentry>
16278 <varlistentry>
16279 <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>
16280 <listitem>
16281 <para>
16282 <indexterm role="concept">
16283 <primary><option>match_ip</option> expansion condition</primary>
16284 </indexterm>
16285 This condition matches an IP address to a list of IP address patterns. It must
16286 be followed by two argument strings. The first (after expansion) must be an IP
16287 address or an empty string. The second (not expanded) is a restricted host
16288 list that can match only an IP address, not a host name. For example:
16289 </para>
16290 <literallayout class="monospaced">
16291 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16292 </literallayout>
16293 <para>
16294 The specific types of host list item that are permitted in the list are:
16295 </para>
16296 <itemizedlist>
16297 <listitem>
16298 <para>
16299 An IP address, optionally with a CIDR mask.
16300 </para>
16301 </listitem>
16302 <listitem>
16303 <para>
16304 A single asterisk, which matches any IP address.
16305 </para>
16306 </listitem>
16307 <listitem>
16308 <para>
16309 An empty item, which matches only if the IP address is empty. This could be
16310 useful for testing for a locally submitted message or one from specific hosts
16311 in a single test such as
16312 </para>
16313 <literallayout class="monospaced">
16314   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16315 </literallayout>
16316 <para>
16317 where the first item in the list is the empty string.
16318 </para>
16319 </listitem>
16320 <listitem>
16321 <para>
16322 The item @[] matches any of the local host&#x2019;s interface addresses.
16323 </para>
16324 </listitem>
16325 <listitem>
16326 <para>
16327 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16328 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16329 address into a host name. The most common type of linear search for
16330 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16331 masks. For example:
16332 </para>
16333 <literallayout class="monospaced">
16334   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16335 </literallayout>
16336 <para>
16337 It is of course possible to use other kinds of lookup, and in such a case, you
16338 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16339 address mask, for example:
16340 </para>
16341 <literallayout class="monospaced">
16342   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16343 </literallayout>
16344 <para>
16345 However, unless you are combining a <option>match_ip</option> condition with others, it is
16346 just as easy to use the fact that a lookup is itself a condition, and write:
16347 </para>
16348 <literallayout class="monospaced">
16349   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16350 </literallayout>
16351 </listitem>
16352 </itemizedlist>
16353 <para>
16354 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16355 Exim was built with the EXPAND_LISTMATCH_RHS option.
16356 </para>
16357 <para>
16358 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16359 </para>
16360 </listitem></varlistentry>
16361 <varlistentry>
16362 <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>
16363 <listitem>
16364 <para>
16365 <indexterm role="concept">
16366 <primary>domain list</primary>
16367 <secondary>in expansion condition</secondary>
16368 </indexterm>
16369 <indexterm role="concept">
16370 <primary>address list</primary>
16371 <secondary>in expansion condition</secondary>
16372 </indexterm>
16373 <indexterm role="concept">
16374 <primary>local part</primary>
16375 <secondary>list, in expansion condition</secondary>
16376 </indexterm>
16377 <indexterm role="concept">
16378 <primary><option>match_local_part</option> expansion condition</primary>
16379 </indexterm>
16380 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16381 possible to test domain, address, and local part lists within expansions. Each
16382 condition requires two arguments: an item and a list to match. A trivial
16383 example is:
16384 </para>
16385 <literallayout class="monospaced">
16386 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16387 </literallayout>
16388 <para>
16389 In each case, the second argument may contain any of the allowable items for a
16390 list of the appropriate type. Also, because the second argument (after
16391 expansion) is a standard form of list, it is possible to refer to a named list.
16392 Thus, you can use conditions like this:
16393 </para>
16394 <literallayout class="monospaced">
16395 ${if match_domain{$domain}{+local_domains}{...
16396 </literallayout>
16397 <para>
16398 <indexterm role="concept">
16399 <primary><literal>+caseful</literal></primary>
16400 </indexterm>
16401 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16402 item can be used, as in all address lists, to cause subsequent items to
16403 have their local parts matched casefully. Domains are always matched
16404 caselessly.
16405 </para>
16406 <para>
16407 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16408 Exim was built with the EXPAND_LISTMATCH_RHS option.
16409 </para>
16410 <para>
16411 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16412 hosts have two identities: a name and an IP address, and it is not clear
16413 how to specify cleanly how such a test would work. However, IP addresses can be
16414 matched using <option>match_ip</option>.
16415 </para>
16416 </listitem></varlistentry>
16417 <varlistentry>
16418 <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>
16419 <listitem>
16420 <para>
16421 <indexterm role="concept">
16422 <primary>PAM authentication</primary>
16423 </indexterm>
16424 <indexterm role="concept">
16425 <primary>AUTH</primary>
16426 <secondary>with PAM</secondary>
16427 </indexterm>
16428 <indexterm role="concept">
16429 <primary>Solaris</primary>
16430 <secondary>PAM support</secondary>
16431 </indexterm>
16432 <indexterm role="concept">
16433 <primary>expansion</primary>
16434 <secondary>PAM authentication test</secondary>
16435 </indexterm>
16436 <indexterm role="concept">
16437 <primary><option>pam</option> expansion condition</primary>
16438 </indexterm>
16439 <emphasis>Pluggable Authentication Modules</emphasis>
16440 (<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
16441 available in the latest releases of Solaris and in some GNU/Linux
16442 distributions. The Exim support, which is intended for use in conjunction with
16443 the SMTP AUTH command, is available only if Exim is compiled with
16444 </para>
16445 <literallayout class="monospaced">
16446 SUPPORT_PAM=yes
16447 </literallayout>
16448 <para>
16449 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16450 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16451 </para>
16452 <para>
16453 The argument string is first expanded, and the result must be a
16454 colon-separated list of strings. Leading and trailing white space is ignored.
16455 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16456 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16457 The remaining items in the data string are passed over in response to requests
16458 from the authentication function. In the simple case there will only be one
16459 request, for a password, so the data consists of just two strings.
16460 </para>
16461 <para>
16462 There can be problems if any of the strings are permitted to contain colon
16463 characters. In the usual way, these have to be doubled to avoid being taken as
16464 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16465 item can be used to double any existing colons. For example, the configuration
16466 of a LOGIN authenticator might contain this setting:
16467 </para>
16468 <literallayout class="monospaced">
16469 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16470 </literallayout>
16471 <para>
16472 For a PLAIN authenticator you could use:
16473 </para>
16474 <literallayout class="monospaced">
16475 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16476 </literallayout>
16477 <para>
16478 In some operating systems, PAM authentication can be done only from a process
16479 running as root. Since Exim is running as the Exim user when receiving
16480 messages, this means that PAM cannot be used directly in those systems.
16481 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16482 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>.
16483 The patched module allows one special uid/gid combination, in addition to root,
16484 to authenticate. If you build the patched module to allow the Exim user and
16485 group, PAM can then be used from an Exim authenticator.
16486 </para>
16487 </listitem></varlistentry>
16488 <varlistentry>
16489 <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>
16490 <listitem>
16491 <para>
16492 <indexterm role="concept">
16493 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16494 </indexterm>
16495 <indexterm role="concept">
16496 <primary>Cyrus</primary>
16497 </indexterm>
16498 <indexterm role="concept">
16499 <primary>expansion</primary>
16500 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16501 </indexterm>
16502 <indexterm role="concept">
16503 <primary><option>pwcheck</option> expansion condition</primary>
16504 </indexterm>
16505 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16506 This is one way of making it possible for passwords to be checked by a process
16507 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16508 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16509 </para>
16510 <para>
16511 The pwcheck support is not included in Exim by default. You need to specify
16512 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16513 building Exim. For example:
16514 </para>
16515 <literallayout class="monospaced">
16516 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16517 </literallayout>
16518 <para>
16519 You do not need to install the full Cyrus software suite in order to use
16520 the pwcheck daemon. You can compile and install just the daemon alone
16521 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16522 access to the <filename>/var/pwcheck</filename> directory.
16523 </para>
16524 <para>
16525 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16526 password, separated by a colon. For example, in a LOGIN authenticator
16527 configuration, you might have this:
16528 </para>
16529 <literallayout class="monospaced">
16530 server_condition = ${if pwcheck{$auth1:$auth2}}
16531 </literallayout>
16532 <para>
16533 Again, for a PLAIN authenticator configuration, this would be:
16534 </para>
16535 <literallayout class="monospaced">
16536 server_condition = ${if pwcheck{$auth2:$auth3}}
16537 </literallayout>
16538 </listitem></varlistentry>
16539 <varlistentry>
16540 <term><emphasis role="bold">queue_running</emphasis></term>
16541 <listitem>
16542 <para>
16543 <indexterm role="concept">
16544 <primary>queue runner</primary>
16545 <secondary>detecting when delivering from</secondary>
16546 </indexterm>
16547 <indexterm role="concept">
16548 <primary>expansion</primary>
16549 <secondary>queue runner test</secondary>
16550 </indexterm>
16551 <indexterm role="concept">
16552 <primary><option>queue_running</option> expansion condition</primary>
16553 </indexterm>
16554 This condition, which has no data, is true during delivery attempts that are
16555 initiated by queue runner processes, and false otherwise.
16556 </para>
16557 </listitem></varlistentry>
16558 <varlistentry>
16559 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16560 <listitem>
16561 <para>
16562 <indexterm role="concept">
16563 <primary>Radius</primary>
16564 </indexterm>
16565 <indexterm role="concept">
16566 <primary>expansion</primary>
16567 <secondary>Radius authentication</secondary>
16568 </indexterm>
16569 <indexterm role="concept">
16570 <primary><option>radius</option> expansion condition</primary>
16571 </indexterm>
16572 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16573 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16574 the Radius client configuration file in order to build Exim with Radius
16575 support.
16576 </para>
16577 <para>
16578 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16579 library, using the original API. If you are using release 0.4.0 or later of
16580 this library, you need to set
16581 </para>
16582 <literallayout class="monospaced">
16583 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16584 </literallayout>
16585 <para>
16586 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16587 <option>libradius</option> library that comes with FreeBSD. To do this, set
16588 </para>
16589 <literallayout class="monospaced">
16590 RADIUS_LIB_TYPE=RADLIB
16591 </literallayout>
16592 <para>
16593 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16594 You may also have to supply a suitable setting in EXTRALIBS so that the
16595 Radius library can be found when Exim is linked.
16596 </para>
16597 <para>
16598 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16599 Radius client library, which calls the Radius server. The condition is true if
16600 the authentication is successful. For example:
16601 </para>
16602 <literallayout class="monospaced">
16603 server_condition = ${if radius{&lt;arguments&gt;}}
16604 </literallayout>
16605 </listitem></varlistentry>
16606 <varlistentry>
16607 <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>
16608 <listitem>
16609 <para>
16610 <indexterm role="concept">
16611 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16612 </indexterm>
16613 <indexterm role="concept">
16614 <primary>Cyrus</primary>
16615 </indexterm>
16616 <indexterm role="concept">
16617 <primary>expansion</primary>
16618 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16619 </indexterm>
16620 <indexterm role="concept">
16621 <primary><option>saslauthd</option> expansion condition</primary>
16622 </indexterm>
16623 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16624 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16625 Using this daemon is one way of making it possible for passwords to be checked
16626 by a process that is not running as root.
16627 </para>
16628 <para>
16629 The saslauthd support is not included in Exim by default. You need to specify
16630 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16631 building Exim. For example:
16632 </para>
16633 <literallayout class="monospaced">
16634 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16635 </literallayout>
16636 <para>
16637 You do not need to install the full Cyrus software suite in order to use
16638 the saslauthd daemon. You can compile and install just the daemon alone
16639 from the Cyrus SASL library.
16640 </para>
16641 <para>
16642 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16643 two are mandatory. For example:
16644 </para>
16645 <literallayout class="monospaced">
16646 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16647 </literallayout>
16648 <para>
16649 The service and the realm are optional (which is why the arguments are enclosed
16650 in their own set of braces). For details of the meaning of the service and
16651 realm, and how to run the daemon, consult the Cyrus documentation.
16652 </para>
16653 </listitem></varlistentry>
16654 </variablelist>
16655 </section>
16656 <section id="SECID84">
16657 <title>Combining expansion conditions</title>
16658 <para>
16659 <indexterm role="concept">
16660 <primary>expansion</primary>
16661 <secondary>combining conditions</secondary>
16662 </indexterm>
16663 Several conditions can be tested at once by combining them using the <option>and</option>
16664 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16665 conditions on their own, and precede their lists of sub-conditions. Each
16666 sub-condition must be enclosed in braces within the overall braces that contain
16667 the list. No repetition of <option>if</option> is used.
16668 </para>
16669 <variablelist>
16670 <varlistentry>
16671 <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>
16672 <listitem>
16673 <para>
16674 <indexterm role="concept">
16675 <primary><quote>or</quote> expansion condition</primary>
16676 </indexterm>
16677 <indexterm role="concept">
16678 <primary>expansion</primary>
16679 <secondary><quote>or</quote> of conditions</secondary>
16680 </indexterm>
16681 The sub-conditions are evaluated from left to right. The condition is true if
16682 any one of the sub-conditions is true.
16683 For example,
16684 </para>
16685 <literallayout class="monospaced">
16686 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16687 </literallayout>
16688 <para>
16689 When a true sub-condition is found, the following ones are parsed but not
16690 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16691 numeric variables afterwards are taken from the first one that succeeds.
16692 </para>
16693 </listitem></varlistentry>
16694 <varlistentry>
16695 <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>
16696 <listitem>
16697 <para>
16698 <indexterm role="concept">
16699 <primary><quote>and</quote> expansion condition</primary>
16700 </indexterm>
16701 <indexterm role="concept">
16702 <primary>expansion</primary>
16703 <secondary><quote>and</quote> of conditions</secondary>
16704 </indexterm>
16705 The sub-conditions are evaluated from left to right. The condition is true if
16706 all of the sub-conditions are true. If there are several <quote>match</quote>
16707 sub-conditions, the values of the numeric variables afterwards are taken from
16708 the last one. When a false sub-condition is found, the following ones are
16709 parsed but not evaluated.
16710 </para>
16711 </listitem></varlistentry>
16712 </variablelist>
16713 <para>
16714 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16715 </para>
16716 </section>
16717 <section id="SECTexpvar">
16718 <title>Expansion variables</title>
16719 <para>
16720 <indexterm role="concept">
16721 <primary>expansion</primary>
16722 <secondary>variables, list of</secondary>
16723 </indexterm>
16724 This section contains an alphabetical list of all the expansion variables. Some
16725 of them are available only when Exim is compiled with specific options such as
16726 support for TLS or the content scanning extension.
16727 </para>
16728 <variablelist>
16729 <varlistentry>
16730 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16731 <listitem>
16732 <para>
16733 <indexterm role="concept">
16734 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16735 </indexterm>
16736 When a <option>match</option> expansion condition succeeds, these variables contain the
16737 captured substrings identified by the regular expression during subsequent
16738 processing of the success string of the containing <option>if</option> expansion item.
16739 However, they do not retain their values afterwards; in fact, their previous
16740 values are restored at the end of processing an <option>if</option> item. The numerical
16741 variables may also be set externally by some other matching process which
16742 precedes the expansion of the string. For example, the commands available in
16743 Exim filter files include an <option>if</option> command with its own regular expression
16744 matching condition.
16745 </para>
16746 </listitem></varlistentry>
16747 <varlistentry revisionflag="changed">
16748 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
16749 <listitem>
16750 <para revisionflag="changed">
16751 Within an acl condition, expansion condition or expansion item
16752 any arguments are copied to these variables,
16753 any unused variables being made empty.
16754 </para>
16755 </listitem></varlistentry>
16756 <varlistentry>
16757 <term><varname>$acl_c...</varname></term>
16758 <listitem>
16759 <para>
16760 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16761 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16762 long, but the sixth character must be either a digit or an underscore. For
16763 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16764 variables persist throughout the lifetime of an SMTP connection. They can be
16765 used to pass information between ACLs and between different invocations of the
16766 same ACL. When a message is received, the values of these variables are saved
16767 with the message, and can be accessed by filters, routers, and transports
16768 during subsequent delivery.
16769 </para>
16770 </listitem></varlistentry>
16771 <varlistentry>
16772 <term><varname>$acl_m...</varname></term>
16773 <listitem>
16774 <para>
16775 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16776 are reset after a message has been received. Thus, if several messages are
16777 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16778 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16779 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16780 message is received, the values of these variables are saved with the message,
16781 and can be accessed by filters, routers, and transports during subsequent
16782 delivery.
16783 </para>
16784 </listitem></varlistentry>
16785 <varlistentry revisionflag="changed">
16786 <term><varname>$acl_narg</varname></term>
16787 <listitem>
16788 <para revisionflag="changed">
16789 Within an acl condition, expansion condition or expansion item
16790 this variable has the number of arguments.
16791 </para>
16792 </listitem></varlistentry>
16793 <varlistentry>
16794 <term><varname>$acl_verify_message</varname></term>
16795 <listitem>
16796 <para>
16797 <indexterm role="variable">
16798 <primary><varname>$acl_verify_message</varname></primary>
16799 </indexterm>
16800 After an address verification has failed, this variable contains the failure
16801 message. It retains its value for use in subsequent modifiers. The message can
16802 be preserved by coding like this:
16803 </para>
16804 <literallayout class="monospaced">
16805 warn !verify = sender
16806      set acl_m0 = $acl_verify_message
16807 </literallayout>
16808 <para>
16809 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16810 <option>log_message</option> modifiers, to include information about the verification
16811 failure.
16812 </para>
16813 </listitem></varlistentry>
16814 <varlistentry>
16815 <term><varname>$address_data</varname></term>
16816 <listitem>
16817 <para>
16818 <indexterm role="variable">
16819 <primary><varname>$address_data</varname></primary>
16820 </indexterm>
16821 This variable is set by means of the <option>address_data</option> option in routers. The
16822 value then remains with the address while it is processed by subsequent routers
16823 and eventually a transport. If the transport is handling multiple addresses,
16824 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16825 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16826 user filter files.
16827 </para>
16828 <para>
16829 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16830 a recipient address, the final value is still in the variable for subsequent
16831 conditions and modifiers of the ACL statement. If routing the address caused it
16832 to be redirected to just one address, the child address is also routed as part
16833 of the verification, and in this case the final value of <varname>$address_data</varname> is
16834 from the child&#x2019;s routing.
16835 </para>
16836 <para>
16837 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16838 sender address, the final value is also preserved, but this time in
16839 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16840 address.
16841 </para>
16842 <para>
16843 In both cases (recipient and sender verification), the value does not persist
16844 after the end of the current ACL statement. If you want to preserve
16845 these values for longer, you can save them in ACL variables.
16846 </para>
16847 </listitem></varlistentry>
16848 <varlistentry>
16849 <term><varname>$address_file</varname></term>
16850 <listitem>
16851 <para>
16852 <indexterm role="variable">
16853 <primary><varname>$address_file</varname></primary>
16854 </indexterm>
16855 When, as a result of aliasing, forwarding, or filtering, a message is directed
16856 to a specific file, this variable holds the name of the file when the transport
16857 is running. At other times, the variable is empty. For example, using the
16858 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16859 </para>
16860 <literallayout class="monospaced">
16861 /home/r2d2/savemail
16862 </literallayout>
16863 <para>
16864 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16865 contains the text string <literal>/home/r2d2/savemail</literal>.
16866 <indexterm role="concept">
16867 <primary>Sieve filter</primary>
16868 <secondary>value of <varname>$address_file</varname></secondary>
16869 </indexterm>
16870 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16871 then up to the transport configuration to generate an appropriate absolute path
16872 to the relevant file.
16873 </para>
16874 </listitem></varlistentry>
16875 <varlistentry>
16876 <term><varname>$address_pipe</varname></term>
16877 <listitem>
16878 <para>
16879 <indexterm role="variable">
16880 <primary><varname>$address_pipe</varname></primary>
16881 </indexterm>
16882 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16883 this variable holds the pipe command when the transport is running.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16888 <listitem>
16889 <para>
16890 <indexterm role="variable">
16891 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16892 </indexterm>
16893 These variables are used in SMTP authenticators (see chapters
16894 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16895 </para>
16896 </listitem></varlistentry>
16897 <varlistentry>
16898 <term><varname>$authenticated_id</varname></term>
16899 <listitem>
16900 <para>
16901 <indexterm role="concept">
16902 <primary>authentication</primary>
16903 <secondary>id</secondary>
16904 </indexterm>
16905 <indexterm role="variable">
16906 <primary><varname>$authenticated_id</varname></primary>
16907 </indexterm>
16908 When a server successfully authenticates a client it may be configured to
16909 preserve some of the authentication information in the variable
16910 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16911 user/password authenticator configuration might preserve the user name for use
16912 in the routers. Note that this is not the same information that is saved in
16913 <varname>$sender_host_authenticated</varname>.
16914 When a message is submitted locally (that is, not over a TCP connection)
16915 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16916 process. However, a trusted user can override this by means of the <option>-oMai</option>
16917 command line option.
16918 </para>
16919 </listitem></varlistentry>
16920 <varlistentry>
16921 <term><varname>$authenticated_fail_id</varname></term>
16922 <listitem>
16923 <para>
16924 <indexterm role="concept">
16925 <primary>authentication</primary>
16926 <secondary>fail</secondary>
16927 </indexterm>
16928 <indexterm role="variable">
16929 <primary><varname>$authenticated_fail_id</varname></primary>
16930 </indexterm>
16931 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
16932 will contain the failed authentication id. If more than one authentication
16933 id is attempted, it will contain only the last one. The variable is
16934 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
16935 A message to a local recipient could still be accepted without requiring
16936 authentication, which means this variable could also be visible in all of
16937 the ACL&#x2019;s as well.
16938 </para>
16939 </listitem></varlistentry>
16940 <varlistentry>
16941 <term><varname>$authenticated_sender</varname></term>
16942 <listitem>
16943 <para>
16944 <indexterm role="concept">
16945 <primary>sender</primary>
16946 <secondary>authenticated</secondary>
16947 </indexterm>
16948 <indexterm role="concept">
16949 <primary>authentication</primary>
16950 <secondary>sender</secondary>
16951 </indexterm>
16952 <indexterm role="concept">
16953 <primary>AUTH</primary>
16954 <secondary>on MAIL command</secondary>
16955 </indexterm>
16956 <indexterm role="variable">
16957 <primary><varname>$authenticated_sender</varname></primary>
16958 </indexterm>
16959 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16960 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16961 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16962 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
16963 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16964 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16965 </para>
16966 <para>
16967 <indexterm role="variable">
16968 <primary><varname>$qualify_domain</varname></primary>
16969 </indexterm>
16970 When a message is submitted locally (that is, not over a TCP connection), the
16971 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16972 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16973 can override this by means of the <option>-oMas</option> command line option.
16974 </para>
16975 </listitem></varlistentry>
16976 <varlistentry>
16977 <term><varname>$authentication_failed</varname></term>
16978 <listitem>
16979 <para>
16980 <indexterm role="concept">
16981 <primary>authentication</primary>
16982 <secondary>failure</secondary>
16983 </indexterm>
16984 <indexterm role="variable">
16985 <primary><varname>$authentication_failed</varname></primary>
16986 </indexterm>
16987 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16988 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16989 possible to distinguish between <quote>did not try to authenticate</quote>
16990 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16991 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16992 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16993 negative response to an AUTH command, including (for example) an attempt to use
16994 an undefined mechanism.
16995 </para>
16996 </listitem></varlistentry>
16997 <varlistentry>
16998 <term><varname>$av_failed</varname></term>
16999 <listitem>
17000 <para>
17001 <indexterm role="concept">
17002 <primary>content scanning</primary>
17003 <secondary>AV scanner failure</secondary>
17004 </indexterm>
17005 This variable is available when Exim is compiled with the content-scanning
17006 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17007 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17008 the ACL malware condition.
17009 </para>
17010 </listitem></varlistentry>
17011 <varlistentry>
17012 <term><varname>$body_linecount</varname></term>
17013 <listitem>
17014 <para>
17015 <indexterm role="concept">
17016 <primary>message body</primary>
17017 <secondary>line count</secondary>
17018 </indexterm>
17019 <indexterm role="concept">
17020 <primary>body of message</primary>
17021 <secondary>line count</secondary>
17022 </indexterm>
17023 <indexterm role="variable">
17024 <primary><varname>$body_linecount</varname></primary>
17025 </indexterm>
17026 When a message is being received or delivered, this variable contains the
17027 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17028 </para>
17029 </listitem></varlistentry>
17030 <varlistentry>
17031 <term><varname>$body_zerocount</varname></term>
17032 <listitem>
17033 <para>
17034 <indexterm role="concept">
17035 <primary>message body</primary>
17036 <secondary>binary zero count</secondary>
17037 </indexterm>
17038 <indexterm role="concept">
17039 <primary>body of message</primary>
17040 <secondary>binary zero count</secondary>
17041 </indexterm>
17042 <indexterm role="concept">
17043 <primary>binary zero</primary>
17044 <secondary>in message body</secondary>
17045 </indexterm>
17046 <indexterm role="variable">
17047 <primary><varname>$body_zerocount</varname></primary>
17048 </indexterm>
17049 When a message is being received or delivered, this variable contains the
17050 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17051 </para>
17052 </listitem></varlistentry>
17053 <varlistentry>
17054 <term><varname>$bounce_recipient</varname></term>
17055 <listitem>
17056 <para>
17057 <indexterm role="variable">
17058 <primary><varname>$bounce_recipient</varname></primary>
17059 </indexterm>
17060 This is set to the recipient address of a bounce message while Exim is creating
17061 it. It is useful if a customized bounce message text file is in use (see
17062 chapter <xref linkend="CHAPemsgcust"/>).
17063 </para>
17064 </listitem></varlistentry>
17065 <varlistentry>
17066 <term><varname>$bounce_return_size_limit</varname></term>
17067 <listitem>
17068 <para>
17069 <indexterm role="variable">
17070 <primary><varname>$bounce_return_size_limit</varname></primary>
17071 </indexterm>
17072 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17073 up to a multiple of 1000. It is useful when a customized error message text
17074 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17075 </para>
17076 </listitem></varlistentry>
17077 <varlistentry>
17078 <term><varname>$caller_gid</varname></term>
17079 <listitem>
17080 <para>
17081 <indexterm role="concept">
17082 <primary>gid (group id)</primary>
17083 <secondary>caller</secondary>
17084 </indexterm>
17085 <indexterm role="variable">
17086 <primary><varname>$caller_gid</varname></primary>
17087 </indexterm>
17088 The real group id under which the process that called Exim was running. This is
17089 not the same as the group id of the originator of a message (see
17090 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17091 incarnation normally contains the Exim gid.
17092 </para>
17093 </listitem></varlistentry>
17094 <varlistentry>
17095 <term><varname>$caller_uid</varname></term>
17096 <listitem>
17097 <para>
17098 <indexterm role="concept">
17099 <primary>uid (user id)</primary>
17100 <secondary>caller</secondary>
17101 </indexterm>
17102 <indexterm role="variable">
17103 <primary><varname>$caller_uid</varname></primary>
17104 </indexterm>
17105 The real user id under which the process that called Exim was running. This is
17106 not the same as the user id of the originator of a message (see
17107 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17108 incarnation normally contains the Exim uid.
17109 </para>
17110 </listitem></varlistentry>
17111 <varlistentry>
17112 <term><varname>$compile_date</varname></term>
17113 <listitem>
17114 <para>
17115 <indexterm role="variable">
17116 <primary><varname>$compile_date</varname></primary>
17117 </indexterm>
17118 The date on which the Exim binary was compiled.
17119 </para>
17120 </listitem></varlistentry>
17121 <varlistentry>
17122 <term><varname>$compile_number</varname></term>
17123 <listitem>
17124 <para>
17125 <indexterm role="variable">
17126 <primary><varname>$compile_number</varname></primary>
17127 </indexterm>
17128 The building process for Exim keeps a count of the number
17129 of times it has been compiled. This serves to distinguish different
17130 compilations of the same version of the program.
17131 </para>
17132 </listitem></varlistentry>
17133 <varlistentry>
17134 <term><varname>$demime_errorlevel</varname></term>
17135 <listitem>
17136 <para>
17137 <indexterm role="variable">
17138 <primary><varname>$demime_errorlevel</varname></primary>
17139 </indexterm>
17140 This variable is available when Exim is compiled with
17141 the content-scanning extension and the obsolete <option>demime</option> condition. For
17142 details, see section <xref linkend="SECTdemimecond"/>.
17143 </para>
17144 </listitem></varlistentry>
17145 <varlistentry>
17146 <term><varname>$demime_reason</varname></term>
17147 <listitem>
17148 <para>
17149 <indexterm role="variable">
17150 <primary><varname>$demime_reason</varname></primary>
17151 </indexterm>
17152 This variable is available when Exim is compiled with the
17153 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17154 see section <xref linkend="SECTdemimecond"/>.
17155 </para>
17156 </listitem></varlistentry>
17157 <varlistentry>
17158 <term><varname>$dnslist_domain</varname></term>
17159 <term><varname>$dnslist_matched</varname></term>
17160 <term><varname>$dnslist_text</varname></term>
17161 <term><varname>$dnslist_value</varname></term>
17162 <listitem>
17163 <para>
17164 <indexterm role="variable">
17165 <primary><varname>$dnslist_domain</varname></primary>
17166 </indexterm>
17167 <indexterm role="variable">
17168 <primary><varname>$dnslist_matched</varname></primary>
17169 </indexterm>
17170 <indexterm role="variable">
17171 <primary><varname>$dnslist_text</varname></primary>
17172 </indexterm>
17173 <indexterm role="variable">
17174 <primary><varname>$dnslist_value</varname></primary>
17175 </indexterm>
17176 <indexterm role="concept">
17177 <primary>black list (DNS)</primary>
17178 </indexterm>
17179 When a DNS (black) list lookup succeeds, these variables are set to contain
17180 the following data from the lookup: the list&#x2019;s domain name, the key that was
17181 looked up, the contents of any associated TXT record, and the value from the
17182 main A record. See section <xref linkend="SECID204"/> for more details.
17183 </para>
17184 </listitem></varlistentry>
17185 <varlistentry>
17186 <term><varname>$domain</varname></term>
17187 <listitem>
17188 <para>
17189 <indexterm role="variable">
17190 <primary><varname>$domain</varname></primary>
17191 </indexterm>
17192 When an address is being routed, or delivered on its own, this variable
17193 contains the domain. Uppercase letters in the domain are converted into lower
17194 case for <varname>$domain</varname>.
17195 </para>
17196 <para>
17197 Global address rewriting happens when a message is received, so the value of
17198 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17199 is set during user filtering, but not during system filtering, because a
17200 message may have many recipients and the system filter is called just once.
17201 </para>
17202 <para>
17203 When more than one address is being delivered at once (for example, several
17204 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17205 have the same domain. Transports can be restricted to handling only one domain
17206 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17207 the default for local transports. For further details of the environment in
17208 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17209 </para>
17210 <para>
17211 <indexterm role="option">
17212 <primary><option>delay_warning_condition</option></primary>
17213 </indexterm>
17214 At the end of a delivery, if all deferred addresses have the same domain, it is
17215 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17216 </para>
17217 <para>
17218 The <varname>$domain</varname> variable is also used in some other circumstances:
17219 </para>
17220 <itemizedlist>
17221 <listitem>
17222 <para>
17223 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17224 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17225 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17226 normally set during the running of the MAIL ACL. However, if the sender address
17227 is verified with a callout during the MAIL ACL, the sender domain is placed in
17228 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17229 the <command>smtp</command> transport.
17230 </para>
17231 </listitem>
17232 <listitem>
17233 <para>
17234 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17235 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17236 it can be used in the expansion of the replacement address, for example, to
17237 rewrite domains by file lookup.
17238 </para>
17239 </listitem>
17240 <listitem>
17241 <para>
17242 With one important exception, whenever a domain list is being scanned,
17243 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17244 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17245 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17246 that, in a RCPT ACL, the sender domain list can be dependent on the
17247 recipient domain (which is what is in <varname>$domain</varname> at this time).
17248 </para>
17249 </listitem>
17250 <listitem>
17251 <para>
17252 <indexterm role="concept">
17253 <primary>ETRN</primary>
17254 <secondary>value of <varname>$domain</varname></secondary>
17255 </indexterm>
17256 <indexterm role="option">
17257 <primary><option>smtp_etrn_command</option></primary>
17258 </indexterm>
17259 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17260 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17261 </para>
17262 </listitem>
17263 </itemizedlist>
17264 </listitem></varlistentry>
17265 <varlistentry>
17266 <term><varname>$domain_data</varname></term>
17267 <listitem>
17268 <para>
17269 <indexterm role="variable">
17270 <primary><varname>$domain_data</varname></primary>
17271 </indexterm>
17272 When the <option>domains</option> option on a router matches a domain by
17273 means of a lookup, the data read by the lookup is available during the running
17274 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17275 address to a transport, the value is available in that transport. If the
17276 transport is handling multiple addresses, the value from the first address is
17277 used.
17278 </para>
17279 <para>
17280 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17281 domain by means of a lookup. The data read by the lookup is available during
17282 the rest of the ACL statement. In all other situations, this variable expands
17283 to nothing.
17284 </para>
17285 </listitem></varlistentry>
17286 <varlistentry>
17287 <term><varname>$exim_gid</varname></term>
17288 <listitem>
17289 <para>
17290 <indexterm role="variable">
17291 <primary><varname>$exim_gid</varname></primary>
17292 </indexterm>
17293 This variable contains the numerical value of the Exim group id.
17294 </para>
17295 </listitem></varlistentry>
17296 <varlistentry>
17297 <term><varname>$exim_path</varname></term>
17298 <listitem>
17299 <para>
17300 <indexterm role="variable">
17301 <primary><varname>$exim_path</varname></primary>
17302 </indexterm>
17303 This variable contains the path to the Exim binary.
17304 </para>
17305 </listitem></varlistentry>
17306 <varlistentry>
17307 <term><varname>$exim_uid</varname></term>
17308 <listitem>
17309 <para>
17310 <indexterm role="variable">
17311 <primary><varname>$exim_uid</varname></primary>
17312 </indexterm>
17313 This variable contains the numerical value of the Exim user id.
17314 </para>
17315 </listitem></varlistentry>
17316 <varlistentry>
17317 <term><varname>$found_extension</varname></term>
17318 <listitem>
17319 <para>
17320 <indexterm role="variable">
17321 <primary><varname>$found_extension</varname></primary>
17322 </indexterm>
17323 This variable is available when Exim is compiled with the
17324 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17325 see section <xref linkend="SECTdemimecond"/>.
17326 </para>
17327 </listitem></varlistentry>
17328 <varlistentry>
17329 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17330 <listitem>
17331 <para>
17332 This is not strictly an expansion variable. It is expansion syntax for
17333 inserting the message header line with the given name. Note that the name must
17334 be terminated by colon or white space, because it may contain a wide variety of
17335 characters. Note also that braces must <emphasis>not</emphasis> be used.
17336 </para>
17337 </listitem></varlistentry>
17338 <varlistentry>
17339 <term><varname>$headers_added</varname></term>
17340 <listitem>
17341 <para>
17342 <indexterm role="variable">
17343 <primary><varname>$headers_added</varname></primary>
17344 </indexterm>
17345 Within an ACL this variable contains the headers added so far by
17346 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17347 The headers are a newline-separated list.
17348 </para>
17349 </listitem></varlistentry>
17350 <varlistentry>
17351 <term><varname>$home</varname></term>
17352 <listitem>
17353 <para>
17354 <indexterm role="variable">
17355 <primary><varname>$home</varname></primary>
17356 </indexterm>
17357 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17358 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17359 means it is set during the running of users&#x2019; filter files. A router may also
17360 explicitly set a home directory for use by a transport; this can be overridden
17361 by a setting on the transport itself.
17362 </para>
17363 <para>
17364 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17365 of the environment variable HOME.
17366 </para>
17367 </listitem></varlistentry>
17368 <varlistentry>
17369 <term><varname>$host</varname></term>
17370 <listitem>
17371 <para>
17372 <indexterm role="variable">
17373 <primary><varname>$host</varname></primary>
17374 </indexterm>
17375 If a router assigns an address to a transport (any transport), and passes a
17376 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17377 to run is the name of the first host on the list. Note that this applies both
17378 to local and remote transports.
17379 </para>
17380 <para>
17381 <indexterm role="concept">
17382 <primary>transport</primary>
17383 <secondary>filter</secondary>
17384 </indexterm>
17385 <indexterm role="concept">
17386 <primary>filter</primary>
17387 <secondary>transport filter</secondary>
17388 </indexterm>
17389 For the <command>smtp</command> transport, if there is more than one host, the value of
17390 <varname>$host</varname> changes as the transport works its way through the list. In
17391 particular, when the <command>smtp</command> transport is expanding its options for encryption
17392 using TLS, or for specifying a transport filter (see chapter
17393 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17394 is connected.
17395 </para>
17396 <para>
17397 When used in the client part of an authenticator configuration (see chapter
17398 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17399 client is connected.
17400 </para>
17401 </listitem></varlistentry>
17402 <varlistentry>
17403 <term><varname>$host_address</varname></term>
17404 <listitem>
17405 <para>
17406 <indexterm role="variable">
17407 <primary><varname>$host_address</varname></primary>
17408 </indexterm>
17409 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17410 for a remote connection. It is also set to the IP address that is being checked
17411 when the <option>ignore_target_hosts</option> option is being processed.
17412 </para>
17413 </listitem></varlistentry>
17414 <varlistentry>
17415 <term><varname>$host_data</varname></term>
17416 <listitem>
17417 <para>
17418 <indexterm role="variable">
17419 <primary><varname>$host_data</varname></primary>
17420 </indexterm>
17421 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17422 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17423 allows you, for example, to do things like this:
17424 </para>
17425 <literallayout class="monospaced">
17426 deny  hosts = net-lsearch;/some/file
17427 message = $host_data
17428 </literallayout>
17429 </listitem></varlistentry>
17430 <varlistentry>
17431 <term><varname>$host_lookup_deferred</varname></term>
17432 <listitem>
17433 <para>
17434 <indexterm role="concept">
17435 <primary>host name</primary>
17436 <secondary>lookup, failure of</secondary>
17437 </indexterm>
17438 <indexterm role="variable">
17439 <primary><varname>$host_lookup_deferred</varname></primary>
17440 </indexterm>
17441 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17442 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17443 name from its IP address, and the attempt is not successful, one of these
17444 variables is set to <quote>1</quote>.
17445 </para>
17446 <itemizedlist>
17447 <listitem>
17448 <para>
17449 If the lookup receives a definite negative response (for example, a DNS lookup
17450 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17451 </para>
17452 </listitem>
17453 <listitem>
17454 <para>
17455 If there is any kind of problem during the lookup, such that Exim cannot
17456 tell whether or not the host name is defined (for example, a timeout for a DNS
17457 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17458 </para>
17459 </listitem>
17460 </itemizedlist>
17461 <para>
17462 Looking up a host&#x2019;s name from its IP address consists of more than just a
17463 single reverse lookup. Exim checks that a forward lookup of at least one of the
17464 names it receives from a reverse lookup yields the original IP address. If this
17465 is not the case, Exim does not accept the looked up name(s), and
17466 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17467 IP address (for example, the existence of a PTR record in the DNS) is not
17468 sufficient on its own for the success of a host name lookup. If the reverse
17469 lookup succeeds, but there is a lookup problem such as a timeout when checking
17470 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17471 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17472 </para>
17473 </listitem></varlistentry>
17474 <varlistentry>
17475 <term><varname>$host_lookup_failed</varname></term>
17476 <listitem>
17477 <para>
17478 <indexterm role="variable">
17479 <primary><varname>$host_lookup_failed</varname></primary>
17480 </indexterm>
17481 See <varname>$host_lookup_deferred</varname>.
17482 </para>
17483 </listitem></varlistentry>
17484 <varlistentry>
17485 <term><varname>$inode</varname></term>
17486 <listitem>
17487 <para>
17488 <indexterm role="variable">
17489 <primary><varname>$inode</varname></primary>
17490 </indexterm>
17491 The only time this variable is set is while expanding the <option>directory_file</option>
17492 option in the <command>appendfile</command> transport. The variable contains the inode number
17493 of the temporary file which is about to be renamed. It can be used to construct
17494 a unique name for the file.
17495 </para>
17496 </listitem></varlistentry>
17497 <varlistentry>
17498 <term><varname>$interface_address</varname></term>
17499 <listitem>
17500 <para>
17501 <indexterm role="variable">
17502 <primary><varname>$interface_address</varname></primary>
17503 </indexterm>
17504 This is an obsolete name for <varname>$received_ip_address</varname>.
17505 </para>
17506 </listitem></varlistentry>
17507 <varlistentry>
17508 <term><varname>$interface_port</varname></term>
17509 <listitem>
17510 <para>
17511 <indexterm role="variable">
17512 <primary><varname>$interface_port</varname></primary>
17513 </indexterm>
17514 This is an obsolete name for <varname>$received_port</varname>.
17515 </para>
17516 </listitem></varlistentry>
17517 <varlistentry>
17518 <term><varname>$item</varname></term>
17519 <listitem>
17520 <para>
17521 <indexterm role="variable">
17522 <primary><varname>$item</varname></primary>
17523 </indexterm>
17524 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17525 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17526 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17527 empty.
17528 </para>
17529 </listitem></varlistentry>
17530 <varlistentry>
17531 <term><varname>$ldap_dn</varname></term>
17532 <listitem>
17533 <para>
17534 <indexterm role="variable">
17535 <primary><varname>$ldap_dn</varname></primary>
17536 </indexterm>
17537 This variable, which is available only when Exim is compiled with LDAP support,
17538 contains the DN from the last entry in the most recently successful LDAP
17539 lookup.
17540 </para>
17541 </listitem></varlistentry>
17542 <varlistentry>
17543 <term><varname>$load_average</varname></term>
17544 <listitem>
17545 <para>
17546 <indexterm role="variable">
17547 <primary><varname>$load_average</varname></primary>
17548 </indexterm>
17549 This variable contains the system load average, multiplied by 1000 so that it
17550 is an integer. For example, if the load average is 0.21, the value of the
17551 variable is 210. The value is recomputed every time the variable is referenced.
17552 </para>
17553 </listitem></varlistentry>
17554 <varlistentry>
17555 <term><varname>$local_part</varname></term>
17556 <listitem>
17557 <para>
17558 <indexterm role="variable">
17559 <primary><varname>$local_part</varname></primary>
17560 </indexterm>
17561 When an address is being routed, or delivered on its own, this
17562 variable contains the local part. When a number of addresses are being
17563 delivered together (for example, multiple RCPT commands in an SMTP
17564 session), <varname>$local_part</varname> is not set.
17565 </para>
17566 <para>
17567 Global address rewriting happens when a message is received, so the value of
17568 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17569 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17570 because a message may have many recipients and the system filter is called just
17571 once.
17572 </para>
17573 <para>
17574 <indexterm role="variable">
17575 <primary><varname>$local_part_prefix</varname></primary>
17576 </indexterm>
17577 <indexterm role="variable">
17578 <primary><varname>$local_part_suffix</varname></primary>
17579 </indexterm>
17580 If a local part prefix or suffix has been recognized, it is not included in the
17581 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17582 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17583 <varname>$local_part_suffix</varname>, respectively.
17584 </para>
17585 <para>
17586 When a message is being delivered to a file, pipe, or autoreply transport as a
17587 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17588 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17589 <varname>$address_pipe</varname>).
17590 </para>
17591 <para>
17592 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17593 local part of the recipient address.
17594 </para>
17595 <para>
17596 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17597 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17598 it can be used in the expansion of the replacement address, for example.
17599 </para>
17600 <para>
17601 In all cases, all quoting is removed from the local part. For example, for both
17602 the addresses
17603 </para>
17604 <literallayout class="monospaced">
17605 "abc:xyz"@test.example
17606 abc\:xyz@test.example
17607 </literallayout>
17608 <para>
17609 the value of <varname>$local_part</varname> is
17610 </para>
17611 <literallayout class="monospaced">
17612 abc:xyz
17613 </literallayout>
17614 <para>
17615 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17616 inside a quoting operator. For example, in a <command>redirect</command> router you could
17617 have:
17618 </para>
17619 <literallayout class="monospaced">
17620 data = ${quote_local_part:$local_part}@new.domain.example
17621 </literallayout>
17622 <para>
17623 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17624 to process local parts in a case-dependent manner in a router, you can set the
17625 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17626 </para>
17627 </listitem></varlistentry>
17628 <varlistentry>
17629 <term><varname>$local_part_data</varname></term>
17630 <listitem>
17631 <para>
17632 <indexterm role="variable">
17633 <primary><varname>$local_part_data</varname></primary>
17634 </indexterm>
17635 When the <option>local_parts</option> option on a router matches a local part by means of a
17636 lookup, the data read by the lookup is available during the running of the
17637 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17638 to a transport, the value is available in that transport. If the transport is
17639 handling multiple addresses, the value from the first address is used.
17640 </para>
17641 <para>
17642 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17643 matches a local part by means of a lookup. The data read by the lookup is
17644 available during the rest of the ACL statement. In all other situations, this
17645 variable expands to nothing.
17646 </para>
17647 </listitem></varlistentry>
17648 <varlistentry>
17649 <term><varname>$local_part_prefix</varname></term>
17650 <listitem>
17651 <para>
17652 <indexterm role="variable">
17653 <primary><varname>$local_part_prefix</varname></primary>
17654 </indexterm>
17655 When an address is being routed or delivered, and a
17656 specific prefix for the local part was recognized, it is available in this
17657 variable, having been removed from <varname>$local_part</varname>.
17658 </para>
17659 </listitem></varlistentry>
17660 <varlistentry>
17661 <term><varname>$local_part_suffix</varname></term>
17662 <listitem>
17663 <para>
17664 <indexterm role="variable">
17665 <primary><varname>$local_part_suffix</varname></primary>
17666 </indexterm>
17667 When an address is being routed or delivered, and a
17668 specific suffix for the local part was recognized, it is available in this
17669 variable, having been removed from <varname>$local_part</varname>.
17670 </para>
17671 </listitem></varlistentry>
17672 <varlistentry>
17673 <term><varname>$local_scan_data</varname></term>
17674 <listitem>
17675 <para>
17676 <indexterm role="variable">
17677 <primary><varname>$local_scan_data</varname></primary>
17678 </indexterm>
17679 This variable contains the text returned by the <function>local_scan()</function> function when
17680 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17681 </para>
17682 </listitem></varlistentry>
17683 <varlistentry>
17684 <term><varname>$local_user_gid</varname></term>
17685 <listitem>
17686 <para>
17687 <indexterm role="variable">
17688 <primary><varname>$local_user_gid</varname></primary>
17689 </indexterm>
17690 See <varname>$local_user_uid</varname>.
17691 </para>
17692 </listitem></varlistentry>
17693 <varlistentry>
17694 <term><varname>$local_user_uid</varname></term>
17695 <listitem>
17696 <para>
17697 <indexterm role="variable">
17698 <primary><varname>$local_user_uid</varname></primary>
17699 </indexterm>
17700 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17701 <option>check_local_user</option> router precondition succeeds. This means that their values
17702 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17703 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17704 router-specific expansions. At all other times, the values in these variables
17705 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17706 </para>
17707 </listitem></varlistentry>
17708 <varlistentry>
17709 <term><varname>$localhost_number</varname></term>
17710 <listitem>
17711 <para>
17712 <indexterm role="variable">
17713 <primary><varname>$localhost_number</varname></primary>
17714 </indexterm>
17715 This contains the expanded value of the
17716 <option>localhost_number</option> option. The expansion happens after the main options have
17717 been read.
17718 </para>
17719 </listitem></varlistentry>
17720 <varlistentry>
17721 <term><varname>$log_inodes</varname></term>
17722 <listitem>
17723 <para>
17724 <indexterm role="variable">
17725 <primary><varname>$log_inodes</varname></primary>
17726 </indexterm>
17727 The number of free inodes in the disk partition where Exim&#x2019;s
17728 log files are being written. The value is recalculated whenever the variable is
17729 referenced. If the relevant file system does not have the concept of inodes,
17730 the value of is -1. See also the <option>check_log_inodes</option> option.
17731 </para>
17732 </listitem></varlistentry>
17733 <varlistentry>
17734 <term><varname>$log_space</varname></term>
17735 <listitem>
17736 <para>
17737 <indexterm role="variable">
17738 <primary><varname>$log_space</varname></primary>
17739 </indexterm>
17740 The amount of free space (as a number of kilobytes) in the disk
17741 partition where Exim&#x2019;s log files are being written. The value is recalculated
17742 whenever the variable is referenced. If the operating system does not have the
17743 ability to find the amount of free space (only true for experimental systems),
17744 the space value is -1. See also the <option>check_log_space</option> option.
17745 </para>
17746 </listitem></varlistentry>
17747 <varlistentry>
17748 <term><varname>$lookup_dnssec_authenticated</varname></term>
17749 <listitem>
17750 <para>
17751 <indexterm role="variable">
17752 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
17753 </indexterm>
17754 This variable is set after a DNS lookup done by
17755 a dnsdb lookup expansion, dnslookup router or smtp transport.
17756 It will be empty if <command>DNSSEC</command> was not requested,
17757 <quote>no</quote> if the result was not labelled as authenticated data
17758 and <quote>yes</quote> if it was.
17759 </para>
17760 </listitem></varlistentry>
17761 <varlistentry>
17762 <term><varname>$mailstore_basename</varname></term>
17763 <listitem>
17764 <para>
17765 <indexterm role="variable">
17766 <primary><varname>$mailstore_basename</varname></primary>
17767 </indexterm>
17768 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
17769 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
17770 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
17771 contains the basename of the files that are being written, that is, the name
17772 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
17773 variable is empty.
17774 </para>
17775 </listitem></varlistentry>
17776 <varlistentry>
17777 <term><varname>$malware_name</varname></term>
17778 <listitem>
17779 <para>
17780 <indexterm role="variable">
17781 <primary><varname>$malware_name</varname></primary>
17782 </indexterm>
17783 This variable is available when Exim is compiled with the
17784 content-scanning extension. It is set to the name of the virus that was found
17785 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
17786 </para>
17787 </listitem></varlistentry>
17788 <varlistentry>
17789 <term><varname>$max_received_linelength</varname></term>
17790 <listitem>
17791 <para>
17792 <indexterm role="variable">
17793 <primary><varname>$max_received_linelength</varname></primary>
17794 </indexterm>
17795 <indexterm role="concept">
17796 <primary>maximum</primary>
17797 <secondary>line length</secondary>
17798 </indexterm>
17799 <indexterm role="concept">
17800 <primary>line length</primary>
17801 <secondary>maximum</secondary>
17802 </indexterm>
17803 This variable contains the number of bytes in the longest line that was
17804 received as part of the message, not counting the line termination
17805 character(s).
17806 </para>
17807 </listitem></varlistentry>
17808 <varlistentry>
17809 <term><varname>$message_age</varname></term>
17810 <listitem>
17811 <para>
17812 <indexterm role="concept">
17813 <primary>message</primary>
17814 <secondary>age of</secondary>
17815 </indexterm>
17816 <indexterm role="variable">
17817 <primary><varname>$message_age</varname></primary>
17818 </indexterm>
17819 This variable is set at the start of a delivery attempt to contain the number
17820 of seconds since the message was received. It does not change during a single
17821 delivery attempt.
17822 </para>
17823 </listitem></varlistentry>
17824 <varlistentry>
17825 <term><varname>$message_body</varname></term>
17826 <listitem>
17827 <para>
17828 <indexterm role="concept">
17829 <primary>body of message</primary>
17830 <secondary>expansion variable</secondary>
17831 </indexterm>
17832 <indexterm role="concept">
17833 <primary>message body</primary>
17834 <secondary>in expansion</secondary>
17835 </indexterm>
17836 <indexterm role="concept">
17837 <primary>binary zero</primary>
17838 <secondary>in message body</secondary>
17839 </indexterm>
17840 <indexterm role="variable">
17841 <primary><varname>$message_body</varname></primary>
17842 </indexterm>
17843 <indexterm role="option">
17844 <primary><option>message_body_visible</option></primary>
17845 </indexterm>
17846 This variable contains the initial portion of a message&#x2019;s body while it is
17847 being delivered, and is intended mainly for use in filter files. The maximum
17848 number of characters of the body that are put into the variable is set by the
17849 <option>message_body_visible</option> configuration option; the default is 500.
17850 </para>
17851 <para>
17852 <indexterm role="option">
17853 <primary><option>message_body_newlines</option></primary>
17854 </indexterm>
17855 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17856 easier to search for phrases that might be split over a line break. However,
17857 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17858 zeros are always converted into spaces.
17859 </para>
17860 </listitem></varlistentry>
17861 <varlistentry>
17862 <term><varname>$message_body_end</varname></term>
17863 <listitem>
17864 <para>
17865 <indexterm role="concept">
17866 <primary>body of message</primary>
17867 <secondary>expansion variable</secondary>
17868 </indexterm>
17869 <indexterm role="concept">
17870 <primary>message body</primary>
17871 <secondary>in expansion</secondary>
17872 </indexterm>
17873 <indexterm role="variable">
17874 <primary><varname>$message_body_end</varname></primary>
17875 </indexterm>
17876 This variable contains the final portion of a message&#x2019;s
17877 body while it is being delivered. The format and maximum size are as for
17878 <varname>$message_body</varname>.
17879 </para>
17880 </listitem></varlistentry>
17881 <varlistentry>
17882 <term><varname>$message_body_size</varname></term>
17883 <listitem>
17884 <para>
17885 <indexterm role="concept">
17886 <primary>body of message</primary>
17887 <secondary>size</secondary>
17888 </indexterm>
17889 <indexterm role="concept">
17890 <primary>message body</primary>
17891 <secondary>size</secondary>
17892 </indexterm>
17893 <indexterm role="variable">
17894 <primary><varname>$message_body_size</varname></primary>
17895 </indexterm>
17896 When a message is being delivered, this variable contains the size of the body
17897 in bytes. The count starts from the character after the blank line that
17898 separates the body from the header. Newlines are included in the count. See
17899 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17900 </para>
17901 </listitem></varlistentry>
17902 <varlistentry>
17903 <term><varname>$message_exim_id</varname></term>
17904 <listitem>
17905 <para>
17906 <indexterm role="variable">
17907 <primary><varname>$message_exim_id</varname></primary>
17908 </indexterm>
17909 When a message is being received or delivered, this variable contains the
17910 unique message id that is generated and used by Exim to identify the message.
17911 An id is not created for a message until after its header has been successfully
17912 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17913 line; it is the local id that Exim assigns to the message, for example:
17914 <literal>1BXTIK-0001yO-VA</literal>.
17915 </para>
17916 </listitem></varlistentry>
17917 <varlistentry>
17918 <term><varname>$message_headers</varname></term>
17919 <listitem>
17920 <para>
17921 <indexterm role="variable">
17922 <primary><varname>$message_headers</varname></primary>
17923 </indexterm>
17924 This variable contains a concatenation of all the header lines when a message
17925 is being processed, except for lines added by routers or transports. The header
17926 lines are separated by newline characters. Their contents are decoded in the
17927 same way as a header line that is inserted by <option>bheader</option>.
17928 </para>
17929 </listitem></varlistentry>
17930 <varlistentry>
17931 <term><varname>$message_headers_raw</varname></term>
17932 <listitem>
17933 <para>
17934 <indexterm role="variable">
17935 <primary><varname>$message_headers_raw</varname></primary>
17936 </indexterm>
17937 This variable is like <varname>$message_headers</varname> except that no processing of the
17938 contents of header lines is done.
17939 </para>
17940 </listitem></varlistentry>
17941 <varlistentry>
17942 <term><varname>$message_id</varname></term>
17943 <listitem>
17944 <para>
17945 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17946 </para>
17947 </listitem></varlistentry>
17948 <varlistentry>
17949 <term><varname>$message_linecount</varname></term>
17950 <listitem>
17951 <para>
17952 <indexterm role="variable">
17953 <primary><varname>$message_linecount</varname></primary>
17954 </indexterm>
17955 This variable contains the total number of lines in the header and body of the
17956 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17957 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17958 number of lines received. Before delivery happens (that is, before filters,
17959 routers, and transports run) the count is increased to include the
17960 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17961 lines that are added by ACLs. The blank line that separates the message header
17962 from the body is not counted.
17963 </para>
17964 <para>
17965 As with the special case of <varname>$message_size</varname>, during the expansion of the
17966 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
17967 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
17968 file that has been written (minus one for the blank line between the
17969 header and the body).
17970 </para>
17971 <para>
17972 Here is an example of the use of this variable in a DATA ACL:
17973 </para>
17974 <literallayout class="monospaced">
17975 deny message   = Too many lines in message header
17976      condition = \
17977       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
17978 </literallayout>
17979 <para>
17980 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17981 message has not yet been received.
17982 </para>
17983 </listitem></varlistentry>
17984 <varlistentry>
17985 <term><varname>$message_size</varname></term>
17986 <listitem>
17987 <para>
17988 <indexterm role="concept">
17989 <primary>size</primary>
17990 <secondary>of message</secondary>
17991 </indexterm>
17992 <indexterm role="concept">
17993 <primary>message</primary>
17994 <secondary>size</secondary>
17995 </indexterm>
17996 <indexterm role="variable">
17997 <primary><varname>$message_size</varname></primary>
17998 </indexterm>
17999 When a message is being processed, this variable contains its size in bytes. In
18000 most cases, the size includes those headers that were received with the
18001 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18002 deliveries as they are written. However, there is one special case: during the
18003 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18004 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18005 precise size of the file that has been written. See also
18006 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18007 </para>
18008 <para>
18009 <indexterm role="concept">
18010 <primary>RCPT</primary>
18011 <secondary>value of <varname>$message_size</varname></secondary>
18012 </indexterm>
18013 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18014 contains the size supplied on the MAIL command, or -1 if no size was given. The
18015 value may not, of course, be truthful.
18016 </para>
18017 </listitem></varlistentry>
18018 <varlistentry>
18019 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18020 <listitem>
18021 <para>
18022 A number of variables whose names start with <varname>$mime</varname> are
18023 available when Exim is compiled with the content-scanning extension. For
18024 details, see section <xref linkend="SECTscanmimepart"/>.
18025 </para>
18026 </listitem></varlistentry>
18027 <varlistentry>
18028 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18029 <listitem>
18030 <para>
18031 These variables are counters that can be incremented by means
18032 of the <option>add</option> command in filter files.
18033 </para>
18034 </listitem></varlistentry>
18035 <varlistentry>
18036 <term><varname>$original_domain</varname></term>
18037 <listitem>
18038 <para>
18039 <indexterm role="variable">
18040 <primary><varname>$domain</varname></primary>
18041 </indexterm>
18042 <indexterm role="variable">
18043 <primary><varname>$original_domain</varname></primary>
18044 </indexterm>
18045 When a top-level address is being processed for delivery, this contains the
18046 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18047 generated by an alias, forward, or filter file) is being processed, this
18048 variable contains the domain of the original address (lower cased). This
18049 differs from <varname>$parent_domain</varname> only when there is more than one level of
18050 aliasing or forwarding. When more than one address is being delivered in a
18051 single transport run, <varname>$original_domain</varname> is not set.
18052 </para>
18053 <para>
18054 If a new address is created by means of a <option>deliver</option> command in a system
18055 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18056 part <emphasis>system-filter</emphasis> and the default qualify domain.
18057 </para>
18058 </listitem></varlistentry>
18059 <varlistentry>
18060 <term><varname>$original_local_part</varname></term>
18061 <listitem>
18062 <para>
18063 <indexterm role="variable">
18064 <primary><varname>$local_part</varname></primary>
18065 </indexterm>
18066 <indexterm role="variable">
18067 <primary><varname>$original_local_part</varname></primary>
18068 </indexterm>
18069 When a top-level address is being processed for delivery, this contains the
18070 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18071 local part, because <varname>$original_local_part</varname> always contains the full local
18072 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18073 filter file) is being processed, this variable contains the full local part of
18074 the original address.
18075 </para>
18076 <para>
18077 If the router that did the redirection processed the local part
18078 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18079 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18080 one level of aliasing or forwarding. When more than one address is being
18081 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18082 </para>
18083 <para>
18084 If a new address is created by means of a <option>deliver</option> command in a system
18085 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18086 part <emphasis>system-filter</emphasis> and the default qualify domain.
18087 </para>
18088 </listitem></varlistentry>
18089 <varlistentry>
18090 <term><varname>$originator_gid</varname></term>
18091 <listitem>
18092 <para>
18093 <indexterm role="concept">
18094 <primary>gid (group id)</primary>
18095 <secondary>of originating user</secondary>
18096 </indexterm>
18097 <indexterm role="concept">
18098 <primary>sender</primary>
18099 <secondary>gid</secondary>
18100 </indexterm>
18101 <indexterm role="variable">
18102 <primary><varname>$caller_gid</varname></primary>
18103 </indexterm>
18104 <indexterm role="variable">
18105 <primary><varname>$originator_gid</varname></primary>
18106 </indexterm>
18107 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18108 message was received. For messages received via the command line, this is the
18109 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18110 normally the gid of the Exim user.
18111 </para>
18112 </listitem></varlistentry>
18113 <varlistentry>
18114 <term><varname>$originator_uid</varname></term>
18115 <listitem>
18116 <para>
18117 <indexterm role="concept">
18118 <primary>uid (user id)</primary>
18119 <secondary>of originating user</secondary>
18120 </indexterm>
18121 <indexterm role="concept">
18122 <primary>sender</primary>
18123 <secondary>uid</secondary>
18124 </indexterm>
18125 <indexterm role="variable">
18126 <primary><varname>$caller_uid</varname></primary>
18127 </indexterm>
18128 <indexterm role="variable">
18129 <primary><varname>$originaltor_uid</varname></primary>
18130 </indexterm>
18131 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18132 messages received via the command line, this is the uid of the sending user.
18133 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18134 user.
18135 </para>
18136 </listitem></varlistentry>
18137 <varlistentry>
18138 <term><varname>$parent_domain</varname></term>
18139 <listitem>
18140 <para>
18141 <indexterm role="variable">
18142 <primary><varname>$parent_domain</varname></primary>
18143 </indexterm>
18144 This variable is similar to <varname>$original_domain</varname> (see
18145 above), except that it refers to the immediately preceding parent address.
18146 </para>
18147 </listitem></varlistentry>
18148 <varlistentry>
18149 <term><varname>$parent_local_part</varname></term>
18150 <listitem>
18151 <para>
18152 <indexterm role="variable">
18153 <primary><varname>$parent_local_part</varname></primary>
18154 </indexterm>
18155 This variable is similar to <varname>$original_local_part</varname>
18156 (see above), except that it refers to the immediately preceding parent address.
18157 </para>
18158 </listitem></varlistentry>
18159 <varlistentry>
18160 <term><varname>$pid</varname></term>
18161 <listitem>
18162 <para>
18163 <indexterm role="concept">
18164 <primary>pid (process id)</primary>
18165 <secondary>of current process</secondary>
18166 </indexterm>
18167 <indexterm role="variable">
18168 <primary><varname>$pid</varname></primary>
18169 </indexterm>
18170 This variable contains the current process id.
18171 </para>
18172 </listitem></varlistentry>
18173 <varlistentry>
18174 <term><varname>$pipe_addresses</varname></term>
18175 <listitem>
18176 <para>
18177 <indexterm role="concept">
18178 <primary>filter</primary>
18179 <secondary>transport filter</secondary>
18180 </indexterm>
18181 <indexterm role="concept">
18182 <primary>transport</primary>
18183 <secondary>filter</secondary>
18184 </indexterm>
18185 <indexterm role="variable">
18186 <primary><varname>$pipe_addresses</varname></primary>
18187 </indexterm>
18188 This is not an expansion variable, but is mentioned here because the string
18189 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18190 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18191 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18192 It cannot be used in general expansion strings, and provokes an <quote>unknown
18193 variable</quote> error if encountered.
18194 </para>
18195 </listitem></varlistentry>
18196 <varlistentry>
18197 <term><varname>$primary_hostname</varname></term>
18198 <listitem>
18199 <para>
18200 <indexterm role="variable">
18201 <primary><varname>$primary_hostname</varname></primary>
18202 </indexterm>
18203 This variable contains the value set by <option>primary_hostname</option> in the
18204 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18205 a single-component name, Exim calls <function>gethostbyname()</function> (or
18206 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18207 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18208 </para>
18209 </listitem></varlistentry>
18210 <varlistentry>
18211 <term><varname>$prvscheck_address</varname></term>
18212 <listitem>
18213 <para>
18214 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18215 which is described in sections <xref linkend="SECTexpansionitems"/> and
18216 <xref linkend="SECTverifyPRVS"/>.
18217 </para>
18218 </listitem></varlistentry>
18219 <varlistentry>
18220 <term><varname>$prvscheck_keynum</varname></term>
18221 <listitem>
18222 <para>
18223 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18224 which is described in sections <xref linkend="SECTexpansionitems"/> and
18225 <xref linkend="SECTverifyPRVS"/>.
18226 </para>
18227 </listitem></varlistentry>
18228 <varlistentry>
18229 <term><varname>$prvscheck_result</varname></term>
18230 <listitem>
18231 <para>
18232 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18233 which is described in sections <xref linkend="SECTexpansionitems"/> and
18234 <xref linkend="SECTverifyPRVS"/>.
18235 </para>
18236 </listitem></varlistentry>
18237 <varlistentry>
18238 <term><varname>$qualify_domain</varname></term>
18239 <listitem>
18240 <para>
18241 <indexterm role="variable">
18242 <primary><varname>$qualify_domain</varname></primary>
18243 </indexterm>
18244 The value set for the <option>qualify_domain</option> option in the configuration file.
18245 </para>
18246 </listitem></varlistentry>
18247 <varlistentry>
18248 <term><varname>$qualify_recipient</varname></term>
18249 <listitem>
18250 <para>
18251 <indexterm role="variable">
18252 <primary><varname>$qualify_recipient</varname></primary>
18253 </indexterm>
18254 The value set for the <option>qualify_recipient</option> option in the configuration file,
18255 or if not set, the value of <varname>$qualify_domain</varname>.
18256 </para>
18257 </listitem></varlistentry>
18258 <varlistentry>
18259 <term><varname>$rcpt_count</varname></term>
18260 <listitem>
18261 <para>
18262 <indexterm role="variable">
18263 <primary><varname>$rcpt_count</varname></primary>
18264 </indexterm>
18265 When a message is being received by SMTP, this variable contains the number of
18266 RCPT commands received for the current message. If this variable is used in a
18267 RCPT ACL, its value includes the current command.
18268 </para>
18269 </listitem></varlistentry>
18270 <varlistentry>
18271 <term><varname>$rcpt_defer_count</varname></term>
18272 <listitem>
18273 <para>
18274 <indexterm role="variable">
18275 <primary><varname>$rcpt_defer_count</varname></primary>
18276 </indexterm>
18277 <indexterm role="concept">
18278 <primary>4<emphasis>xx</emphasis> responses</primary>
18279 <secondary>count of</secondary>
18280 </indexterm>
18281 When a message is being received by SMTP, this variable contains the number of
18282 RCPT commands in the current message that have previously been rejected with a
18283 temporary (4<emphasis>xx</emphasis>) response.
18284 </para>
18285 </listitem></varlistentry>
18286 <varlistentry>
18287 <term><varname>$rcpt_fail_count</varname></term>
18288 <listitem>
18289 <para>
18290 <indexterm role="variable">
18291 <primary><varname>$rcpt_fail_count</varname></primary>
18292 </indexterm>
18293 When a message is being received by SMTP, this variable contains the number of
18294 RCPT commands in the current message that have previously been rejected with a
18295 permanent (5<emphasis>xx</emphasis>) response.
18296 </para>
18297 </listitem></varlistentry>
18298 <varlistentry>
18299 <term><varname>$received_count</varname></term>
18300 <listitem>
18301 <para>
18302 <indexterm role="variable">
18303 <primary><varname>$received_count</varname></primary>
18304 </indexterm>
18305 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18306 including the one added by Exim (so its value is always greater than zero). It
18307 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18308 delivering.
18309 </para>
18310 </listitem></varlistentry>
18311 <varlistentry>
18312 <term><varname>$received_for</varname></term>
18313 <listitem>
18314 <para>
18315 <indexterm role="variable">
18316 <primary><varname>$received_for</varname></primary>
18317 </indexterm>
18318 If there is only a single recipient address in an incoming message, this
18319 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18320 built. The value is copied after recipient rewriting has happened, but before
18321 the <function>local_scan()</function> function is run.
18322 </para>
18323 </listitem></varlistentry>
18324 <varlistentry>
18325 <term><varname>$received_ip_address</varname></term>
18326 <listitem>
18327 <para>
18328 <indexterm role="variable">
18329 <primary><varname>$received_ip_address</varname></primary>
18330 </indexterm>
18331 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18332 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18333 is set to the local port number. (The remote IP address and port are in
18334 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18335 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18336 option.
18337 </para>
18338 <para>
18339 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18340 could be used, for example, to make the file name for a TLS certificate depend
18341 on which interface and/or port is being used for the incoming connection. The
18342 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18343 messages that are received, thus making these variables available at delivery
18344 time.
18345 </para>
18346 <para>
18347 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
18348 the values are unknown (unless they are explicitly set by options of the
18349 <command>smtp</command> transport).
18350 </para>
18351 </listitem></varlistentry>
18352 <varlistentry>
18353 <term><varname>$received_port</varname></term>
18354 <listitem>
18355 <para>
18356 <indexterm role="variable">
18357 <primary><varname>$received_port</varname></primary>
18358 </indexterm>
18359 See <varname>$received_ip_address</varname>.
18360 </para>
18361 </listitem></varlistentry>
18362 <varlistentry>
18363 <term><varname>$received_protocol</varname></term>
18364 <listitem>
18365 <para>
18366 <indexterm role="variable">
18367 <primary><varname>$received_protocol</varname></primary>
18368 </indexterm>
18369 When a message is being processed, this variable contains the name of the
18370 protocol by which it was received. Most of the names used by Exim are defined
18371 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18372 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18373 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18374 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18375 connection and the client was successfully authenticated.
18376 </para>
18377 <para>
18378 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18379 automatically set up on connection without the use of STARTTLS (see
18380 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18381 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18382 where the client initially uses EHLO, sets up an encrypted connection using
18383 STARTTLS, and then uses HELO afterwards.
18384 </para>
18385 <para>
18386 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18387 messages that are injected locally by trusted callers. This is commonly used to
18388 identify messages that are being re-injected after some kind of scanning.
18389 </para>
18390 </listitem></varlistentry>
18391 <varlistentry>
18392 <term><varname>$received_time</varname></term>
18393 <listitem>
18394 <para>
18395 <indexterm role="variable">
18396 <primary><varname>$received_time</varname></primary>
18397 </indexterm>
18398 This variable contains the date and time when the current message was received,
18399 as a number of seconds since the start of the Unix epoch.
18400 </para>
18401 </listitem></varlistentry>
18402 <varlistentry>
18403 <term><varname>$recipient_data</varname></term>
18404 <listitem>
18405 <para>
18406 <indexterm role="variable">
18407 <primary><varname>$recipient_data</varname></primary>
18408 </indexterm>
18409 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18410 condition. It contains the data from the lookup, and the value remains set
18411 until the next <option>recipients</option> test. Thus, you can do things like this:
18412 </para>
18413 <literallayout>
18414 <literal>require recipients  = cdb*@;/some/file</literal>
18415 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18416 </literallayout>
18417 <para>
18418 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18419 method in the address list, using the semicolon syntax as in the example above.
18420 The variable is not set for a lookup that is used as part of the string
18421 expansion that all such lists undergo before being interpreted.
18422 </para>
18423 </listitem></varlistentry>
18424 <varlistentry>
18425 <term><varname>$recipient_verify_failure</varname></term>
18426 <listitem>
18427 <para>
18428 <indexterm role="variable">
18429 <primary><varname>$recipient_verify_failure</varname></primary>
18430 </indexterm>
18431 In an ACL, when a recipient verification fails, this variable contains
18432 information about the failure. It is set to one of the following words:
18433 </para>
18434 <itemizedlist>
18435 <listitem>
18436 <para>
18437 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18438 was neither local nor came from an exempted host.
18439 </para>
18440 </listitem>
18441 <listitem>
18442 <para>
18443 <quote>route</quote>: Routing failed.
18444 </para>
18445 </listitem>
18446 <listitem>
18447 <para>
18448 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18449 or before the MAIL command (that is, on initial connection, HELO, or
18450 MAIL).
18451 </para>
18452 </listitem>
18453 <listitem>
18454 <para>
18455 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18456 </para>
18457 </listitem>
18458 <listitem>
18459 <para>
18460 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18461 </para>
18462 </listitem>
18463 </itemizedlist>
18464 <para>
18465 The main use of this variable is expected to be to distinguish between
18466 rejections of MAIL and rejections of RCPT.
18467 </para>
18468 </listitem></varlistentry>
18469 <varlistentry>
18470 <term><varname>$recipients</varname></term>
18471 <listitem>
18472 <para>
18473 <indexterm role="variable">
18474 <primary><varname>$recipients</varname></primary>
18475 </indexterm>
18476 This variable contains a list of envelope recipients for a message. A comma and
18477 a space separate the addresses in the replacement text. However, the variable
18478 is not generally available, to prevent exposure of Bcc recipients in
18479 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18480 cases:
18481 </para>
18482 <orderedlist numeration="arabic">
18483 <listitem>
18484 <para>
18485 In a system filter file.
18486 </para>
18487 </listitem>
18488 <listitem>
18489 <para>
18490 In the ACLs associated with the DATA command and with non-SMTP messages, that
18491 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18492 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18493 <option>acl_not_smtp_mime</option>.
18494 </para>
18495 </listitem>
18496 <listitem>
18497 <para>
18498 From within a <function>local_scan()</function> function.
18499 </para>
18500 </listitem>
18501 </orderedlist>
18502 </listitem></varlistentry>
18503 <varlistentry>
18504 <term><varname>$recipients_count</varname></term>
18505 <listitem>
18506 <para>
18507 <indexterm role="variable">
18508 <primary><varname>$recipients_count</varname></primary>
18509 </indexterm>
18510 When a message is being processed, this variable contains the number of
18511 envelope recipients that came with the message. Duplicates are not excluded
18512 from the count. While a message is being received over SMTP, the number
18513 increases for each accepted recipient. It can be referenced in an ACL.
18514 </para>
18515 </listitem></varlistentry>
18516 <varlistentry>
18517 <term><varname>$regex_match_string</varname></term>
18518 <listitem>
18519 <para>
18520 <indexterm role="variable">
18521 <primary><varname>$regex_match_string</varname></primary>
18522 </indexterm>
18523 This variable is set to contain the matching regular expression after a
18524 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18525 </para>
18526 </listitem></varlistentry>
18527 <varlistentry>
18528 <term><varname>$reply_address</varname></term>
18529 <listitem>
18530 <para>
18531 <indexterm role="variable">
18532 <primary><varname>$reply_address</varname></primary>
18533 </indexterm>
18534 When a message is being processed, this variable contains the contents of the
18535 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18536 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18537 white space, the value is not processed in any way. In particular, no RFC 2047
18538 decoding or character code translation takes place.
18539 </para>
18540 </listitem></varlistentry>
18541 <varlistentry>
18542 <term><varname>$return_path</varname></term>
18543 <listitem>
18544 <para>
18545 <indexterm role="variable">
18546 <primary><varname>$return_path</varname></primary>
18547 </indexterm>
18548 When a message is being delivered, this variable contains the return path &ndash;
18549 the sender field that will be sent as part of the envelope. It is not enclosed
18550 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18551 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18552 mailing list has been expanded by a router which specifies a different address
18553 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18554 address, whereas <varname>$sender_address</varname> always contains the original sender address
18555 that was received with the message. In other words, <varname>$sender_address</varname> contains
18556 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18557 envelope sender.
18558 </para>
18559 </listitem></varlistentry>
18560 <varlistentry>
18561 <term><varname>$return_size_limit</varname></term>
18562 <listitem>
18563 <para>
18564 <indexterm role="variable">
18565 <primary><varname>$return_size_limit</varname></primary>
18566 </indexterm>
18567 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18568 </para>
18569 </listitem></varlistentry>
18570 <varlistentry>
18571 <term><varname>$router_name</varname></term>
18572 <listitem>
18573 <para>
18574 <indexterm role="concept">
18575 <primary>router</primary>
18576 <secondary>name</secondary>
18577 </indexterm>
18578 <indexterm role="concept">
18579 <primary>name</primary>
18580 <secondary>of router</secondary>
18581 </indexterm>
18582 <indexterm role="variable">
18583 <primary><varname>$router_name</varname></primary>
18584 </indexterm>
18585 During the running of a router this variable contains its name.
18586 </para>
18587 </listitem></varlistentry>
18588 <varlistentry>
18589 <term><varname>$runrc</varname></term>
18590 <listitem>
18591 <para>
18592 <indexterm role="concept">
18593 <primary>return code</primary>
18594 <secondary>from <option>run</option> expansion</secondary>
18595 </indexterm>
18596 <indexterm role="variable">
18597 <primary><varname>$runrc</varname></primary>
18598 </indexterm>
18599 This variable contains the return code from a command that is run by the
18600 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18601 assume the order in which option values are expanded, except for those
18602 preconditions whose order of testing is documented. Therefore, you cannot
18603 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18604 another.
18605 </para>
18606 </listitem></varlistentry>
18607 <varlistentry>
18608 <term><varname>$self_hostname</varname></term>
18609 <listitem>
18610 <para>
18611 <indexterm role="option">
18612 <primary><option>self</option></primary>
18613 <secondary>value of host name</secondary>
18614 </indexterm>
18615 <indexterm role="variable">
18616 <primary><varname>$self_hostname</varname></primary>
18617 </indexterm>
18618 When an address is routed to a supposedly remote host that turns out to be the
18619 local host, what happens is controlled by the <option>self</option> generic router option.
18620 One of its values causes the address to be passed to another router. When this
18621 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18622 original router encountered. In other circumstances its contents are null.
18623 </para>
18624 </listitem></varlistentry>
18625 <varlistentry>
18626 <term><varname>$sender_address</varname></term>
18627 <listitem>
18628 <para>
18629 <indexterm role="variable">
18630 <primary><varname>$sender_address</varname></primary>
18631 </indexterm>
18632 When a message is being processed, this variable contains the sender&#x2019;s address
18633 that was received in the message&#x2019;s envelope. The case of letters in the address
18634 is retained, in both the local part and the domain. For bounce messages, the
18635 value of this variable is the empty string. See also <varname>$return_path</varname>.
18636 </para>
18637 </listitem></varlistentry>
18638 <varlistentry>
18639 <term><varname>$sender_address_data</varname></term>
18640 <listitem>
18641 <para>
18642 <indexterm role="variable">
18643 <primary><varname>$address_data</varname></primary>
18644 </indexterm>
18645 <indexterm role="variable">
18646 <primary><varname>$sender_address_data</varname></primary>
18647 </indexterm>
18648 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18649 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18650 distinguish it from data from a recipient address. The value does not persist
18651 after the end of the current ACL statement. If you want to preserve it for
18652 longer, you can save it in an ACL variable.
18653 </para>
18654 </listitem></varlistentry>
18655 <varlistentry>
18656 <term><varname>$sender_address_domain</varname></term>
18657 <listitem>
18658 <para>
18659 <indexterm role="variable">
18660 <primary><varname>$sender_address_domain</varname></primary>
18661 </indexterm>
18662 The domain portion of <varname>$sender_address</varname>.
18663 </para>
18664 </listitem></varlistentry>
18665 <varlistentry>
18666 <term><varname>$sender_address_local_part</varname></term>
18667 <listitem>
18668 <para>
18669 <indexterm role="variable">
18670 <primary><varname>$sender_address_local_part</varname></primary>
18671 </indexterm>
18672 The local part portion of <varname>$sender_address</varname>.
18673 </para>
18674 </listitem></varlistentry>
18675 <varlistentry>
18676 <term><varname>$sender_data</varname></term>
18677 <listitem>
18678 <para>
18679 <indexterm role="variable">
18680 <primary><varname>$sender_data</varname></primary>
18681 </indexterm>
18682 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18683 in a router <option>senders</option> option. It contains the data from the lookup, and the
18684 value remains set until the next <option>senders</option> test. Thus, you can do things like
18685 this:
18686 </para>
18687 <literallayout>
18688 <literal>require senders      = cdb*@;/some/file</literal>
18689 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18690 </literallayout>
18691 <para>
18692 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18693 method in the address list, using the semicolon syntax as in the example above.
18694 The variable is not set for a lookup that is used as part of the string
18695 expansion that all such lists undergo before being interpreted.
18696 </para>
18697 </listitem></varlistentry>
18698 <varlistentry>
18699 <term><varname>$sender_fullhost</varname></term>
18700 <listitem>
18701 <para>
18702 <indexterm role="variable">
18703 <primary><varname>$sender_fullhost</varname></primary>
18704 </indexterm>
18705 When a message is received from a remote host, this variable contains the host
18706 name and IP address in a single string. It ends with the IP address in square
18707 brackets, followed by a colon and a port number if the logging of ports is
18708 enabled. The format of the rest of the string depends on whether the host
18709 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18710 looking up its IP address. (Looking up the IP address can be forced by the
18711 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18712 start of the string is a verified host name; if this is not present,
18713 verification either failed or was not requested. A host name in parentheses is
18714 the argument of a HELO or EHLO command. This is omitted if it is identical to
18715 the verified host name or to the host&#x2019;s IP address in square brackets.
18716 </para>
18717 </listitem></varlistentry>
18718 <varlistentry>
18719 <term><varname>$sender_helo_name</varname></term>
18720 <listitem>
18721 <para>
18722 <indexterm role="variable">
18723 <primary><varname>$sender_helo_name</varname></primary>
18724 </indexterm>
18725 When a message is received from a remote host that has issued a HELO or EHLO
18726 command, the argument of that command is placed in this variable. It is also
18727 set if HELO or EHLO is used when a message is received using SMTP locally via
18728 the <option>-bs</option> or <option>-bS</option> options.
18729 </para>
18730 </listitem></varlistentry>
18731 <varlistentry>
18732 <term><varname>$sender_host_address</varname></term>
18733 <listitem>
18734 <para>
18735 <indexterm role="variable">
18736 <primary><varname>$sender_host_address</varname></primary>
18737 </indexterm>
18738 When a message is received from a remote host, this variable contains that
18739 host&#x2019;s IP address. For locally submitted messages, it is empty.
18740 </para>
18741 </listitem></varlistentry>
18742 <varlistentry>
18743 <term><varname>$sender_host_authenticated</varname></term>
18744 <listitem>
18745 <para>
18746 <indexterm role="variable">
18747 <primary><varname>$sender_host_authenticated</varname></primary>
18748 </indexterm>
18749 This variable contains the name (not the public name) of the authenticator
18750 driver that successfully authenticated the client from which the message was
18751 received. It is empty if there was no successful authentication. See also
18752 <varname>$authenticated_id</varname>.
18753 </para>
18754 </listitem></varlistentry>
18755 <varlistentry>
18756 <term><varname>$sender_host_dnssec</varname></term>
18757 <listitem>
18758 <para>
18759 <indexterm role="variable">
18760 <primary><varname>$sender_host_dnssec</varname></primary>
18761 </indexterm>
18762 If an attempt to populate <varname>$sender_host_name</varname> has been made
18763 (by reference, <option>hosts_lookup</option> or
18764 otherwise) then this boolean will have been set true if, and only if, the
18765 resolver library states that the reverse DNS was authenticated data.  At all
18766 other times, this variable is false.
18767 </para>
18768 <para>
18769 It is likely that you will need to coerce DNSSEC support on in the resolver
18770 library, by setting:
18771 </para>
18772 <literallayout class="monospaced">
18773 dns_dnssec_ok = 1
18774 </literallayout>
18775 <para>
18776 Exim does not perform DNSSEC validation itself, instead leaving that to a
18777 validating resolver (eg, unbound, or bind with suitable configuration).
18778 </para>
18779 <para>
18780 Exim does not (currently) check to see if the forward DNS was also secured
18781 with DNSSEC, only the reverse DNS.
18782 </para>
18783 <para>
18784 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
18785 mechanism in the list, then this variable will be false.
18786 </para>
18787 </listitem></varlistentry>
18788 <varlistentry>
18789 <term><varname>$sender_host_name</varname></term>
18790 <listitem>
18791 <para>
18792 <indexterm role="variable">
18793 <primary><varname>$sender_host_name</varname></primary>
18794 </indexterm>
18795 When a message is received from a remote host, this variable contains the
18796 host&#x2019;s name as obtained by looking up its IP address. For messages received by
18797 other means, this variable is empty.
18798 </para>
18799 <para>
18800 <indexterm role="variable">
18801 <primary><varname>$host_lookup_failed</varname></primary>
18802 </indexterm>
18803 If the host name has not previously been looked up, a reference to
18804 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
18805 A looked up name is accepted only if it leads back to the original IP address
18806 via a forward lookup. If either the reverse or the forward lookup fails to find
18807 any data, or if the forward lookup does not yield the original IP address,
18808 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18809 </para>
18810 <para>
18811 <indexterm role="variable">
18812 <primary><varname>$host_lookup_deferred</varname></primary>
18813 </indexterm>
18814 However, if either of the lookups cannot be completed (for example, there is a
18815 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
18816 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
18817 </para>
18818 <para>
18819 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
18820 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
18821 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
18822 is set to <quote>1</quote>.
18823 </para>
18824 <para>
18825 Exim does not automatically look up every calling host&#x2019;s name. If you want
18826 maximum efficiency, you should arrange your configuration so that it avoids
18827 these lookups altogether. The lookup happens only if one or more of the
18828 following are true:
18829 </para>
18830 <itemizedlist>
18831 <listitem>
18832 <para>
18833 A string containing <varname>$sender_host_name</varname> is expanded.
18834 </para>
18835 </listitem>
18836 <listitem>
18837 <para>
18838 The calling host matches the list in <option>host_lookup</option>. In the default
18839 configuration, this option is set to *, so it must be changed if lookups are
18840 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
18841 </para>
18842 </listitem>
18843 <listitem>
18844 <para>
18845 Exim needs the host name in order to test an item in a host list. The items
18846 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
18847 <xref linkend="SECThoslispatnamsk"/>.
18848 </para>
18849 </listitem>
18850 <listitem>
18851 <para>
18852 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
18853 In this case, the host name is required to compare with the name quoted in any
18854 EHLO or HELO commands that the client issues.
18855 </para>
18856 </listitem>
18857 <listitem>
18858 <para>
18859 The remote host issues a EHLO or HELO command that quotes one of the
18860 domains in <option>helo_lookup_domains</option>. The default value of this option is
18861 </para>
18862 <literallayout class="monospaced">
18863   helo_lookup_domains = @ : @[]
18864 </literallayout>
18865 <para>
18866 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
18867 IP address in an EHLO or HELO command.
18868 </para>
18869 </listitem>
18870 </itemizedlist>
18871 </listitem></varlistentry>
18872 <varlistentry>
18873 <term><varname>$sender_host_port</varname></term>
18874 <listitem>
18875 <para>
18876 <indexterm role="variable">
18877 <primary><varname>$sender_host_port</varname></primary>
18878 </indexterm>
18879 When a message is received from a remote host, this variable contains the port
18880 number that was used on the remote host.
18881 </para>
18882 </listitem></varlistentry>
18883 <varlistentry>
18884 <term><varname>$sender_ident</varname></term>
18885 <listitem>
18886 <para>
18887 <indexterm role="variable">
18888 <primary><varname>$sender_ident</varname></primary>
18889 </indexterm>
18890 When a message is received from a remote host, this variable contains the
18891 identification received in response to an RFC 1413 request. When a message has
18892 been received locally, this variable contains the login name of the user that
18893 called Exim.
18894 </para>
18895 </listitem></varlistentry>
18896 <varlistentry>
18897 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18898 <listitem>
18899 <para>
18900 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18901 <option>ratelimit</option> ACL condition. Details are given in section
18902 <xref linkend="SECTratelimiting"/>.
18903 </para>
18904 </listitem></varlistentry>
18905 <varlistentry>
18906 <term><varname>$sender_rcvhost</varname></term>
18907 <listitem>
18908 <para>
18909 <indexterm role="concept">
18910 <primary>DNS</primary>
18911 <secondary>reverse lookup</secondary>
18912 </indexterm>
18913 <indexterm role="concept">
18914 <primary>reverse DNS lookup</primary>
18915 </indexterm>
18916 <indexterm role="variable">
18917 <primary><varname>$sender_rcvhost</varname></primary>
18918 </indexterm>
18919 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
18920 either the verified host name (as obtained from a reverse DNS lookup) or, if
18921 there is no verified host name, the IP address in square brackets. After that
18922 there may be text in parentheses. When the first item is a verified host name,
18923 the first thing in the parentheses is the IP address in square brackets,
18924 followed by a colon and a port number if port logging is enabled. When the
18925 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
18926 the parentheses.
18927 </para>
18928 <para>
18929 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
18930 was used and its argument was not identical to the real host name or IP
18931 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
18932 all three items are present in the parentheses, a newline and tab are inserted
18933 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
18934 </para>
18935 </listitem></varlistentry>
18936 <varlistentry>
18937 <term><varname>$sender_verify_failure</varname></term>
18938 <listitem>
18939 <para>
18940 <indexterm role="variable">
18941 <primary><varname>$sender_verify_failure</varname></primary>
18942 </indexterm>
18943 In an ACL, when a sender verification fails, this variable contains information
18944 about the failure. The details are the same as for
18945 <varname>$recipient_verify_failure</varname>.
18946 </para>
18947 </listitem></varlistentry>
18948 <varlistentry>
18949 <term><varname>$sending_ip_address</varname></term>
18950 <listitem>
18951 <para>
18952 <indexterm role="variable">
18953 <primary><varname>$sending_ip_address</varname></primary>
18954 </indexterm>
18955 This variable is set whenever an outgoing SMTP connection to another host has
18956 been set up. It contains the IP address of the local interface that is being
18957 used. This is useful if a host that has more than one IP address wants to take
18958 on different personalities depending on which one is being used. For incoming
18959 connections, see <varname>$received_ip_address</varname>.
18960 </para>
18961 </listitem></varlistentry>
18962 <varlistentry>
18963 <term><varname>$sending_port</varname></term>
18964 <listitem>
18965 <para>
18966 <indexterm role="variable">
18967 <primary><varname>$sending_port</varname></primary>
18968 </indexterm>
18969 This variable is set whenever an outgoing SMTP connection to another host has
18970 been set up. It contains the local port that is being used. For incoming
18971 connections, see <varname>$received_port</varname>.
18972 </para>
18973 </listitem></varlistentry>
18974 <varlistentry>
18975 <term><varname>$smtp_active_hostname</varname></term>
18976 <listitem>
18977 <para>
18978 <indexterm role="variable">
18979 <primary><varname>$smtp_active_hostname</varname></primary>
18980 </indexterm>
18981 During an incoming SMTP session, this variable contains the value of the active
18982 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18983 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18984 value can be consulted during routing and delivery.
18985 </para>
18986 </listitem></varlistentry>
18987 <varlistentry>
18988 <term><varname>$smtp_command</varname></term>
18989 <listitem>
18990 <para>
18991 <indexterm role="variable">
18992 <primary><varname>$smtp_command</varname></primary>
18993 </indexterm>
18994 During the processing of an incoming SMTP command, this variable contains the
18995 entire command. This makes it possible to distinguish between HELO and EHLO in
18996 the HELO ACL, and also to distinguish between commands such as these:
18997 </para>
18998 <literallayout class="monospaced">
18999 MAIL FROM:&lt;&gt;
19000 MAIL FROM: &lt;&gt;
19001 </literallayout>
19002 <para>
19003 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19004 command, the address in <varname>$smtp_command</varname> is the original address before any
19005 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19006 the address after SMTP-time rewriting.
19007 </para>
19008 </listitem></varlistentry>
19009 <varlistentry>
19010 <term><varname>$smtp_command_argument</varname></term>
19011 <listitem>
19012 <para>
19013 <indexterm role="concept">
19014 <primary>SMTP</primary>
19015 <secondary>command, argument for</secondary>
19016 </indexterm>
19017 <indexterm role="variable">
19018 <primary><varname>$smtp_command_argument</varname></primary>
19019 </indexterm>
19020 While an ACL is running to check an SMTP command, this variable contains the
19021 argument, that is, the text that follows the command name, with leading white
19022 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19023 somewhat redundant, but is retained for backwards compatibility.
19024 </para>
19025 </listitem></varlistentry>
19026 <varlistentry>
19027 <term><varname>$smtp_count_at_connection_start</varname></term>
19028 <listitem>
19029 <para>
19030 <indexterm role="variable">
19031 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19032 </indexterm>
19033 This variable is set greater than zero only in processes spawned by the Exim
19034 daemon for handling incoming SMTP connections. The name is deliberately long,
19035 in order to emphasize what the contents are. When the daemon accepts a new
19036 connection, it increments this variable. A copy of the variable is passed to
19037 the child process that handles the connection, but its value is fixed, and
19038 never changes. It is only an approximation of how many incoming connections
19039 there actually are, because many other connections may come and go while a
19040 single connection is being processed. When a child process terminates, the
19041 daemon decrements its copy of the variable.
19042 </para>
19043 </listitem></varlistentry>
19044 <varlistentry>
19045 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19046 <listitem>
19047 <para>
19048 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19049 that were current at the end of the system filter file. This allows a system
19050 filter file to set values that can be tested in users&#x2019; filter files. For
19051 example, a system filter could set a value indicating how likely it is that a
19052 message is junk mail.
19053 </para>
19054 </listitem></varlistentry>
19055 <varlistentry>
19056 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19057 <listitem>
19058 <para>
19059 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19060 is compiled with the content-scanning extension. For details, see section
19061 <xref linkend="SECTscanspamass"/>.
19062 </para>
19063 </listitem></varlistentry>
19064 <varlistentry>
19065 <term><varname>$spool_directory</varname></term>
19066 <listitem>
19067 <para>
19068 <indexterm role="variable">
19069 <primary><varname>$spool_directory</varname></primary>
19070 </indexterm>
19071 The name of Exim&#x2019;s spool directory.
19072 </para>
19073 </listitem></varlistentry>
19074 <varlistentry>
19075 <term><varname>$spool_inodes</varname></term>
19076 <listitem>
19077 <para>
19078 <indexterm role="variable">
19079 <primary><varname>$spool_inodes</varname></primary>
19080 </indexterm>
19081 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19082 being written. The value is recalculated whenever the variable is referenced.
19083 If the relevant file system does not have the concept of inodes, the value of
19084 is -1. See also the <option>check_spool_inodes</option> option.
19085 </para>
19086 </listitem></varlistentry>
19087 <varlistentry>
19088 <term><varname>$spool_space</varname></term>
19089 <listitem>
19090 <para>
19091 <indexterm role="variable">
19092 <primary><varname>$spool_space</varname></primary>
19093 </indexterm>
19094 The amount of free space (as a number of kilobytes) in the disk partition where
19095 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19096 variable is referenced. If the operating system does not have the ability to
19097 find the amount of free space (only true for experimental systems), the space
19098 value is -1. For example, to check in an ACL that there is at least 50
19099 megabytes free on the spool, you could write:
19100 </para>
19101 <literallayout class="monospaced">
19102 condition = ${if &gt; {$spool_space}{50000}}
19103 </literallayout>
19104 <para>
19105 See also the <option>check_spool_space</option> option.
19106 </para>
19107 </listitem></varlistentry>
19108 <varlistentry>
19109 <term><varname>$thisaddress</varname></term>
19110 <listitem>
19111 <para>
19112 <indexterm role="variable">
19113 <primary><varname>$thisaddress</varname></primary>
19114 </indexterm>
19115 This variable is set only during the processing of the <option>foranyaddress</option>
19116 command in a filter file. Its use is explained in the description of that
19117 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19118 interfaces to mail filtering</emphasis>.
19119 </para>
19120 </listitem></varlistentry>
19121 <varlistentry>
19122 <term><varname>$tls_in_bits</varname></term>
19123 <listitem>
19124 <para>
19125 <indexterm role="variable">
19126 <primary><varname>$tls_in_bits</varname></primary>
19127 </indexterm>
19128 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19129 on the inbound connection; the meaning of
19130 this depends upon the TLS implementation used.
19131 If TLS has not been negotiated, the value will be 0.
19132 The value of this is automatically fed into the Cyrus SASL authenticator
19133 when acting as a server, to specify the "external SSF" (a SASL term).
19134 </para>
19135 <para>
19136 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19137 except when used in the context of an outbound SMTP delivery, when it refers to
19138 the outbound.
19139 </para>
19140 </listitem></varlistentry>
19141 <varlistentry>
19142 <term><varname>$tls_out_bits</varname></term>
19143 <listitem>
19144 <para>
19145 <indexterm role="variable">
19146 <primary><varname>$tls_out_bits</varname></primary>
19147 </indexterm>
19148 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19149 on an outbound SMTP connection; the meaning of
19150 this depends upon the TLS implementation used.
19151 If TLS has not been negotiated, the value will be 0.
19152 </para>
19153 </listitem></varlistentry>
19154 <varlistentry>
19155 <term><varname>$tls_in_ourcert</varname></term>
19156 <listitem>
19157 <para>
19158 <indexterm role="variable">
19159 <primary><varname>$tls_in_ourcert</varname></primary>
19160 </indexterm>
19161 This variable refers to the certificate presented to the peer of an
19162 inbound connection when the message was received.
19163 It is only useful as the argument of a
19164 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19165 or a <option>def</option> condition.
19166 </para>
19167 </listitem></varlistentry>
19168 <varlistentry>
19169 <term><varname>$tls_in_peercert</varname></term>
19170 <listitem>
19171 <para>
19172 <indexterm role="variable">
19173 <primary><varname>$tls_in_peercert</varname></primary>
19174 </indexterm>
19175 This variable refers to the certificate presented by the peer of an
19176 inbound connection when the message was received.
19177 It is only useful as the argument of a
19178 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19179 or a <option>def</option> condition.
19180 </para>
19181 </listitem></varlistentry>
19182 <varlistentry>
19183 <term><varname>$tls_out_ourcert</varname></term>
19184 <listitem>
19185 <para>
19186 <indexterm role="variable">
19187 <primary><varname>$tls_out_ourcert</varname></primary>
19188 </indexterm>
19189 This variable refers to the certificate presented to the peer of an
19190 outbound connection.  It is only useful as the argument of a
19191 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19192 or a <option>def</option> condition.
19193 </para>
19194 </listitem></varlistentry>
19195 <varlistentry>
19196 <term><varname>$tls_out_peercert</varname></term>
19197 <listitem>
19198 <para>
19199 <indexterm role="variable">
19200 <primary><varname>$tls_out_peercert</varname></primary>
19201 </indexterm>
19202 This variable refers to the certificate presented by the peer of an
19203 outbound connection.  It is only useful as the argument of a
19204 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19205 or a <option>def</option> condition.
19206 </para>
19207 </listitem></varlistentry>
19208 <varlistentry>
19209 <term><varname>$tls_in_certificate_verified</varname></term>
19210 <listitem>
19211 <para>
19212 <indexterm role="variable">
19213 <primary><varname>$tls_in_certificate_verified</varname></primary>
19214 </indexterm>
19215 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19216 message was received, and <quote>0</quote> otherwise.
19217 </para>
19218 <para>
19219 The deprecated <varname>$tls_certificate_verfied</varname> variable refers to the inbound side
19220 except when used in the context of an outbound SMTP delivery, when it refers to
19221 the outbound.
19222 </para>
19223 </listitem></varlistentry>
19224 <varlistentry>
19225 <term><varname>$tls_out_certificate_verified</varname></term>
19226 <listitem>
19227 <para>
19228 <indexterm role="variable">
19229 <primary><varname>$tls_out_certificate_verified</varname></primary>
19230 </indexterm>
19231 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19232 outbound SMTP connection was made,
19233 and <quote>0</quote> otherwise.
19234 </para>
19235 </listitem></varlistentry>
19236 <varlistentry>
19237 <term><varname>$tls_in_cipher</varname></term>
19238 <listitem>
19239 <para>
19240 <indexterm role="variable">
19241 <primary><varname>$tls_in_cipher</varname></primary>
19242 </indexterm>
19243 <indexterm role="variable">
19244 <primary><varname>$tls_cipher</varname></primary>
19245 </indexterm>
19246 When a message is received from a remote host over an encrypted SMTP
19247 connection, this variable is set to the cipher suite that was negotiated, for
19248 example DES-CBC3-SHA. In other circumstances, in particular, for message
19249 received over unencrypted connections, the variable is empty. Testing
19250 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19251 non-encrypted connections during ACL processing.
19252 </para>
19253 <para>
19254 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19255 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19256 becomes the same as <varname>$tls_out_cipher</varname>.
19257 </para>
19258 </listitem></varlistentry>
19259 <varlistentry>
19260 <term><varname>$tls_out_cipher</varname></term>
19261 <listitem>
19262 <para>
19263 <indexterm role="variable">
19264 <primary><varname>$tls_out_cipher</varname></primary>
19265 </indexterm>
19266 This variable is
19267 cleared before any outgoing SMTP connection is made,
19268 and then set to the outgoing cipher suite if one is negotiated. See chapter
19269 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19270 details of the <command>smtp</command> transport.
19271 </para>
19272 </listitem></varlistentry>
19273 <varlistentry revisionflag="changed">
19274 <term><varname>$tls_in_ocsp</varname></term>
19275 <listitem>
19276 <para revisionflag="changed">
19277 <indexterm role="variable">
19278 <primary><varname>$tls_in_ocsp</varname></primary>
19279 </indexterm>
19280 When a message is received from a remote client connection
19281 the result of any OCSP request from the client is encoded in this variable:
19282 </para>
19283 <literallayout class="monospaced" revisionflag="changed">
19284 0 OCSP proof was not requested (default value)
19285 1 No response to request
19286 2 Response not verified
19287 3 Verification failed
19288 4 Verification succeeded
19289 </literallayout>
19290 </listitem></varlistentry>
19291 <varlistentry revisionflag="changed">
19292 <term><varname>$tls_out_ocsp</varname></term>
19293 <listitem>
19294 <para revisionflag="changed">
19295 <indexterm role="variable">
19296 <primary><varname>$tls_out_ocsp</varname></primary>
19297 </indexterm>
19298 When a message is sent to a remote host connection
19299 the result of any OCSP request made is encoded in this variable.
19300 See <varname>$tls_in_ocsp</varname> for values.
19301 </para>
19302 </listitem></varlistentry>
19303 <varlistentry>
19304 <term><varname>$tls_in_peerdn</varname></term>
19305 <listitem>
19306 <para>
19307 <indexterm role="variable">
19308 <primary><varname>$tls_in_peerdn</varname></primary>
19309 </indexterm>
19310 <indexterm role="variable">
19311 <primary><varname>$tls_peerdn</varname></primary>
19312 </indexterm>
19313 When a message is received from a remote host over an encrypted SMTP
19314 connection, and Exim is configured to request a certificate from the client,
19315 the value of the Distinguished Name of the certificate is made available in the
19316 <varname>$tls_in_peerdn</varname> during subsequent processing.
19317 </para>
19318 <para>
19319 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19320 except when used in the context of an outbound SMTP delivery, when it refers to
19321 the outbound.
19322 </para>
19323 </listitem></varlistentry>
19324 <varlistentry>
19325 <term><varname>$tls_out_peerdn</varname></term>
19326 <listitem>
19327 <para>
19328 <indexterm role="variable">
19329 <primary><varname>$tls_out_peerdn</varname></primary>
19330 </indexterm>
19331 When a message is being delivered to a remote host over an encrypted SMTP
19332 connection, and Exim is configured to request a certificate from the server,
19333 the value of the Distinguished Name of the certificate is made available in the
19334 <varname>$tls_out_peerdn</varname> during subsequent processing.
19335 </para>
19336 </listitem></varlistentry>
19337 <varlistentry>
19338 <term><varname>$tls_in_sni</varname></term>
19339 <listitem>
19340 <para>
19341 <indexterm role="variable">
19342 <primary><varname>$tls_in_sni</varname></primary>
19343 </indexterm>
19344 <indexterm role="variable">
19345 <primary><varname>$tls_sni</varname></primary>
19346 </indexterm>
19347 <indexterm role="concept">
19348 <primary>TLS</primary>
19349 <secondary>Server Name Indication</secondary>
19350 </indexterm>
19351 When a TLS session is being established, if the client sends the Server
19352 Name Indication extension, the value will be placed in this variable.
19353 If the variable appears in <option>tls_certificate</option> then this option and
19354 some others, described in <xref linkend="SECTtlssni"/>,
19355 will be re-expanded early in the TLS session, to permit
19356 a different certificate to be presented (and optionally a different key to be
19357 used) to the client, based upon the value of the SNI extension.
19358 </para>
19359 <para>
19360 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
19361 except when used in the context of an outbound SMTP delivery, when it refers to
19362 the outbound.
19363 </para>
19364 </listitem></varlistentry>
19365 <varlistentry>
19366 <term><varname>$tls_out_sni</varname></term>
19367 <listitem>
19368 <para>
19369 <indexterm role="variable">
19370 <primary><varname>$tls_out_sni</varname></primary>
19371 </indexterm>
19372 <indexterm role="concept">
19373 <primary>TLS</primary>
19374 <secondary>Server Name Indication</secondary>
19375 </indexterm>
19376 During outbound
19377 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
19378 the transport.
19379 </para>
19380 </listitem></varlistentry>
19381 <varlistentry>
19382 <term><varname>$tod_bsdinbox</varname></term>
19383 <listitem>
19384 <para>
19385 <indexterm role="variable">
19386 <primary><varname>$tod_bsdinbox</varname></primary>
19387 </indexterm>
19388 The time of day and the date, in the format required for BSD-style mailbox
19389 files, for example: Thu Oct 17 17:14:09 1995.
19390 </para>
19391 </listitem></varlistentry>
19392 <varlistentry>
19393 <term><varname>$tod_epoch</varname></term>
19394 <listitem>
19395 <para>
19396 <indexterm role="variable">
19397 <primary><varname>$tod_epoch</varname></primary>
19398 </indexterm>
19399 The time and date as a number of seconds since the start of the Unix epoch.
19400 </para>
19401 </listitem></varlistentry>
19402 <varlistentry>
19403 <term><varname>$tod_epoch_l</varname></term>
19404 <listitem>
19405 <para>
19406 <indexterm role="variable">
19407 <primary><varname>$tod_epoch_l</varname></primary>
19408 </indexterm>
19409 The time and date as a number of microseconds since the start of the Unix epoch.
19410 </para>
19411 </listitem></varlistentry>
19412 <varlistentry>
19413 <term><varname>$tod_full</varname></term>
19414 <listitem>
19415 <para>
19416 <indexterm role="variable">
19417 <primary><varname>$tod_full</varname></primary>
19418 </indexterm>
19419 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19420 +0100. The timezone is always given as a numerical offset from UTC, with
19421 positive values used for timezones that are ahead (east) of UTC, and negative
19422 values for those that are behind (west).
19423 </para>
19424 </listitem></varlistentry>
19425 <varlistentry>
19426 <term><varname>$tod_log</varname></term>
19427 <listitem>
19428 <para>
19429 <indexterm role="variable">
19430 <primary><varname>$tod_log</varname></primary>
19431 </indexterm>
19432 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19433 1995-10-12 15:32:29, but without a timezone.
19434 </para>
19435 </listitem></varlistentry>
19436 <varlistentry>
19437 <term><varname>$tod_logfile</varname></term>
19438 <listitem>
19439 <para>
19440 <indexterm role="variable">
19441 <primary><varname>$tod_logfile</varname></primary>
19442 </indexterm>
19443 This variable contains the date in the format yyyymmdd. This is the format that
19444 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19445 flag.
19446 </para>
19447 </listitem></varlistentry>
19448 <varlistentry>
19449 <term><varname>$tod_zone</varname></term>
19450 <listitem>
19451 <para>
19452 <indexterm role="variable">
19453 <primary><varname>$tod_zone</varname></primary>
19454 </indexterm>
19455 This variable contains the numerical value of the local timezone, for example:
19456 -0500.
19457 </para>
19458 </listitem></varlistentry>
19459 <varlistentry>
19460 <term><varname>$tod_zulu</varname></term>
19461 <listitem>
19462 <para>
19463 <indexterm role="variable">
19464 <primary><varname>$tod_zulu</varname></primary>
19465 </indexterm>
19466 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19467 by ISO 8601, for example: 20030221154023Z.
19468 </para>
19469 </listitem></varlistentry>
19470 <varlistentry>
19471 <term><varname>$transport_name</varname></term>
19472 <listitem>
19473 <para>
19474 <indexterm role="concept">
19475 <primary>transport</primary>
19476 <secondary>name</secondary>
19477 </indexterm>
19478 <indexterm role="concept">
19479 <primary>name</primary>
19480 <secondary>of transport</secondary>
19481 </indexterm>
19482 <indexterm role="variable">
19483 <primary><varname>$transport_name</varname></primary>
19484 </indexterm>
19485 During the running of a transport, this variable contains its name.
19486 </para>
19487 </listitem></varlistentry>
19488 <varlistentry>
19489 <term><varname>$value</varname></term>
19490 <listitem>
19491 <para>
19492 <indexterm role="variable">
19493 <primary><varname>$value</varname></primary>
19494 </indexterm>
19495 This variable contains the result of an expansion lookup, extraction operation,
19496 or external command, as described above. It is also used during a
19497 <emphasis role="bold">reduce</emphasis> expansion.
19498 </para>
19499 </listitem></varlistentry>
19500 <varlistentry>
19501 <term><varname>$version_number</varname></term>
19502 <listitem>
19503 <para>
19504 <indexterm role="variable">
19505 <primary><varname>$version_number</varname></primary>
19506 </indexterm>
19507 The version number of Exim.
19508 </para>
19509 </listitem></varlistentry>
19510 <varlistentry>
19511 <term><varname>$warn_message_delay</varname></term>
19512 <listitem>
19513 <para>
19514 <indexterm role="variable">
19515 <primary><varname>$warn_message_delay</varname></primary>
19516 </indexterm>
19517 This variable is set only during the creation of a message warning about a
19518 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19519 </para>
19520 </listitem></varlistentry>
19521 <varlistentry>
19522 <term><varname>$warn_message_recipients</varname></term>
19523 <listitem>
19524 <para>
19525 <indexterm role="variable">
19526 <primary><varname>$warn_message_recipients</varname></primary>
19527 </indexterm>
19528 This variable is set only during the creation of a message warning about a
19529 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19530 </para>
19531 </listitem></varlistentry>
19532 </variablelist>
19533 <para>
19534 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19535 </para>
19536 </section>
19537 </chapter>
19538
19539 <chapter id="CHAPperl">
19540 <title>Embedded Perl</title>
19541 <para>
19542 <indexterm role="concept" id="IIDperl" class="startofrange">
19543 <primary>Perl</primary>
19544 <secondary>calling from Exim</secondary>
19545 </indexterm>
19546 Exim can be built to include an embedded Perl interpreter. When this is done,
19547 Perl subroutines can be called as part of the string expansion process. To make
19548 use of the Perl support, you need version 5.004 or later of Perl installed on
19549 your system. To include the embedded interpreter in the Exim binary, include
19550 the line
19551 </para>
19552 <literallayout class="monospaced">
19553 EXIM_PERL = perl.o
19554 </literallayout>
19555 <para>
19556 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19557 </para>
19558 <section id="SECID85">
19559 <title>Setting up so Perl can be used</title>
19560 <para>
19561 <indexterm role="option">
19562 <primary><option>perl_startup</option></primary>
19563 </indexterm>
19564 Access to Perl subroutines is via a global configuration option called
19565 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19566 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19567 interpreter is started and there is almost no overhead for Exim (since none of
19568 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19569 option then the associated value is taken to be Perl code which is executed in
19570 a newly created Perl interpreter.
19571 </para>
19572 <para>
19573 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19574 need backslashes before any characters to escape special meanings. The option
19575 should usually be something like
19576 </para>
19577 <literallayout class="monospaced">
19578 perl_startup = do '/etc/exim.pl'
19579 </literallayout>
19580 <para>
19581 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19582 use from Exim. Exim can be configured either to start up a Perl interpreter as
19583 soon as it is entered, or to wait until the first time it is needed. Starting
19584 the interpreter at the beginning ensures that it is done while Exim still has
19585 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19586 fact used in a particular run. Also, note that this does not mean that Exim is
19587 necessarily running as root when Perl is called at a later time. By default,
19588 the interpreter is started only when it is needed, but this can be changed in
19589 two ways:
19590 </para>
19591 <itemizedlist>
19592 <listitem>
19593 <para>
19594 <indexterm role="option">
19595 <primary><option>perl_at_start</option></primary>
19596 </indexterm>
19597 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19598 a startup when Exim is entered.
19599 </para>
19600 </listitem>
19601 <listitem>
19602 <para>
19603 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19604 overriding the setting of <option>perl_at_start</option>.
19605 </para>
19606 </listitem>
19607 </itemizedlist>
19608 <para>
19609 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19610 initial startup, even if <option>perl_at_start</option> is set.
19611 </para>
19612 </section>
19613 <section id="SECID86">
19614 <title>Calling Perl subroutines</title>
19615 <para>
19616 When the configuration file includes a <option>perl_startup</option> option you can make use
19617 of the string expansion item to call the Perl subroutines that are defined
19618 by the <option>perl_startup</option> code. The operator is used in any of the following
19619 forms:
19620 </para>
19621 <literallayout class="monospaced">
19622 ${perl{foo}}
19623 ${perl{foo}{argument}}
19624 ${perl{foo}{argument1}{argument2} ... }
19625 </literallayout>
19626 <para>
19627 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19628 arguments may be passed. Passing more than this results in an expansion failure
19629 with an error message of the form
19630 </para>
19631 <literallayout class="monospaced">
19632 Too many arguments passed to Perl subroutine "foo" (max is 8)
19633 </literallayout>
19634 <para>
19635 The return value of the Perl subroutine is evaluated in a scalar context before
19636 it is passed back to Exim to be inserted into the expanded string. If the
19637 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19638 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19639 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19640 that was passed to <option>die</option>.
19641 </para>
19642 </section>
19643 <section id="SECID87">
19644 <title>Calling Exim functions from Perl</title>
19645 <para>
19646 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19647 is available to call back into Exim&#x2019;s string expansion function. For example,
19648 the Perl code
19649 </para>
19650 <literallayout class="monospaced">
19651 my $lp = Exim::expand_string('$local_part');
19652 </literallayout>
19653 <para>
19654 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19655 Note those are single quotes and not double quotes to protect against
19656 <varname>$local_part</varname> being interpolated as a Perl variable.
19657 </para>
19658 <para>
19659 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19660 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19661 expansion string, the Perl call from the original expansion string fails with
19662 an appropriate error message, in the same way as if <option>die</option> were used.
19663 </para>
19664 <para>
19665 <indexterm role="concept">
19666 <primary>debugging</primary>
19667 <secondary>from embedded Perl</secondary>
19668 </indexterm>
19669 <indexterm role="concept">
19670 <primary>log</primary>
19671 <secondary>writing from embedded Perl</secondary>
19672 </indexterm>
19673 Two other Exim functions are available for use from within Perl code.
19674 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19675 debugging is enabled. If you want a newline at the end, you must supply it.
19676 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
19677 timestamp. In this case, you should not supply a terminating newline.
19678 </para>
19679 </section>
19680 <section id="SECID88">
19681 <title>Use of standard output and error by Perl</title>
19682 <para>
19683 <indexterm role="concept">
19684 <primary>Perl</primary>
19685 <secondary>standard output and error</secondary>
19686 </indexterm>
19687 You should not write to the standard error or output streams from within your
19688 Perl code, as it is not defined how these are set up. In versions of Exim
19689 before 4.50, it is possible for the standard output or error to refer to the
19690 SMTP connection during message reception via the daemon. Writing to this stream
19691 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
19692 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
19693 avoided, but the output is lost.
19694 </para>
19695 <para>
19696 <indexterm role="concept">
19697 <primary>Perl</primary>
19698 <secondary>use of <option>warn</option></secondary>
19699 </indexterm>
19700 The Perl <option>warn</option> statement writes to the standard error stream by default.
19701 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
19702 you have no control. When Exim starts up the Perl interpreter, it arranges for
19703 output from the <option>warn</option> statement to be written to the Exim main log. You can
19704 change this by including appropriate Perl magic somewhere in your Perl code.
19705 For example, to discard <option>warn</option> output completely, you need this:
19706 </para>
19707 <literallayout class="monospaced">
19708 $SIG{__WARN__} = sub { };
19709 </literallayout>
19710 <para>
19711 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
19712 example, the code for the subroutine is empty, so it does nothing, but you can
19713 include any Perl code that you like. The text of the <option>warn</option> message is passed
19714 as the first subroutine argument.
19715 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
19716 </para>
19717 </section>
19718 </chapter>
19719
19720 <chapter id="CHAPinterfaces">
19721 <title>Starting the daemon and the use of network interfaces</title>
19722 <titleabbrev>Starting the daemon</titleabbrev>
19723 <para>
19724 <indexterm role="concept">
19725 <primary>daemon</primary>
19726 <secondary>starting</secondary>
19727 </indexterm>
19728 <indexterm role="concept">
19729 <primary>interface</primary>
19730 <secondary>listening</secondary>
19731 </indexterm>
19732 <indexterm role="concept">
19733 <primary>network interface</primary>
19734 </indexterm>
19735 <indexterm role="concept">
19736 <primary>interface</primary>
19737 <secondary>network</secondary>
19738 </indexterm>
19739 <indexterm role="concept">
19740 <primary>IP address</primary>
19741 <secondary>for listening</secondary>
19742 </indexterm>
19743 <indexterm role="concept">
19744 <primary>daemon</primary>
19745 <secondary>listening IP addresses</secondary>
19746 </indexterm>
19747 <indexterm role="concept">
19748 <primary>TCP/IP</primary>
19749 <secondary>setting listening interfaces</secondary>
19750 </indexterm>
19751 <indexterm role="concept">
19752 <primary>TCP/IP</primary>
19753 <secondary>setting listening ports</secondary>
19754 </indexterm>
19755 A host that is connected to a TCP/IP network may have one or more physical
19756 hardware network interfaces. Each of these interfaces may be configured as one
19757 or more <quote>logical</quote> interfaces, which are the entities that a program actually
19758 works with. Each of these logical interfaces is associated with an IP address.
19759 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
19760 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
19761 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
19762 </para>
19763 <orderedlist numeration="arabic">
19764 <listitem>
19765 <para>
19766 When a listening daemon is started, Exim needs to know which interfaces
19767 and ports to listen on.
19768 </para>
19769 </listitem>
19770 <listitem>
19771 <para>
19772 When Exim is routing an address, it needs to know which IP addresses
19773 are associated with local interfaces. This is required for the correct
19774 processing of MX lists by removing the local host and others with the
19775 same or higher priority values. Also, Exim needs to detect cases
19776 when an address is routed to an IP address that in fact belongs to the
19777 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
19778 option of the smtp transport is set (as appropriate), this is treated
19779 as an error situation.
19780 </para>
19781 </listitem>
19782 <listitem>
19783 <para>
19784 When Exim connects to a remote host, it may need to know which interface to use
19785 for the outgoing connection.
19786 </para>
19787 </listitem>
19788 </orderedlist>
19789 <para>
19790 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
19791 of cases. If your host has only one interface, and you want all its IP
19792 addresses to be treated in the same way, and you are using only the
19793 standard SMTP port, you should not need to take any special action. The
19794 rest of this chapter does not apply to you.
19795 </para>
19796 <para>
19797 In a more complicated situation you may want to listen only on certain
19798 interfaces, or on different ports, and for this reason there are a number of
19799 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
19800 chapter describes how they operate.
19801 </para>
19802 <para>
19803 When a message is received over TCP/IP, the interface and port that were
19804 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
19805 </para>
19806 <section id="SECID89">
19807 <title>Starting a listening daemon</title>
19808 <para>
19809 When a listening daemon is started (by means of the <option>-bd</option> command line
19810 option), the interfaces and ports on which it listens are controlled by the
19811 following options:
19812 </para>
19813 <itemizedlist>
19814 <listitem>
19815 <para>
19816 <option>daemon_smtp_ports</option> contains a list of default ports
19817 or service names.
19818 (For backward compatibility, this option can also be specified in the singular.)
19819 </para>
19820 </listitem>
19821 <listitem>
19822 <para>
19823 <option>local_interfaces</option> contains list of interface IP addresses on which to
19824 listen. Each item may optionally also specify a port.
19825 </para>
19826 </listitem>
19827 </itemizedlist>
19828 <para>
19829 The default list separator in both cases is a colon, but this can be changed as
19830 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
19831 it is usually best to change the separator to avoid having to double all the
19832 colons. For example:
19833 </para>
19834 <literallayout class="monospaced">
19835 local_interfaces = &lt;; 127.0.0.1 ; \
19836                       192.168.23.65 ; \
19837                       ::1 ; \
19838                       3ffe:ffff:836f::fe86:a061
19839 </literallayout>
19840 <para>
19841 There are two different formats for specifying a port along with an IP address
19842 in <option>local_interfaces</option>:
19843 </para>
19844 <orderedlist numeration="arabic">
19845 <listitem>
19846 <para>
19847 The port is added onto the address with a dot separator. For example, to listen
19848 on port 1234 on two different IP addresses:
19849 </para>
19850 <literallayout class="monospaced">
19851 local_interfaces = &lt;; 192.168.23.65.1234 ; \
19852                       3ffe:ffff:836f::fe86:a061.1234
19853 </literallayout>
19854 </listitem>
19855 <listitem>
19856 <para>
19857 The IP address is enclosed in square brackets, and the port is added
19858 with a colon separator, for example:
19859 </para>
19860 <literallayout class="monospaced">
19861 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
19862                       [3ffe:ffff:836f::fe86:a061]:1234
19863 </literallayout>
19864 </listitem>
19865 </orderedlist>
19866 <para>
19867 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
19868 default setting contains just one port:
19869 </para>
19870 <literallayout class="monospaced">
19871 daemon_smtp_ports = smtp
19872 </literallayout>
19873 <para>
19874 If more than one port is listed, each interface that does not have its own port
19875 specified listens on all of them. Ports that are listed in
19876 <option>daemon_smtp_ports</option> can be identified either by name (defined in
19877 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
19878 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
19879 </para>
19880 </section>
19881 <section id="SECID90">
19882 <title>Special IP listening addresses</title>
19883 <para>
19884 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
19885 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
19886 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
19887 instead of setting up separate listening sockets for each interface. The
19888 default value of <option>local_interfaces</option> is
19889 </para>
19890 <literallayout class="monospaced">
19891 local_interfaces = 0.0.0.0
19892 </literallayout>
19893 <para>
19894 when Exim is built without IPv6 support; otherwise it is:
19895 </para>
19896 <literallayout class="monospaced">
19897 local_interfaces = &lt;; ::0 ; 0.0.0.0
19898 </literallayout>
19899 <para>
19900 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
19901 </para>
19902 </section>
19903 <section id="SECID91">
19904 <title>Overriding local_interfaces and daemon_smtp_ports</title>
19905 <para>
19906 The <option>-oX</option> command line option can be used to override the values of
19907 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
19908 instance. Another way of doing this would be to use macros and the <option>-D</option>
19909 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
19910 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
19911 exim.
19912 </para>
19913 <para>
19914 The value of <option>-oX</option> is a list of items. The default colon separator can be
19915 changed in the usual way if required. If there are any items that do not
19916 contain dots or colons (that is, are not IP addresses), the value of
19917 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
19918 items that do contain dots or colons, the value of <option>local_interfaces</option> is
19919 replaced by those items. Thus, for example,
19920 </para>
19921 <literallayout class="monospaced">
19922 -oX 1225
19923 </literallayout>
19924 <para>
19925 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
19926 whereas
19927 </para>
19928 <literallayout class="monospaced">
19929 -oX 192.168.34.5.1125
19930 </literallayout>
19931 <para>
19932 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
19933 (However, since <option>local_interfaces</option> now contains no items without ports, the
19934 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
19935 </para>
19936 </section>
19937 <section id="SECTsupobssmt">
19938 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
19939 <para>
19940 <indexterm role="concept">
19941 <primary>ssmtp protocol</primary>
19942 </indexterm>
19943 <indexterm role="concept">
19944 <primary>smtps protocol</primary>
19945 </indexterm>
19946 <indexterm role="concept">
19947 <primary>SMTP</primary>
19948 <secondary>ssmtp protocol</secondary>
19949 </indexterm>
19950 <indexterm role="concept">
19951 <primary>SMTP</primary>
19952 <secondary>smtps protocol</secondary>
19953 </indexterm>
19954 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
19955 before the STARTTLS command was standardized for SMTP. Some legacy clients
19956 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
19957 list of port numbers or service names,
19958 connections to those ports must use SSMTP. The most
19959 common use of this option is expected to be
19960 </para>
19961 <literallayout class="monospaced">
19962 tls_on_connect_ports = 465
19963 </literallayout>
19964 <para>
19965 because 465 is the usual port number used by the legacy clients. There is also
19966 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
19967 this way when a daemon is started.
19968 </para>
19969 <para>
19970 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
19971 daemon to listen on those ports. You must still specify them in
19972 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
19973 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
19974 connections via the daemon.)
19975 </para>
19976 </section>
19977 <section id="SECID92">
19978 <title>IPv6 address scopes</title>
19979 <para>
19980 <indexterm role="concept">
19981 <primary>IPv6</primary>
19982 <secondary>address scopes</secondary>
19983 </indexterm>
19984 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
19985 can, in principle, have the same link-local IPv6 address on different
19986 interfaces. Thus, additional information is needed, over and above the IP
19987 address, to distinguish individual interfaces. A convention of using a
19988 percent sign followed by something (often the interface name) has been
19989 adopted in some cases, leading to addresses like this:
19990 </para>
19991 <literallayout class="monospaced">
19992 fe80::202:b3ff:fe03:45c1%eth0
19993 </literallayout>
19994 <para>
19995 To accommodate this usage, a percent sign followed by an arbitrary string is
19996 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
19997 to convert a textual IPv6 address for actual use. This function recognizes the
19998 percent convention in operating systems that support it, and it processes the
19999 address appropriately. Unfortunately, some older libraries have problems with
20000 <function>getaddrinfo()</function>. If
20001 </para>
20002 <literallayout class="monospaced">
20003 IPV6_USE_INET_PTON=yes
20004 </literallayout>
20005 <para>
20006 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20007 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20008 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20009 function.) Of course, this means that the additional functionality of
20010 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20011 </para>
20012 </section>
20013 <section id="SECID93">
20014 <title>Disabling IPv6</title>
20015 <para>
20016 <indexterm role="concept">
20017 <primary>IPv6</primary>
20018 <secondary>disabling</secondary>
20019 </indexterm>
20020 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20021 run on a host whose kernel does not support IPv6. The binary will fall back to
20022 using IPv4, but it may waste resources looking up AAAA records, and trying to
20023 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20024 <indexterm role="option">
20025 <primary><option>disable_ipv6</option></primary>
20026 </indexterm>
20027 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20028 activities take place. AAAA records are never looked up, and any IPv6 addresses
20029 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20030 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20031 to handle IPv6 literal addresses.
20032 </para>
20033 <para>
20034 On the other hand, when IPv6 is in use, there may be times when you want to
20035 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20036 option to globally suppress the lookup of AAAA records for specified domains,
20037 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20038 IPv6 addresses in an individual router.
20039 </para>
20040 </section>
20041 <section id="SECID94">
20042 <title>Examples of starting a listening daemon</title>
20043 <para>
20044 The default case in an IPv6 environment is
20045 </para>
20046 <literallayout class="monospaced">
20047 daemon_smtp_ports = smtp
20048 local_interfaces = &lt;; ::0 ; 0.0.0.0
20049 </literallayout>
20050 <para>
20051 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20052 Either one or two sockets may be used, depending on the characteristics of
20053 the TCP/IP stack. (This is complicated and messy; for more information,
20054 read the comments in the <filename>daemon.c</filename> source file.)
20055 </para>
20056 <para>
20057 To specify listening on ports 25 and 26 on all interfaces:
20058 </para>
20059 <literallayout class="monospaced">
20060 daemon_smtp_ports = 25 : 26
20061 </literallayout>
20062 <para>
20063 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20064 </para>
20065 <literallayout class="monospaced">
20066 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20067                       0.0.0.0.25 ; 0.0.0.0.26
20068 </literallayout>
20069 <para>
20070 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20071 IPv4 loopback address only:
20072 </para>
20073 <literallayout class="monospaced">
20074 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20075 </literallayout>
20076 <para>
20077 To specify listening on the default port on specific interfaces only:
20078 </para>
20079 <literallayout class="monospaced">
20080 local_interfaces = 10.0.0.67 : 192.168.34.67
20081 </literallayout>
20082 <para>
20083 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20084 </para>
20085 </section>
20086 <section id="SECTreclocipadd">
20087 <title>Recognizing the local host</title>
20088 <para>
20089 The <option>local_interfaces</option> option is also used when Exim needs to determine
20090 whether or not an IP address refers to the local host. That is, the IP
20091 addresses of all the interfaces on which a daemon is listening are always
20092 treated as local.
20093 </para>
20094 <para>
20095 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20096 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20097 available interfaces from the operating system, and extracts the relevant
20098 (that is, IPv4 or IPv6) addresses to use for checking.
20099 </para>
20100 <para>
20101 Some systems set up large numbers of virtual interfaces in order to provide
20102 many virtual web servers. In this situation, you may want to listen for
20103 email on only a few of the available interfaces, but nevertheless treat all
20104 interfaces as local when routing. You can do this by setting
20105 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20106 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20107 used for listening. Consider this example:
20108 </para>
20109 <literallayout class="monospaced">
20110 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20111                       192.168.53.235 ; \
20112                       3ffe:2101:12:1:a00:20ff:fe86:a061
20113
20114 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20115 </literallayout>
20116 <para>
20117 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20118 address, but all available interface addresses are treated as local when
20119 Exim is routing.
20120 </para>
20121 <para>
20122 In some environments the local host name may be in an MX list, but with an IP
20123 address that is not assigned to any local interface. In other cases it may be
20124 desirable to treat other host names as if they referred to the local host. Both
20125 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20126 This contains host names rather than IP addresses. When a host is referenced
20127 during routing, either via an MX record or directly, it is treated as the local
20128 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20129 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20130 </para>
20131 </section>
20132 <section id="SECID95">
20133 <title>Delivering to a remote host</title>
20134 <para>
20135 Delivery to a remote host is handled by the smtp transport. By default, it
20136 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20137 there is more than one) when connecting to a remote host. However, the
20138 <option>interface</option> option can be set to specify which interface is used. See the
20139 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20140 details.
20141 </para>
20142 </section>
20143 </chapter>
20144
20145 <chapter id="CHAPmainconfig">
20146 <title>Main configuration</title>
20147 <para>
20148 <indexterm role="concept" id="IIDconfima" class="startofrange">
20149 <primary>configuration file</primary>
20150 <secondary>main section</secondary>
20151 </indexterm>
20152 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20153 <primary>main configuration</primary>
20154 </indexterm>
20155 The first part of the run time configuration file contains three types of item:
20156 </para>
20157 <itemizedlist>
20158 <listitem>
20159 <para>
20160 Macro definitions: These lines start with an upper case letter. See section
20161 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20162 </para>
20163 </listitem>
20164 <listitem>
20165 <para>
20166 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20167 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20168 section <xref linkend="SECTnamedlists"/>.
20169 </para>
20170 </listitem>
20171 <listitem>
20172 <para>
20173 Main configuration settings: Each setting occupies one line of the file
20174 (with possible continuations). If any setting is preceded by the word
20175 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20176 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20177 settings.
20178 </para>
20179 </listitem>
20180 </itemizedlist>
20181 <para>
20182 This chapter specifies all the main configuration options, along with their
20183 types and default values. For ease of finding a particular option, they appear
20184 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20185 are now so many options, they are first listed briefly in functional groups, as
20186 an aid to finding the name of the option you are looking for. Some options are
20187 listed in more than one group.
20188 </para>
20189 <section id="SECID96">
20190 <title>Miscellaneous</title>
20191 <informaltable frame="none">
20192 <tgroup cols="2" colsep="0" rowsep="0">
20193 <colspec colwidth="196pt" align="left"/>
20194 <colspec colwidth="254pt" align="left"/>
20195 <tbody>
20196 <row>
20197 <entry><option>bi_command</option></entry>
20198 <entry>to run for <option>-bi</option> command line option</entry>
20199 </row>
20200 <row>
20201 <entry><option>disable_ipv6</option></entry>
20202 <entry>do no IPv6 processing</entry>
20203 </row>
20204 <row>
20205 <entry><option>keep_malformed</option></entry>
20206 <entry>for broken files &ndash; should not happen</entry>
20207 </row>
20208 <row>
20209 <entry><option>localhost_number</option></entry>
20210 <entry>for unique message ids in clusters</entry>
20211 </row>
20212 <row>
20213 <entry><option>message_body_newlines</option></entry>
20214 <entry>retain newlines in <varname>$message_body</varname></entry>
20215 </row>
20216 <row>
20217 <entry><option>message_body_visible</option></entry>
20218 <entry>how much to show in <varname>$message_body</varname></entry>
20219 </row>
20220 <row>
20221 <entry><option>mua_wrapper</option></entry>
20222 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20223 </row>
20224 <row>
20225 <entry><option>print_topbitchars</option></entry>
20226 <entry>top-bit characters are printing</entry>
20227 </row>
20228 <row>
20229 <entry><option>timezone</option></entry>
20230 <entry>force time zone</entry>
20231 </row>
20232 </tbody>
20233 </tgroup>
20234 </informaltable>
20235 </section>
20236 <section id="SECID97">
20237 <title>Exim parameters</title>
20238 <informaltable frame="none">
20239 <tgroup cols="2" colsep="0" rowsep="0">
20240 <colspec colwidth="196pt" align="left"/>
20241 <colspec colwidth="254pt" align="left"/>
20242 <tbody>
20243 <row>
20244 <entry><option>exim_group</option></entry>
20245 <entry>override compiled-in value</entry>
20246 </row>
20247 <row>
20248 <entry><option>exim_path</option></entry>
20249 <entry>override compiled-in value</entry>
20250 </row>
20251 <row>
20252 <entry><option>exim_user</option></entry>
20253 <entry>override compiled-in value</entry>
20254 </row>
20255 <row>
20256 <entry><option>primary_hostname</option></entry>
20257 <entry>default from <function>uname()</function></entry>
20258 </row>
20259 <row>
20260 <entry><option>split_spool_directory</option></entry>
20261 <entry>use multiple directories</entry>
20262 </row>
20263 <row>
20264 <entry><option>spool_directory</option></entry>
20265 <entry>override compiled-in value</entry>
20266 </row>
20267 </tbody>
20268 </tgroup>
20269 </informaltable>
20270 </section>
20271 <section id="SECID98">
20272 <title>Privilege controls</title>
20273 <informaltable frame="none">
20274 <tgroup cols="2" colsep="0" rowsep="0">
20275 <colspec colwidth="196pt" align="left"/>
20276 <colspec colwidth="254pt" align="left"/>
20277 <tbody>
20278 <row>
20279 <entry><option>admin_groups</option></entry>
20280 <entry>groups that are Exim admin users</entry>
20281 </row>
20282 <row>
20283 <entry><option>deliver_drop_privilege</option></entry>
20284 <entry>drop root for delivery processes</entry>
20285 </row>
20286 <row>
20287 <entry><option>local_from_check</option></entry>
20288 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20289 </row>
20290 <row>
20291 <entry><option>local_from_prefix</option></entry>
20292 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20293 </row>
20294 <row>
20295 <entry><option>local_from_suffix</option></entry>
20296 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20297 </row>
20298 <row>
20299 <entry><option>local_sender_retain</option></entry>
20300 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20301 </row>
20302 <row>
20303 <entry><option>never_users</option></entry>
20304 <entry>do not run deliveries as these</entry>
20305 </row>
20306 <row>
20307 <entry><option>prod_requires_admin</option></entry>
20308 <entry>forced delivery requires admin user</entry>
20309 </row>
20310 <row>
20311 <entry><option>queue_list_requires_admin</option></entry>
20312 <entry>queue listing requires admin user</entry>
20313 </row>
20314 <row>
20315 <entry><option>trusted_groups</option></entry>
20316 <entry>groups that are trusted</entry>
20317 </row>
20318 <row>
20319 <entry><option>trusted_users</option></entry>
20320 <entry>users that are trusted</entry>
20321 </row>
20322 </tbody>
20323 </tgroup>
20324 </informaltable>
20325 </section>
20326 <section id="SECID99">
20327 <title>Logging</title>
20328 <informaltable frame="none">
20329 <tgroup cols="2" colsep="0" rowsep="0">
20330 <colspec colwidth="196pt" align="left"/>
20331 <colspec colwidth="254pt" align="left"/>
20332 <tbody>
20333 <row>
20334 <entry><option>hosts_connection_nolog</option></entry>
20335 <entry>exemption from connect logging</entry>
20336 </row>
20337 <row>
20338 <entry><option>log_file_path</option></entry>
20339 <entry>override compiled-in value</entry>
20340 </row>
20341 <row>
20342 <entry><option>log_selector</option></entry>
20343 <entry>set/unset optional logging</entry>
20344 </row>
20345 <row>
20346 <entry><option>log_timezone</option></entry>
20347 <entry>add timezone to log lines</entry>
20348 </row>
20349 <row>
20350 <entry><option>message_logs</option></entry>
20351 <entry>create per-message logs</entry>
20352 </row>
20353 <row>
20354 <entry><option>preserve_message_logs</option></entry>
20355 <entry>after message completion</entry>
20356 </row>
20357 <row>
20358 <entry><option>process_log_path</option></entry>
20359 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
20360 </row>
20361 <row>
20362 <entry><option>syslog_duplication</option></entry>
20363 <entry>controls duplicate log lines on syslog</entry>
20364 </row>
20365 <row>
20366 <entry><option>syslog_facility</option></entry>
20367 <entry>set syslog <quote>facility</quote> field</entry>
20368 </row>
20369 <row>
20370 <entry><option>syslog_processname</option></entry>
20371 <entry>set syslog <quote>ident</quote> field</entry>
20372 </row>
20373 <row>
20374 <entry><option>syslog_timestamp</option></entry>
20375 <entry>timestamp syslog lines</entry>
20376 </row>
20377 <row>
20378 <entry><option>write_rejectlog</option></entry>
20379 <entry>control use of message log</entry>
20380 </row>
20381 </tbody>
20382 </tgroup>
20383 </informaltable>
20384 </section>
20385 <section id="SECID100">
20386 <title>Frozen messages</title>
20387 <informaltable frame="none">
20388 <tgroup cols="2" colsep="0" rowsep="0">
20389 <colspec colwidth="196pt" align="left"/>
20390 <colspec colwidth="254pt" align="left"/>
20391 <tbody>
20392 <row>
20393 <entry><option>auto_thaw</option></entry>
20394 <entry>sets time for retrying frozen messages</entry>
20395 </row>
20396 <row>
20397 <entry><option>freeze_tell</option></entry>
20398 <entry>send message when freezing</entry>
20399 </row>
20400 <row>
20401 <entry><option>move_frozen_messages</option></entry>
20402 <entry>to another directory</entry>
20403 </row>
20404 <row>
20405 <entry><option>timeout_frozen_after</option></entry>
20406 <entry>keep frozen messages only so long</entry>
20407 </row>
20408 </tbody>
20409 </tgroup>
20410 </informaltable>
20411 </section>
20412 <section id="SECID101">
20413 <title>Data lookups</title>
20414 <informaltable frame="none">
20415 <tgroup cols="2" colsep="0" rowsep="0">
20416 <colspec colwidth="196pt" align="left"/>
20417 <colspec colwidth="254pt" align="left"/>
20418 <tbody>
20419 <row>
20420 <entry><option>ibase_servers</option></entry>
20421 <entry>InterBase servers</entry>
20422 </row>
20423 <row>
20424 <entry><option>ldap_ca_cert_dir</option></entry>
20425 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20426 </row>
20427 <row>
20428 <entry><option>ldap_ca_cert_file</option></entry>
20429 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20430 </row>
20431 <row>
20432 <entry><option>ldap_cert_file</option></entry>
20433 <entry>client cert file for LDAP</entry>
20434 </row>
20435 <row>
20436 <entry><option>ldap_cert_key</option></entry>
20437 <entry>client key file for LDAP</entry>
20438 </row>
20439 <row>
20440 <entry><option>ldap_cipher_suite</option></entry>
20441 <entry>TLS negotiation preference control</entry>
20442 </row>
20443 <row>
20444 <entry><option>ldap_default_servers</option></entry>
20445 <entry>used if no server in query</entry>
20446 </row>
20447 <row>
20448 <entry><option>ldap_require_cert</option></entry>
20449 <entry>action to take without LDAP server cert</entry>
20450 </row>
20451 <row>
20452 <entry><option>ldap_start_tls</option></entry>
20453 <entry>require TLS within LDAP</entry>
20454 </row>
20455 <row>
20456 <entry><option>ldap_version</option></entry>
20457 <entry>set protocol version</entry>
20458 </row>
20459 <row>
20460 <entry><option>lookup_open_max</option></entry>
20461 <entry>lookup files held open</entry>
20462 </row>
20463 <row>
20464 <entry><option>mysql_servers</option></entry>
20465 <entry>default MySQL servers</entry>
20466 </row>
20467 <row>
20468 <entry><option>oracle_servers</option></entry>
20469 <entry>Oracle servers</entry>
20470 </row>
20471 <row>
20472 <entry><option>pgsql_servers</option></entry>
20473 <entry>default PostgreSQL servers</entry>
20474 </row>
20475 <row>
20476 <entry><option>sqlite_lock_timeout</option></entry>
20477 <entry>as it says</entry>
20478 </row>
20479 </tbody>
20480 </tgroup>
20481 </informaltable>
20482 </section>
20483 <section id="SECID102">
20484 <title>Message ids</title>
20485 <informaltable frame="none">
20486 <tgroup cols="2" colsep="0" rowsep="0">
20487 <colspec colwidth="196pt" align="left"/>
20488 <colspec colwidth="254pt" align="left"/>
20489 <tbody>
20490 <row>
20491 <entry><option>message_id_header_domain</option></entry>
20492 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20493 </row>
20494 <row>
20495 <entry><option>message_id_header_text</option></entry>
20496 <entry>ditto</entry>
20497 </row>
20498 </tbody>
20499 </tgroup>
20500 </informaltable>
20501 </section>
20502 <section id="SECID103">
20503 <title>Embedded Perl Startup</title>
20504 <informaltable frame="none">
20505 <tgroup cols="2" colsep="0" rowsep="0">
20506 <colspec colwidth="196pt" align="left"/>
20507 <colspec colwidth="254pt" align="left"/>
20508 <tbody>
20509 <row>
20510 <entry><option>perl_at_start</option></entry>
20511 <entry>always start the interpreter</entry>
20512 </row>
20513 <row>
20514 <entry><option>perl_startup</option></entry>
20515 <entry>code to obey when starting Perl</entry>
20516 </row>
20517 </tbody>
20518 </tgroup>
20519 </informaltable>
20520 </section>
20521 <section id="SECID104">
20522 <title>Daemon</title>
20523 <informaltable frame="none">
20524 <tgroup cols="2" colsep="0" rowsep="0">
20525 <colspec colwidth="196pt" align="left"/>
20526 <colspec colwidth="254pt" align="left"/>
20527 <tbody>
20528 <row>
20529 <entry><option>daemon_smtp_ports</option></entry>
20530 <entry>default ports</entry>
20531 </row>
20532 <row>
20533 <entry><option>daemon_startup_retries</option></entry>
20534 <entry>number of times to retry</entry>
20535 </row>
20536 <row>
20537 <entry><option>daemon_startup_sleep</option></entry>
20538 <entry>time to sleep between tries</entry>
20539 </row>
20540 <row>
20541 <entry><option>extra_local_interfaces</option></entry>
20542 <entry>not necessarily listened on</entry>
20543 </row>
20544 <row>
20545 <entry><option>local_interfaces</option></entry>
20546 <entry>on which to listen, with optional ports</entry>
20547 </row>
20548 <row>
20549 <entry><option>pid_file_path</option></entry>
20550 <entry>override compiled-in value</entry>
20551 </row>
20552 <row>
20553 <entry><option>queue_run_max</option></entry>
20554 <entry>maximum simultaneous queue runners</entry>
20555 </row>
20556 </tbody>
20557 </tgroup>
20558 </informaltable>
20559 </section>
20560 <section id="SECID105">
20561 <title>Resource control</title>
20562 <informaltable frame="none">
20563 <tgroup cols="2" colsep="0" rowsep="0">
20564 <colspec colwidth="196pt" align="left"/>
20565 <colspec colwidth="254pt" align="left"/>
20566 <tbody>
20567 <row>
20568 <entry><option>check_log_inodes</option></entry>
20569 <entry>before accepting a message</entry>
20570 </row>
20571 <row>
20572 <entry><option>check_log_space</option></entry>
20573 <entry>before accepting a message</entry>
20574 </row>
20575 <row>
20576 <entry><option>check_spool_inodes</option></entry>
20577 <entry>before accepting a message</entry>
20578 </row>
20579 <row>
20580 <entry><option>check_spool_space</option></entry>
20581 <entry>before accepting a message</entry>
20582 </row>
20583 <row>
20584 <entry><option>deliver_queue_load_max</option></entry>
20585 <entry>no queue deliveries if load high</entry>
20586 </row>
20587 <row>
20588 <entry><option>queue_only_load</option></entry>
20589 <entry>queue incoming if load high</entry>
20590 </row>
20591 <row>
20592 <entry><option>queue_only_load_latch</option></entry>
20593 <entry>don&#x2019;t re-evaluate load for each message</entry>
20594 </row>
20595 <row>
20596 <entry><option>queue_run_max</option></entry>
20597 <entry>maximum simultaneous queue runners</entry>
20598 </row>
20599 <row>
20600 <entry><option>remote_max_parallel</option></entry>
20601 <entry>parallel SMTP delivery per message</entry>
20602 </row>
20603 <row>
20604 <entry><option>smtp_accept_max</option></entry>
20605 <entry>simultaneous incoming connections</entry>
20606 </row>
20607 <row>
20608 <entry><option>smtp_accept_max_nonmail</option></entry>
20609 <entry>non-mail commands</entry>
20610 </row>
20611 <row>
20612 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20613 <entry>hosts to which the limit applies</entry>
20614 </row>
20615 <row>
20616 <entry><option>smtp_accept_max_per_connection</option></entry>
20617 <entry>messages per connection</entry>
20618 </row>
20619 <row>
20620 <entry><option>smtp_accept_max_per_host</option></entry>
20621 <entry>connections from one host</entry>
20622 </row>
20623 <row>
20624 <entry><option>smtp_accept_queue</option></entry>
20625 <entry>queue mail if more connections</entry>
20626 </row>
20627 <row>
20628 <entry><option>smtp_accept_queue_per_connection</option></entry>
20629 <entry>queue if more messages per connection</entry>
20630 </row>
20631 <row>
20632 <entry><option>smtp_accept_reserve</option></entry>
20633 <entry>only reserve hosts if more connections</entry>
20634 </row>
20635 <row>
20636 <entry><option>smtp_check_spool_space</option></entry>
20637 <entry>from SIZE on MAIL command</entry>
20638 </row>
20639 <row>
20640 <entry><option>smtp_connect_backlog</option></entry>
20641 <entry>passed to TCP/IP stack</entry>
20642 </row>
20643 <row>
20644 <entry><option>smtp_load_reserve</option></entry>
20645 <entry>SMTP from reserved hosts if load high</entry>
20646 </row>
20647 <row>
20648 <entry><option>smtp_reserve_hosts</option></entry>
20649 <entry>these are the reserve hosts</entry>
20650 </row>
20651 </tbody>
20652 </tgroup>
20653 </informaltable>
20654 </section>
20655 <section id="SECID106">
20656 <title>Policy controls</title>
20657 <informaltable frame="none">
20658 <tgroup cols="2" colsep="0" rowsep="0">
20659 <colspec colwidth="196pt" align="left"/>
20660 <colspec colwidth="254pt" align="left"/>
20661 <tbody>
20662 <row>
20663 <entry><option>acl_not_smtp</option></entry>
20664 <entry>ACL for non-SMTP messages</entry>
20665 </row>
20666 <row>
20667 <entry><option>acl_not_smtp_mime</option></entry>
20668 <entry>ACL for non-SMTP MIME parts</entry>
20669 </row>
20670 <row>
20671 <entry><option>acl_not_smtp_start</option></entry>
20672 <entry>ACL for start of non-SMTP message</entry>
20673 </row>
20674 <row>
20675 <entry><option>acl_smtp_auth</option></entry>
20676 <entry>ACL for AUTH</entry>
20677 </row>
20678 <row>
20679 <entry><option>acl_smtp_connect</option></entry>
20680 <entry>ACL for connection</entry>
20681 </row>
20682 <row>
20683 <entry><option>acl_smtp_data</option></entry>
20684 <entry>ACL for DATA</entry>
20685 </row>
20686 <row>
20687 <entry><option>acl_smtp_data_prdr</option></entry>
20688 <entry>ACL for DATA, per-recipient</entry>
20689 </row>
20690 <row>
20691 <entry><option>acl_smtp_dkim</option></entry>
20692 <entry>ACL for DKIM verification</entry>
20693 </row>
20694 <row>
20695 <entry><option>acl_smtp_etrn</option></entry>
20696 <entry>ACL for ETRN</entry>
20697 </row>
20698 <row>
20699 <entry><option>acl_smtp_expn</option></entry>
20700 <entry>ACL for EXPN</entry>
20701 </row>
20702 <row>
20703 <entry><option>acl_smtp_helo</option></entry>
20704 <entry>ACL for EHLO or HELO</entry>
20705 </row>
20706 <row>
20707 <entry><option>acl_smtp_mail</option></entry>
20708 <entry>ACL for MAIL</entry>
20709 </row>
20710 <row>
20711 <entry><option>acl_smtp_mailauth</option></entry>
20712 <entry>ACL for AUTH on MAIL command</entry>
20713 </row>
20714 <row>
20715 <entry><option>acl_smtp_mime</option></entry>
20716 <entry>ACL for MIME parts</entry>
20717 </row>
20718 <row>
20719 <entry><option>acl_smtp_predata</option></entry>
20720 <entry>ACL for start of data</entry>
20721 </row>
20722 <row>
20723 <entry><option>acl_smtp_quit</option></entry>
20724 <entry>ACL for QUIT</entry>
20725 </row>
20726 <row>
20727 <entry><option>acl_smtp_rcpt</option></entry>
20728 <entry>ACL for RCPT</entry>
20729 </row>
20730 <row>
20731 <entry><option>acl_smtp_starttls</option></entry>
20732 <entry>ACL for STARTTLS</entry>
20733 </row>
20734 <row>
20735 <entry><option>acl_smtp_vrfy</option></entry>
20736 <entry>ACL for VRFY</entry>
20737 </row>
20738 <row>
20739 <entry><option>av_scanner</option></entry>
20740 <entry>specify virus scanner</entry>
20741 </row>
20742 <row>
20743 <entry><option>check_rfc2047_length</option></entry>
20744 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20745 </row>
20746 <row>
20747 <entry><option>dns_csa_search_limit</option></entry>
20748 <entry>control CSA parent search depth</entry>
20749 </row>
20750 <row>
20751 <entry><option>dns_csa_use_reverse</option></entry>
20752 <entry>en/disable CSA IP reverse search</entry>
20753 </row>
20754 <row>
20755 <entry><option>header_maxsize</option></entry>
20756 <entry>total size of message header</entry>
20757 </row>
20758 <row>
20759 <entry><option>header_line_maxsize</option></entry>
20760 <entry>individual header line limit</entry>
20761 </row>
20762 <row>
20763 <entry><option>helo_accept_junk_hosts</option></entry>
20764 <entry>allow syntactic junk from these hosts</entry>
20765 </row>
20766 <row>
20767 <entry><option>helo_allow_chars</option></entry>
20768 <entry>allow illegal chars in HELO names</entry>
20769 </row>
20770 <row>
20771 <entry><option>helo_lookup_domains</option></entry>
20772 <entry>lookup hostname for these HELO names</entry>
20773 </row>
20774 <row>
20775 <entry><option>helo_try_verify_hosts</option></entry>
20776 <entry>HELO soft-checked for these hosts</entry>
20777 </row>
20778 <row>
20779 <entry><option>helo_verify_hosts</option></entry>
20780 <entry>HELO hard-checked for these hosts</entry>
20781 </row>
20782 <row>
20783 <entry><option>host_lookup</option></entry>
20784 <entry>host name looked up for these hosts</entry>
20785 </row>
20786 <row>
20787 <entry><option>host_lookup_order</option></entry>
20788 <entry>order of DNS and local name lookups</entry>
20789 </row>
20790 <row>
20791 <entry><option>host_reject_connection</option></entry>
20792 <entry>reject connection from these hosts</entry>
20793 </row>
20794 <row>
20795 <entry><option>hosts_treat_as_local</option></entry>
20796 <entry>useful in some cluster configurations</entry>
20797 </row>
20798 <row>
20799 <entry><option>local_scan_timeout</option></entry>
20800 <entry>timeout for <function>local_scan()</function></entry>
20801 </row>
20802 <row>
20803 <entry><option>message_size_limit</option></entry>
20804 <entry>for all messages</entry>
20805 </row>
20806 <row>
20807 <entry><option>percent_hack_domains</option></entry>
20808 <entry>recognize %-hack for these domains</entry>
20809 </row>
20810 <row>
20811 <entry><option>spamd_address</option></entry>
20812 <entry>set interface to SpamAssassin</entry>
20813 </row>
20814 <row>
20815 <entry><option>strict_acl_vars</option></entry>
20816 <entry>object to unset ACL variables</entry>
20817 </row>
20818 </tbody>
20819 </tgroup>
20820 </informaltable>
20821 </section>
20822 <section id="SECID107">
20823 <title>Callout cache</title>
20824 <informaltable frame="none">
20825 <tgroup cols="2" colsep="0" rowsep="0">
20826 <colspec colwidth="196pt" align="left"/>
20827 <colspec colwidth="254pt" align="left"/>
20828 <tbody>
20829 <row>
20830 <entry><option>callout_domain_negative_expire</option></entry>
20831 <entry>timeout for negative domain cache item</entry>
20832 </row>
20833 <row>
20834 <entry><option>callout_domain_positive_expire</option></entry>
20835 <entry>timeout for positive domain cache item</entry>
20836 </row>
20837 <row>
20838 <entry><option>callout_negative_expire</option></entry>
20839 <entry>timeout for negative address cache item</entry>
20840 </row>
20841 <row>
20842 <entry><option>callout_positive_expire</option></entry>
20843 <entry>timeout for positive address cache item</entry>
20844 </row>
20845 <row>
20846 <entry><option>callout_random_local_part</option></entry>
20847 <entry>string to use for <quote>random</quote> testing</entry>
20848 </row>
20849 </tbody>
20850 </tgroup>
20851 </informaltable>
20852 </section>
20853 <section id="SECID108">
20854 <title>TLS</title>
20855 <informaltable frame="none">
20856 <tgroup cols="2" colsep="0" rowsep="0">
20857 <colspec colwidth="196pt" align="left"/>
20858 <colspec colwidth="254pt" align="left"/>
20859 <tbody>
20860 <row>
20861 <entry><option>gnutls_compat_mode</option></entry>
20862 <entry>use GnuTLS compatibility mode</entry>
20863 </row>
20864 <row>
20865 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
20866 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
20867 </row>
20868 <row>
20869 <entry><option>openssl_options</option></entry>
20870 <entry>adjust OpenSSL compatibility options</entry>
20871 </row>
20872 <row>
20873 <entry><option>tls_advertise_hosts</option></entry>
20874 <entry>advertise TLS to these hosts</entry>
20875 </row>
20876 <row>
20877 <entry><option>tls_certificate</option></entry>
20878 <entry>location of server certificate</entry>
20879 </row>
20880 <row>
20881 <entry><option>tls_crl</option></entry>
20882 <entry>certificate revocation list</entry>
20883 </row>
20884 <row>
20885 <entry><option>tls_dh_max_bits</option></entry>
20886 <entry>clamp D-H bit count suggestion</entry>
20887 </row>
20888 <row>
20889 <entry><option>tls_dhparam</option></entry>
20890 <entry>DH parameters for server</entry>
20891 </row>
20892 <row>
20893 <entry><option>tls_ocsp_file</option></entry>
20894 <entry>location of server certificate status proof</entry>
20895 </row>
20896 <row>
20897 <entry><option>tls_on_connect_ports</option></entry>
20898 <entry>specify SSMTP (SMTPS) ports</entry>
20899 </row>
20900 <row>
20901 <entry><option>tls_privatekey</option></entry>
20902 <entry>location of server private key</entry>
20903 </row>
20904 <row>
20905 <entry><option>tls_remember_esmtp</option></entry>
20906 <entry>don&#x2019;t reset after starting TLS</entry>
20907 </row>
20908 <row>
20909 <entry><option>tls_require_ciphers</option></entry>
20910 <entry>specify acceptable ciphers</entry>
20911 </row>
20912 <row>
20913 <entry><option>tls_try_verify_hosts</option></entry>
20914 <entry>try to verify client certificate</entry>
20915 </row>
20916 <row>
20917 <entry><option>tls_verify_certificates</option></entry>
20918 <entry>expected client certificates</entry>
20919 </row>
20920 <row>
20921 <entry><option>tls_verify_hosts</option></entry>
20922 <entry>insist on client certificate verify</entry>
20923 </row>
20924 </tbody>
20925 </tgroup>
20926 </informaltable>
20927 </section>
20928 <section id="SECID109">
20929 <title>Local user handling</title>
20930 <informaltable frame="none">
20931 <tgroup cols="2" colsep="0" rowsep="0">
20932 <colspec colwidth="196pt" align="left"/>
20933 <colspec colwidth="254pt" align="left"/>
20934 <tbody>
20935 <row>
20936 <entry><option>finduser_retries</option></entry>
20937 <entry>useful in NIS environments</entry>
20938 </row>
20939 <row>
20940 <entry><option>gecos_name</option></entry>
20941 <entry>used when creating <emphasis>Sender:</emphasis></entry>
20942 </row>
20943 <row>
20944 <entry><option>gecos_pattern</option></entry>
20945 <entry>ditto</entry>
20946 </row>
20947 <row>
20948 <entry><option>max_username_length</option></entry>
20949 <entry>for systems that truncate</entry>
20950 </row>
20951 <row>
20952 <entry><option>unknown_login</option></entry>
20953 <entry>used when no login name found</entry>
20954 </row>
20955 <row>
20956 <entry><option>unknown_username</option></entry>
20957 <entry>ditto</entry>
20958 </row>
20959 <row>
20960 <entry><option>uucp_from_pattern</option></entry>
20961 <entry>for recognizing <quote>From </quote> lines</entry>
20962 </row>
20963 <row>
20964 <entry><option>uucp_from_sender</option></entry>
20965 <entry>ditto</entry>
20966 </row>
20967 </tbody>
20968 </tgroup>
20969 </informaltable>
20970 </section>
20971 <section id="SECID110">
20972 <title>All incoming messages (SMTP and non-SMTP)</title>
20973 <informaltable frame="none">
20974 <tgroup cols="2" colsep="0" rowsep="0">
20975 <colspec colwidth="196pt" align="left"/>
20976 <colspec colwidth="254pt" align="left"/>
20977 <tbody>
20978 <row>
20979 <entry><option>header_maxsize</option></entry>
20980 <entry>total size of message header</entry>
20981 </row>
20982 <row>
20983 <entry><option>header_line_maxsize</option></entry>
20984 <entry>individual header line limit</entry>
20985 </row>
20986 <row>
20987 <entry><option>message_size_limit</option></entry>
20988 <entry>applies to all messages</entry>
20989 </row>
20990 <row>
20991 <entry><option>percent_hack_domains</option></entry>
20992 <entry>recognize %-hack for these domains</entry>
20993 </row>
20994 <row>
20995 <entry><option>received_header_text</option></entry>
20996 <entry>expanded to make <emphasis>Received:</emphasis></entry>
20997 </row>
20998 <row>
20999 <entry><option>received_headers_max</option></entry>
21000 <entry>for mail loop detection</entry>
21001 </row>
21002 <row>
21003 <entry><option>recipients_max</option></entry>
21004 <entry>limit per message</entry>
21005 </row>
21006 <row>
21007 <entry><option>recipients_max_reject</option></entry>
21008 <entry>permanently reject excess recipients</entry>
21009 </row>
21010 </tbody>
21011 </tgroup>
21012 </informaltable>
21013 </section>
21014 <section id="SECID111">
21015 <title>Non-SMTP incoming messages</title>
21016 <informaltable frame="none">
21017 <tgroup cols="2" colsep="0" rowsep="0">
21018 <colspec colwidth="196pt" align="left"/>
21019 <colspec colwidth="254pt" align="left"/>
21020 <tbody>
21021 <row>
21022 <entry><option>receive_timeout</option></entry>
21023 <entry>for non-SMTP messages</entry>
21024 </row>
21025 </tbody>
21026 </tgroup>
21027 </informaltable>
21028 </section>
21029 <section id="SECID112">
21030 <title>Incoming SMTP messages</title>
21031 <para>
21032 See also the <emphasis>Policy controls</emphasis> section above.
21033 </para>
21034 <informaltable frame="none">
21035 <tgroup cols="2" colsep="0" rowsep="0">
21036 <colspec colwidth="196pt" align="left"/>
21037 <colspec colwidth="254pt" align="left"/>
21038 <tbody>
21039 <row>
21040 <entry><option>host_lookup</option></entry>
21041 <entry>host name looked up for these hosts</entry>
21042 </row>
21043 <row>
21044 <entry><option>host_lookup_order</option></entry>
21045 <entry>order of DNS and local name lookups</entry>
21046 </row>
21047 <row>
21048 <entry><option>recipient_unqualified_hosts</option></entry>
21049 <entry>may send unqualified recipients</entry>
21050 </row>
21051 <row>
21052 <entry><option>rfc1413_hosts</option></entry>
21053 <entry>make ident calls to these hosts</entry>
21054 </row>
21055 <row>
21056 <entry><option>rfc1413_query_timeout</option></entry>
21057 <entry>zero disables ident calls</entry>
21058 </row>
21059 <row>
21060 <entry><option>sender_unqualified_hosts</option></entry>
21061 <entry>may send unqualified senders</entry>
21062 </row>
21063 <row>
21064 <entry><option>smtp_accept_keepalive</option></entry>
21065 <entry>some TCP/IP magic</entry>
21066 </row>
21067 <row>
21068 <entry><option>smtp_accept_max</option></entry>
21069 <entry>simultaneous incoming connections</entry>
21070 </row>
21071 <row>
21072 <entry><option>smtp_accept_max_nonmail</option></entry>
21073 <entry>non-mail commands</entry>
21074 </row>
21075 <row>
21076 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21077 <entry>hosts to which the limit applies</entry>
21078 </row>
21079 <row>
21080 <entry><option>smtp_accept_max_per_connection</option></entry>
21081 <entry>messages per connection</entry>
21082 </row>
21083 <row>
21084 <entry><option>smtp_accept_max_per_host</option></entry>
21085 <entry>connections from one host</entry>
21086 </row>
21087 <row>
21088 <entry><option>smtp_accept_queue</option></entry>
21089 <entry>queue mail if more connections</entry>
21090 </row>
21091 <row>
21092 <entry><option>smtp_accept_queue_per_connection</option></entry>
21093 <entry>queue if more messages per connection</entry>
21094 </row>
21095 <row>
21096 <entry><option>smtp_accept_reserve</option></entry>
21097 <entry>only reserve hosts if more connections</entry>
21098 </row>
21099 <row>
21100 <entry><option>smtp_active_hostname</option></entry>
21101 <entry>host name to use in messages</entry>
21102 </row>
21103 <row>
21104 <entry><option>smtp_banner</option></entry>
21105 <entry>text for welcome banner</entry>
21106 </row>
21107 <row>
21108 <entry><option>smtp_check_spool_space</option></entry>
21109 <entry>from SIZE on MAIL command</entry>
21110 </row>
21111 <row>
21112 <entry><option>smtp_connect_backlog</option></entry>
21113 <entry>passed to TCP/IP stack</entry>
21114 </row>
21115 <row>
21116 <entry><option>smtp_enforce_sync</option></entry>
21117 <entry>of SMTP command/responses</entry>
21118 </row>
21119 <row>
21120 <entry><option>smtp_etrn_command</option></entry>
21121 <entry>what to run for ETRN</entry>
21122 </row>
21123 <row>
21124 <entry><option>smtp_etrn_serialize</option></entry>
21125 <entry>only one at once</entry>
21126 </row>
21127 <row>
21128 <entry><option>smtp_load_reserve</option></entry>
21129 <entry>only reserve hosts if this load</entry>
21130 </row>
21131 <row>
21132 <entry><option>smtp_max_unknown_commands</option></entry>
21133 <entry>before dropping connection</entry>
21134 </row>
21135 <row>
21136 <entry><option>smtp_ratelimit_hosts</option></entry>
21137 <entry>apply ratelimiting to these hosts</entry>
21138 </row>
21139 <row>
21140 <entry><option>smtp_ratelimit_mail</option></entry>
21141 <entry>ratelimit for MAIL commands</entry>
21142 </row>
21143 <row>
21144 <entry><option>smtp_ratelimit_rcpt</option></entry>
21145 <entry>ratelimit for RCPT commands</entry>
21146 </row>
21147 <row>
21148 <entry><option>smtp_receive_timeout</option></entry>
21149 <entry>per command or data line</entry>
21150 </row>
21151 <row>
21152 <entry><option>smtp_reserve_hosts</option></entry>
21153 <entry>these are the reserve hosts</entry>
21154 </row>
21155 <row>
21156 <entry><option>smtp_return_error_details</option></entry>
21157 <entry>give detail on rejections</entry>
21158 </row>
21159 </tbody>
21160 </tgroup>
21161 </informaltable>
21162 </section>
21163 <section id="SECID113">
21164 <title>SMTP extensions</title>
21165 <informaltable frame="none">
21166 <tgroup cols="2" colsep="0" rowsep="0">
21167 <colspec colwidth="196pt" align="left"/>
21168 <colspec colwidth="254pt" align="left"/>
21169 <tbody>
21170 <row>
21171 <entry><option>accept_8bitmime</option></entry>
21172 <entry>advertise 8BITMIME</entry>
21173 </row>
21174 <row>
21175 <entry><option>auth_advertise_hosts</option></entry>
21176 <entry>advertise AUTH to these hosts</entry>
21177 </row>
21178 <row>
21179 <entry><option>ignore_fromline_hosts</option></entry>
21180 <entry>allow <quote>From </quote> from these hosts</entry>
21181 </row>
21182 <row>
21183 <entry><option>ignore_fromline_local</option></entry>
21184 <entry>allow <quote>From </quote> from local SMTP</entry>
21185 </row>
21186 <row>
21187 <entry><option>pipelining_advertise_hosts</option></entry>
21188 <entry>advertise pipelining to these hosts</entry>
21189 </row>
21190 <row>
21191 <entry><option>prdr_enable</option></entry>
21192 <entry>advertise PRDR to all hosts</entry>
21193 </row>
21194 <row>
21195 <entry><option>tls_advertise_hosts</option></entry>
21196 <entry>advertise TLS to these hosts</entry>
21197 </row>
21198 </tbody>
21199 </tgroup>
21200 </informaltable>
21201 </section>
21202 <section id="SECID114">
21203 <title>Processing messages</title>
21204 <informaltable frame="none">
21205 <tgroup cols="2" colsep="0" rowsep="0">
21206 <colspec colwidth="196pt" align="left"/>
21207 <colspec colwidth="254pt" align="left"/>
21208 <tbody>
21209 <row>
21210 <entry><option>allow_domain_literals</option></entry>
21211 <entry>recognize domain literal syntax</entry>
21212 </row>
21213 <row>
21214 <entry><option>allow_mx_to_ip</option></entry>
21215 <entry>allow MX to point to IP address</entry>
21216 </row>
21217 <row>
21218 <entry><option>allow_utf8_domains</option></entry>
21219 <entry>in addresses</entry>
21220 </row>
21221 <row>
21222 <entry><option>check_rfc2047_length</option></entry>
21223 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21224 </row>
21225 <row>
21226 <entry><option>delivery_date_remove</option></entry>
21227 <entry>from incoming messages</entry>
21228 </row>
21229 <row>
21230 <entry><option>envelope_to_remove</option></entry>
21231 <entry>from incoming messages</entry>
21232 </row>
21233 <row>
21234 <entry><option>extract_addresses_remove_arguments</option></entry>
21235 <entry>affects <option>-t</option> processing</entry>
21236 </row>
21237 <row>
21238 <entry><option>headers_charset</option></entry>
21239 <entry>default for translations</entry>
21240 </row>
21241 <row>
21242 <entry><option>qualify_domain</option></entry>
21243 <entry>default for senders</entry>
21244 </row>
21245 <row>
21246 <entry><option>qualify_recipient</option></entry>
21247 <entry>default for recipients</entry>
21248 </row>
21249 <row>
21250 <entry><option>return_path_remove</option></entry>
21251 <entry>from incoming messages</entry>
21252 </row>
21253 <row>
21254 <entry><option>strip_excess_angle_brackets</option></entry>
21255 <entry>in addresses</entry>
21256 </row>
21257 <row>
21258 <entry><option>strip_trailing_dot</option></entry>
21259 <entry>at end of addresses</entry>
21260 </row>
21261 <row>
21262 <entry><option>untrusted_set_sender</option></entry>
21263 <entry>untrusted can set envelope sender</entry>
21264 </row>
21265 </tbody>
21266 </tgroup>
21267 </informaltable>
21268 </section>
21269 <section id="SECID115">
21270 <title>System filter</title>
21271 <informaltable frame="none">
21272 <tgroup cols="2" colsep="0" rowsep="0">
21273 <colspec colwidth="196pt" align="left"/>
21274 <colspec colwidth="254pt" align="left"/>
21275 <tbody>
21276 <row>
21277 <entry><option>system_filter</option></entry>
21278 <entry>locate system filter</entry>
21279 </row>
21280 <row>
21281 <entry><option>system_filter_directory_transport</option></entry>
21282 <entry>transport for delivery to a directory</entry>
21283 </row>
21284 <row>
21285 <entry><option>system_filter_file_transport</option></entry>
21286 <entry>transport for delivery to a file</entry>
21287 </row>
21288 <row>
21289 <entry><option>system_filter_group</option></entry>
21290 <entry>group for filter running</entry>
21291 </row>
21292 <row>
21293 <entry><option>system_filter_pipe_transport</option></entry>
21294 <entry>transport for delivery to a pipe</entry>
21295 </row>
21296 <row>
21297 <entry><option>system_filter_reply_transport</option></entry>
21298 <entry>transport for autoreply delivery</entry>
21299 </row>
21300 <row>
21301 <entry><option>system_filter_user</option></entry>
21302 <entry>user for filter running</entry>
21303 </row>
21304 </tbody>
21305 </tgroup>
21306 </informaltable>
21307 </section>
21308 <section id="SECID116">
21309 <title>Routing and delivery</title>
21310 <informaltable frame="none">
21311 <tgroup cols="2" colsep="0" rowsep="0">
21312 <colspec colwidth="196pt" align="left"/>
21313 <colspec colwidth="254pt" align="left"/>
21314 <tbody>
21315 <row>
21316 <entry><option>disable_ipv6</option></entry>
21317 <entry>do no IPv6 processing</entry>
21318 </row>
21319 <row>
21320 <entry><option>dns_again_means_nonexist</option></entry>
21321 <entry>for broken domains</entry>
21322 </row>
21323 <row>
21324 <entry><option>dns_check_names_pattern</option></entry>
21325 <entry>pre-DNS syntax check</entry>
21326 </row>
21327 <row>
21328 <entry><option>dns_dnssec_ok</option></entry>
21329 <entry>parameter for resolver</entry>
21330 </row>
21331 <row>
21332 <entry><option>dns_ipv4_lookup</option></entry>
21333 <entry>only v4 lookup for these domains</entry>
21334 </row>
21335 <row>
21336 <entry><option>dns_retrans</option></entry>
21337 <entry>parameter for resolver</entry>
21338 </row>
21339 <row>
21340 <entry><option>dns_retry</option></entry>
21341 <entry>parameter for resolver</entry>
21342 </row>
21343 <row>
21344 <entry><option>dns_use_edns0</option></entry>
21345 <entry>parameter for resolver</entry>
21346 </row>
21347 <row>
21348 <entry><option>hold_domains</option></entry>
21349 <entry>hold delivery for these domains</entry>
21350 </row>
21351 <row>
21352 <entry><option>local_interfaces</option></entry>
21353 <entry>for routing checks</entry>
21354 </row>
21355 <row>
21356 <entry><option>queue_domains</option></entry>
21357 <entry>no immediate delivery for these</entry>
21358 </row>
21359 <row>
21360 <entry><option>queue_only</option></entry>
21361 <entry>no immediate delivery at all</entry>
21362 </row>
21363 <row>
21364 <entry><option>queue_only_file</option></entry>
21365 <entry>no immediate delivery if file exists</entry>
21366 </row>
21367 <row>
21368 <entry><option>queue_only_load</option></entry>
21369 <entry>no immediate delivery if load is high</entry>
21370 </row>
21371 <row>
21372 <entry><option>queue_only_load_latch</option></entry>
21373 <entry>don&#x2019;t re-evaluate load for each message</entry>
21374 </row>
21375 <row>
21376 <entry><option>queue_only_override</option></entry>
21377 <entry>allow command line to override</entry>
21378 </row>
21379 <row>
21380 <entry><option>queue_run_in_order</option></entry>
21381 <entry>order of arrival</entry>
21382 </row>
21383 <row>
21384 <entry><option>queue_run_max</option></entry>
21385 <entry>of simultaneous queue runners</entry>
21386 </row>
21387 <row>
21388 <entry><option>queue_smtp_domains</option></entry>
21389 <entry>no immediate SMTP delivery for these</entry>
21390 </row>
21391 <row>
21392 <entry><option>remote_max_parallel</option></entry>
21393 <entry>parallel SMTP delivery per message</entry>
21394 </row>
21395 <row>
21396 <entry><option>remote_sort_domains</option></entry>
21397 <entry>order of remote deliveries</entry>
21398 </row>
21399 <row>
21400 <entry><option>retry_data_expire</option></entry>
21401 <entry>timeout for retry data</entry>
21402 </row>
21403 <row>
21404 <entry><option>retry_interval_max</option></entry>
21405 <entry>safety net for retry rules</entry>
21406 </row>
21407 </tbody>
21408 </tgroup>
21409 </informaltable>
21410 </section>
21411 <section id="SECID117">
21412 <title>Bounce and warning messages</title>
21413 <informaltable frame="none">
21414 <tgroup cols="2" colsep="0" rowsep="0">
21415 <colspec colwidth="196pt" align="left"/>
21416 <colspec colwidth="254pt" align="left"/>
21417 <tbody>
21418 <row>
21419 <entry><option>bounce_message_file</option></entry>
21420 <entry>content of bounce</entry>
21421 </row>
21422 <row>
21423 <entry><option>bounce_message_text</option></entry>
21424 <entry>content of bounce</entry>
21425 </row>
21426 <row>
21427 <entry><option>bounce_return_body</option></entry>
21428 <entry>include body if returning message</entry>
21429 </row>
21430 <row>
21431 <entry><option>bounce_return_message</option></entry>
21432 <entry>include original message in bounce</entry>
21433 </row>
21434 <row>
21435 <entry><option>bounce_return_size_limit</option></entry>
21436 <entry>limit on returned message</entry>
21437 </row>
21438 <row>
21439 <entry><option>bounce_sender_authentication</option></entry>
21440 <entry>send authenticated sender with bounce</entry>
21441 </row>
21442 <row>
21443 <entry><option>dsn_from</option></entry>
21444 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21445 </row>
21446 <row>
21447 <entry><option>errors_copy</option></entry>
21448 <entry>copy bounce messages</entry>
21449 </row>
21450 <row>
21451 <entry><option>errors_reply_to</option></entry>
21452 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21453 </row>
21454 <row>
21455 <entry><option>delay_warning</option></entry>
21456 <entry>time schedule</entry>
21457 </row>
21458 <row>
21459 <entry><option>delay_warning_condition</option></entry>
21460 <entry>condition for warning messages</entry>
21461 </row>
21462 <row>
21463 <entry><option>ignore_bounce_errors_after</option></entry>
21464 <entry>discard undeliverable bounces</entry>
21465 </row>
21466 <row>
21467 <entry><option>smtp_return_error_details</option></entry>
21468 <entry>give detail on rejections</entry>
21469 </row>
21470 <row>
21471 <entry><option>warn_message_file</option></entry>
21472 <entry>content of warning message</entry>
21473 </row>
21474 </tbody>
21475 </tgroup>
21476 </informaltable>
21477 </section>
21478 <section id="SECTalomo">
21479 <title>Alphabetical list of main options</title>
21480 <para>
21481 Those options that undergo string expansion before use are marked with
21482 &dagger;.
21483 </para>
21484 <para>
21485 <indexterm role="option">
21486 <primary><option>accept_8bitmime</option></primary>
21487 </indexterm>
21488 </para>
21489 <informaltable frame="all">
21490 <tgroup cols="4" colsep="0" rowsep="0">
21491 <colspec colwidth="8*" align="left"/>
21492 <colspec colwidth="6*" align="center"/>
21493 <colspec colwidth="6*" align="center"/>
21494 <colspec colwidth="6*" align="right"/>
21495 <tbody>
21496 <row>
21497 <entry><option>accept_8bitmime</option></entry>
21498 <entry>Use: <emphasis>main</emphasis></entry>
21499 <entry>Type: <emphasis>boolean</emphasis></entry>
21500 <entry>Default: <emphasis>true</emphasis></entry>
21501 </row>
21502 </tbody>
21503 </tgroup>
21504 </informaltable>
21505 <para>
21506 <indexterm role="concept">
21507 <primary>8BITMIME</primary>
21508 </indexterm>
21509 <indexterm role="concept">
21510 <primary>8-bit characters</primary>
21511 </indexterm>
21512 <indexterm role="concept">
21513 <primary>log</primary>
21514 <secondary>selectors</secondary>
21515 </indexterm>
21516 <indexterm role="concept">
21517 <primary>log</primary>
21518 <secondary>8BITMIME</secondary>
21519 </indexterm>
21520 This option causes Exim to send 8BITMIME in its response to an SMTP
21521 EHLO command, and to accept the BODY= parameter on MAIL commands.
21522 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21523 takes no steps to do anything special with messages received by this route.
21524 </para>
21525 <para>
21526 Historically Exim kept this option off by default, but the maintainers
21527 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21528 It now defaults to true.
21529 A more detailed analysis of the issues is provided by Dan Bernstein:
21530 </para>
21531 <literallayout>
21532 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21533 </literallayout>
21534 <para>
21535 To log received 8BITMIME status use
21536 </para>
21537 <literallayout class="monospaced">
21538 log_selector = +8bitmime
21539 </literallayout>
21540 <para>
21541 <indexterm role="option">
21542 <primary><option>acl_not_smtp</option></primary>
21543 </indexterm>
21544 </para>
21545 <informaltable frame="all">
21546 <tgroup cols="4" colsep="0" rowsep="0">
21547 <colspec colwidth="8*" align="left"/>
21548 <colspec colwidth="6*" align="center"/>
21549 <colspec colwidth="6*" align="center"/>
21550 <colspec colwidth="6*" align="right"/>
21551 <tbody>
21552 <row>
21553 <entry><option>acl_not_smtp</option></entry>
21554 <entry>Use: <emphasis>main</emphasis></entry>
21555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21556 <entry>Default: <emphasis>unset</emphasis></entry>
21557 </row>
21558 </tbody>
21559 </tgroup>
21560 </informaltable>
21561 <para>
21562 <indexterm role="concept">
21563 <primary>access control lists (ACLs)</primary>
21564 <secondary>for non-SMTP messages</secondary>
21565 </indexterm>
21566 <indexterm role="concept">
21567 <primary>non-SMTP messages</primary>
21568 <secondary>ACLs for</secondary>
21569 </indexterm>
21570 This option defines the ACL that is run when a non-SMTP message has been
21571 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21572 further details.
21573 </para>
21574 <para>
21575 <indexterm role="option">
21576 <primary><option>acl_not_smtp_mime</option></primary>
21577 </indexterm>
21578 </para>
21579 <informaltable frame="all">
21580 <tgroup cols="4" colsep="0" rowsep="0">
21581 <colspec colwidth="8*" align="left"/>
21582 <colspec colwidth="6*" align="center"/>
21583 <colspec colwidth="6*" align="center"/>
21584 <colspec colwidth="6*" align="right"/>
21585 <tbody>
21586 <row>
21587 <entry><option>acl_not_smtp_mime</option></entry>
21588 <entry>Use: <emphasis>main</emphasis></entry>
21589 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21590 <entry>Default: <emphasis>unset</emphasis></entry>
21591 </row>
21592 </tbody>
21593 </tgroup>
21594 </informaltable>
21595 <para>
21596 This option defines the ACL that is run for individual MIME parts of non-SMTP
21597 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21598 SMTP messages.
21599 </para>
21600 <para>
21601 <indexterm role="option">
21602 <primary><option>acl_not_smtp_start</option></primary>
21603 </indexterm>
21604 </para>
21605 <informaltable frame="all">
21606 <tgroup cols="4" colsep="0" rowsep="0">
21607 <colspec colwidth="8*" align="left"/>
21608 <colspec colwidth="6*" align="center"/>
21609 <colspec colwidth="6*" align="center"/>
21610 <colspec colwidth="6*" align="right"/>
21611 <tbody>
21612 <row>
21613 <entry><option>acl_not_smtp_start</option></entry>
21614 <entry>Use: <emphasis>main</emphasis></entry>
21615 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21616 <entry>Default: <emphasis>unset</emphasis></entry>
21617 </row>
21618 </tbody>
21619 </tgroup>
21620 </informaltable>
21621 <para>
21622 <indexterm role="concept">
21623 <primary>access control lists (ACLs)</primary>
21624 <secondary>at start of non-SMTP message</secondary>
21625 </indexterm>
21626 <indexterm role="concept">
21627 <primary>non-SMTP messages</primary>
21628 <secondary>ACLs for</secondary>
21629 </indexterm>
21630 This option defines the ACL that is run before Exim starts reading a
21631 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21632 </para>
21633 <para>
21634 <indexterm role="option">
21635 <primary><option>acl_smtp_auth</option></primary>
21636 </indexterm>
21637 </para>
21638 <informaltable frame="all">
21639 <tgroup cols="4" colsep="0" rowsep="0">
21640 <colspec colwidth="8*" align="left"/>
21641 <colspec colwidth="6*" align="center"/>
21642 <colspec colwidth="6*" align="center"/>
21643 <colspec colwidth="6*" align="right"/>
21644 <tbody>
21645 <row>
21646 <entry><option>acl_smtp_auth</option></entry>
21647 <entry>Use: <emphasis>main</emphasis></entry>
21648 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21649 <entry>Default: <emphasis>unset</emphasis></entry>
21650 </row>
21651 </tbody>
21652 </tgroup>
21653 </informaltable>
21654 <para>
21655 <indexterm role="concept">
21656 <primary>access control lists (ACLs)</primary>
21657 <secondary>setting up for SMTP commands</secondary>
21658 </indexterm>
21659 <indexterm role="concept">
21660 <primary>AUTH</primary>
21661 <secondary>ACL for</secondary>
21662 </indexterm>
21663 This option defines the ACL that is run when an SMTP AUTH command is
21664 received. See chapter <xref linkend="CHAPACL"/> for further details.
21665 </para>
21666 <para>
21667 <indexterm role="option">
21668 <primary><option>acl_smtp_connect</option></primary>
21669 </indexterm>
21670 </para>
21671 <informaltable frame="all">
21672 <tgroup cols="4" colsep="0" rowsep="0">
21673 <colspec colwidth="8*" align="left"/>
21674 <colspec colwidth="6*" align="center"/>
21675 <colspec colwidth="6*" align="center"/>
21676 <colspec colwidth="6*" align="right"/>
21677 <tbody>
21678 <row>
21679 <entry><option>acl_smtp_connect</option></entry>
21680 <entry>Use: <emphasis>main</emphasis></entry>
21681 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21682 <entry>Default: <emphasis>unset</emphasis></entry>
21683 </row>
21684 </tbody>
21685 </tgroup>
21686 </informaltable>
21687 <para>
21688 <indexterm role="concept">
21689 <primary>access control lists (ACLs)</primary>
21690 <secondary>on SMTP connection</secondary>
21691 </indexterm>
21692 This option defines the ACL that is run when an SMTP connection is received.
21693 See chapter <xref linkend="CHAPACL"/> for further details.
21694 </para>
21695 <para>
21696 <indexterm role="option">
21697 <primary><option>acl_smtp_data</option></primary>
21698 </indexterm>
21699 </para>
21700 <informaltable frame="all">
21701 <tgroup cols="4" colsep="0" rowsep="0">
21702 <colspec colwidth="8*" align="left"/>
21703 <colspec colwidth="6*" align="center"/>
21704 <colspec colwidth="6*" align="center"/>
21705 <colspec colwidth="6*" align="right"/>
21706 <tbody>
21707 <row>
21708 <entry><option>acl_smtp_data</option></entry>
21709 <entry>Use: <emphasis>main</emphasis></entry>
21710 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21711 <entry>Default: <emphasis>unset</emphasis></entry>
21712 </row>
21713 </tbody>
21714 </tgroup>
21715 </informaltable>
21716 <para>
21717 <indexterm role="concept">
21718 <primary>DATA</primary>
21719 <secondary>ACL for</secondary>
21720 </indexterm>
21721 This option defines the ACL that is run after an SMTP DATA command has been
21722 processed and the message itself has been received, but before the final
21723 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21724 </para>
21725 <para>
21726 <indexterm role="option">
21727 <primary><option>acl_smtp_data_prdr</option></primary>
21728 </indexterm>
21729 </para>
21730 <informaltable frame="all">
21731 <tgroup cols="4" colsep="0" rowsep="0">
21732 <colspec colwidth="8*" align="left"/>
21733 <colspec colwidth="6*" align="center"/>
21734 <colspec colwidth="6*" align="center"/>
21735 <colspec colwidth="6*" align="right"/>
21736 <tbody>
21737 <row>
21738 <entry><option>acl_smtp_data_prdr</option></entry>
21739 <entry>Use: <emphasis>main</emphasis></entry>
21740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21741 <entry>Default: <emphasis>unset</emphasis></entry>
21742 </row>
21743 </tbody>
21744 </tgroup>
21745 </informaltable>
21746 <para>
21747 <indexterm role="concept">
21748 <primary>DATA</primary>
21749 <secondary>ACL for</secondary>
21750 </indexterm>
21751 <indexterm role="concept">
21752 <primary>access control lists (ACLs)</primary>
21753 <secondary>PRDR-related</secondary>
21754 </indexterm>
21755 <indexterm role="concept">
21756 <primary>access control lists (ACLs)</primary>
21757 <secondary>per-user data processing</secondary>
21758 </indexterm>
21759 This option defines the ACL that,
21760 if the PRDR feature has been negotiated,
21761 is run for each recipient after an SMTP DATA command has been
21762 processed and the message itself has been received, but before the
21763 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21764 </para>
21765 <para>
21766 <indexterm role="option">
21767 <primary><option>acl_smtp_etrn</option></primary>
21768 </indexterm>
21769 </para>
21770 <informaltable frame="all">
21771 <tgroup cols="4" colsep="0" rowsep="0">
21772 <colspec colwidth="8*" align="left"/>
21773 <colspec colwidth="6*" align="center"/>
21774 <colspec colwidth="6*" align="center"/>
21775 <colspec colwidth="6*" align="right"/>
21776 <tbody>
21777 <row>
21778 <entry><option>acl_smtp_etrn</option></entry>
21779 <entry>Use: <emphasis>main</emphasis></entry>
21780 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21781 <entry>Default: <emphasis>unset</emphasis></entry>
21782 </row>
21783 </tbody>
21784 </tgroup>
21785 </informaltable>
21786 <para>
21787 <indexterm role="concept">
21788 <primary>ETRN</primary>
21789 <secondary>ACL for</secondary>
21790 </indexterm>
21791 This option defines the ACL that is run when an SMTP ETRN command is
21792 received. See chapter <xref linkend="CHAPACL"/> for further details.
21793 </para>
21794 <para>
21795 <indexterm role="option">
21796 <primary><option>acl_smtp_expn</option></primary>
21797 </indexterm>
21798 </para>
21799 <informaltable frame="all">
21800 <tgroup cols="4" colsep="0" rowsep="0">
21801 <colspec colwidth="8*" align="left"/>
21802 <colspec colwidth="6*" align="center"/>
21803 <colspec colwidth="6*" align="center"/>
21804 <colspec colwidth="6*" align="right"/>
21805 <tbody>
21806 <row>
21807 <entry><option>acl_smtp_expn</option></entry>
21808 <entry>Use: <emphasis>main</emphasis></entry>
21809 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21810 <entry>Default: <emphasis>unset</emphasis></entry>
21811 </row>
21812 </tbody>
21813 </tgroup>
21814 </informaltable>
21815 <para>
21816 <indexterm role="concept">
21817 <primary>EXPN</primary>
21818 <secondary>ACL for</secondary>
21819 </indexterm>
21820 This option defines the ACL that is run when an SMTP EXPN command is
21821 received. See chapter <xref linkend="CHAPACL"/> for further details.
21822 </para>
21823 <para>
21824 <indexterm role="option">
21825 <primary><option>acl_smtp_helo</option></primary>
21826 </indexterm>
21827 </para>
21828 <informaltable frame="all">
21829 <tgroup cols="4" colsep="0" rowsep="0">
21830 <colspec colwidth="8*" align="left"/>
21831 <colspec colwidth="6*" align="center"/>
21832 <colspec colwidth="6*" align="center"/>
21833 <colspec colwidth="6*" align="right"/>
21834 <tbody>
21835 <row>
21836 <entry><option>acl_smtp_helo</option></entry>
21837 <entry>Use: <emphasis>main</emphasis></entry>
21838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21839 <entry>Default: <emphasis>unset</emphasis></entry>
21840 </row>
21841 </tbody>
21842 </tgroup>
21843 </informaltable>
21844 <para>
21845 <indexterm role="concept">
21846 <primary>EHLO</primary>
21847 <secondary>ACL for</secondary>
21848 </indexterm>
21849 <indexterm role="concept">
21850 <primary>HELO</primary>
21851 <secondary>ACL for</secondary>
21852 </indexterm>
21853 This option defines the ACL that is run when an SMTP EHLO or HELO
21854 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
21855 </para>
21856 <para>
21857 <indexterm role="option">
21858 <primary><option>acl_smtp_mail</option></primary>
21859 </indexterm>
21860 </para>
21861 <informaltable frame="all">
21862 <tgroup cols="4" colsep="0" rowsep="0">
21863 <colspec colwidth="8*" align="left"/>
21864 <colspec colwidth="6*" align="center"/>
21865 <colspec colwidth="6*" align="center"/>
21866 <colspec colwidth="6*" align="right"/>
21867 <tbody>
21868 <row>
21869 <entry><option>acl_smtp_mail</option></entry>
21870 <entry>Use: <emphasis>main</emphasis></entry>
21871 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21872 <entry>Default: <emphasis>unset</emphasis></entry>
21873 </row>
21874 </tbody>
21875 </tgroup>
21876 </informaltable>
21877 <para>
21878 <indexterm role="concept">
21879 <primary>MAIL</primary>
21880 <secondary>ACL for</secondary>
21881 </indexterm>
21882 This option defines the ACL that is run when an SMTP MAIL command is
21883 received. See chapter <xref linkend="CHAPACL"/> for further details.
21884 </para>
21885 <para>
21886 <indexterm role="option">
21887 <primary><option>acl_smtp_mailauth</option></primary>
21888 </indexterm>
21889 </para>
21890 <informaltable frame="all">
21891 <tgroup cols="4" colsep="0" rowsep="0">
21892 <colspec colwidth="8*" align="left"/>
21893 <colspec colwidth="6*" align="center"/>
21894 <colspec colwidth="6*" align="center"/>
21895 <colspec colwidth="6*" align="right"/>
21896 <tbody>
21897 <row>
21898 <entry><option>acl_smtp_mailauth</option></entry>
21899 <entry>Use: <emphasis>main</emphasis></entry>
21900 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21901 <entry>Default: <emphasis>unset</emphasis></entry>
21902 </row>
21903 </tbody>
21904 </tgroup>
21905 </informaltable>
21906 <para>
21907 <indexterm role="concept">
21908 <primary>AUTH</primary>
21909 <secondary>on MAIL command</secondary>
21910 </indexterm>
21911 This option defines the ACL that is run when there is an AUTH parameter on
21912 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
21913 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
21914 </para>
21915 <para>
21916 <indexterm role="option">
21917 <primary><option>acl_smtp_mime</option></primary>
21918 </indexterm>
21919 </para>
21920 <informaltable frame="all">
21921 <tgroup cols="4" colsep="0" rowsep="0">
21922 <colspec colwidth="8*" align="left"/>
21923 <colspec colwidth="6*" align="center"/>
21924 <colspec colwidth="6*" align="center"/>
21925 <colspec colwidth="6*" align="right"/>
21926 <tbody>
21927 <row>
21928 <entry><option>acl_smtp_mime</option></entry>
21929 <entry>Use: <emphasis>main</emphasis></entry>
21930 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21931 <entry>Default: <emphasis>unset</emphasis></entry>
21932 </row>
21933 </tbody>
21934 </tgroup>
21935 </informaltable>
21936 <para>
21937 <indexterm role="concept">
21938 <primary>MIME content scanning</primary>
21939 <secondary>ACL for</secondary>
21940 </indexterm>
21941 This option is available when Exim is built with the content-scanning
21942 extension. It defines the ACL that is run for each MIME part in a message. See
21943 section <xref linkend="SECTscanmimepart"/> for details.
21944 </para>
21945 <para>
21946 <indexterm role="option">
21947 <primary><option>acl_smtp_predata</option></primary>
21948 </indexterm>
21949 </para>
21950 <informaltable frame="all">
21951 <tgroup cols="4" colsep="0" rowsep="0">
21952 <colspec colwidth="8*" align="left"/>
21953 <colspec colwidth="6*" align="center"/>
21954 <colspec colwidth="6*" align="center"/>
21955 <colspec colwidth="6*" align="right"/>
21956 <tbody>
21957 <row>
21958 <entry><option>acl_smtp_predata</option></entry>
21959 <entry>Use: <emphasis>main</emphasis></entry>
21960 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21961 <entry>Default: <emphasis>unset</emphasis></entry>
21962 </row>
21963 </tbody>
21964 </tgroup>
21965 </informaltable>
21966 <para>
21967 This option defines the ACL that is run when an SMTP DATA command is
21968 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
21969 further details.
21970 </para>
21971 <para>
21972 <indexterm role="option">
21973 <primary><option>acl_smtp_quit</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_quit</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>QUIT, ACL for</primary>
21995 </indexterm>
21996 This option defines the ACL that is run when an SMTP QUIT command is
21997 received. See chapter <xref linkend="CHAPACL"/> for further details.
21998 </para>
21999 <para>
22000 <indexterm role="option">
22001 <primary><option>acl_smtp_rcpt</option></primary>
22002 </indexterm>
22003 </para>
22004 <informaltable frame="all">
22005 <tgroup cols="4" colsep="0" rowsep="0">
22006 <colspec colwidth="8*" align="left"/>
22007 <colspec colwidth="6*" align="center"/>
22008 <colspec colwidth="6*" align="center"/>
22009 <colspec colwidth="6*" align="right"/>
22010 <tbody>
22011 <row>
22012 <entry><option>acl_smtp_rcpt</option></entry>
22013 <entry>Use: <emphasis>main</emphasis></entry>
22014 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22015 <entry>Default: <emphasis>unset</emphasis></entry>
22016 </row>
22017 </tbody>
22018 </tgroup>
22019 </informaltable>
22020 <para>
22021 <indexterm role="concept">
22022 <primary>RCPT</primary>
22023 <secondary>ACL for</secondary>
22024 </indexterm>
22025 This option defines the ACL that is run when an SMTP RCPT command is
22026 received. See chapter <xref linkend="CHAPACL"/> for further details.
22027 </para>
22028 <para>
22029 <indexterm role="option">
22030 <primary><option>acl_smtp_starttls</option></primary>
22031 </indexterm>
22032 </para>
22033 <informaltable frame="all">
22034 <tgroup cols="4" colsep="0" rowsep="0">
22035 <colspec colwidth="8*" align="left"/>
22036 <colspec colwidth="6*" align="center"/>
22037 <colspec colwidth="6*" align="center"/>
22038 <colspec colwidth="6*" align="right"/>
22039 <tbody>
22040 <row>
22041 <entry><option>acl_smtp_starttls</option></entry>
22042 <entry>Use: <emphasis>main</emphasis></entry>
22043 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22044 <entry>Default: <emphasis>unset</emphasis></entry>
22045 </row>
22046 </tbody>
22047 </tgroup>
22048 </informaltable>
22049 <para>
22050 <indexterm role="concept">
22051 <primary>STARTTLS, ACL for</primary>
22052 </indexterm>
22053 This option defines the ACL that is run when an SMTP STARTTLS command is
22054 received. See chapter <xref linkend="CHAPACL"/> for further details.
22055 </para>
22056 <para>
22057 <indexterm role="option">
22058 <primary><option>acl_smtp_vrfy</option></primary>
22059 </indexterm>
22060 </para>
22061 <informaltable frame="all">
22062 <tgroup cols="4" colsep="0" rowsep="0">
22063 <colspec colwidth="8*" align="left"/>
22064 <colspec colwidth="6*" align="center"/>
22065 <colspec colwidth="6*" align="center"/>
22066 <colspec colwidth="6*" align="right"/>
22067 <tbody>
22068 <row>
22069 <entry><option>acl_smtp_vrfy</option></entry>
22070 <entry>Use: <emphasis>main</emphasis></entry>
22071 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22072 <entry>Default: <emphasis>unset</emphasis></entry>
22073 </row>
22074 </tbody>
22075 </tgroup>
22076 </informaltable>
22077 <para>
22078 <indexterm role="concept">
22079 <primary>VRFY</primary>
22080 <secondary>ACL for</secondary>
22081 </indexterm>
22082 This option defines the ACL that is run when an SMTP VRFY command is
22083 received. See chapter <xref linkend="CHAPACL"/> for further details.
22084 </para>
22085 <para revisionflag="changed">
22086 <indexterm role="option">
22087 <primary><option>add_environment</option></primary>
22088 </indexterm>
22089 </para>
22090 <informaltable frame="all" revisionflag="changed">
22091 <tgroup cols="4" colsep="0" rowsep="0">
22092 <colspec colwidth="8*" align="left"/>
22093 <colspec colwidth="6*" align="center"/>
22094 <colspec colwidth="6*" align="center"/>
22095 <colspec colwidth="6*" align="right"/>
22096 <tbody>
22097 <row>
22098 <entry><option>add_environment</option></entry>
22099 <entry>Use: <emphasis>main</emphasis></entry>
22100 <entry>Type: <emphasis>string list</emphasis></entry>
22101 <entry>Default: <emphasis>empty</emphasis></entry>
22102 </row>
22103 </tbody>
22104 </tgroup>
22105 </informaltable>
22106 <para revisionflag="changed">
22107 <indexterm role="concept">
22108 <primary>environment</primary>
22109 <secondary>inherited</secondary>
22110 </indexterm>
22111 This option allows to set individual environment variables that the
22112 currently linked libraries and programs in child processes use. The
22113 default list is empty,
22114 </para>
22115 <para>
22116 <indexterm role="option">
22117 <primary><option>admin_groups</option></primary>
22118 </indexterm>
22119 </para>
22120 <informaltable frame="all">
22121 <tgroup cols="4" colsep="0" rowsep="0">
22122 <colspec colwidth="8*" align="left"/>
22123 <colspec colwidth="6*" align="center"/>
22124 <colspec colwidth="6*" align="center"/>
22125 <colspec colwidth="6*" align="right"/>
22126 <tbody>
22127 <row>
22128 <entry><option>admin_groups</option></entry>
22129 <entry>Use: <emphasis>main</emphasis></entry>
22130 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22131 <entry>Default: <emphasis>unset</emphasis></entry>
22132 </row>
22133 </tbody>
22134 </tgroup>
22135 </informaltable>
22136 <para>
22137 <indexterm role="concept">
22138 <primary>admin user</primary>
22139 </indexterm>
22140 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22141 current group or any of the supplementary groups of an Exim caller is in this
22142 colon-separated list, the caller has admin privileges. If all your system
22143 programmers are in a specific group, for example, you can give them all Exim
22144 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22145 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22146 To permit this, you have to add individuals to the Exim group.
22147 </para>
22148 <para>
22149 <indexterm role="option">
22150 <primary><option>allow_domain_literals</option></primary>
22151 </indexterm>
22152 </para>
22153 <informaltable frame="all">
22154 <tgroup cols="4" colsep="0" rowsep="0">
22155 <colspec colwidth="8*" align="left"/>
22156 <colspec colwidth="6*" align="center"/>
22157 <colspec colwidth="6*" align="center"/>
22158 <colspec colwidth="6*" align="right"/>
22159 <tbody>
22160 <row>
22161 <entry><option>allow_domain_literals</option></entry>
22162 <entry>Use: <emphasis>main</emphasis></entry>
22163 <entry>Type: <emphasis>boolean</emphasis></entry>
22164 <entry>Default: <emphasis>false</emphasis></entry>
22165 </row>
22166 </tbody>
22167 </tgroup>
22168 </informaltable>
22169 <para>
22170 <indexterm role="concept">
22171 <primary>domain literal</primary>
22172 </indexterm>
22173 If this option is set, the RFC 2822 domain literal format is permitted in
22174 email addresses. The option is not set by default, because the domain literal
22175 format is not normally required these days, and few people know about it. It
22176 has, however, been exploited by mail abusers.
22177 </para>
22178 <para>
22179 Unfortunately, it seems that some DNS black list maintainers are using this
22180 format to report black listing to postmasters. If you want to accept messages
22181 addressed to your hosts by IP address, you need to set
22182 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22183 domains (defined in the named domain list <option>local_domains</option> in the default
22184 configuration). This <quote>magic string</quote> matches the domain literal form of all
22185 the local host&#x2019;s IP addresses.
22186 </para>
22187 <para>
22188 <indexterm role="option">
22189 <primary><option>allow_mx_to_ip</option></primary>
22190 </indexterm>
22191 </para>
22192 <informaltable frame="all">
22193 <tgroup cols="4" colsep="0" rowsep="0">
22194 <colspec colwidth="8*" align="left"/>
22195 <colspec colwidth="6*" align="center"/>
22196 <colspec colwidth="6*" align="center"/>
22197 <colspec colwidth="6*" align="right"/>
22198 <tbody>
22199 <row>
22200 <entry><option>allow_mx_to_ip</option></entry>
22201 <entry>Use: <emphasis>main</emphasis></entry>
22202 <entry>Type: <emphasis>boolean</emphasis></entry>
22203 <entry>Default: <emphasis>false</emphasis></entry>
22204 </row>
22205 </tbody>
22206 </tgroup>
22207 </informaltable>
22208 <para>
22209 <indexterm role="concept">
22210 <primary>MX record</primary>
22211 <secondary>pointing to IP address</secondary>
22212 </indexterm>
22213 It appears that more and more DNS zone administrators are breaking the rules
22214 and putting domain names that look like IP addresses on the right hand side of
22215 MX records. Exim follows the rules and rejects this, giving an error message
22216 that explains the mis-configuration. However, some other MTAs support this
22217 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22218 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22219 recommended, except when you have no other choice.
22220 </para>
22221 <para>
22222 <indexterm role="option">
22223 <primary><option>allow_utf8_domains</option></primary>
22224 </indexterm>
22225 </para>
22226 <informaltable frame="all">
22227 <tgroup cols="4" colsep="0" rowsep="0">
22228 <colspec colwidth="8*" align="left"/>
22229 <colspec colwidth="6*" align="center"/>
22230 <colspec colwidth="6*" align="center"/>
22231 <colspec colwidth="6*" align="right"/>
22232 <tbody>
22233 <row>
22234 <entry><option>allow_utf8_domains</option></entry>
22235 <entry>Use: <emphasis>main</emphasis></entry>
22236 <entry>Type: <emphasis>boolean</emphasis></entry>
22237 <entry>Default: <emphasis>false</emphasis></entry>
22238 </row>
22239 </tbody>
22240 </tgroup>
22241 </informaltable>
22242 <para>
22243 <indexterm role="concept">
22244 <primary>domain</primary>
22245 <secondary>UTF-8 characters in</secondary>
22246 </indexterm>
22247 <indexterm role="concept">
22248 <primary>UTF-8</primary>
22249 <secondary>in domain name</secondary>
22250 </indexterm>
22251 Lots of discussion is going on about internationalized domain names. One
22252 camp is strongly in favour of just using UTF-8 characters, and it seems
22253 that at least two other MTAs permit this. This option allows Exim users to
22254 experiment if they wish.
22255 </para>
22256 <para>
22257 If it is set true, Exim&#x2019;s domain parsing function allows valid
22258 UTF-8 multicharacters to appear in domain name components, in addition to
22259 letters, digits, and hyphens. However, just setting this option is not
22260 enough; if you want to look up these domain names in the DNS, you must also
22261 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
22262 suitable setting is:
22263 </para>
22264 <literallayout class="monospaced">
22265 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
22266   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
22267 </literallayout>
22268 <para>
22269 Alternatively, you can just disable this feature by setting
22270 </para>
22271 <literallayout class="monospaced">
22272 dns_check_names_pattern =
22273 </literallayout>
22274 <para>
22275 That is, set the option to an empty string so that no check is done.
22276 </para>
22277 <para>
22278 <indexterm role="option">
22279 <primary><option>auth_advertise_hosts</option></primary>
22280 </indexterm>
22281 </para>
22282 <informaltable frame="all">
22283 <tgroup cols="4" colsep="0" rowsep="0">
22284 <colspec colwidth="8*" align="left"/>
22285 <colspec colwidth="6*" align="center"/>
22286 <colspec colwidth="6*" align="center"/>
22287 <colspec colwidth="6*" align="right"/>
22288 <tbody>
22289 <row>
22290 <entry><option>auth_advertise_hosts</option></entry>
22291 <entry>Use: <emphasis>main</emphasis></entry>
22292 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22293 <entry>Default: <emphasis>*</emphasis></entry>
22294 </row>
22295 </tbody>
22296 </tgroup>
22297 </informaltable>
22298 <para>
22299 <indexterm role="concept">
22300 <primary>authentication</primary>
22301 <secondary>advertising</secondary>
22302 </indexterm>
22303 <indexterm role="concept">
22304 <primary>AUTH</primary>
22305 <secondary>advertising</secondary>
22306 </indexterm>
22307 If any server authentication mechanisms are configured, Exim advertises them in
22308 response to an EHLO command only if the calling host matches this list.
22309 Otherwise, Exim does not advertise AUTH.
22310 Exim does not accept AUTH commands from clients to which it has not
22311 advertised the availability of AUTH. The advertising of individual
22312 authentication mechanisms can be controlled by the use of the
22313 <option>server_advertise_condition</option> generic authenticator option on the individual
22314 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
22315 </para>
22316 <para>
22317 Certain mail clients (for example, Netscape) require the user to provide a name
22318 and password for authentication if AUTH is advertised, even though it may
22319 not be needed (the host may accept messages from hosts on its local LAN without
22320 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
22321 to make these clients more friendly by excluding them from the set of hosts to
22322 which Exim advertises AUTH.
22323 </para>
22324 <para>
22325 <indexterm role="concept">
22326 <primary>AUTH</primary>
22327 <secondary>advertising when encrypted</secondary>
22328 </indexterm>
22329 If you want to advertise the availability of AUTH only when the connection
22330 is encrypted using TLS, you can make use of the fact that the value of this
22331 option is expanded, with a setting like this:
22332 </para>
22333 <literallayout class="monospaced">
22334 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
22335 </literallayout>
22336 <para>
22337 <indexterm role="variable">
22338 <primary><varname>$tls_in_cipher</varname></primary>
22339 </indexterm>
22340 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
22341 the expansion is empty, thus matching no hosts. Otherwise, the result of the
22342 expansion is *, which matches all hosts.
22343 </para>
22344 <para>
22345 <indexterm role="option">
22346 <primary><option>auto_thaw</option></primary>
22347 </indexterm>
22348 </para>
22349 <informaltable frame="all">
22350 <tgroup cols="4" colsep="0" rowsep="0">
22351 <colspec colwidth="8*" align="left"/>
22352 <colspec colwidth="6*" align="center"/>
22353 <colspec colwidth="6*" align="center"/>
22354 <colspec colwidth="6*" align="right"/>
22355 <tbody>
22356 <row>
22357 <entry><option>auto_thaw</option></entry>
22358 <entry>Use: <emphasis>main</emphasis></entry>
22359 <entry>Type: <emphasis>time</emphasis></entry>
22360 <entry>Default: <emphasis>0s</emphasis></entry>
22361 </row>
22362 </tbody>
22363 </tgroup>
22364 </informaltable>
22365 <para>
22366 <indexterm role="concept">
22367 <primary>thawing messages</primary>
22368 </indexterm>
22369 <indexterm role="concept">
22370 <primary>unfreezing messages</primary>
22371 </indexterm>
22372 If this option is set to a time greater than zero, a queue runner will try a
22373 new delivery attempt on any frozen message, other than a bounce message, if
22374 this much time has passed since it was frozen. This may result in the message
22375 being re-frozen if nothing has changed since the last attempt. It is a way of
22376 saying <quote>keep on trying, even though there are big problems</quote>.
22377 </para>
22378 <para>
22379 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
22380 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
22381 thought to be very useful any more, and its use should probably be avoided.
22382 </para>
22383 <para>
22384 <indexterm role="option">
22385 <primary><option>av_scanner</option></primary>
22386 </indexterm>
22387 </para>
22388 <informaltable frame="all">
22389 <tgroup cols="4" colsep="0" rowsep="0">
22390 <colspec colwidth="8*" align="left"/>
22391 <colspec colwidth="6*" align="center"/>
22392 <colspec colwidth="6*" align="center"/>
22393 <colspec colwidth="6*" align="right"/>
22394 <tbody>
22395 <row>
22396 <entry><option>av_scanner</option></entry>
22397 <entry>Use: <emphasis>main</emphasis></entry>
22398 <entry>Type: <emphasis>string</emphasis></entry>
22399 <entry>Default: <emphasis>see below</emphasis></entry>
22400 </row>
22401 </tbody>
22402 </tgroup>
22403 </informaltable>
22404 <para>
22405 This option is available if Exim is built with the content-scanning extension.
22406 It specifies which anti-virus scanner to use. The default value is:
22407 </para>
22408 <literallayout class="monospaced">
22409 sophie:/var/run/sophie
22410 </literallayout>
22411 <para>
22412 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
22413 before use. See section <xref linkend="SECTscanvirus"/> for further details.
22414 </para>
22415 <para>
22416 <indexterm role="option">
22417 <primary><option>bi_command</option></primary>
22418 </indexterm>
22419 </para>
22420 <informaltable frame="all">
22421 <tgroup cols="4" colsep="0" rowsep="0">
22422 <colspec colwidth="8*" align="left"/>
22423 <colspec colwidth="6*" align="center"/>
22424 <colspec colwidth="6*" align="center"/>
22425 <colspec colwidth="6*" align="right"/>
22426 <tbody>
22427 <row>
22428 <entry><option>bi_command</option></entry>
22429 <entry>Use: <emphasis>main</emphasis></entry>
22430 <entry>Type: <emphasis>string</emphasis></entry>
22431 <entry>Default: <emphasis>unset</emphasis></entry>
22432 </row>
22433 </tbody>
22434 </tgroup>
22435 </informaltable>
22436 <para>
22437 <indexterm role="option">
22438 <primary><option>-bi</option></primary>
22439 </indexterm>
22440 This option supplies the name of a command that is run when Exim is called with
22441 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
22442 just the command name, it is not a complete command line. If an argument is
22443 required, it must come from the <option>-oA</option> command line option.
22444 </para>
22445 <para>
22446 <indexterm role="option">
22447 <primary><option>bounce_message_file</option></primary>
22448 </indexterm>
22449 </para>
22450 <informaltable frame="all">
22451 <tgroup cols="4" colsep="0" rowsep="0">
22452 <colspec colwidth="8*" align="left"/>
22453 <colspec colwidth="6*" align="center"/>
22454 <colspec colwidth="6*" align="center"/>
22455 <colspec colwidth="6*" align="right"/>
22456 <tbody>
22457 <row>
22458 <entry><option>bounce_message_file</option></entry>
22459 <entry>Use: <emphasis>main</emphasis></entry>
22460 <entry>Type: <emphasis>string</emphasis></entry>
22461 <entry>Default: <emphasis>unset</emphasis></entry>
22462 </row>
22463 </tbody>
22464 </tgroup>
22465 </informaltable>
22466 <para>
22467 <indexterm role="concept">
22468 <primary>bounce message</primary>
22469 <secondary>customizing</secondary>
22470 </indexterm>
22471 <indexterm role="concept">
22472 <primary>customizing</primary>
22473 <secondary>bounce message</secondary>
22474 </indexterm>
22475 This option defines a template file containing paragraphs of text to be used
22476 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22477 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22478 </para>
22479 <para>
22480 <indexterm role="option">
22481 <primary><option>bounce_message_text</option></primary>
22482 </indexterm>
22483 </para>
22484 <informaltable frame="all">
22485 <tgroup cols="4" colsep="0" rowsep="0">
22486 <colspec colwidth="8*" align="left"/>
22487 <colspec colwidth="6*" align="center"/>
22488 <colspec colwidth="6*" align="center"/>
22489 <colspec colwidth="6*" align="right"/>
22490 <tbody>
22491 <row>
22492 <entry><option>bounce_message_text</option></entry>
22493 <entry>Use: <emphasis>main</emphasis></entry>
22494 <entry>Type: <emphasis>string</emphasis></entry>
22495 <entry>Default: <emphasis>unset</emphasis></entry>
22496 </row>
22497 </tbody>
22498 </tgroup>
22499 </informaltable>
22500 <para>
22501 When this option is set, its contents are included in the default bounce
22502 message immediately after <quote>This message was created automatically by mail
22503 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22504 </para>
22505 <para>
22506 <indexterm role="option">
22507 <primary><option>bounce_return_body</option></primary>
22508 </indexterm>
22509 </para>
22510 <informaltable frame="all">
22511 <tgroup cols="4" colsep="0" rowsep="0">
22512 <colspec colwidth="8*" align="left"/>
22513 <colspec colwidth="6*" align="center"/>
22514 <colspec colwidth="6*" align="center"/>
22515 <colspec colwidth="6*" align="right"/>
22516 <tbody>
22517 <row>
22518 <entry><option>bounce_return_body</option></entry>
22519 <entry>Use: <emphasis>main</emphasis></entry>
22520 <entry>Type: <emphasis>boolean</emphasis></entry>
22521 <entry>Default: <emphasis>true</emphasis></entry>
22522 </row>
22523 </tbody>
22524 </tgroup>
22525 </informaltable>
22526 <para>
22527 <indexterm role="concept">
22528 <primary>bounce message</primary>
22529 <secondary>including body</secondary>
22530 </indexterm>
22531 This option controls whether the body of an incoming message is included in a
22532 bounce message when <option>bounce_return_message</option> is true. The default setting
22533 causes the entire message, both header and body, to be returned (subject to the
22534 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22535 message header is included. In the case of a non-SMTP message containing an
22536 error that is detected during reception, only those header lines preceding the
22537 point at which the error was detected are returned.
22538 <indexterm role="concept">
22539 <primary>bounce message</primary>
22540 <secondary>including original</secondary>
22541 </indexterm>
22542 </para>
22543 <para>
22544 <indexterm role="option">
22545 <primary><option>bounce_return_message</option></primary>
22546 </indexterm>
22547 </para>
22548 <informaltable frame="all">
22549 <tgroup cols="4" colsep="0" rowsep="0">
22550 <colspec colwidth="8*" align="left"/>
22551 <colspec colwidth="6*" align="center"/>
22552 <colspec colwidth="6*" align="center"/>
22553 <colspec colwidth="6*" align="right"/>
22554 <tbody>
22555 <row>
22556 <entry><option>bounce_return_message</option></entry>
22557 <entry>Use: <emphasis>main</emphasis></entry>
22558 <entry>Type: <emphasis>boolean</emphasis></entry>
22559 <entry>Default: <emphasis>true</emphasis></entry>
22560 </row>
22561 </tbody>
22562 </tgroup>
22563 </informaltable>
22564 <para>
22565 If this option is set false, none of the original message is included in
22566 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22567 <option>bounce_return_body</option>.
22568 </para>
22569 <para>
22570 <indexterm role="option">
22571 <primary><option>bounce_return_size_limit</option></primary>
22572 </indexterm>
22573 </para>
22574 <informaltable frame="all">
22575 <tgroup cols="4" colsep="0" rowsep="0">
22576 <colspec colwidth="8*" align="left"/>
22577 <colspec colwidth="6*" align="center"/>
22578 <colspec colwidth="6*" align="center"/>
22579 <colspec colwidth="6*" align="right"/>
22580 <tbody>
22581 <row>
22582 <entry><option>bounce_return_size_limit</option></entry>
22583 <entry>Use: <emphasis>main</emphasis></entry>
22584 <entry>Type: <emphasis>integer</emphasis></entry>
22585 <entry>Default: <emphasis>100K</emphasis></entry>
22586 </row>
22587 </tbody>
22588 </tgroup>
22589 </informaltable>
22590 <para>
22591 <indexterm role="concept">
22592 <primary>size</primary>
22593 <secondary>of bounce, limit</secondary>
22594 </indexterm>
22595 <indexterm role="concept">
22596 <primary>bounce message</primary>
22597 <secondary>size limit</secondary>
22598 </indexterm>
22599 <indexterm role="concept">
22600 <primary>limit</primary>
22601 <secondary>bounce message size</secondary>
22602 </indexterm>
22603 This option sets a limit in bytes on the size of messages that are returned to
22604 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
22605 limit should be less than the value of the global <option>message_size_limit</option> and of
22606 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
22607 that Exim generates. If this option is set to zero there is no limit.
22608 </para>
22609 <para>
22610 When the body of any message that is to be included in a bounce message is
22611 greater than the limit, it is truncated, and a comment pointing this out is
22612 added at the top. The actual cutoff may be greater than the value given, owing
22613 to the use of buffering for transferring the message in chunks (typically 8K in
22614 size). The idea is to save bandwidth on those undeliverable 15-megabyte
22615 messages.
22616 </para>
22617 <para>
22618 <indexterm role="option">
22619 <primary><option>bounce_sender_authentication</option></primary>
22620 </indexterm>
22621 </para>
22622 <informaltable frame="all">
22623 <tgroup cols="4" colsep="0" rowsep="0">
22624 <colspec colwidth="8*" align="left"/>
22625 <colspec colwidth="6*" align="center"/>
22626 <colspec colwidth="6*" align="center"/>
22627 <colspec colwidth="6*" align="right"/>
22628 <tbody>
22629 <row>
22630 <entry><option>bounce_sender_authentication</option></entry>
22631 <entry>Use: <emphasis>main</emphasis></entry>
22632 <entry>Type: <emphasis>string</emphasis></entry>
22633 <entry>Default: <emphasis>unset</emphasis></entry>
22634 </row>
22635 </tbody>
22636 </tgroup>
22637 </informaltable>
22638 <para>
22639 <indexterm role="concept">
22640 <primary>bounce message</primary>
22641 <secondary>sender authentication</secondary>
22642 </indexterm>
22643 <indexterm role="concept">
22644 <primary>authentication</primary>
22645 <secondary>bounce message</secondary>
22646 </indexterm>
22647 <indexterm role="concept">
22648 <primary>AUTH</primary>
22649 <secondary>on bounce message</secondary>
22650 </indexterm>
22651 This option provides an authenticated sender address that is sent with any
22652 bounce messages generated by Exim that are sent over an authenticated SMTP
22653 connection. A typical setting might be:
22654 </para>
22655 <literallayout class="monospaced">
22656 bounce_sender_authentication = mailer-daemon@my.domain.example
22657 </literallayout>
22658 <para>
22659 which would cause bounce messages to be sent using the SMTP command:
22660 </para>
22661 <literallayout class="monospaced">
22662 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
22663 </literallayout>
22664 <para>
22665 The value of <option>bounce_sender_authentication</option> must always be a complete email
22666 address.
22667 </para>
22668 <para>
22669 <indexterm role="option">
22670 <primary><option>callout_domain_negative_expire</option></primary>
22671 </indexterm>
22672 </para>
22673 <informaltable frame="all">
22674 <tgroup cols="4" colsep="0" rowsep="0">
22675 <colspec colwidth="8*" align="left"/>
22676 <colspec colwidth="6*" align="center"/>
22677 <colspec colwidth="6*" align="center"/>
22678 <colspec colwidth="6*" align="right"/>
22679 <tbody>
22680 <row>
22681 <entry><option>callout_domain_negative_expire</option></entry>
22682 <entry>Use: <emphasis>main</emphasis></entry>
22683 <entry>Type: <emphasis>time</emphasis></entry>
22684 <entry>Default: <emphasis>3h</emphasis></entry>
22685 </row>
22686 </tbody>
22687 </tgroup>
22688 </informaltable>
22689 <para>
22690 <indexterm role="concept">
22691 <primary>caching</primary>
22692 <secondary>callout timeouts</secondary>
22693 </indexterm>
22694 <indexterm role="concept">
22695 <primary>callout</primary>
22696 <secondary>caching timeouts</secondary>
22697 </indexterm>
22698 This option specifies the expiry time for negative callout cache data for a
22699 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22700 section <xref linkend="SECTcallvercache"/> for details of the caching.
22701 </para>
22702 <para>
22703 <indexterm role="option">
22704 <primary><option>callout_domain_positive_expire</option></primary>
22705 </indexterm>
22706 </para>
22707 <informaltable frame="all">
22708 <tgroup cols="4" colsep="0" rowsep="0">
22709 <colspec colwidth="8*" align="left"/>
22710 <colspec colwidth="6*" align="center"/>
22711 <colspec colwidth="6*" align="center"/>
22712 <colspec colwidth="6*" align="right"/>
22713 <tbody>
22714 <row>
22715 <entry><option>callout_domain_positive_expire</option></entry>
22716 <entry>Use: <emphasis>main</emphasis></entry>
22717 <entry>Type: <emphasis>time</emphasis></entry>
22718 <entry>Default: <emphasis>7d</emphasis></entry>
22719 </row>
22720 </tbody>
22721 </tgroup>
22722 </informaltable>
22723 <para>
22724 This option specifies the expiry time for positive callout cache data for a
22725 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22726 section <xref linkend="SECTcallvercache"/> for details of the caching.
22727 </para>
22728 <para>
22729 <indexterm role="option">
22730 <primary><option>callout_negative_expire</option></primary>
22731 </indexterm>
22732 </para>
22733 <informaltable frame="all">
22734 <tgroup cols="4" colsep="0" rowsep="0">
22735 <colspec colwidth="8*" align="left"/>
22736 <colspec colwidth="6*" align="center"/>
22737 <colspec colwidth="6*" align="center"/>
22738 <colspec colwidth="6*" align="right"/>
22739 <tbody>
22740 <row>
22741 <entry><option>callout_negative_expire</option></entry>
22742 <entry>Use: <emphasis>main</emphasis></entry>
22743 <entry>Type: <emphasis>time</emphasis></entry>
22744 <entry>Default: <emphasis>2h</emphasis></entry>
22745 </row>
22746 </tbody>
22747 </tgroup>
22748 </informaltable>
22749 <para>
22750 This option specifies the expiry time for negative callout cache data for an
22751 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22752 section <xref linkend="SECTcallvercache"/> for details of the caching.
22753 </para>
22754 <para>
22755 <indexterm role="option">
22756 <primary><option>callout_positive_expire</option></primary>
22757 </indexterm>
22758 </para>
22759 <informaltable frame="all">
22760 <tgroup cols="4" colsep="0" rowsep="0">
22761 <colspec colwidth="8*" align="left"/>
22762 <colspec colwidth="6*" align="center"/>
22763 <colspec colwidth="6*" align="center"/>
22764 <colspec colwidth="6*" align="right"/>
22765 <tbody>
22766 <row>
22767 <entry><option>callout_positive_expire</option></entry>
22768 <entry>Use: <emphasis>main</emphasis></entry>
22769 <entry>Type: <emphasis>time</emphasis></entry>
22770 <entry>Default: <emphasis>24h</emphasis></entry>
22771 </row>
22772 </tbody>
22773 </tgroup>
22774 </informaltable>
22775 <para>
22776 This option specifies the expiry time for positive callout cache data for an
22777 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22778 section <xref linkend="SECTcallvercache"/> for details of the caching.
22779 </para>
22780 <para>
22781 <indexterm role="option">
22782 <primary><option>callout_random_local_part</option></primary>
22783 </indexterm>
22784 </para>
22785 <informaltable frame="all">
22786 <tgroup cols="4" colsep="0" rowsep="0">
22787 <colspec colwidth="8*" align="left"/>
22788 <colspec colwidth="6*" align="center"/>
22789 <colspec colwidth="6*" align="center"/>
22790 <colspec colwidth="6*" align="right"/>
22791 <tbody>
22792 <row>
22793 <entry><option>callout_random_local_part</option></entry>
22794 <entry>Use: <emphasis>main</emphasis></entry>
22795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22796 <entry>Default: <emphasis>see below</emphasis></entry>
22797 </row>
22798 </tbody>
22799 </tgroup>
22800 </informaltable>
22801 <para>
22802 This option defines the <quote>random</quote> local part that can be used as part of
22803 callout verification. The default value is
22804 </para>
22805 <literallayout class="monospaced">
22806 $primary_hostname-$tod_epoch-testing
22807 </literallayout>
22808 <para>
22809 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
22810 </para>
22811 <para>
22812 <indexterm role="option">
22813 <primary><option>check_log_inodes</option></primary>
22814 </indexterm>
22815 </para>
22816 <informaltable frame="all">
22817 <tgroup cols="4" colsep="0" rowsep="0">
22818 <colspec colwidth="8*" align="left"/>
22819 <colspec colwidth="6*" align="center"/>
22820 <colspec colwidth="6*" align="center"/>
22821 <colspec colwidth="6*" align="right"/>
22822 <tbody>
22823 <row>
22824 <entry><option>check_log_inodes</option></entry>
22825 <entry>Use: <emphasis>main</emphasis></entry>
22826 <entry>Type: <emphasis>integer</emphasis></entry>
22827 <entry>Default: <emphasis>0</emphasis></entry>
22828 </row>
22829 </tbody>
22830 </tgroup>
22831 </informaltable>
22832 <para>
22833 See <option>check_spool_space</option> below.
22834 </para>
22835 <para>
22836 <indexterm role="option">
22837 <primary><option>check_log_space</option></primary>
22838 </indexterm>
22839 </para>
22840 <informaltable frame="all">
22841 <tgroup cols="4" colsep="0" rowsep="0">
22842 <colspec colwidth="8*" align="left"/>
22843 <colspec colwidth="6*" align="center"/>
22844 <colspec colwidth="6*" align="center"/>
22845 <colspec colwidth="6*" align="right"/>
22846 <tbody>
22847 <row>
22848 <entry><option>check_log_space</option></entry>
22849 <entry>Use: <emphasis>main</emphasis></entry>
22850 <entry>Type: <emphasis>integer</emphasis></entry>
22851 <entry>Default: <emphasis>0</emphasis></entry>
22852 </row>
22853 </tbody>
22854 </tgroup>
22855 </informaltable>
22856 <para>
22857 See <option>check_spool_space</option> below.
22858 </para>
22859 <para>
22860 <indexterm role="option">
22861 <primary><option>check_rfc2047_length</option></primary>
22862 </indexterm>
22863 <indexterm role="concept">
22864 <primary>RFC 2047</primary>
22865 <secondary>disabling length check</secondary>
22866 </indexterm>
22867 <indexterm role="option">
22868 <primary><option>check_rfc2047_length</option></primary>
22869 </indexterm>
22870 </para>
22871 <informaltable frame="all">
22872 <tgroup cols="4" colsep="0" rowsep="0">
22873 <colspec colwidth="8*" align="left"/>
22874 <colspec colwidth="6*" align="center"/>
22875 <colspec colwidth="6*" align="center"/>
22876 <colspec colwidth="6*" align="right"/>
22877 <tbody>
22878 <row>
22879 <entry><option>check_rfc2047_length</option></entry>
22880 <entry>Use: <emphasis>main</emphasis></entry>
22881 <entry>Type: <emphasis>boolean</emphasis></entry>
22882 <entry>Default: <emphasis>true</emphasis></entry>
22883 </row>
22884 </tbody>
22885 </tgroup>
22886 </informaltable>
22887 <para>
22888 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
22889 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
22890 word; strings to be encoded that exceed this length are supposed to use
22891 multiple encoded words. By default, Exim does not recognize encoded words that
22892 exceed the maximum length. However, it seems that some software, in violation
22893 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
22894 set false, Exim recognizes encoded words of any length.
22895 </para>
22896 <para>
22897 <indexterm role="option">
22898 <primary><option>check_spool_inodes</option></primary>
22899 </indexterm>
22900 </para>
22901 <informaltable frame="all">
22902 <tgroup cols="4" colsep="0" rowsep="0">
22903 <colspec colwidth="8*" align="left"/>
22904 <colspec colwidth="6*" align="center"/>
22905 <colspec colwidth="6*" align="center"/>
22906 <colspec colwidth="6*" align="right"/>
22907 <tbody>
22908 <row>
22909 <entry><option>check_spool_inodes</option></entry>
22910 <entry>Use: <emphasis>main</emphasis></entry>
22911 <entry>Type: <emphasis>integer</emphasis></entry>
22912 <entry>Default: <emphasis>0</emphasis></entry>
22913 </row>
22914 </tbody>
22915 </tgroup>
22916 </informaltable>
22917 <para>
22918 See <option>check_spool_space</option> below.
22919 </para>
22920 <para>
22921 <indexterm role="option">
22922 <primary><option>check_spool_space</option></primary>
22923 </indexterm>
22924 </para>
22925 <informaltable frame="all">
22926 <tgroup cols="4" colsep="0" rowsep="0">
22927 <colspec colwidth="8*" align="left"/>
22928 <colspec colwidth="6*" align="center"/>
22929 <colspec colwidth="6*" align="center"/>
22930 <colspec colwidth="6*" align="right"/>
22931 <tbody>
22932 <row>
22933 <entry><option>check_spool_space</option></entry>
22934 <entry>Use: <emphasis>main</emphasis></entry>
22935 <entry>Type: <emphasis>integer</emphasis></entry>
22936 <entry>Default: <emphasis>0</emphasis></entry>
22937 </row>
22938 </tbody>
22939 </tgroup>
22940 </informaltable>
22941 <para>
22942 <indexterm role="concept">
22943 <primary>checking disk space</primary>
22944 </indexterm>
22945 <indexterm role="concept">
22946 <primary>disk space, checking</primary>
22947 </indexterm>
22948 <indexterm role="concept">
22949 <primary>spool directory</primary>
22950 <secondary>checking space</secondary>
22951 </indexterm>
22952 The four <option>check_...</option> options allow for checking of disk resources before a
22953 message is accepted.
22954 </para>
22955 <para>
22956 <indexterm role="variable">
22957 <primary><varname>$log_inodes</varname></primary>
22958 </indexterm>
22959 <indexterm role="variable">
22960 <primary><varname>$log_space</varname></primary>
22961 </indexterm>
22962 <indexterm role="variable">
22963 <primary><varname>$spool_inodes</varname></primary>
22964 </indexterm>
22965 <indexterm role="variable">
22966 <primary><varname>$spool_space</varname></primary>
22967 </indexterm>
22968 When any of these options are set, they apply to all incoming messages. If you
22969 want to apply different checks to different kinds of message, you can do so by
22970 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
22971 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
22972 </para>
22973 <para>
22974 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
22975 either value is greater than zero, for example:
22976 </para>
22977 <literallayout class="monospaced">
22978 check_spool_space = 10M
22979 check_spool_inodes = 100
22980 </literallayout>
22981 <para>
22982 The spool partition is the one that contains the directory defined by
22983 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
22984 transit.
22985 </para>
22986 <para>
22987 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
22988 files are written if either is greater than zero. These should be set only if
22989 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
22990 </para>
22991 <para>
22992 If there is less space or fewer inodes than requested, Exim refuses to accept
22993 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
22994 error response to the MAIL command. If ESMTP is in use and there was a
22995 SIZE parameter on the MAIL command, its value is added to the
22996 <option>check_spool_space</option> value, and the check is performed even if
22997 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
22998 </para>
22999 <para>
23000 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
23001 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
23002 </para>
23003 <para>
23004 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
23005 failure a message is written to stderr and Exim exits with a non-zero code, as
23006 it obviously cannot send an error message of any kind.
23007 </para>
23008 <para>
23009 <indexterm role="option">
23010 <primary><option>daemon_smtp_ports</option></primary>
23011 </indexterm>
23012 </para>
23013 <informaltable frame="all">
23014 <tgroup cols="4" colsep="0" rowsep="0">
23015 <colspec colwidth="8*" align="left"/>
23016 <colspec colwidth="6*" align="center"/>
23017 <colspec colwidth="6*" align="center"/>
23018 <colspec colwidth="6*" align="right"/>
23019 <tbody>
23020 <row>
23021 <entry><option>daemon_smtp_ports</option></entry>
23022 <entry>Use: <emphasis>main</emphasis></entry>
23023 <entry>Type: <emphasis>string</emphasis></entry>
23024 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
23025 </row>
23026 </tbody>
23027 </tgroup>
23028 </informaltable>
23029 <para>
23030 <indexterm role="concept">
23031 <primary>port</primary>
23032 <secondary>for daemon</secondary>
23033 </indexterm>
23034 <indexterm role="concept">
23035 <primary>TCP/IP</primary>
23036 <secondary>setting listening ports</secondary>
23037 </indexterm>
23038 This option specifies one or more default SMTP ports on which the Exim daemon
23039 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
23040 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23041 </para>
23042 <para>
23043 <indexterm role="option">
23044 <primary><option>daemon_startup_retries</option></primary>
23045 </indexterm>
23046 </para>
23047 <informaltable frame="all">
23048 <tgroup cols="4" colsep="0" rowsep="0">
23049 <colspec colwidth="8*" align="left"/>
23050 <colspec colwidth="6*" align="center"/>
23051 <colspec colwidth="6*" align="center"/>
23052 <colspec colwidth="6*" align="right"/>
23053 <tbody>
23054 <row>
23055 <entry><option>daemon_startup_retries</option></entry>
23056 <entry>Use: <emphasis>main</emphasis></entry>
23057 <entry>Type: <emphasis>integer</emphasis></entry>
23058 <entry>Default: <emphasis>9</emphasis></entry>
23059 </row>
23060 </tbody>
23061 </tgroup>
23062 </informaltable>
23063 <para>
23064 <indexterm role="concept">
23065 <primary>daemon startup, retrying</primary>
23066 </indexterm>
23067 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23068 the daemon at startup when it cannot immediately bind a listening socket
23069 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23070 defines the number of retries after the first failure, and
23071 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23072 </para>
23073 <para>
23074 <indexterm role="option">
23075 <primary><option>daemon_startup_sleep</option></primary>
23076 </indexterm>
23077 </para>
23078 <informaltable frame="all">
23079 <tgroup cols="4" colsep="0" rowsep="0">
23080 <colspec colwidth="8*" align="left"/>
23081 <colspec colwidth="6*" align="center"/>
23082 <colspec colwidth="6*" align="center"/>
23083 <colspec colwidth="6*" align="right"/>
23084 <tbody>
23085 <row>
23086 <entry><option>daemon_startup_sleep</option></entry>
23087 <entry>Use: <emphasis>main</emphasis></entry>
23088 <entry>Type: <emphasis>time</emphasis></entry>
23089 <entry>Default: <emphasis>30s</emphasis></entry>
23090 </row>
23091 </tbody>
23092 </tgroup>
23093 </informaltable>
23094 <para>
23095 See <option>daemon_startup_retries</option>.
23096 </para>
23097 <para>
23098 <indexterm role="option">
23099 <primary><option>delay_warning</option></primary>
23100 </indexterm>
23101 </para>
23102 <informaltable frame="all">
23103 <tgroup cols="4" colsep="0" rowsep="0">
23104 <colspec colwidth="8*" align="left"/>
23105 <colspec colwidth="6*" align="center"/>
23106 <colspec colwidth="6*" align="center"/>
23107 <colspec colwidth="6*" align="right"/>
23108 <tbody>
23109 <row>
23110 <entry><option>delay_warning</option></entry>
23111 <entry>Use: <emphasis>main</emphasis></entry>
23112 <entry>Type: <emphasis>time list</emphasis></entry>
23113 <entry>Default: <emphasis>24h</emphasis></entry>
23114 </row>
23115 </tbody>
23116 </tgroup>
23117 </informaltable>
23118 <para>
23119 <indexterm role="concept">
23120 <primary>warning of delay</primary>
23121 </indexterm>
23122 <indexterm role="concept">
23123 <primary>delay warning, specifying</primary>
23124 </indexterm>
23125 When a message is delayed, Exim sends a warning message to the sender at
23126 intervals specified by this option. The data is a colon-separated list of times
23127 after which to send warning messages. If the value of the option is an empty
23128 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23129 message has been on the queue for longer than the last time, the last interval
23130 between the times is used to compute subsequent warning times. For example,
23131 with
23132 </para>
23133 <literallayout class="monospaced">
23134 delay_warning = 4h:8h:24h
23135 </literallayout>
23136 <para>
23137 the first message is sent after 4 hours, the second after 8 hours, and
23138 the third one after 24 hours. After that, messages are sent every 16 hours,
23139 because that is the interval between the last two times on the list. If you set
23140 just one time, it specifies the repeat interval. For example, with:
23141 </para>
23142 <literallayout class="monospaced">
23143 delay_warning = 6h
23144 </literallayout>
23145 <para>
23146 messages are repeated every six hours. To stop warnings after a given time, set
23147 a very large time at the end of the list. For example:
23148 </para>
23149 <literallayout class="monospaced">
23150 delay_warning = 2h:12h:99d
23151 </literallayout>
23152 <para>
23153 Note that the option is only evaluated at the time a delivery attempt fails,
23154 which depends on retry and queue-runner configuration.
23155 Typically retries will be configured more frequently than warning messages.
23156 </para>
23157 <para>
23158 <indexterm role="option">
23159 <primary><option>delay_warning_condition</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>delay_warning_condition</option></entry>
23171 <entry>Use: <emphasis>main</emphasis></entry>
23172 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23173 <entry>Default: <emphasis>see below</emphasis></entry>
23174 </row>
23175 </tbody>
23176 </tgroup>
23177 </informaltable>
23178 <para>
23179 <indexterm role="variable">
23180 <primary><varname>$domain</varname></primary>
23181 </indexterm>
23182 The string is expanded at the time a warning message might be sent. If all the
23183 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
23184 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
23185 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
23186 <quote>false</quote> (the comparison being done caselessly) then the warning message is
23187 not sent. The default is:
23188 </para>
23189 <literallayout class="monospaced">
23190 delay_warning_condition = ${if or {\
23191   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
23192   { match{$h_precedence:}{(?i)bulk|list|junk} }\
23193   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
23194   } {no}{yes}}
23195 </literallayout>
23196 <para>
23197 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
23198 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
23199 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
23200 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
23201 </para>
23202 <para>
23203 <indexterm role="option">
23204 <primary><option>deliver_drop_privilege</option></primary>
23205 </indexterm>
23206 </para>
23207 <informaltable frame="all">
23208 <tgroup cols="4" colsep="0" rowsep="0">
23209 <colspec colwidth="8*" align="left"/>
23210 <colspec colwidth="6*" align="center"/>
23211 <colspec colwidth="6*" align="center"/>
23212 <colspec colwidth="6*" align="right"/>
23213 <tbody>
23214 <row>
23215 <entry><option>deliver_drop_privilege</option></entry>
23216 <entry>Use: <emphasis>main</emphasis></entry>
23217 <entry>Type: <emphasis>boolean</emphasis></entry>
23218 <entry>Default: <emphasis>false</emphasis></entry>
23219 </row>
23220 </tbody>
23221 </tgroup>
23222 </informaltable>
23223 <para>
23224 <indexterm role="concept">
23225 <primary>unprivileged delivery</primary>
23226 </indexterm>
23227 <indexterm role="concept">
23228 <primary>delivery</primary>
23229 <secondary>unprivileged</secondary>
23230 </indexterm>
23231 If this option is set true, Exim drops its root privilege at the start of a
23232 delivery process, and runs as the Exim user throughout. This severely restricts
23233 the kinds of local delivery that are possible, but is viable in certain types
23234 of configuration. There is a discussion about the use of root privilege in
23235 chapter <xref linkend="CHAPsecurity"/>.
23236 </para>
23237 <para>
23238 <indexterm role="option">
23239 <primary><option>deliver_queue_load_max</option></primary>
23240 </indexterm>
23241 </para>
23242 <informaltable frame="all">
23243 <tgroup cols="4" colsep="0" rowsep="0">
23244 <colspec colwidth="8*" align="left"/>
23245 <colspec colwidth="6*" align="center"/>
23246 <colspec colwidth="6*" align="center"/>
23247 <colspec colwidth="6*" align="right"/>
23248 <tbody>
23249 <row>
23250 <entry><option>deliver_queue_load_max</option></entry>
23251 <entry>Use: <emphasis>main</emphasis></entry>
23252 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23253 <entry>Default: <emphasis>unset</emphasis></entry>
23254 </row>
23255 </tbody>
23256 </tgroup>
23257 </informaltable>
23258 <para>
23259 <indexterm role="concept">
23260 <primary>load average</primary>
23261 </indexterm>
23262 <indexterm role="concept">
23263 <primary>queue runner</primary>
23264 <secondary>abandoning</secondary>
23265 </indexterm>
23266 When this option is set, a queue run is abandoned if the system load average
23267 becomes greater than the value of the option. The option has no effect on
23268 ancient operating systems on which Exim cannot determine the load average.
23269 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
23270 </para>
23271 <para>
23272 <indexterm role="option">
23273 <primary><option>delivery_date_remove</option></primary>
23274 </indexterm>
23275 </para>
23276 <informaltable frame="all">
23277 <tgroup cols="4" colsep="0" rowsep="0">
23278 <colspec colwidth="8*" align="left"/>
23279 <colspec colwidth="6*" align="center"/>
23280 <colspec colwidth="6*" align="center"/>
23281 <colspec colwidth="6*" align="right"/>
23282 <tbody>
23283 <row>
23284 <entry><option>delivery_date_remove</option></entry>
23285 <entry>Use: <emphasis>main</emphasis></entry>
23286 <entry>Type: <emphasis>boolean</emphasis></entry>
23287 <entry>Default: <emphasis>true</emphasis></entry>
23288 </row>
23289 </tbody>
23290 </tgroup>
23291 </informaltable>
23292 <para>
23293 <indexterm role="concept">
23294 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
23295 </indexterm>
23296 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
23297 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23298 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
23299 should not be present in incoming messages, and this option causes them to be
23300 removed at the time the message is received, to avoid any problems that might
23301 occur when a delivered message is subsequently sent on to some other recipient.
23302 </para>
23303 <para>
23304 <indexterm role="option">
23305 <primary><option>disable_fsync</option></primary>
23306 </indexterm>
23307 </para>
23308 <informaltable frame="all">
23309 <tgroup cols="4" colsep="0" rowsep="0">
23310 <colspec colwidth="8*" align="left"/>
23311 <colspec colwidth="6*" align="center"/>
23312 <colspec colwidth="6*" align="center"/>
23313 <colspec colwidth="6*" align="right"/>
23314 <tbody>
23315 <row>
23316 <entry><option>disable_fsync</option></entry>
23317 <entry>Use: <emphasis>main</emphasis></entry>
23318 <entry>Type: <emphasis>boolean</emphasis></entry>
23319 <entry>Default: <emphasis>false</emphasis></entry>
23320 </row>
23321 </tbody>
23322 </tgroup>
23323 </informaltable>
23324 <para>
23325 <indexterm role="concept">
23326 <primary><function>fsync()</function>, disabling</primary>
23327 </indexterm>
23328 This option is available only if Exim was built with the compile-time option
23329 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
23330 a runtime configuration generates an <quote>unknown option</quote> error. You should not
23331 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
23332 really, really, really understand what you are doing. <emphasis>No pre-compiled
23333 distributions of Exim should ever make this option available.</emphasis>
23334 </para>
23335 <para>
23336 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
23337 updated files&#x2019; data to be written to disc before continuing. Unexpected events
23338 such as crashes and power outages may cause data to be lost or scrambled.
23339 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
23340 </para>
23341 <para>
23342 <indexterm role="option">
23343 <primary><option>disable_ipv6</option></primary>
23344 </indexterm>
23345 </para>
23346 <informaltable frame="all">
23347 <tgroup cols="4" colsep="0" rowsep="0">
23348 <colspec colwidth="8*" align="left"/>
23349 <colspec colwidth="6*" align="center"/>
23350 <colspec colwidth="6*" align="center"/>
23351 <colspec colwidth="6*" align="right"/>
23352 <tbody>
23353 <row>
23354 <entry><option>disable_ipv6</option></entry>
23355 <entry>Use: <emphasis>main</emphasis></entry>
23356 <entry>Type: <emphasis>boolean</emphasis></entry>
23357 <entry>Default: <emphasis>false</emphasis></entry>
23358 </row>
23359 </tbody>
23360 </tgroup>
23361 </informaltable>
23362 <para>
23363 <indexterm role="concept">
23364 <primary>IPv6</primary>
23365 <secondary>disabling</secondary>
23366 </indexterm>
23367 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
23368 activities take place. AAAA records are never looked up, and any IPv6 addresses
23369 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
23370 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23371 to handle IPv6 literal addresses.
23372 </para>
23373 <para>
23374 <indexterm role="option">
23375 <primary><option>dns_again_means_nonexist</option></primary>
23376 </indexterm>
23377 </para>
23378 <informaltable frame="all">
23379 <tgroup cols="4" colsep="0" rowsep="0">
23380 <colspec colwidth="8*" align="left"/>
23381 <colspec colwidth="6*" align="center"/>
23382 <colspec colwidth="6*" align="center"/>
23383 <colspec colwidth="6*" align="right"/>
23384 <tbody>
23385 <row>
23386 <entry><option>dns_again_means_nonexist</option></entry>
23387 <entry>Use: <emphasis>main</emphasis></entry>
23388 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23389 <entry>Default: <emphasis>unset</emphasis></entry>
23390 </row>
23391 </tbody>
23392 </tgroup>
23393 </informaltable>
23394 <para>
23395 <indexterm role="concept">
23396 <primary>DNS</primary>
23397 <secondary><quote>try again</quote> response; overriding</secondary>
23398 </indexterm>
23399 DNS lookups give a <quote>try again</quote> response for the DNS errors
23400 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
23401 keep trying to deliver a message, or to give repeated temporary errors to
23402 incoming mail. Sometimes the effect is caused by a badly set up name server and
23403 may persist for a long time. If a domain which exhibits this problem matches
23404 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
23405 This option should be used with care. You can make it apply to reverse lookups
23406 by a setting such as this:
23407 </para>
23408 <literallayout class="monospaced">
23409 dns_again_means_nonexist = *.in-addr.arpa
23410 </literallayout>
23411 <para>
23412 This option applies to all DNS lookups that Exim does. It also applies when the
23413 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
23414 since these are most likely to be caused by DNS lookup problems. The
23415 <command>dnslookup</command> router has some options of its own for controlling what happens
23416 when lookups for MX or SRV records give temporary errors. These more specific
23417 options are applied after this global option.
23418 </para>
23419 <para>
23420 <indexterm role="option">
23421 <primary><option>dns_check_names_pattern</option></primary>
23422 </indexterm>
23423 </para>
23424 <informaltable frame="all">
23425 <tgroup cols="4" colsep="0" rowsep="0">
23426 <colspec colwidth="8*" align="left"/>
23427 <colspec colwidth="6*" align="center"/>
23428 <colspec colwidth="6*" align="center"/>
23429 <colspec colwidth="6*" align="right"/>
23430 <tbody>
23431 <row>
23432 <entry><option>dns_check_names_pattern</option></entry>
23433 <entry>Use: <emphasis>main</emphasis></entry>
23434 <entry>Type: <emphasis>string</emphasis></entry>
23435 <entry>Default: <emphasis>see below</emphasis></entry>
23436 </row>
23437 </tbody>
23438 </tgroup>
23439 </informaltable>
23440 <para>
23441 <indexterm role="concept">
23442 <primary>DNS</primary>
23443 <secondary>pre-check of name syntax</secondary>
23444 </indexterm>
23445 When this option is set to a non-empty string, it causes Exim to check domain
23446 names for characters that are not allowed in host names before handing them to
23447 the DNS resolver, because some resolvers give temporary errors for names that
23448 contain unusual characters. If a domain name contains any unwanted characters,
23449 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
23450 done by matching the domain name against a regular expression, which is the
23451 value of this option. The default pattern is
23452 </para>
23453 <literallayout class="monospaced">
23454 dns_check_names_pattern = \
23455   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
23456 </literallayout>
23457 <para>
23458 which permits only letters, digits, slashes, and hyphens in components, but
23459 they must start and end with a letter or digit. Slashes are not, in fact,
23460 permitted in host names, but they are found in certain NS records (which can be
23461 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
23462 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
23463 empty string.
23464 </para>
23465 <para>
23466 <indexterm role="option">
23467 <primary><option>dns_csa_search_limit</option></primary>
23468 </indexterm>
23469 </para>
23470 <informaltable frame="all">
23471 <tgroup cols="4" colsep="0" rowsep="0">
23472 <colspec colwidth="8*" align="left"/>
23473 <colspec colwidth="6*" align="center"/>
23474 <colspec colwidth="6*" align="center"/>
23475 <colspec colwidth="6*" align="right"/>
23476 <tbody>
23477 <row>
23478 <entry><option>dns_csa_search_limit</option></entry>
23479 <entry>Use: <emphasis>main</emphasis></entry>
23480 <entry>Type: <emphasis>integer</emphasis></entry>
23481 <entry>Default: <emphasis>5</emphasis></entry>
23482 </row>
23483 </tbody>
23484 </tgroup>
23485 </informaltable>
23486 <para>
23487 This option controls the depth of parental searching for CSA SRV records in the
23488 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23489 </para>
23490 <para>
23491 <indexterm role="option">
23492 <primary><option>dns_csa_use_reverse</option></primary>
23493 </indexterm>
23494 </para>
23495 <informaltable frame="all">
23496 <tgroup cols="4" colsep="0" rowsep="0">
23497 <colspec colwidth="8*" align="left"/>
23498 <colspec colwidth="6*" align="center"/>
23499 <colspec colwidth="6*" align="center"/>
23500 <colspec colwidth="6*" align="right"/>
23501 <tbody>
23502 <row>
23503 <entry><option>dns_csa_use_reverse</option></entry>
23504 <entry>Use: <emphasis>main</emphasis></entry>
23505 <entry>Type: <emphasis>boolean</emphasis></entry>
23506 <entry>Default: <emphasis>true</emphasis></entry>
23507 </row>
23508 </tbody>
23509 </tgroup>
23510 </informaltable>
23511 <para>
23512 This option controls whether or not an IP address, given as a CSA domain, is
23513 reversed and looked up in the reverse DNS, as described in more detail in
23514 section <xref linkend="SECTverifyCSA"/>.
23515 </para>
23516 <para>
23517 <indexterm role="option">
23518 <primary><option>dns_dnssec_ok</option></primary>
23519 </indexterm>
23520 </para>
23521 <informaltable frame="all">
23522 <tgroup cols="4" colsep="0" rowsep="0">
23523 <colspec colwidth="8*" align="left"/>
23524 <colspec colwidth="6*" align="center"/>
23525 <colspec colwidth="6*" align="center"/>
23526 <colspec colwidth="6*" align="right"/>
23527 <tbody>
23528 <row>
23529 <entry><option>dns_dnssec_ok</option></entry>
23530 <entry>Use: <emphasis>main</emphasis></entry>
23531 <entry>Type: <emphasis>integer</emphasis></entry>
23532 <entry>Default: <emphasis>-1</emphasis></entry>
23533 </row>
23534 </tbody>
23535 </tgroup>
23536 </informaltable>
23537 <para>
23538 <indexterm role="concept">
23539 <primary>DNS</primary>
23540 <secondary>resolver options</secondary>
23541 </indexterm>
23542 <indexterm role="concept">
23543 <primary>DNS</primary>
23544 <secondary>DNSSEC</secondary>
23545 </indexterm>
23546 If this option is set to a non-negative number then Exim will initialise the
23547 DNS resolver library to either use or not use DNSSEC, overriding the system
23548 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23549 </para>
23550 <para>
23551 If the resolver library does not support DNSSEC then this option has no effect.
23552 </para>
23553 <para>
23554 <indexterm role="option">
23555 <primary><option>dns_ipv4_lookup</option></primary>
23556 </indexterm>
23557 </para>
23558 <informaltable frame="all">
23559 <tgroup cols="4" colsep="0" rowsep="0">
23560 <colspec colwidth="8*" align="left"/>
23561 <colspec colwidth="6*" align="center"/>
23562 <colspec colwidth="6*" align="center"/>
23563 <colspec colwidth="6*" align="right"/>
23564 <tbody>
23565 <row>
23566 <entry><option>dns_ipv4_lookup</option></entry>
23567 <entry>Use: <emphasis>main</emphasis></entry>
23568 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23569 <entry>Default: <emphasis>unset</emphasis></entry>
23570 </row>
23571 </tbody>
23572 </tgroup>
23573 </informaltable>
23574 <para>
23575 <indexterm role="concept">
23576 <primary>IPv6</primary>
23577 <secondary>DNS lookup for AAAA records</secondary>
23578 </indexterm>
23579 <indexterm role="concept">
23580 <primary>DNS</primary>
23581 <secondary>IPv6 lookup for AAAA records</secondary>
23582 </indexterm>
23583 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
23584 looks for IPv6 address records (AAAA records) as well as IPv4 address records
23585 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
23586 domain matches this list.
23587 </para>
23588 <para>
23589 This is a fudge to help with name servers that give big delays or otherwise do
23590 not work for the AAAA record type. In due course, when the world&#x2019;s name
23591 servers have all been upgraded, there should be no need for this option.
23592 </para>
23593 <para>
23594 <indexterm role="option">
23595 <primary><option>dns_retrans</option></primary>
23596 </indexterm>
23597 </para>
23598 <informaltable frame="all">
23599 <tgroup cols="4" colsep="0" rowsep="0">
23600 <colspec colwidth="8*" align="left"/>
23601 <colspec colwidth="6*" align="center"/>
23602 <colspec colwidth="6*" align="center"/>
23603 <colspec colwidth="6*" align="right"/>
23604 <tbody>
23605 <row>
23606 <entry><option>dns_retrans</option></entry>
23607 <entry>Use: <emphasis>main</emphasis></entry>
23608 <entry>Type: <emphasis>time</emphasis></entry>
23609 <entry>Default: <emphasis>0s</emphasis></entry>
23610 </row>
23611 </tbody>
23612 </tgroup>
23613 </informaltable>
23614 <para>
23615 <indexterm role="concept">
23616 <primary>DNS</primary>
23617 <secondary>resolver options</secondary>
23618 </indexterm>
23619 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
23620 retransmission and retry parameters for DNS lookups. Values of zero (the
23621 defaults) leave the system default settings unchanged. The first value is the
23622 time between retries, and the second is the number of retries. It isn&#x2019;t
23623 totally clear exactly how these settings affect the total time a DNS lookup may
23624 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
23625 parameter values are available in the external resolver interface structure,
23626 but nowhere does it seem to describe how they are used or what you might want
23627 to set in them.
23628 </para>
23629 <para>
23630 <indexterm role="option">
23631 <primary><option>dns_retry</option></primary>
23632 </indexterm>
23633 </para>
23634 <informaltable frame="all">
23635 <tgroup cols="4" colsep="0" rowsep="0">
23636 <colspec colwidth="8*" align="left"/>
23637 <colspec colwidth="6*" align="center"/>
23638 <colspec colwidth="6*" align="center"/>
23639 <colspec colwidth="6*" align="right"/>
23640 <tbody>
23641 <row>
23642 <entry><option>dns_retry</option></entry>
23643 <entry>Use: <emphasis>main</emphasis></entry>
23644 <entry>Type: <emphasis>integer</emphasis></entry>
23645 <entry>Default: <emphasis>0</emphasis></entry>
23646 </row>
23647 </tbody>
23648 </tgroup>
23649 </informaltable>
23650 <para>
23651 See <option>dns_retrans</option> above.
23652 </para>
23653 <para>
23654 <indexterm role="option">
23655 <primary><option>dns_use_edns0</option></primary>
23656 </indexterm>
23657 </para>
23658 <informaltable frame="all">
23659 <tgroup cols="4" colsep="0" rowsep="0">
23660 <colspec colwidth="8*" align="left"/>
23661 <colspec colwidth="6*" align="center"/>
23662 <colspec colwidth="6*" align="center"/>
23663 <colspec colwidth="6*" align="right"/>
23664 <tbody>
23665 <row>
23666 <entry><option>dns_use_edns0</option></entry>
23667 <entry>Use: <emphasis>main</emphasis></entry>
23668 <entry>Type: <emphasis>integer</emphasis></entry>
23669 <entry>Default: <emphasis>-1</emphasis></entry>
23670 </row>
23671 </tbody>
23672 </tgroup>
23673 </informaltable>
23674 <para>
23675 <indexterm role="concept">
23676 <primary>DNS</primary>
23677 <secondary>resolver options</secondary>
23678 </indexterm>
23679 <indexterm role="concept">
23680 <primary>DNS</primary>
23681 <secondary>EDNS0</secondary>
23682 </indexterm>
23683 If this option is set to a non-negative number then Exim will initialise the
23684 DNS resolver library to either use or not use EDNS0 extensions, overriding
23685 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
23686 on.
23687 </para>
23688 <para>
23689 If the resolver library does not support EDNS0 then this option has no effect.
23690 </para>
23691 <para>
23692 <indexterm role="option">
23693 <primary><option>drop_cr</option></primary>
23694 </indexterm>
23695 </para>
23696 <informaltable frame="all">
23697 <tgroup cols="4" colsep="0" rowsep="0">
23698 <colspec colwidth="8*" align="left"/>
23699 <colspec colwidth="6*" align="center"/>
23700 <colspec colwidth="6*" align="center"/>
23701 <colspec colwidth="6*" align="right"/>
23702 <tbody>
23703 <row>
23704 <entry><option>drop_cr</option></entry>
23705 <entry>Use: <emphasis>main</emphasis></entry>
23706 <entry>Type: <emphasis>boolean</emphasis></entry>
23707 <entry>Default: <emphasis>false</emphasis></entry>
23708 </row>
23709 </tbody>
23710 </tgroup>
23711 </informaltable>
23712 <para>
23713 This is an obsolete option that is now a no-op. It used to affect the way Exim
23714 handled CR and LF characters in incoming messages. What happens now is
23715 described in section <xref linkend="SECTlineendings"/>.
23716 </para>
23717 <para>
23718 <indexterm role="option">
23719 <primary><option>dsn_from</option></primary>
23720 </indexterm>
23721 </para>
23722 <informaltable frame="all">
23723 <tgroup cols="4" colsep="0" rowsep="0">
23724 <colspec colwidth="8*" align="left"/>
23725 <colspec colwidth="6*" align="center"/>
23726 <colspec colwidth="6*" align="center"/>
23727 <colspec colwidth="6*" align="right"/>
23728 <tbody>
23729 <row>
23730 <entry><option>dsn_from</option></entry>
23731 <entry>Use: <emphasis>main</emphasis></entry>
23732 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23733 <entry>Default: <emphasis>see below</emphasis></entry>
23734 </row>
23735 </tbody>
23736 </tgroup>
23737 </informaltable>
23738 <para>
23739 <indexterm role="concept">
23740 <primary><emphasis>From:</emphasis> header line</primary>
23741 <secondary>in bounces</secondary>
23742 </indexterm>
23743 <indexterm role="concept">
23744 <primary>bounce messages</primary>
23745 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
23746 </indexterm>
23747 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
23748 bounces and other automatically generated messages (<quote>Delivery Status
23749 Notifications</quote> &ndash; hence the name of the option). The default setting is:
23750 </para>
23751 <literallayout class="monospaced">
23752 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
23753 </literallayout>
23754 <para>
23755 The value is expanded every time it is needed. If the expansion fails, a
23756 panic is logged, and the default value is used.
23757 </para>
23758 <para>
23759 <indexterm role="option">
23760 <primary><option>envelope_to_remove</option></primary>
23761 </indexterm>
23762 </para>
23763 <informaltable frame="all">
23764 <tgroup cols="4" colsep="0" rowsep="0">
23765 <colspec colwidth="8*" align="left"/>
23766 <colspec colwidth="6*" align="center"/>
23767 <colspec colwidth="6*" align="center"/>
23768 <colspec colwidth="6*" align="right"/>
23769 <tbody>
23770 <row>
23771 <entry><option>envelope_to_remove</option></entry>
23772 <entry>Use: <emphasis>main</emphasis></entry>
23773 <entry>Type: <emphasis>boolean</emphasis></entry>
23774 <entry>Default: <emphasis>true</emphasis></entry>
23775 </row>
23776 </tbody>
23777 </tgroup>
23778 </informaltable>
23779 <para>
23780 <indexterm role="concept">
23781 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
23782 </indexterm>
23783 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
23784 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23785 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
23786 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
23787 be present in incoming messages, and this option causes them to be removed at
23788 the time the message is received, to avoid any problems that might occur when a
23789 delivered message is subsequently sent on to some other recipient.
23790 </para>
23791 <para>
23792 <indexterm role="option">
23793 <primary><option>errors_copy</option></primary>
23794 </indexterm>
23795 </para>
23796 <informaltable frame="all">
23797 <tgroup cols="4" colsep="0" rowsep="0">
23798 <colspec colwidth="8*" align="left"/>
23799 <colspec colwidth="6*" align="center"/>
23800 <colspec colwidth="6*" align="center"/>
23801 <colspec colwidth="6*" align="right"/>
23802 <tbody>
23803 <row>
23804 <entry><option>errors_copy</option></entry>
23805 <entry>Use: <emphasis>main</emphasis></entry>
23806 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23807 <entry>Default: <emphasis>unset</emphasis></entry>
23808 </row>
23809 </tbody>
23810 </tgroup>
23811 </informaltable>
23812 <para>
23813 <indexterm role="concept">
23814 <primary>bounce message</primary>
23815 <secondary>copy to other address</secondary>
23816 </indexterm>
23817 <indexterm role="concept">
23818 <primary>copy of bounce message</primary>
23819 </indexterm>
23820 Setting this option causes Exim to send bcc copies of bounce messages that it
23821 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
23822 coming from elsewhere. The value of the option is a colon-separated list of
23823 items. Each item consists of a pattern, terminated by white space, followed by
23824 a comma-separated list of email addresses. If a pattern contains spaces, it
23825 must be enclosed in double quotes.
23826 </para>
23827 <para>
23828 Each pattern is processed in the same way as a single item in an address list
23829 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
23830 the bounce message, the message is copied to the addresses on the list. The
23831 items are scanned in order, and once a matching one is found, no further items
23832 are examined. For example:
23833 </para>
23834 <literallayout class="monospaced">
23835 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
23836               rqps@mydomain   hostmaster@mydomain.example,\
23837                               postmaster@mydomain.example
23838 </literallayout>
23839 <para>
23840 <indexterm role="variable">
23841 <primary><varname>$domain</varname></primary>
23842 </indexterm>
23843 <indexterm role="variable">
23844 <primary><varname>$local_part</varname></primary>
23845 </indexterm>
23846 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
23847 and <varname>$domain</varname> are set from the original recipient of the error message, and if
23848 there was any wildcard matching in the pattern, the expansion
23849 <indexterm role="concept">
23850 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23851 <secondary>in <option>errors_copy</option></secondary>
23852 </indexterm>
23853 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
23854 </para>
23855 <para>
23856 <indexterm role="option">
23857 <primary><option>errors_reply_to</option></primary>
23858 </indexterm>
23859 </para>
23860 <informaltable frame="all">
23861 <tgroup cols="4" colsep="0" rowsep="0">
23862 <colspec colwidth="8*" align="left"/>
23863 <colspec colwidth="6*" align="center"/>
23864 <colspec colwidth="6*" align="center"/>
23865 <colspec colwidth="6*" align="right"/>
23866 <tbody>
23867 <row>
23868 <entry><option>errors_reply_to</option></entry>
23869 <entry>Use: <emphasis>main</emphasis></entry>
23870 <entry>Type: <emphasis>string</emphasis></entry>
23871 <entry>Default: <emphasis>unset</emphasis></entry>
23872 </row>
23873 </tbody>
23874 </tgroup>
23875 </informaltable>
23876 <para>
23877 <indexterm role="concept">
23878 <primary>bounce message</primary>
23879 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
23880 </indexterm>
23881 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
23882 </para>
23883 <literallayout>
23884 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
23885 </literallayout>
23886 <para>
23887 <indexterm role="option">
23888 <primary><option>quota_warn_message</option></primary>
23889 </indexterm>
23890 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
23891 A warning message that is generated by the <option>quota_warn_message</option> option in an
23892 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
23893 overrides the default.
23894 </para>
23895 <para>
23896 Experience shows that people reply to bounce messages. If the
23897 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
23898 and warning messages. For example:
23899 </para>
23900 <literallayout class="monospaced">
23901 errors_reply_to = postmaster@my.domain.example
23902 </literallayout>
23903 <para>
23904 The value of the option is not expanded. It must specify a valid RFC 2822
23905 address. However, if a warning message that is generated by the
23906 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
23907 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
23908 not used.
23909 </para>
23910 <para>
23911 <indexterm role="option">
23912 <primary><option>exim_group</option></primary>
23913 </indexterm>
23914 </para>
23915 <informaltable frame="all">
23916 <tgroup cols="4" colsep="0" rowsep="0">
23917 <colspec colwidth="8*" align="left"/>
23918 <colspec colwidth="6*" align="center"/>
23919 <colspec colwidth="6*" align="center"/>
23920 <colspec colwidth="6*" align="right"/>
23921 <tbody>
23922 <row>
23923 <entry><option>exim_group</option></entry>
23924 <entry>Use: <emphasis>main</emphasis></entry>
23925 <entry>Type: <emphasis>string</emphasis></entry>
23926 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
23927 </row>
23928 </tbody>
23929 </tgroup>
23930 </informaltable>
23931 <para>
23932 <indexterm role="concept">
23933 <primary>gid (group id)</primary>
23934 <secondary>Exim&#x2019;s own</secondary>
23935 </indexterm>
23936 <indexterm role="concept">
23937 <primary>Exim group</primary>
23938 </indexterm>
23939 This option changes the gid under which Exim runs when it gives up root
23940 privilege. The default value is compiled into the binary. The value of this
23941 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
23942 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
23943 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
23944 security issues.
23945 </para>
23946 <para>
23947 <indexterm role="option">
23948 <primary><option>exim_path</option></primary>
23949 </indexterm>
23950 </para>
23951 <informaltable frame="all">
23952 <tgroup cols="4" colsep="0" rowsep="0">
23953 <colspec colwidth="8*" align="left"/>
23954 <colspec colwidth="6*" align="center"/>
23955 <colspec colwidth="6*" align="center"/>
23956 <colspec colwidth="6*" align="right"/>
23957 <tbody>
23958 <row>
23959 <entry><option>exim_path</option></entry>
23960 <entry>Use: <emphasis>main</emphasis></entry>
23961 <entry>Type: <emphasis>string</emphasis></entry>
23962 <entry>Default: <emphasis>see below</emphasis></entry>
23963 </row>
23964 </tbody>
23965 </tgroup>
23966 </informaltable>
23967 <para>
23968 <indexterm role="concept">
23969 <primary>Exim binary, path name</primary>
23970 </indexterm>
23971 This option specifies the path name of the Exim binary, which is used when Exim
23972 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
23973 the directory configured at compile time by the BIN_DIRECTORY setting. It
23974 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
23975 other place.
23976 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
23977 you will break those Exim utilities that scan the configuration file to find
23978 where the binary is. (They then use the <option>-bP</option> option to extract option
23979 settings such as the value of <option>spool_directory</option>.)
23980 </para>
23981 <para>
23982 <indexterm role="option">
23983 <primary><option>exim_user</option></primary>
23984 </indexterm>
23985 </para>
23986 <informaltable frame="all">
23987 <tgroup cols="4" colsep="0" rowsep="0">
23988 <colspec colwidth="8*" align="left"/>
23989 <colspec colwidth="6*" align="center"/>
23990 <colspec colwidth="6*" align="center"/>
23991 <colspec colwidth="6*" align="right"/>
23992 <tbody>
23993 <row>
23994 <entry><option>exim_user</option></entry>
23995 <entry>Use: <emphasis>main</emphasis></entry>
23996 <entry>Type: <emphasis>string</emphasis></entry>
23997 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
23998 </row>
23999 </tbody>
24000 </tgroup>
24001 </informaltable>
24002 <para>
24003 <indexterm role="concept">
24004 <primary>uid (user id)</primary>
24005 <secondary>Exim&#x2019;s own</secondary>
24006 </indexterm>
24007 <indexterm role="concept">
24008 <primary>Exim user</primary>
24009 </indexterm>
24010 This option changes the uid under which Exim runs when it gives up root
24011 privilege. The default value is compiled into the binary. Ownership of the run
24012 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
24013 options is checked against the values in the binary, not what is set here.
24014 </para>
24015 <para>
24016 Unless it consists entirely of digits, the string is looked up using
24017 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
24018 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
24019 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
24020 </para>
24021 <para>
24022 <indexterm role="option">
24023 <primary><option>extra_local_interfaces</option></primary>
24024 </indexterm>
24025 </para>
24026 <informaltable frame="all">
24027 <tgroup cols="4" colsep="0" rowsep="0">
24028 <colspec colwidth="8*" align="left"/>
24029 <colspec colwidth="6*" align="center"/>
24030 <colspec colwidth="6*" align="center"/>
24031 <colspec colwidth="6*" align="right"/>
24032 <tbody>
24033 <row>
24034 <entry><option>extra_local_interfaces</option></entry>
24035 <entry>Use: <emphasis>main</emphasis></entry>
24036 <entry>Type: <emphasis>string list</emphasis></entry>
24037 <entry>Default: <emphasis>unset</emphasis></entry>
24038 </row>
24039 </tbody>
24040 </tgroup>
24041 </informaltable>
24042 <para>
24043 This option defines network interfaces that are to be considered local when
24044 routing, but which are not used for listening by the daemon. See section
24045 <xref linkend="SECTreclocipadd"/> for details.
24046 </para>
24047 <para>
24048 <indexterm role="option">
24049 <primary><option>extract_addresses_remove_arguments</option></primary>
24050 </indexterm>
24051 </para>
24052 <informaltable frame="all">
24053 <tgroup cols="4" colsep="0" rowsep="0">
24054 <colspec colwidth="8*" align="left"/>
24055 <colspec colwidth="6*" align="center"/>
24056 <colspec colwidth="6*" align="center"/>
24057 <colspec colwidth="6*" align="right"/>
24058 <tbody>
24059 <row>
24060 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
24061 <entry>Use: <emphasis>main</emphasis></entry>
24062 <entry>Type: <emphasis>boolean</emphasis></entry>
24063 <entry>Default: <emphasis>true</emphasis></entry>
24064 </row>
24065 </tbody>
24066 </tgroup>
24067 </informaltable>
24068 <para>
24069 <indexterm role="option">
24070 <primary><option>-t</option></primary>
24071 </indexterm>
24072 <indexterm role="concept">
24073 <primary>command line</primary>
24074 <secondary>addresses with <option>-t</option></secondary>
24075 </indexterm>
24076 <indexterm role="concept">
24077 <primary>Sendmail compatibility</primary>
24078 <secondary><option>-t</option> option</secondary>
24079 </indexterm>
24080 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
24081 are present on the command line when the <option>-t</option> option is used to build an
24082 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
24083 line addresses are removed from the recipients list. This is also how Smail
24084 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
24085 command line addresses are added to those obtained from the header lines. When
24086 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
24087 argument headers. If it is set false, Exim adds rather than removes argument
24088 addresses.
24089 </para>
24090 <para>
24091 <indexterm role="option">
24092 <primary><option>finduser_retries</option></primary>
24093 </indexterm>
24094 </para>
24095 <informaltable frame="all">
24096 <tgroup cols="4" colsep="0" rowsep="0">
24097 <colspec colwidth="8*" align="left"/>
24098 <colspec colwidth="6*" align="center"/>
24099 <colspec colwidth="6*" align="center"/>
24100 <colspec colwidth="6*" align="right"/>
24101 <tbody>
24102 <row>
24103 <entry><option>finduser_retries</option></entry>
24104 <entry>Use: <emphasis>main</emphasis></entry>
24105 <entry>Type: <emphasis>integer</emphasis></entry>
24106 <entry>Default: <emphasis>0</emphasis></entry>
24107 </row>
24108 </tbody>
24109 </tgroup>
24110 </informaltable>
24111 <para>
24112 <indexterm role="concept">
24113 <primary>NIS, retrying user lookups</primary>
24114 </indexterm>
24115 On systems running NIS or other schemes in which user and group information is
24116 distributed from a remote system, there can be times when <function>getpwnam()</function> and
24117 related functions fail, even when given valid data, because things time out.
24118 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
24119 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
24120 many extra times to find a user or a group, waiting for one second between
24121 retries.
24122 </para>
24123 <para>
24124 <indexterm role="concept">
24125 <primary><filename>/etc/passwd</filename></primary>
24126 <secondary>multiple reading of</secondary>
24127 </indexterm>
24128 You should not set this option greater than zero if your user information is in
24129 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
24130 search the file multiple times for non-existent users, and also cause delay.
24131 </para>
24132 <para>
24133 <indexterm role="option">
24134 <primary><option>freeze_tell</option></primary>
24135 </indexterm>
24136 </para>
24137 <informaltable frame="all">
24138 <tgroup cols="4" colsep="0" rowsep="0">
24139 <colspec colwidth="8*" align="left"/>
24140 <colspec colwidth="6*" align="center"/>
24141 <colspec colwidth="6*" align="center"/>
24142 <colspec colwidth="6*" align="right"/>
24143 <tbody>
24144 <row>
24145 <entry><option>freeze_tell</option></entry>
24146 <entry>Use: <emphasis>main</emphasis></entry>
24147 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
24148 <entry>Default: <emphasis>unset</emphasis></entry>
24149 </row>
24150 </tbody>
24151 </tgroup>
24152 </informaltable>
24153 <para>
24154 <indexterm role="concept">
24155 <primary>freezing messages</primary>
24156 <secondary>sending a message when freezing</secondary>
24157 </indexterm>
24158 On encountering certain errors, or when configured to do so in a system filter,
24159 ACL, or special router, Exim freezes a message. This means that no further
24160 delivery attempts take place until an administrator thaws the message, or the
24161 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
24162 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
24163 warning message whenever it freezes something, unless the message it is
24164 freezing is a locally-generated bounce message. (Without this exception there
24165 is the possibility of looping.) The warning message is sent to the addresses
24166 supplied as the comma-separated value of this option. If several of the
24167 message&#x2019;s addresses cause freezing, only a single message is sent. If the
24168 freezing was automatic, the reason(s) for freezing can be found in the message
24169 log. If you configure freezing in a filter or ACL, you must arrange for any
24170 logging that you require.
24171 </para>
24172 <para>
24173 <indexterm role="option">
24174 <primary><option>gecos_name</option></primary>
24175 </indexterm>
24176 </para>
24177 <informaltable frame="all">
24178 <tgroup cols="4" colsep="0" rowsep="0">
24179 <colspec colwidth="8*" align="left"/>
24180 <colspec colwidth="6*" align="center"/>
24181 <colspec colwidth="6*" align="center"/>
24182 <colspec colwidth="6*" align="right"/>
24183 <tbody>
24184 <row>
24185 <entry><option>gecos_name</option></entry>
24186 <entry>Use: <emphasis>main</emphasis></entry>
24187 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24188 <entry>Default: <emphasis>unset</emphasis></entry>
24189 </row>
24190 </tbody>
24191 </tgroup>
24192 </informaltable>
24193 <para>
24194 <indexterm role="concept">
24195 <primary>HP-UX</primary>
24196 </indexterm>
24197 <indexterm role="concept">
24198 <primary><quote>gecos</quote> field, parsing</primary>
24199 </indexterm>
24200 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
24201 password file to hold other information in addition to users&#x2019; real names. Exim
24202 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
24203 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
24204 of the field are used unchanged, except that, if an ampersand is encountered,
24205 it is replaced by the user&#x2019;s login name with the first character forced to
24206 upper case, since this is a convention that is observed on many systems.
24207 </para>
24208 <para>
24209 When these options are set, <option>gecos_pattern</option> is treated as a regular
24210 expression that is to be applied to the field (again with &amp; replaced by the
24211 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
24212 user&#x2019;s name.
24213 </para>
24214 <para>
24215 <indexterm role="concept">
24216 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24217 <secondary>in <option>gecos_name</option></secondary>
24218 </indexterm>
24219 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
24220 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
24221 name terminates at the first comma, the following can be used:
24222 </para>
24223 <literallayout class="monospaced">
24224 gecos_pattern = ([^,]*)
24225 gecos_name = $1
24226 </literallayout>
24227 <para>
24228 <indexterm role="option">
24229 <primary><option>gecos_pattern</option></primary>
24230 </indexterm>
24231 </para>
24232 <informaltable frame="all">
24233 <tgroup cols="4" colsep="0" rowsep="0">
24234 <colspec colwidth="8*" align="left"/>
24235 <colspec colwidth="6*" align="center"/>
24236 <colspec colwidth="6*" align="center"/>
24237 <colspec colwidth="6*" align="right"/>
24238 <tbody>
24239 <row>
24240 <entry><option>gecos_pattern</option></entry>
24241 <entry>Use: <emphasis>main</emphasis></entry>
24242 <entry>Type: <emphasis>string</emphasis></entry>
24243 <entry>Default: <emphasis>unset</emphasis></entry>
24244 </row>
24245 </tbody>
24246 </tgroup>
24247 </informaltable>
24248 <para>
24249 See <option>gecos_name</option> above.
24250 </para>
24251 <para>
24252 <indexterm role="option">
24253 <primary><option>gnutls_compat_mode</option></primary>
24254 </indexterm>
24255 </para>
24256 <informaltable frame="all">
24257 <tgroup cols="4" colsep="0" rowsep="0">
24258 <colspec colwidth="8*" align="left"/>
24259 <colspec colwidth="6*" align="center"/>
24260 <colspec colwidth="6*" align="center"/>
24261 <colspec colwidth="6*" align="right"/>
24262 <tbody>
24263 <row>
24264 <entry><option>gnutls_compat_mode</option></entry>
24265 <entry>Use: <emphasis>main</emphasis></entry>
24266 <entry>Type: <emphasis>boolean</emphasis></entry>
24267 <entry>Default: <emphasis>unset</emphasis></entry>
24268 </row>
24269 </tbody>
24270 </tgroup>
24271 </informaltable>
24272 <para>
24273 This option controls whether GnuTLS is used in compatibility mode in an Exim
24274 server. This reduces security slightly, but improves interworking with older
24275 implementations of TLS.
24276 </para>
24277 <para>
24278 option gnutls_allow_auto_pkcs11 main boolean unset
24279 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
24280 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
24281 </para>
24282 <para>
24283 See
24284 <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>
24285 for documentation.
24286 </para>
24287 <para>
24288 <indexterm role="option">
24289 <primary><option>headers_charset</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>headers_charset</option></entry>
24301 <entry>Use: <emphasis>main</emphasis></entry>
24302 <entry>Type: <emphasis>string</emphasis></entry>
24303 <entry>Default: <emphasis>see below</emphasis></entry>
24304 </row>
24305 </tbody>
24306 </tgroup>
24307 </informaltable>
24308 <para>
24309 This option sets a default character set for translating from encoded MIME
24310 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
24311 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
24312 ultimate default is ISO-8859-1. For more details see the description of header
24313 insertions in section <xref linkend="SECTexpansionitems"/>.
24314 </para>
24315 <para>
24316 <indexterm role="option">
24317 <primary><option>header_maxsize</option></primary>
24318 </indexterm>
24319 </para>
24320 <informaltable frame="all">
24321 <tgroup cols="4" colsep="0" rowsep="0">
24322 <colspec colwidth="8*" align="left"/>
24323 <colspec colwidth="6*" align="center"/>
24324 <colspec colwidth="6*" align="center"/>
24325 <colspec colwidth="6*" align="right"/>
24326 <tbody>
24327 <row>
24328 <entry><option>header_maxsize</option></entry>
24329 <entry>Use: <emphasis>main</emphasis></entry>
24330 <entry>Type: <emphasis>integer</emphasis></entry>
24331 <entry>Default: <emphasis>see below</emphasis></entry>
24332 </row>
24333 </tbody>
24334 </tgroup>
24335 </informaltable>
24336 <para>
24337 <indexterm role="concept">
24338 <primary>header section</primary>
24339 <secondary>maximum size of</secondary>
24340 </indexterm>
24341 <indexterm role="concept">
24342 <primary>limit</primary>
24343 <secondary>size of message header section</secondary>
24344 </indexterm>
24345 This option controls the overall maximum size of a message&#x2019;s header
24346 section. The default is the value of HEADER_MAXSIZE in
24347 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
24348 sections are rejected.
24349 </para>
24350 <para>
24351 <indexterm role="option">
24352 <primary><option>header_line_maxsize</option></primary>
24353 </indexterm>
24354 </para>
24355 <informaltable frame="all">
24356 <tgroup cols="4" colsep="0" rowsep="0">
24357 <colspec colwidth="8*" align="left"/>
24358 <colspec colwidth="6*" align="center"/>
24359 <colspec colwidth="6*" align="center"/>
24360 <colspec colwidth="6*" align="right"/>
24361 <tbody>
24362 <row>
24363 <entry><option>header_line_maxsize</option></entry>
24364 <entry>Use: <emphasis>main</emphasis></entry>
24365 <entry>Type: <emphasis>integer</emphasis></entry>
24366 <entry>Default: <emphasis>0</emphasis></entry>
24367 </row>
24368 </tbody>
24369 </tgroup>
24370 </informaltable>
24371 <para>
24372 <indexterm role="concept">
24373 <primary>header lines</primary>
24374 <secondary>maximum size of</secondary>
24375 </indexterm>
24376 <indexterm role="concept">
24377 <primary>limit</primary>
24378 <secondary>size of one header line</secondary>
24379 </indexterm>
24380 This option limits the length of any individual header line in a message, after
24381 all the continuations have been joined together. Messages with individual
24382 header lines that are longer than the limit are rejected. The default value of
24383 zero means <quote>no limit</quote>.
24384 </para>
24385 <para>
24386 <indexterm role="option">
24387 <primary><option>helo_accept_junk_hosts</option></primary>
24388 </indexterm>
24389 </para>
24390 <informaltable frame="all">
24391 <tgroup cols="4" colsep="0" rowsep="0">
24392 <colspec colwidth="8*" align="left"/>
24393 <colspec colwidth="6*" align="center"/>
24394 <colspec colwidth="6*" align="center"/>
24395 <colspec colwidth="6*" align="right"/>
24396 <tbody>
24397 <row>
24398 <entry><option>helo_accept_junk_hosts</option></entry>
24399 <entry>Use: <emphasis>main</emphasis></entry>
24400 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24401 <entry>Default: <emphasis>unset</emphasis></entry>
24402 </row>
24403 </tbody>
24404 </tgroup>
24405 </informaltable>
24406 <para>
24407 <indexterm role="concept">
24408 <primary>HELO</primary>
24409 <secondary>accepting junk data</secondary>
24410 </indexterm>
24411 <indexterm role="concept">
24412 <primary>EHLO</primary>
24413 <secondary>accepting junk data</secondary>
24414 </indexterm>
24415 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
24416 mail, and gives an error response for invalid data. Unfortunately, there are
24417 some SMTP clients that send syntactic junk. They can be accommodated by setting
24418 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
24419 if you want to do semantic checking.
24420 See also <option>helo_allow_chars</option> for a way of extending the permitted character
24421 set.
24422 </para>
24423 <para>
24424 <indexterm role="option">
24425 <primary><option>helo_allow_chars</option></primary>
24426 </indexterm>
24427 </para>
24428 <informaltable frame="all">
24429 <tgroup cols="4" colsep="0" rowsep="0">
24430 <colspec colwidth="8*" align="left"/>
24431 <colspec colwidth="6*" align="center"/>
24432 <colspec colwidth="6*" align="center"/>
24433 <colspec colwidth="6*" align="right"/>
24434 <tbody>
24435 <row>
24436 <entry><option>helo_allow_chars</option></entry>
24437 <entry>Use: <emphasis>main</emphasis></entry>
24438 <entry>Type: <emphasis>string</emphasis></entry>
24439 <entry>Default: <emphasis>unset</emphasis></entry>
24440 </row>
24441 </tbody>
24442 </tgroup>
24443 </informaltable>
24444 <para>
24445 <indexterm role="concept">
24446 <primary>HELO</primary>
24447 <secondary>underscores in</secondary>
24448 </indexterm>
24449 <indexterm role="concept">
24450 <primary>EHLO</primary>
24451 <secondary>underscores in</secondary>
24452 </indexterm>
24453 <indexterm role="concept">
24454 <primary>underscore in EHLO/HELO</primary>
24455 </indexterm>
24456 This option can be set to a string of rogue characters that are permitted in
24457 all EHLO and HELO names in addition to the standard letters, digits,
24458 hyphens, and dots. If you really must allow underscores, you can set
24459 </para>
24460 <literallayout class="monospaced">
24461 helo_allow_chars = _
24462 </literallayout>
24463 <para>
24464 Note that the value is one string, not a list.
24465 </para>
24466 <para>
24467 <indexterm role="option">
24468 <primary><option>helo_lookup_domains</option></primary>
24469 </indexterm>
24470 </para>
24471 <informaltable frame="all">
24472 <tgroup cols="4" colsep="0" rowsep="0">
24473 <colspec colwidth="8*" align="left"/>
24474 <colspec colwidth="6*" align="center"/>
24475 <colspec colwidth="6*" align="center"/>
24476 <colspec colwidth="6*" align="right"/>
24477 <tbody>
24478 <row>
24479 <entry><option>helo_lookup_domains</option></entry>
24480 <entry>Use: <emphasis>main</emphasis></entry>
24481 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24482 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
24483 </row>
24484 </tbody>
24485 </tgroup>
24486 </informaltable>
24487 <para>
24488 <indexterm role="concept">
24489 <primary>HELO</primary>
24490 <secondary>forcing reverse lookup</secondary>
24491 </indexterm>
24492 <indexterm role="concept">
24493 <primary>EHLO</primary>
24494 <secondary>forcing reverse lookup</secondary>
24495 </indexterm>
24496 If the domain given by a client in a HELO or EHLO command matches this
24497 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
24498 default forces a lookup if the client host gives the server&#x2019;s name or any of
24499 its IP addresses (in brackets), something that broken clients have been seen to
24500 do.
24501 </para>
24502 <para>
24503 <indexterm role="option">
24504 <primary><option>helo_try_verify_hosts</option></primary>
24505 </indexterm>
24506 </para>
24507 <informaltable frame="all">
24508 <tgroup cols="4" colsep="0" rowsep="0">
24509 <colspec colwidth="8*" align="left"/>
24510 <colspec colwidth="6*" align="center"/>
24511 <colspec colwidth="6*" align="center"/>
24512 <colspec colwidth="6*" align="right"/>
24513 <tbody>
24514 <row>
24515 <entry><option>helo_try_verify_hosts</option></entry>
24516 <entry>Use: <emphasis>main</emphasis></entry>
24517 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24518 <entry>Default: <emphasis>unset</emphasis></entry>
24519 </row>
24520 </tbody>
24521 </tgroup>
24522 </informaltable>
24523 <para>
24524 <indexterm role="concept">
24525 <primary>HELO verifying</primary>
24526 <secondary>optional</secondary>
24527 </indexterm>
24528 <indexterm role="concept">
24529 <primary>EHLO</primary>
24530 <secondary>verifying, optional</secondary>
24531 </indexterm>
24532 By default, Exim just checks the syntax of HELO and EHLO commands (see
24533 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
24534 to do more extensive checking of the data supplied by these commands. The ACL
24535 condition <literal>verify = helo</literal> is provided to make this possible.
24536 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
24537 to force the check to occur. From release 4.53 onwards, this is no longer
24538 necessary. If the check has not been done before <literal>verify = helo</literal> is
24539 encountered, it is done at that time. Consequently, this option is obsolete.
24540 Its specification is retained here for backwards compatibility.
24541 </para>
24542 <para>
24543 When an EHLO or HELO command is received, if the calling host matches
24544 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
24545 EHLO command either:
24546 </para>
24547 <itemizedlist>
24548 <listitem>
24549 <para>
24550 is an IP literal matching the calling address of the host, or
24551 </para>
24552 </listitem>
24553 <listitem>
24554 <para>
24555 <indexterm role="concept">
24556 <primary>DNS</primary>
24557 <secondary>reverse lookup</secondary>
24558 </indexterm>
24559 <indexterm role="concept">
24560 <primary>reverse DNS lookup</primary>
24561 </indexterm>
24562 matches the host name that Exim obtains by doing a reverse lookup of the
24563 calling host address, or
24564 </para>
24565 </listitem>
24566 <listitem>
24567 <para>
24568 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
24569 available) yields the calling host address.
24570 </para>
24571 </listitem>
24572 </itemizedlist>
24573 <para>
24574 However, the EHLO or HELO command is not rejected if any of the checks
24575 fail. Processing continues, but the result of the check is remembered, and can
24576 be detected later in an ACL by the <literal>verify = helo</literal> condition.
24577 </para>
24578 <para>
24579 <indexterm role="option">
24580 <primary><option>helo_verify_hosts</option></primary>
24581 </indexterm>
24582 </para>
24583 <informaltable frame="all">
24584 <tgroup cols="4" colsep="0" rowsep="0">
24585 <colspec colwidth="8*" align="left"/>
24586 <colspec colwidth="6*" align="center"/>
24587 <colspec colwidth="6*" align="center"/>
24588 <colspec colwidth="6*" align="right"/>
24589 <tbody>
24590 <row>
24591 <entry><option>helo_verify_hosts</option></entry>
24592 <entry>Use: <emphasis>main</emphasis></entry>
24593 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24594 <entry>Default: <emphasis>unset</emphasis></entry>
24595 </row>
24596 </tbody>
24597 </tgroup>
24598 </informaltable>
24599 <para>
24600 <indexterm role="concept">
24601 <primary>HELO verifying</primary>
24602 <secondary>mandatory</secondary>
24603 </indexterm>
24604 <indexterm role="concept">
24605 <primary>EHLO</primary>
24606 <secondary>verifying, mandatory</secondary>
24607 </indexterm>
24608 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
24609 backwards compatibility. For hosts that match this option, Exim checks the host
24610 name given in the HELO or EHLO in the same way as for
24611 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
24612 rejected with a 550 error, and entries are written to the main and reject logs.
24613 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
24614 error.
24615 </para>
24616 <para>
24617 <indexterm role="option">
24618 <primary><option>hold_domains</option></primary>
24619 </indexterm>
24620 </para>
24621 <informaltable frame="all">
24622 <tgroup cols="4" colsep="0" rowsep="0">
24623 <colspec colwidth="8*" align="left"/>
24624 <colspec colwidth="6*" align="center"/>
24625 <colspec colwidth="6*" align="center"/>
24626 <colspec colwidth="6*" align="right"/>
24627 <tbody>
24628 <row>
24629 <entry><option>hold_domains</option></entry>
24630 <entry>Use: <emphasis>main</emphasis></entry>
24631 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24632 <entry>Default: <emphasis>unset</emphasis></entry>
24633 </row>
24634 </tbody>
24635 </tgroup>
24636 </informaltable>
24637 <para>
24638 <indexterm role="concept">
24639 <primary>domain</primary>
24640 <secondary>delaying delivery</secondary>
24641 </indexterm>
24642 <indexterm role="concept">
24643 <primary>delivery</primary>
24644 <secondary>delaying certain domains</secondary>
24645 </indexterm>
24646 This option allows mail for particular domains to be held on the queue
24647 manually. The option is overridden if a message delivery is forced with the
24648 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
24649 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
24650 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
24651 it is deferred every time the message is looked at.
24652 </para>
24653 <para>
24654 This option is intended as a temporary operational measure for delaying the
24655 delivery of mail while some problem is being sorted out, or some new
24656 configuration tested. If you just want to delay the processing of some
24657 domains until a queue run occurs, you should use <option>queue_domains</option> or
24658 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
24659 </para>
24660 <para>
24661 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
24662 messages from the queue if they have been there longer than the longest retry
24663 time in any retry rule. If you want to hold messages for longer than the normal
24664 retry times, insert a dummy retry rule with a long retry time.
24665 </para>
24666 <para>
24667 <indexterm role="option">
24668 <primary><option>host_lookup</option></primary>
24669 </indexterm>
24670 </para>
24671 <informaltable frame="all">
24672 <tgroup cols="4" colsep="0" rowsep="0">
24673 <colspec colwidth="8*" align="left"/>
24674 <colspec colwidth="6*" align="center"/>
24675 <colspec colwidth="6*" align="center"/>
24676 <colspec colwidth="6*" align="right"/>
24677 <tbody>
24678 <row>
24679 <entry><option>host_lookup</option></entry>
24680 <entry>Use: <emphasis>main</emphasis></entry>
24681 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24682 <entry>Default: <emphasis>unset</emphasis></entry>
24683 </row>
24684 </tbody>
24685 </tgroup>
24686 </informaltable>
24687 <para>
24688 <indexterm role="concept">
24689 <primary>host name</primary>
24690 <secondary>lookup, forcing</secondary>
24691 </indexterm>
24692 Exim does not look up the name of a calling host from its IP address unless it
24693 is required to compare against some host list, or the host matches
24694 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
24695 option (which normally contains IP addresses rather than host names). The
24696 default configuration file contains
24697 </para>
24698 <literallayout class="monospaced">
24699 host_lookup = *
24700 </literallayout>
24701 <para>
24702 which causes a lookup to happen for all hosts. If the expense of these lookups
24703 is felt to be too great, the setting can be changed or removed.
24704 </para>
24705 <para>
24706 After a successful reverse lookup, Exim does a forward lookup on the name it
24707 has obtained, to verify that it yields the IP address that it started with. If
24708 this check fails, Exim behaves as if the name lookup failed.
24709 </para>
24710 <para>
24711 <indexterm role="variable">
24712 <primary><varname>$host_lookup_failed</varname></primary>
24713 </indexterm>
24714 <indexterm role="variable">
24715 <primary><varname>$sender_host_name</varname></primary>
24716 </indexterm>
24717 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
24718 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
24719 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
24720 <literal>verify = reverse_host_lookup</literal> in ACLs.
24721 </para>
24722 <para>
24723 <indexterm role="option">
24724 <primary><option>host_lookup_order</option></primary>
24725 </indexterm>
24726 </para>
24727 <informaltable frame="all">
24728 <tgroup cols="4" colsep="0" rowsep="0">
24729 <colspec colwidth="8*" align="left"/>
24730 <colspec colwidth="6*" align="center"/>
24731 <colspec colwidth="6*" align="center"/>
24732 <colspec colwidth="6*" align="right"/>
24733 <tbody>
24734 <row>
24735 <entry><option>host_lookup_order</option></entry>
24736 <entry>Use: <emphasis>main</emphasis></entry>
24737 <entry>Type: <emphasis>string list</emphasis></entry>
24738 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
24739 </row>
24740 </tbody>
24741 </tgroup>
24742 </informaltable>
24743 <para>
24744 This option specifies the order of different lookup methods when Exim is trying
24745 to find a host name from an IP address. The default is to do a DNS lookup
24746 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
24747 if that fails. You can change the order of these lookups, or omit one entirely,
24748 if you want.
24749 </para>
24750 <para>
24751 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
24752 multiple PTR records in the DNS and the IP address is not listed in
24753 <filename>/etc/hosts</filename>. Different operating systems give different results in this
24754 case. That is why the default tries a DNS lookup first.
24755 </para>
24756 <para>
24757 <indexterm role="option">
24758 <primary><option>host_reject_connection</option></primary>
24759 </indexterm>
24760 </para>
24761 <informaltable frame="all">
24762 <tgroup cols="4" colsep="0" rowsep="0">
24763 <colspec colwidth="8*" align="left"/>
24764 <colspec colwidth="6*" align="center"/>
24765 <colspec colwidth="6*" align="center"/>
24766 <colspec colwidth="6*" align="right"/>
24767 <tbody>
24768 <row>
24769 <entry><option>host_reject_connection</option></entry>
24770 <entry>Use: <emphasis>main</emphasis></entry>
24771 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24772 <entry>Default: <emphasis>unset</emphasis></entry>
24773 </row>
24774 </tbody>
24775 </tgroup>
24776 </informaltable>
24777 <para>
24778 <indexterm role="concept">
24779 <primary>host</primary>
24780 <secondary>rejecting connections from</secondary>
24781 </indexterm>
24782 If this option is set, incoming SMTP calls from the hosts listed are rejected
24783 as soon as the connection is made.
24784 This option is obsolete, and retained only for backward compatibility, because
24785 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
24786 connections immediately.
24787 </para>
24788 <para>
24789 The ability to give an immediate rejection (either by this option or using an
24790 ACL) is provided for use in unusual cases. Many hosts will just try again,
24791 sometimes without much delay. Normally, it is better to use an ACL to reject
24792 incoming messages at a later stage, such as after RCPT commands. See
24793 chapter <xref linkend="CHAPACL"/>.
24794 </para>
24795 <para>
24796 <indexterm role="option">
24797 <primary><option>hosts_connection_nolog</option></primary>
24798 </indexterm>
24799 </para>
24800 <informaltable frame="all">
24801 <tgroup cols="4" colsep="0" rowsep="0">
24802 <colspec colwidth="8*" align="left"/>
24803 <colspec colwidth="6*" align="center"/>
24804 <colspec colwidth="6*" align="center"/>
24805 <colspec colwidth="6*" align="right"/>
24806 <tbody>
24807 <row>
24808 <entry><option>hosts_connection_nolog</option></entry>
24809 <entry>Use: <emphasis>main</emphasis></entry>
24810 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24811 <entry>Default: <emphasis>unset</emphasis></entry>
24812 </row>
24813 </tbody>
24814 </tgroup>
24815 </informaltable>
24816 <para>
24817 <indexterm role="concept">
24818 <primary>host</primary>
24819 <secondary>not logging connections from</secondary>
24820 </indexterm>
24821 This option defines a list of hosts for which connection logging does not
24822 happen, even though the <option>smtp_connection</option> log selector is set. For example,
24823 you might want not to log SMTP connections from local processes, or from
24824 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
24825 the daemon; you should therefore strive to restrict its value to a short inline
24826 list of IP addresses and networks. To disable logging SMTP connections from
24827 local processes, you must create a host list with an empty item. For example:
24828 </para>
24829 <literallayout class="monospaced">
24830 hosts_connection_nolog = :
24831 </literallayout>
24832 <para>
24833 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
24834 </para>
24835 <para>
24836 <indexterm role="option">
24837 <primary><option>hosts_treat_as_local</option></primary>
24838 </indexterm>
24839 </para>
24840 <informaltable frame="all">
24841 <tgroup cols="4" colsep="0" rowsep="0">
24842 <colspec colwidth="8*" align="left"/>
24843 <colspec colwidth="6*" align="center"/>
24844 <colspec colwidth="6*" align="center"/>
24845 <colspec colwidth="6*" align="right"/>
24846 <tbody>
24847 <row>
24848 <entry><option>hosts_treat_as_local</option></entry>
24849 <entry>Use: <emphasis>main</emphasis></entry>
24850 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24851 <entry>Default: <emphasis>unset</emphasis></entry>
24852 </row>
24853 </tbody>
24854 </tgroup>
24855 </informaltable>
24856 <para>
24857 <indexterm role="concept">
24858 <primary>local host</primary>
24859 <secondary>domains treated as</secondary>
24860 </indexterm>
24861 <indexterm role="concept">
24862 <primary>host</primary>
24863 <secondary>treated as local</secondary>
24864 </indexterm>
24865 If this option is set, any host names that match the domain list are treated as
24866 if they were the local host when Exim is scanning host lists obtained from MX
24867 records
24868 or other sources. Note that the value of this option is a domain list, not a
24869 host list, because it is always used to check host names, not IP addresses.
24870 </para>
24871 <para>
24872 This option also applies when Exim is matching the special items
24873 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
24874 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
24875 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
24876 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
24877 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
24878 interfaces and recognizing the local host.
24879 </para>
24880 <para>
24881 <indexterm role="option">
24882 <primary><option>ibase_servers</option></primary>
24883 </indexterm>
24884 </para>
24885 <informaltable frame="all">
24886 <tgroup cols="4" colsep="0" rowsep="0">
24887 <colspec colwidth="8*" align="left"/>
24888 <colspec colwidth="6*" align="center"/>
24889 <colspec colwidth="6*" align="center"/>
24890 <colspec colwidth="6*" align="right"/>
24891 <tbody>
24892 <row>
24893 <entry><option>ibase_servers</option></entry>
24894 <entry>Use: <emphasis>main</emphasis></entry>
24895 <entry>Type: <emphasis>string list</emphasis></entry>
24896 <entry>Default: <emphasis>unset</emphasis></entry>
24897 </row>
24898 </tbody>
24899 </tgroup>
24900 </informaltable>
24901 <para>
24902 <indexterm role="concept">
24903 <primary>InterBase</primary>
24904 <secondary>server list</secondary>
24905 </indexterm>
24906 This option provides a list of InterBase servers and associated connection data,
24907 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
24908 The option is available only if Exim has been built with InterBase support.
24909 </para>
24910 <para>
24911 <indexterm role="option">
24912 <primary><option>ignore_bounce_errors_after</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>ignore_bounce_errors_after</option></entry>
24924 <entry>Use: <emphasis>main</emphasis></entry>
24925 <entry>Type: <emphasis>time</emphasis></entry>
24926 <entry>Default: <emphasis>10w</emphasis></entry>
24927 </row>
24928 </tbody>
24929 </tgroup>
24930 </informaltable>
24931 <para>
24932 <indexterm role="concept">
24933 <primary>bounce message</primary>
24934 <secondary>discarding</secondary>
24935 </indexterm>
24936 <indexterm role="concept">
24937 <primary>discarding bounce message</primary>
24938 </indexterm>
24939 This option affects the processing of bounce messages that cannot be delivered,
24940 that is, those that suffer a permanent delivery failure. (Bounce messages that
24941 suffer temporary delivery failures are of course retried in the usual way.)
24942 </para>
24943 <para>
24944 After a permanent delivery failure, bounce messages are frozen,
24945 because there is no sender to whom they can be returned. When a frozen bounce
24946 message has been on the queue for more than the given time, it is unfrozen at
24947 the next queue run, and a further delivery is attempted. If delivery fails
24948 again, the bounce message is discarded. This makes it possible to keep failed
24949 bounce messages around for a shorter time than the normal maximum retry time
24950 for frozen messages. For example,
24951 </para>
24952 <literallayout class="monospaced">
24953 ignore_bounce_errors_after = 12h
24954 </literallayout>
24955 <para>
24956 retries failed bounce message deliveries after 12 hours, discarding any further
24957 failures. If the value of this option is set to a zero time period, bounce
24958 failures are discarded immediately. Setting a very long time (as in the default
24959 value) has the effect of disabling this option. For ways of automatically
24960 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
24961 <option>timeout_frozen_after</option>.
24962 </para>
24963 <para>
24964 <indexterm role="option">
24965 <primary><option>ignore_fromline_hosts</option></primary>
24966 </indexterm>
24967 </para>
24968 <informaltable frame="all">
24969 <tgroup cols="4" colsep="0" rowsep="0">
24970 <colspec colwidth="8*" align="left"/>
24971 <colspec colwidth="6*" align="center"/>
24972 <colspec colwidth="6*" align="center"/>
24973 <colspec colwidth="6*" align="right"/>
24974 <tbody>
24975 <row>
24976 <entry><option>ignore_fromline_hosts</option></entry>
24977 <entry>Use: <emphasis>main</emphasis></entry>
24978 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24979 <entry>Default: <emphasis>unset</emphasis></entry>
24980 </row>
24981 </tbody>
24982 </tgroup>
24983 </informaltable>
24984 <para>
24985 <indexterm role="concept">
24986 <primary><quote>From</quote> line</primary>
24987 </indexterm>
24988 <indexterm role="concept">
24989 <primary>UUCP</primary>
24990 <secondary><quote>From</quote> line</secondary>
24991 </indexterm>
24992 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
24993 the headers of a message. By default this is treated as the start of the
24994 message&#x2019;s body, which means that any following headers are not recognized as
24995 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
24996 match those hosts that insist on sending it. If the sender is actually a local
24997 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
24998 <option>ignore_fromline_local</option> must be set to achieve this effect.
24999 </para>
25000 <para>
25001 <indexterm role="option">
25002 <primary><option>ignore_fromline_local</option></primary>
25003 </indexterm>
25004 </para>
25005 <informaltable frame="all">
25006 <tgroup cols="4" colsep="0" rowsep="0">
25007 <colspec colwidth="8*" align="left"/>
25008 <colspec colwidth="6*" align="center"/>
25009 <colspec colwidth="6*" align="center"/>
25010 <colspec colwidth="6*" align="right"/>
25011 <tbody>
25012 <row>
25013 <entry><option>ignore_fromline_local</option></entry>
25014 <entry>Use: <emphasis>main</emphasis></entry>
25015 <entry>Type: <emphasis>boolean</emphasis></entry>
25016 <entry>Default: <emphasis>false</emphasis></entry>
25017 </row>
25018 </tbody>
25019 </tgroup>
25020 </informaltable>
25021 <para>
25022 See <option>ignore_fromline_hosts</option> above.
25023 </para>
25024 <para revisionflag="changed">
25025 <indexterm role="option">
25026 <primary><option>keep_environment</option></primary>
25027 </indexterm>
25028 </para>
25029 <informaltable frame="all" revisionflag="changed">
25030 <tgroup cols="4" colsep="0" rowsep="0">
25031 <colspec colwidth="8*" align="left"/>
25032 <colspec colwidth="6*" align="center"/>
25033 <colspec colwidth="6*" align="center"/>
25034 <colspec colwidth="6*" align="right"/>
25035 <tbody>
25036 <row>
25037 <entry><option>keep_environment</option></entry>
25038 <entry>Use: <emphasis>main</emphasis></entry>
25039 <entry>Type: <emphasis>string list</emphasis></entry>
25040 <entry>Default: <emphasis>unset</emphasis></entry>
25041 </row>
25042 </tbody>
25043 </tgroup>
25044 </informaltable>
25045 <para revisionflag="changed">
25046 <indexterm role="concept">
25047 <primary>environment</primary>
25048 <secondary>inherited</secondary>
25049 </indexterm>
25050 This option contains a string list of environment variables to keep.
25051 You have to trust these variables or you have to be sure that
25052 these variables do not impose any security risk. Keep in mind that
25053 during the startup phase Exim is running with an effective UID 0 in most
25054 installations. As the default value is an empty list, the default
25055 environment for using libraries, running embedded Perl code, or running
25056 external binaries is empty, and does not not even contain PATH or HOME.
25057 </para>
25058 <para revisionflag="changed">
25059 Actually the list is interpreted as a list of patterns
25060 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
25061 </para>
25062 <para revisionflag="changed">
25063 WARNING: Macro substitution is still done first, so having a macro
25064 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
25065 unexpected results. You may work around this using a regular expression
25066 that does not match the macro name: ^[F]OO_HOME$.
25067 </para>
25068 <para revisionflag="changed">
25069 Current versions of Exim issue a warning during startupif you do not mention
25070 <option>keep_environment</option> or <option>add_environment</option> in your runtime configuration
25071 file.
25072 </para>
25073 <para>
25074 <indexterm role="option">
25075 <primary><option>keep_malformed</option></primary>
25076 </indexterm>
25077 </para>
25078 <informaltable frame="all">
25079 <tgroup cols="4" colsep="0" rowsep="0">
25080 <colspec colwidth="8*" align="left"/>
25081 <colspec colwidth="6*" align="center"/>
25082 <colspec colwidth="6*" align="center"/>
25083 <colspec colwidth="6*" align="right"/>
25084 <tbody>
25085 <row>
25086 <entry><option>keep_malformed</option></entry>
25087 <entry>Use: <emphasis>main</emphasis></entry>
25088 <entry>Type: <emphasis>time</emphasis></entry>
25089 <entry>Default: <emphasis>4d</emphasis></entry>
25090 </row>
25091 </tbody>
25092 </tgroup>
25093 </informaltable>
25094 <para>
25095 This option specifies the length of time to keep messages whose spool files
25096 have been corrupted in some way. This should, of course, never happen. At the
25097 next attempt to deliver such a message, it gets removed. The incident is
25098 logged.
25099 </para>
25100 <para>
25101 <indexterm role="option">
25102 <primary><option>ldap_ca_cert_dir</option></primary>
25103 </indexterm>
25104 </para>
25105 <informaltable frame="all">
25106 <tgroup cols="4" colsep="0" rowsep="0">
25107 <colspec colwidth="8*" align="left"/>
25108 <colspec colwidth="6*" align="center"/>
25109 <colspec colwidth="6*" align="center"/>
25110 <colspec colwidth="6*" align="right"/>
25111 <tbody>
25112 <row>
25113 <entry><option>ldap_ca_cert_dir</option></entry>
25114 <entry>Use: <emphasis>main</emphasis></entry>
25115 <entry>Type: <emphasis>string</emphasis></entry>
25116 <entry>Default: <emphasis>unset</emphasis></entry>
25117 </row>
25118 </tbody>
25119 </tgroup>
25120 </informaltable>
25121 <para>
25122 <indexterm role="concept">
25123 <primary>LDAP</primary>
25124 <secondary>,</secondary>
25125 </indexterm>
25126 This option indicates which directory contains CA certificates for verifying
25127 a TLS certificate presented by an LDAP server.
25128 While Exim does not provide a default value, your SSL library may.
25129 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25130 and constrained to be a directory.
25131 </para>
25132 <para>
25133 <indexterm role="option">
25134 <primary><option>ldap_ca_cert_file</option></primary>
25135 </indexterm>
25136 </para>
25137 <informaltable frame="all">
25138 <tgroup cols="4" colsep="0" rowsep="0">
25139 <colspec colwidth="8*" align="left"/>
25140 <colspec colwidth="6*" align="center"/>
25141 <colspec colwidth="6*" align="center"/>
25142 <colspec colwidth="6*" align="right"/>
25143 <tbody>
25144 <row>
25145 <entry><option>ldap_ca_cert_file</option></entry>
25146 <entry>Use: <emphasis>main</emphasis></entry>
25147 <entry>Type: <emphasis>string</emphasis></entry>
25148 <entry>Default: <emphasis>unset</emphasis></entry>
25149 </row>
25150 </tbody>
25151 </tgroup>
25152 </informaltable>
25153 <para>
25154 <indexterm role="concept">
25155 <primary>LDAP</primary>
25156 <secondary>,</secondary>
25157 </indexterm>
25158 This option indicates which file contains CA certificates for verifying
25159 a TLS certificate presented by an LDAP server.
25160 While Exim does not provide a default value, your SSL library may.
25161 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25162 and constrained to be a file.
25163 </para>
25164 <para>
25165 <indexterm role="option">
25166 <primary><option>ldap_cert_file</option></primary>
25167 </indexterm>
25168 </para>
25169 <informaltable frame="all">
25170 <tgroup cols="4" colsep="0" rowsep="0">
25171 <colspec colwidth="8*" align="left"/>
25172 <colspec colwidth="6*" align="center"/>
25173 <colspec colwidth="6*" align="center"/>
25174 <colspec colwidth="6*" align="right"/>
25175 <tbody>
25176 <row>
25177 <entry><option>ldap_cert_file</option></entry>
25178 <entry>Use: <emphasis>main</emphasis></entry>
25179 <entry>Type: <emphasis>string</emphasis></entry>
25180 <entry>Default: <emphasis>unset</emphasis></entry>
25181 </row>
25182 </tbody>
25183 </tgroup>
25184 </informaltable>
25185 <para>
25186 <indexterm role="concept">
25187 <primary>LDAP</primary>
25188 <secondary>TLS client certificate file</secondary>
25189 </indexterm>
25190 This option indicates which file contains an TLS client certificate which
25191 Exim should present to the LDAP server during TLS negotiation.
25192 Should be used together with <option>ldap_cert_key</option>.
25193 </para>
25194 <para>
25195 <indexterm role="option">
25196 <primary><option>ldap_cert_key</option></primary>
25197 </indexterm>
25198 </para>
25199 <informaltable frame="all">
25200 <tgroup cols="4" colsep="0" rowsep="0">
25201 <colspec colwidth="8*" align="left"/>
25202 <colspec colwidth="6*" align="center"/>
25203 <colspec colwidth="6*" align="center"/>
25204 <colspec colwidth="6*" align="right"/>
25205 <tbody>
25206 <row>
25207 <entry><option>ldap_cert_key</option></entry>
25208 <entry>Use: <emphasis>main</emphasis></entry>
25209 <entry>Type: <emphasis>string</emphasis></entry>
25210 <entry>Default: <emphasis>unset</emphasis></entry>
25211 </row>
25212 </tbody>
25213 </tgroup>
25214 </informaltable>
25215 <para>
25216 <indexterm role="concept">
25217 <primary>LDAP</primary>
25218 <secondary>TLS client key file</secondary>
25219 </indexterm>
25220 This option indicates which file contains the secret/private key to use
25221 to prove identity to the LDAP server during TLS negotiation.
25222 Should be used together with <option>ldap_cert_file</option>, which contains the
25223 identity to be proven.
25224 </para>
25225 <para>
25226 <indexterm role="option">
25227 <primary><option>ldap_cipher_suite</option></primary>
25228 </indexterm>
25229 </para>
25230 <informaltable frame="all">
25231 <tgroup cols="4" colsep="0" rowsep="0">
25232 <colspec colwidth="8*" align="left"/>
25233 <colspec colwidth="6*" align="center"/>
25234 <colspec colwidth="6*" align="center"/>
25235 <colspec colwidth="6*" align="right"/>
25236 <tbody>
25237 <row>
25238 <entry><option>ldap_cipher_suite</option></entry>
25239 <entry>Use: <emphasis>main</emphasis></entry>
25240 <entry>Type: <emphasis>string</emphasis></entry>
25241 <entry>Default: <emphasis>unset</emphasis></entry>
25242 </row>
25243 </tbody>
25244 </tgroup>
25245 </informaltable>
25246 <para>
25247 <indexterm role="concept">
25248 <primary>LDAP</primary>
25249 <secondary>TLS cipher suite</secondary>
25250 </indexterm>
25251 This controls the TLS cipher-suite negotiation during TLS negotiation with
25252 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
25253 cipher-suite options with OpenSSL (as used by LDAP client libraries).
25254 </para>
25255 <para>
25256 <indexterm role="option">
25257 <primary><option>ldap_default_servers</option></primary>
25258 </indexterm>
25259 </para>
25260 <informaltable frame="all">
25261 <tgroup cols="4" colsep="0" rowsep="0">
25262 <colspec colwidth="8*" align="left"/>
25263 <colspec colwidth="6*" align="center"/>
25264 <colspec colwidth="6*" align="center"/>
25265 <colspec colwidth="6*" align="right"/>
25266 <tbody>
25267 <row>
25268 <entry><option>ldap_default_servers</option></entry>
25269 <entry>Use: <emphasis>main</emphasis></entry>
25270 <entry>Type: <emphasis>string list</emphasis></entry>
25271 <entry>Default: <emphasis>unset</emphasis></entry>
25272 </row>
25273 </tbody>
25274 </tgroup>
25275 </informaltable>
25276 <para>
25277 <indexterm role="concept">
25278 <primary>LDAP</primary>
25279 <secondary>default servers</secondary>
25280 </indexterm>
25281 This option provides a list of LDAP servers which are tried in turn when an
25282 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
25283 details of LDAP queries. This option is available only when Exim has been built
25284 with LDAP support.
25285 </para>
25286 <para>
25287 <indexterm role="option">
25288 <primary><option>ldap_require_cert</option></primary>
25289 </indexterm>
25290 </para>
25291 <informaltable frame="all">
25292 <tgroup cols="4" colsep="0" rowsep="0">
25293 <colspec colwidth="8*" align="left"/>
25294 <colspec colwidth="6*" align="center"/>
25295 <colspec colwidth="6*" align="center"/>
25296 <colspec colwidth="6*" align="right"/>
25297 <tbody>
25298 <row>
25299 <entry><option>ldap_require_cert</option></entry>
25300 <entry>Use: <emphasis>main</emphasis></entry>
25301 <entry>Type: <emphasis>string</emphasis></entry>
25302 <entry>Default: <emphasis>unset.</emphasis></entry>
25303 </row>
25304 </tbody>
25305 </tgroup>
25306 </informaltable>
25307 <para>
25308 <indexterm role="concept">
25309 <primary>LDAP</primary>
25310 <secondary>policy for LDAP server TLS cert presentation</secondary>
25311 </indexterm>
25312 This should be one of the values "hard", "demand", "allow", "try" or "never".
25313 A value other than one of these is interpreted as "never".
25314 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
25315 Although Exim does not set a default, the LDAP library probably defaults
25316 to hard/demand.
25317 </para>
25318 <para>
25319 <indexterm role="option">
25320 <primary><option>ldap_start_tls</option></primary>
25321 </indexterm>
25322 </para>
25323 <informaltable frame="all">
25324 <tgroup cols="4" colsep="0" rowsep="0">
25325 <colspec colwidth="8*" align="left"/>
25326 <colspec colwidth="6*" align="center"/>
25327 <colspec colwidth="6*" align="center"/>
25328 <colspec colwidth="6*" align="right"/>
25329 <tbody>
25330 <row>
25331 <entry><option>ldap_start_tls</option></entry>
25332 <entry>Use: <emphasis>main</emphasis></entry>
25333 <entry>Type: <emphasis>boolean</emphasis></entry>
25334 <entry>Default: <emphasis>false</emphasis></entry>
25335 </row>
25336 </tbody>
25337 </tgroup>
25338 </informaltable>
25339 <para>
25340 <indexterm role="concept">
25341 <primary>LDAP</primary>
25342 <secondary>whether or not to negotiate TLS</secondary>
25343 </indexterm>
25344 If set, Exim will attempt to negotiate TLS with the LDAP server when
25345 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
25346 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
25347 of SSL-on-connect.
25348 In the event of failure to negotiate TLS, the action taken is controlled
25349 by <option>ldap_require_cert</option>.
25350 </para>
25351 <para>
25352 <indexterm role="option">
25353 <primary><option>ldap_version</option></primary>
25354 </indexterm>
25355 </para>
25356 <informaltable frame="all">
25357 <tgroup cols="4" colsep="0" rowsep="0">
25358 <colspec colwidth="8*" align="left"/>
25359 <colspec colwidth="6*" align="center"/>
25360 <colspec colwidth="6*" align="center"/>
25361 <colspec colwidth="6*" align="right"/>
25362 <tbody>
25363 <row>
25364 <entry><option>ldap_version</option></entry>
25365 <entry>Use: <emphasis>main</emphasis></entry>
25366 <entry>Type: <emphasis>integer</emphasis></entry>
25367 <entry>Default: <emphasis>unset</emphasis></entry>
25368 </row>
25369 </tbody>
25370 </tgroup>
25371 </informaltable>
25372 <para>
25373 <indexterm role="concept">
25374 <primary>LDAP</primary>
25375 <secondary>protocol version, forcing</secondary>
25376 </indexterm>
25377 This option can be used to force Exim to set a specific protocol version for
25378 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
25379 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
25380 the LDAP headers; otherwise it is 2. This option is available only when Exim
25381 has been built with LDAP support.
25382 </para>
25383 <para>
25384 <indexterm role="option">
25385 <primary><option>local_from_check</option></primary>
25386 </indexterm>
25387 </para>
25388 <informaltable frame="all">
25389 <tgroup cols="4" colsep="0" rowsep="0">
25390 <colspec colwidth="8*" align="left"/>
25391 <colspec colwidth="6*" align="center"/>
25392 <colspec colwidth="6*" align="center"/>
25393 <colspec colwidth="6*" align="right"/>
25394 <tbody>
25395 <row>
25396 <entry><option>local_from_check</option></entry>
25397 <entry>Use: <emphasis>main</emphasis></entry>
25398 <entry>Type: <emphasis>boolean</emphasis></entry>
25399 <entry>Default: <emphasis>true</emphasis></entry>
25400 </row>
25401 </tbody>
25402 </tgroup>
25403 </informaltable>
25404 <para>
25405 <indexterm role="concept">
25406 <primary><emphasis>Sender:</emphasis> header line</primary>
25407 <secondary>disabling addition of</secondary>
25408 </indexterm>
25409 <indexterm role="concept">
25410 <primary><emphasis>From:</emphasis> header line</primary>
25411 <secondary>disabling checking of</secondary>
25412 </indexterm>
25413 When a message is submitted locally (that is, not over a TCP/IP connection) by
25414 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
25415 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
25416 the domain specified by <option>qualify_domain</option>.
25417 </para>
25418 <para>
25419 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
25420 locally submitted message is automatically qualified by Exim, unless the
25421 <option>-bnq</option> command line option is used.
25422 </para>
25423 <para>
25424 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
25425 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
25426 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
25427 and the default qualify domain.
25428 </para>
25429 <para>
25430 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
25431 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
25432 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
25433 <option>local_sender_retain</option> to be true.
25434 </para>
25435 <para>
25436 <indexterm role="concept">
25437 <primary>envelope sender</primary>
25438 </indexterm>
25439 These options affect only the header lines in the message. The envelope sender
25440 is still forced to be the login id at the qualify domain unless
25441 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
25442 </para>
25443 <para>
25444 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
25445 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
25446 has more details about <emphasis>Sender:</emphasis> processing.
25447 </para>
25448 <para>
25449 <indexterm role="option">
25450 <primary><option>local_from_prefix</option></primary>
25451 </indexterm>
25452 </para>
25453 <informaltable frame="all">
25454 <tgroup cols="4" colsep="0" rowsep="0">
25455 <colspec colwidth="8*" align="left"/>
25456 <colspec colwidth="6*" align="center"/>
25457 <colspec colwidth="6*" align="center"/>
25458 <colspec colwidth="6*" align="right"/>
25459 <tbody>
25460 <row>
25461 <entry><option>local_from_prefix</option></entry>
25462 <entry>Use: <emphasis>main</emphasis></entry>
25463 <entry>Type: <emphasis>string</emphasis></entry>
25464 <entry>Default: <emphasis>unset</emphasis></entry>
25465 </row>
25466 </tbody>
25467 </tgroup>
25468 </informaltable>
25469 <para>
25470 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
25471 matching the login id (see <option>local_from_check</option> above), it can be configured to
25472 ignore certain prefixes and suffixes in the local part of the address. This is
25473 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
25474 appropriate lists, in the same form as the <option>local_part_prefix</option> and
25475 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
25476 example, if
25477 </para>
25478 <literallayout class="monospaced">
25479 local_from_prefix = *-
25480 </literallayout>
25481 <para>
25482 is set, a <emphasis>From:</emphasis> line containing
25483 </para>
25484 <literallayout class="monospaced">
25485 From: anything-user@your.domain.example
25486 </literallayout>
25487 <para>
25488 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
25489 matches the actual sender address that is constructed from the login name and
25490 qualify domain.
25491 </para>
25492 <para>
25493 <indexterm role="option">
25494 <primary><option>local_from_suffix</option></primary>
25495 </indexterm>
25496 </para>
25497 <informaltable frame="all">
25498 <tgroup cols="4" colsep="0" rowsep="0">
25499 <colspec colwidth="8*" align="left"/>
25500 <colspec colwidth="6*" align="center"/>
25501 <colspec colwidth="6*" align="center"/>
25502 <colspec colwidth="6*" align="right"/>
25503 <tbody>
25504 <row>
25505 <entry><option>local_from_suffix</option></entry>
25506 <entry>Use: <emphasis>main</emphasis></entry>
25507 <entry>Type: <emphasis>string</emphasis></entry>
25508 <entry>Default: <emphasis>unset</emphasis></entry>
25509 </row>
25510 </tbody>
25511 </tgroup>
25512 </informaltable>
25513 <para>
25514 See <option>local_from_prefix</option> above.
25515 </para>
25516 <para>
25517 <indexterm role="option">
25518 <primary><option>local_interfaces</option></primary>
25519 </indexterm>
25520 </para>
25521 <informaltable frame="all">
25522 <tgroup cols="4" colsep="0" rowsep="0">
25523 <colspec colwidth="8*" align="left"/>
25524 <colspec colwidth="6*" align="center"/>
25525 <colspec colwidth="6*" align="center"/>
25526 <colspec colwidth="6*" align="right"/>
25527 <tbody>
25528 <row>
25529 <entry><option>local_interfaces</option></entry>
25530 <entry>Use: <emphasis>main</emphasis></entry>
25531 <entry>Type: <emphasis>string list</emphasis></entry>
25532 <entry>Default: <emphasis>see below</emphasis></entry>
25533 </row>
25534 </tbody>
25535 </tgroup>
25536 </informaltable>
25537 <para>
25538 This option controls which network interfaces are used by the daemon for
25539 listening; they are also used to identify the local host when routing. Chapter
25540 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
25541 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
25542 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
25543 <option>local_interfaces</option> is
25544 </para>
25545 <literallayout class="monospaced">
25546 local_interfaces = 0.0.0.0
25547 </literallayout>
25548 <para>
25549 when Exim is built without IPv6 support; otherwise it is
25550 </para>
25551 <literallayout class="monospaced">
25552 local_interfaces = &lt;; ::0 ; 0.0.0.0
25553 </literallayout>
25554 <para>
25555 <indexterm role="option">
25556 <primary><option>local_scan_timeout</option></primary>
25557 </indexterm>
25558 </para>
25559 <informaltable frame="all">
25560 <tgroup cols="4" colsep="0" rowsep="0">
25561 <colspec colwidth="8*" align="left"/>
25562 <colspec colwidth="6*" align="center"/>
25563 <colspec colwidth="6*" align="center"/>
25564 <colspec colwidth="6*" align="right"/>
25565 <tbody>
25566 <row>
25567 <entry><option>local_scan_timeout</option></entry>
25568 <entry>Use: <emphasis>main</emphasis></entry>
25569 <entry>Type: <emphasis>time</emphasis></entry>
25570 <entry>Default: <emphasis>5m</emphasis></entry>
25571 </row>
25572 </tbody>
25573 </tgroup>
25574 </informaltable>
25575 <para>
25576 <indexterm role="concept">
25577 <primary>timeout</primary>
25578 <secondary>for <function>local_scan()</function> function</secondary>
25579 </indexterm>
25580 <indexterm role="concept">
25581 <primary><function>local_scan()</function> function</primary>
25582 <secondary>timeout</secondary>
25583 </indexterm>
25584 This timeout applies to the <function>local_scan()</function> function (see chapter
25585 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
25586 the incoming message is rejected with a temporary error if it is an SMTP
25587 message. For a non-SMTP message, the message is dropped and Exim ends with a
25588 non-zero code. The incident is logged on the main and reject logs.
25589 </para>
25590 <para>
25591 <indexterm role="option">
25592 <primary><option>local_sender_retain</option></primary>
25593 </indexterm>
25594 </para>
25595 <informaltable frame="all">
25596 <tgroup cols="4" colsep="0" rowsep="0">
25597 <colspec colwidth="8*" align="left"/>
25598 <colspec colwidth="6*" align="center"/>
25599 <colspec colwidth="6*" align="center"/>
25600 <colspec colwidth="6*" align="right"/>
25601 <tbody>
25602 <row>
25603 <entry><option>local_sender_retain</option></entry>
25604 <entry>Use: <emphasis>main</emphasis></entry>
25605 <entry>Type: <emphasis>boolean</emphasis></entry>
25606 <entry>Default: <emphasis>false</emphasis></entry>
25607 </row>
25608 </tbody>
25609 </tgroup>
25610 </informaltable>
25611 <para>
25612 <indexterm role="concept">
25613 <primary><emphasis>Sender:</emphasis> header line</primary>
25614 <secondary>retaining from local submission</secondary>
25615 </indexterm>
25616 When a message is submitted locally (that is, not over a TCP/IP connection) by
25617 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
25618 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
25619 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
25620 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
25621 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
25622 </para>
25623 <para>
25624 <indexterm role="option">
25625 <primary><option>localhost_number</option></primary>
25626 </indexterm>
25627 </para>
25628 <informaltable frame="all">
25629 <tgroup cols="4" colsep="0" rowsep="0">
25630 <colspec colwidth="8*" align="left"/>
25631 <colspec colwidth="6*" align="center"/>
25632 <colspec colwidth="6*" align="center"/>
25633 <colspec colwidth="6*" align="right"/>
25634 <tbody>
25635 <row>
25636 <entry><option>localhost_number</option></entry>
25637 <entry>Use: <emphasis>main</emphasis></entry>
25638 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25639 <entry>Default: <emphasis>unset</emphasis></entry>
25640 </row>
25641 </tbody>
25642 </tgroup>
25643 </informaltable>
25644 <para>
25645 <indexterm role="concept">
25646 <primary>host</primary>
25647 <secondary>locally unique number for</secondary>
25648 </indexterm>
25649 <indexterm role="concept">
25650 <primary>message ids</primary>
25651 <secondary>with multiple hosts</secondary>
25652 </indexterm>
25653 <indexterm role="variable">
25654 <primary><varname>$localhost_number</varname></primary>
25655 </indexterm>
25656 Exim&#x2019;s message ids are normally unique only within the local host. If
25657 uniqueness among a set of hosts is required, each host must set a different
25658 value for the <option>localhost_number</option> option. The string is expanded immediately
25659 after reading the configuration file (so that a number can be computed from the
25660 host name, for example) and the result of the expansion must be a number in the
25661 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
25662 systems). This is available in subsequent string expansions via the variable
25663 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
25664 characters of the message id, instead of just being a fractional part of the
25665 time, are computed from the time and the local host number as described in
25666 section <xref linkend="SECTmessiden"/>.
25667 </para>
25668 <para>
25669 <indexterm role="option">
25670 <primary><option>log_file_path</option></primary>
25671 </indexterm>
25672 </para>
25673 <informaltable frame="all">
25674 <tgroup cols="4" colsep="0" rowsep="0">
25675 <colspec colwidth="8*" align="left"/>
25676 <colspec colwidth="6*" align="center"/>
25677 <colspec colwidth="6*" align="center"/>
25678 <colspec colwidth="6*" align="right"/>
25679 <tbody>
25680 <row>
25681 <entry><option>log_file_path</option></entry>
25682 <entry>Use: <emphasis>main</emphasis></entry>
25683 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25684 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25685 </row>
25686 </tbody>
25687 </tgroup>
25688 </informaltable>
25689 <para>
25690 <indexterm role="concept">
25691 <primary>log</primary>
25692 <secondary>file path for</secondary>
25693 </indexterm>
25694 This option sets the path which is used to determine the names of Exim&#x2019;s log
25695 files, or indicates that logging is to be to syslog, or both. It is expanded
25696 when Exim is entered, so it can, for example, contain a reference to the host
25697 name. If no specific path is set for the log files at compile or run time, they
25698 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
25699 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
25700 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
25701 used. If this string is fixed at your installation (contains no expansion
25702 variables) it is recommended that you do not set this option in the
25703 configuration file, but instead supply the path using LOG_FILE_PATH in
25704 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
25705 early on &ndash; in particular, failure to read the configuration file.
25706 </para>
25707 <para>
25708 <indexterm role="option">
25709 <primary><option>log_selector</option></primary>
25710 </indexterm>
25711 </para>
25712 <informaltable frame="all">
25713 <tgroup cols="4" colsep="0" rowsep="0">
25714 <colspec colwidth="8*" align="left"/>
25715 <colspec colwidth="6*" align="center"/>
25716 <colspec colwidth="6*" align="center"/>
25717 <colspec colwidth="6*" align="right"/>
25718 <tbody>
25719 <row>
25720 <entry><option>log_selector</option></entry>
25721 <entry>Use: <emphasis>main</emphasis></entry>
25722 <entry>Type: <emphasis>string</emphasis></entry>
25723 <entry>Default: <emphasis>unset</emphasis></entry>
25724 </row>
25725 </tbody>
25726 </tgroup>
25727 </informaltable>
25728 <para>
25729 <indexterm role="concept">
25730 <primary>log</primary>
25731 <secondary>selectors</secondary>
25732 </indexterm>
25733 This option can be used to reduce or increase the number of things that Exim
25734 writes to its log files. Its argument is made up of names preceded by plus or
25735 minus characters. For example:
25736 </para>
25737 <literallayout class="monospaced">
25738 log_selector = +arguments -retry_defer
25739 </literallayout>
25740 <para>
25741 A list of possible names and what they control is given in the chapter on
25742 logging, in section <xref linkend="SECTlogselector"/>.
25743 </para>
25744 <para>
25745 <indexterm role="option">
25746 <primary><option>log_timezone</option></primary>
25747 </indexterm>
25748 </para>
25749 <informaltable frame="all">
25750 <tgroup cols="4" colsep="0" rowsep="0">
25751 <colspec colwidth="8*" align="left"/>
25752 <colspec colwidth="6*" align="center"/>
25753 <colspec colwidth="6*" align="center"/>
25754 <colspec colwidth="6*" align="right"/>
25755 <tbody>
25756 <row>
25757 <entry><option>log_timezone</option></entry>
25758 <entry>Use: <emphasis>main</emphasis></entry>
25759 <entry>Type: <emphasis>boolean</emphasis></entry>
25760 <entry>Default: <emphasis>false</emphasis></entry>
25761 </row>
25762 </tbody>
25763 </tgroup>
25764 </informaltable>
25765 <para>
25766 <indexterm role="concept">
25767 <primary>log</primary>
25768 <secondary>timezone for entries</secondary>
25769 </indexterm>
25770 <indexterm role="variable">
25771 <primary><varname>$tod_log</varname></primary>
25772 </indexterm>
25773 <indexterm role="variable">
25774 <primary><varname>$tod_zone</varname></primary>
25775 </indexterm>
25776 By default, the timestamps on log lines are in local time without the
25777 timezone. This means that if your timezone changes twice a year, the timestamps
25778 in log lines are ambiguous for an hour when the clocks go back. One way of
25779 avoiding this problem is to set the timezone to UTC. An alternative is to set
25780 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
25781 timestamps in log lines. Turning on this option can add quite a lot to the size
25782 of log files because each line is extended by 6 characters. Note that the
25783 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
25784 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
25785 </para>
25786 <para>
25787 <indexterm role="option">
25788 <primary><option>lookup_open_max</option></primary>
25789 </indexterm>
25790 </para>
25791 <informaltable frame="all">
25792 <tgroup cols="4" colsep="0" rowsep="0">
25793 <colspec colwidth="8*" align="left"/>
25794 <colspec colwidth="6*" align="center"/>
25795 <colspec colwidth="6*" align="center"/>
25796 <colspec colwidth="6*" align="right"/>
25797 <tbody>
25798 <row>
25799 <entry><option>lookup_open_max</option></entry>
25800 <entry>Use: <emphasis>main</emphasis></entry>
25801 <entry>Type: <emphasis>integer</emphasis></entry>
25802 <entry>Default: <emphasis>25</emphasis></entry>
25803 </row>
25804 </tbody>
25805 </tgroup>
25806 </informaltable>
25807 <para>
25808 <indexterm role="concept">
25809 <primary>too many open files</primary>
25810 </indexterm>
25811 <indexterm role="concept">
25812 <primary>open files, too many</primary>
25813 </indexterm>
25814 <indexterm role="concept">
25815 <primary>file</primary>
25816 <secondary>too many open</secondary>
25817 </indexterm>
25818 <indexterm role="concept">
25819 <primary>lookup</primary>
25820 <secondary>maximum open files</secondary>
25821 </indexterm>
25822 <indexterm role="concept">
25823 <primary>limit</primary>
25824 <secondary>open files for lookups</secondary>
25825 </indexterm>
25826 This option limits the number of simultaneously open files for single-key
25827 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
25828 Exim normally keeps these files open during routing, because often the same
25829 file is required several times. If the limit is reached, Exim closes the least
25830 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
25831 actually opens two files for each logical DBM database, though it still counts
25832 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
25833 open files</quote> errors with NDBM, you need to reduce the value of
25834 <option>lookup_open_max</option>.
25835 </para>
25836 <para>
25837 <indexterm role="option">
25838 <primary><option>max_username_length</option></primary>
25839 </indexterm>
25840 </para>
25841 <informaltable frame="all">
25842 <tgroup cols="4" colsep="0" rowsep="0">
25843 <colspec colwidth="8*" align="left"/>
25844 <colspec colwidth="6*" align="center"/>
25845 <colspec colwidth="6*" align="center"/>
25846 <colspec colwidth="6*" align="right"/>
25847 <tbody>
25848 <row>
25849 <entry><option>max_username_length</option></entry>
25850 <entry>Use: <emphasis>main</emphasis></entry>
25851 <entry>Type: <emphasis>integer</emphasis></entry>
25852 <entry>Default: <emphasis>0</emphasis></entry>
25853 </row>
25854 </tbody>
25855 </tgroup>
25856 </informaltable>
25857 <para>
25858 <indexterm role="concept">
25859 <primary>length of login name</primary>
25860 </indexterm>
25861 <indexterm role="concept">
25862 <primary>user name</primary>
25863 <secondary>maximum length</secondary>
25864 </indexterm>
25865 <indexterm role="concept">
25866 <primary>limit</primary>
25867 <secondary>user name length</secondary>
25868 </indexterm>
25869 Some operating systems are broken in that they truncate long arguments to
25870 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
25871 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
25872 an argument that is longer behaves as if <function>getpwnam()</function> failed.
25873 </para>
25874 <para>
25875 <indexterm role="option">
25876 <primary><option>message_body_newlines</option></primary>
25877 </indexterm>
25878 </para>
25879 <informaltable frame="all">
25880 <tgroup cols="4" colsep="0" rowsep="0">
25881 <colspec colwidth="8*" align="left"/>
25882 <colspec colwidth="6*" align="center"/>
25883 <colspec colwidth="6*" align="center"/>
25884 <colspec colwidth="6*" align="right"/>
25885 <tbody>
25886 <row>
25887 <entry><option>message_body_newlines</option></entry>
25888 <entry>Use: <emphasis>main</emphasis></entry>
25889 <entry>Type: <emphasis>bool</emphasis></entry>
25890 <entry>Default: <emphasis>false</emphasis></entry>
25891 </row>
25892 </tbody>
25893 </tgroup>
25894 </informaltable>
25895 <para>
25896 <indexterm role="concept">
25897 <primary>message body</primary>
25898 <secondary>newlines in variables</secondary>
25899 </indexterm>
25900 <indexterm role="concept">
25901 <primary>newline</primary>
25902 <secondary>in message body variables</secondary>
25903 </indexterm>
25904 <indexterm role="variable">
25905 <primary><varname>$message_body</varname></primary>
25906 </indexterm>
25907 <indexterm role="variable">
25908 <primary><varname>$message_body_end</varname></primary>
25909 </indexterm>
25910 By default, newlines in the message body are replaced by spaces when setting
25911 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
25912 option is set true, this no longer happens.
25913 </para>
25914 <para>
25915 <indexterm role="option">
25916 <primary><option>message_body_visible</option></primary>
25917 </indexterm>
25918 </para>
25919 <informaltable frame="all">
25920 <tgroup cols="4" colsep="0" rowsep="0">
25921 <colspec colwidth="8*" align="left"/>
25922 <colspec colwidth="6*" align="center"/>
25923 <colspec colwidth="6*" align="center"/>
25924 <colspec colwidth="6*" align="right"/>
25925 <tbody>
25926 <row>
25927 <entry><option>message_body_visible</option></entry>
25928 <entry>Use: <emphasis>main</emphasis></entry>
25929 <entry>Type: <emphasis>integer</emphasis></entry>
25930 <entry>Default: <emphasis>500</emphasis></entry>
25931 </row>
25932 </tbody>
25933 </tgroup>
25934 </informaltable>
25935 <para>
25936 <indexterm role="concept">
25937 <primary>body of message</primary>
25938 <secondary>visible size</secondary>
25939 </indexterm>
25940 <indexterm role="concept">
25941 <primary>message body</primary>
25942 <secondary>visible size</secondary>
25943 </indexterm>
25944 <indexterm role="variable">
25945 <primary><varname>$message_body</varname></primary>
25946 </indexterm>
25947 <indexterm role="variable">
25948 <primary><varname>$message_body_end</varname></primary>
25949 </indexterm>
25950 This option specifies how much of a message&#x2019;s body is to be included in the
25951 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
25952 </para>
25953 <para>
25954 <indexterm role="option">
25955 <primary><option>message_id_header_domain</option></primary>
25956 </indexterm>
25957 </para>
25958 <informaltable frame="all">
25959 <tgroup cols="4" colsep="0" rowsep="0">
25960 <colspec colwidth="8*" align="left"/>
25961 <colspec colwidth="6*" align="center"/>
25962 <colspec colwidth="6*" align="center"/>
25963 <colspec colwidth="6*" align="right"/>
25964 <tbody>
25965 <row>
25966 <entry><option>message_id_header_domain</option></entry>
25967 <entry>Use: <emphasis>main</emphasis></entry>
25968 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25969 <entry>Default: <emphasis>unset</emphasis></entry>
25970 </row>
25971 </tbody>
25972 </tgroup>
25973 </informaltable>
25974 <para>
25975 <indexterm role="concept">
25976 <primary><emphasis>Message-ID:</emphasis> header line</primary>
25977 </indexterm>
25978 If this option is set, the string is expanded and used as the right hand side
25979 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
25980 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
25981 means <quote>not received over TCP/IP.</quote>
25982 Otherwise, the primary host name is used.
25983 Only letters, digits, dot and hyphen are accepted; any other characters are
25984 replaced by hyphens. If the expansion is forced to fail, or if the result is an
25985 empty string, the option is ignored.
25986 </para>
25987 <para>
25988 <indexterm role="option">
25989 <primary><option>message_id_header_text</option></primary>
25990 </indexterm>
25991 </para>
25992 <informaltable frame="all">
25993 <tgroup cols="4" colsep="0" rowsep="0">
25994 <colspec colwidth="8*" align="left"/>
25995 <colspec colwidth="6*" align="center"/>
25996 <colspec colwidth="6*" align="center"/>
25997 <colspec colwidth="6*" align="right"/>
25998 <tbody>
25999 <row>
26000 <entry><option>message_id_header_text</option></entry>
26001 <entry>Use: <emphasis>main</emphasis></entry>
26002 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26003 <entry>Default: <emphasis>unset</emphasis></entry>
26004 </row>
26005 </tbody>
26006 </tgroup>
26007 </informaltable>
26008 <para>
26009 If this variable is set, the string is expanded and used to augment the text of
26010 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
26011 message does not have one. The text of this header is required by RFC 2822 to
26012 take the form of an address. By default, Exim uses its internal message id as
26013 the local part, and the primary host name as the domain. If this option is set,
26014 it is expanded, and provided the expansion is not forced to fail, and does not
26015 yield an empty string, the result is inserted into the header immediately
26016 before the @, separated from the internal message id by a dot. Any characters
26017 that are illegal in an address are automatically converted into hyphens. This
26018 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
26019 colons will become hyphens.
26020 </para>
26021 <para>
26022 <indexterm role="option">
26023 <primary><option>message_logs</option></primary>
26024 </indexterm>
26025 </para>
26026 <informaltable frame="all">
26027 <tgroup cols="4" colsep="0" rowsep="0">
26028 <colspec colwidth="8*" align="left"/>
26029 <colspec colwidth="6*" align="center"/>
26030 <colspec colwidth="6*" align="center"/>
26031 <colspec colwidth="6*" align="right"/>
26032 <tbody>
26033 <row>
26034 <entry><option>message_logs</option></entry>
26035 <entry>Use: <emphasis>main</emphasis></entry>
26036 <entry>Type: <emphasis>boolean</emphasis></entry>
26037 <entry>Default: <emphasis>true</emphasis></entry>
26038 </row>
26039 </tbody>
26040 </tgroup>
26041 </informaltable>
26042 <para>
26043 <indexterm role="concept">
26044 <primary>message logs</primary>
26045 <secondary>disabling</secondary>
26046 </indexterm>
26047 <indexterm role="concept">
26048 <primary>log</primary>
26049 <secondary>message log; disabling</secondary>
26050 </indexterm>
26051 If this option is turned off, per-message log files are not created in the
26052 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
26053 Exim, by reducing the number of files involved in handling a message from a
26054 minimum of four (header spool file, body spool file, delivery journal, and
26055 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
26056 which is not affected by this option.
26057 </para>
26058 <para>
26059 <indexterm role="option">
26060 <primary><option>message_size_limit</option></primary>
26061 </indexterm>
26062 </para>
26063 <informaltable frame="all">
26064 <tgroup cols="4" colsep="0" rowsep="0">
26065 <colspec colwidth="8*" align="left"/>
26066 <colspec colwidth="6*" align="center"/>
26067 <colspec colwidth="6*" align="center"/>
26068 <colspec colwidth="6*" align="right"/>
26069 <tbody>
26070 <row>
26071 <entry><option>message_size_limit</option></entry>
26072 <entry>Use: <emphasis>main</emphasis></entry>
26073 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26074 <entry>Default: <emphasis>50M</emphasis></entry>
26075 </row>
26076 </tbody>
26077 </tgroup>
26078 </informaltable>
26079 <para>
26080 <indexterm role="concept">
26081 <primary>message</primary>
26082 <secondary>size limit</secondary>
26083 </indexterm>
26084 <indexterm role="concept">
26085 <primary>limit</primary>
26086 <secondary>message size</secondary>
26087 </indexterm>
26088 <indexterm role="concept">
26089 <primary>size</primary>
26090 <secondary>of message, limit</secondary>
26091 </indexterm>
26092 This option limits the maximum size of message that Exim will process. The
26093 value is expanded for each incoming connection so, for example, it can be made
26094 to depend on the IP address of the remote host for messages arriving via
26095 TCP/IP. After expansion, the value must be a sequence of decimal digits,
26096 optionally followed by K or M.
26097 </para>
26098 <para>
26099 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
26100 other properties of an individual message, because it has to be advertised in
26101 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
26102 error. A value of zero means no limit, but its use is not recommended. See also
26103 <option>bounce_return_size_limit</option>.
26104 </para>
26105 <para>
26106 Incoming SMTP messages are failed with a 552 error if the limit is
26107 exceeded; locally-generated messages either get a stderr message or a delivery
26108 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
26109 an oversized message is logged in both the main and the reject logs. See also
26110 the generic transport option <option>message_size_limit</option>, which limits the size of
26111 message that an individual transport can process.
26112 </para>
26113 <para>
26114 If you use a virus-scanner and set this option to to a value larger than the
26115 maximum size that your virus-scanner is configured to support, you may get
26116 failures triggered by large mails.  The right size to configure for the
26117 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
26118 probably safest to just set it to a little larger than this value.  Eg, with a
26119 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
26120 some problems may result.
26121 </para>
26122 <para>
26123 A value of 0 will disable size limit checking; Exim will still advertise the
26124 SIZE extension in an EHLO response, but without a limit, so as to permit
26125 SMTP clients to still indicate the message size along with the MAIL verb.
26126 </para>
26127 <para>
26128 <indexterm role="option">
26129 <primary><option>move_frozen_messages</option></primary>
26130 </indexterm>
26131 </para>
26132 <informaltable frame="all">
26133 <tgroup cols="4" colsep="0" rowsep="0">
26134 <colspec colwidth="8*" align="left"/>
26135 <colspec colwidth="6*" align="center"/>
26136 <colspec colwidth="6*" align="center"/>
26137 <colspec colwidth="6*" align="right"/>
26138 <tbody>
26139 <row>
26140 <entry><option>move_frozen_messages</option></entry>
26141 <entry>Use: <emphasis>main</emphasis></entry>
26142 <entry>Type: <emphasis>boolean</emphasis></entry>
26143 <entry>Default: <emphasis>false</emphasis></entry>
26144 </row>
26145 </tbody>
26146 </tgroup>
26147 </informaltable>
26148 <para>
26149 <indexterm role="concept">
26150 <primary>frozen messages</primary>
26151 <secondary>moving</secondary>
26152 </indexterm>
26153 This option, which is available only if Exim has been built with the setting
26154 </para>
26155 <literallayout class="monospaced">
26156 SUPPORT_MOVE_FROZEN_MESSAGES=yes
26157 </literallayout>
26158 <para>
26159 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
26160 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
26161 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
26162 standard utilities for handling such moved messages, and they do not show up in
26163 lists generated by <option>-bp</option> or by the Exim monitor.
26164 </para>
26165 <para>
26166 <indexterm role="option">
26167 <primary><option>mua_wrapper</option></primary>
26168 </indexterm>
26169 </para>
26170 <informaltable frame="all">
26171 <tgroup cols="4" colsep="0" rowsep="0">
26172 <colspec colwidth="8*" align="left"/>
26173 <colspec colwidth="6*" align="center"/>
26174 <colspec colwidth="6*" align="center"/>
26175 <colspec colwidth="6*" align="right"/>
26176 <tbody>
26177 <row>
26178 <entry><option>mua_wrapper</option></entry>
26179 <entry>Use: <emphasis>main</emphasis></entry>
26180 <entry>Type: <emphasis>boolean</emphasis></entry>
26181 <entry>Default: <emphasis>false</emphasis></entry>
26182 </row>
26183 </tbody>
26184 </tgroup>
26185 </informaltable>
26186 <para>
26187 Setting this option true causes Exim to run in a very restrictive mode in which
26188 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
26189 contains a full description of this facility.
26190 </para>
26191 <para>
26192 <indexterm role="option">
26193 <primary><option>mysql_servers</option></primary>
26194 </indexterm>
26195 </para>
26196 <informaltable frame="all">
26197 <tgroup cols="4" colsep="0" rowsep="0">
26198 <colspec colwidth="8*" align="left"/>
26199 <colspec colwidth="6*" align="center"/>
26200 <colspec colwidth="6*" align="center"/>
26201 <colspec colwidth="6*" align="right"/>
26202 <tbody>
26203 <row>
26204 <entry><option>mysql_servers</option></entry>
26205 <entry>Use: <emphasis>main</emphasis></entry>
26206 <entry>Type: <emphasis>string list</emphasis></entry>
26207 <entry>Default: <emphasis>unset</emphasis></entry>
26208 </row>
26209 </tbody>
26210 </tgroup>
26211 </informaltable>
26212 <para>
26213 <indexterm role="concept">
26214 <primary>MySQL</primary>
26215 <secondary>server list</secondary>
26216 </indexterm>
26217 This option provides a list of MySQL servers and associated connection data, to
26218 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
26219 option is available only if Exim has been built with MySQL support.
26220 </para>
26221 <para>
26222 <indexterm role="option">
26223 <primary><option>never_users</option></primary>
26224 </indexterm>
26225 </para>
26226 <informaltable frame="all">
26227 <tgroup cols="4" colsep="0" rowsep="0">
26228 <colspec colwidth="8*" align="left"/>
26229 <colspec colwidth="6*" align="center"/>
26230 <colspec colwidth="6*" align="center"/>
26231 <colspec colwidth="6*" align="right"/>
26232 <tbody>
26233 <row>
26234 <entry><option>never_users</option></entry>
26235 <entry>Use: <emphasis>main</emphasis></entry>
26236 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26237 <entry>Default: <emphasis>unset</emphasis></entry>
26238 </row>
26239 </tbody>
26240 </tgroup>
26241 </informaltable>
26242 <para>
26243 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
26244 message deliveries are normally run in processes that are setuid to the
26245 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
26246 It is usually desirable to prevent any deliveries from running as root, as a
26247 safety precaution.
26248 </para>
26249 <para>
26250 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
26251 list of users that must not be used for local deliveries. This list is fixed in
26252 the binary and cannot be overridden by the configuration file. By default, it
26253 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
26254 can be used to add more users to the fixed list.
26255 </para>
26256 <para>
26257 If a message is to be delivered as one of the users on the fixed list or the
26258 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
26259 example is
26260 </para>
26261 <literallayout class="monospaced">
26262 never_users = root:daemon:bin
26263 </literallayout>
26264 <para>
26265 Including root is redundant if it is also on the fixed list, but it does no
26266 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
26267 transport driver.
26268 </para>
26269 <para>
26270 <indexterm role="option">
26271 <primary><option>openssl_options</option></primary>
26272 </indexterm>
26273 </para>
26274 <informaltable frame="all">
26275 <tgroup cols="4" colsep="0" rowsep="0">
26276 <colspec colwidth="8*" align="left"/>
26277 <colspec colwidth="6*" align="center"/>
26278 <colspec colwidth="6*" align="center"/>
26279 <colspec colwidth="6*" align="right"/>
26280 <tbody>
26281 <row>
26282 <entry><option>openssl_options</option></entry>
26283 <entry>Use: <emphasis>main</emphasis></entry>
26284 <entry>Type: <emphasis>string list</emphasis></entry>
26285 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
26286 </row>
26287 </tbody>
26288 </tgroup>
26289 </informaltable>
26290 <para>
26291 <indexterm role="concept">
26292 <primary>OpenSSL </primary>
26293 <secondary>compatibility</secondary>
26294 </indexterm>
26295 This option allows an administrator to adjust the SSL options applied
26296 by OpenSSL to connections.  It is given as a space-separated list of items,
26297 each one to be +added or -subtracted from the current value.
26298 </para>
26299 <para>
26300 This option is only available if Exim is built against OpenSSL.  The values
26301 available for this option vary according to the age of your OpenSSL install.
26302 The <quote>all</quote> value controls a subset of flags which are available, typically
26303 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
26304 list the values known on your system and Exim should support all the
26305 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
26306 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
26307 </para>
26308 <para>
26309 Note that adjusting the options can have severe impact upon the security of
26310 SSL as used by Exim.  It is possible to disable safety checks and shoot
26311 yourself in the foot in various unpleasant ways.  This option should not be
26312 adjusted lightly.  An unrecognised item will be detected at startup, by
26313 invoking Exim with the <option>-bV</option> flag.
26314 </para>
26315 <para>
26316 Historical note: prior to release 4.80, Exim defaulted this value to
26317 "+dont_insert_empty_fragments", which may still be needed for compatibility
26318 with some clients, but which lowers security by increasing exposure to
26319 some now infamous attacks.
26320 </para>
26321 <para>
26322 An example:
26323 </para>
26324 <literallayout class="monospaced">
26325 # Make both old MS and old Eudora happy:
26326 openssl_options = -all +microsoft_big_sslv3_buffer \
26327                        +dont_insert_empty_fragments
26328 </literallayout>
26329 <para>
26330 Possible options may include:
26331 </para>
26332 <itemizedlist>
26333 <listitem>
26334 <para>
26335 <literal>all</literal>
26336 </para>
26337 </listitem>
26338 <listitem>
26339 <para>
26340 <literal>allow_unsafe_legacy_renegotiation</literal>
26341 </para>
26342 </listitem>
26343 <listitem>
26344 <para>
26345 <literal>cipher_server_preference</literal>
26346 </para>
26347 </listitem>
26348 <listitem>
26349 <para>
26350 <literal>dont_insert_empty_fragments</literal>
26351 </para>
26352 </listitem>
26353 <listitem>
26354 <para>
26355 <literal>ephemeral_rsa</literal>
26356 </para>
26357 </listitem>
26358 <listitem>
26359 <para>
26360 <literal>legacy_server_connect</literal>
26361 </para>
26362 </listitem>
26363 <listitem>
26364 <para>
26365 <literal>microsoft_big_sslv3_buffer</literal>
26366 </para>
26367 </listitem>
26368 <listitem>
26369 <para>
26370 <literal>microsoft_sess_id_bug</literal>
26371 </para>
26372 </listitem>
26373 <listitem>
26374 <para>
26375 <literal>msie_sslv2_rsa_padding</literal>
26376 </para>
26377 </listitem>
26378 <listitem>
26379 <para>
26380 <literal>netscape_challenge_bug</literal>
26381 </para>
26382 </listitem>
26383 <listitem>
26384 <para>
26385 <literal>netscape_reuse_cipher_change_bug</literal>
26386 </para>
26387 </listitem>
26388 <listitem>
26389 <para>
26390 <literal>no_compression</literal>
26391 </para>
26392 </listitem>
26393 <listitem>
26394 <para>
26395 <literal>no_session_resumption_on_renegotiation</literal>
26396 </para>
26397 </listitem>
26398 <listitem>
26399 <para>
26400 <literal>no_sslv2</literal>
26401 </para>
26402 </listitem>
26403 <listitem>
26404 <para>
26405 <literal>no_sslv3</literal>
26406 </para>
26407 </listitem>
26408 <listitem>
26409 <para>
26410 <literal>no_ticket</literal>
26411 </para>
26412 </listitem>
26413 <listitem>
26414 <para>
26415 <literal>no_tlsv1</literal>
26416 </para>
26417 </listitem>
26418 <listitem>
26419 <para>
26420 <literal>no_tlsv1_1</literal>
26421 </para>
26422 </listitem>
26423 <listitem>
26424 <para>
26425 <literal>no_tlsv1_2</literal>
26426 </para>
26427 </listitem>
26428 <listitem>
26429 <para>
26430 <literal>safari_ecdhe_ecdsa_bug</literal>
26431 </para>
26432 </listitem>
26433 <listitem>
26434 <para>
26435 <literal>single_dh_use</literal>
26436 </para>
26437 </listitem>
26438 <listitem>
26439 <para>
26440 <literal>single_ecdh_use</literal>
26441 </para>
26442 </listitem>
26443 <listitem>
26444 <para>
26445 <literal>ssleay_080_client_dh_bug</literal>
26446 </para>
26447 </listitem>
26448 <listitem>
26449 <para>
26450 <literal>sslref2_reuse_cert_type_bug</literal>
26451 </para>
26452 </listitem>
26453 <listitem>
26454 <para>
26455 <literal>tls_block_padding_bug</literal>
26456 </para>
26457 </listitem>
26458 <listitem>
26459 <para>
26460 <literal>tls_d5_bug</literal>
26461 </para>
26462 </listitem>
26463 <listitem>
26464 <para>
26465 <literal>tls_rollback_bug</literal>
26466 </para>
26467 </listitem>
26468 </itemizedlist>
26469 <para>
26470 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
26471 all clients connecting using the MacOS SecureTransport TLS facility prior
26472 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
26473 to negotiate TLS then this option value might help, provided that your OpenSSL
26474 release is new enough to contain this work-around.  This may be a situation
26475 where you have to upgrade OpenSSL to get buggy clients working.
26476 </para>
26477 <para>
26478 <indexterm role="option">
26479 <primary><option>oracle_servers</option></primary>
26480 </indexterm>
26481 </para>
26482 <informaltable frame="all">
26483 <tgroup cols="4" colsep="0" rowsep="0">
26484 <colspec colwidth="8*" align="left"/>
26485 <colspec colwidth="6*" align="center"/>
26486 <colspec colwidth="6*" align="center"/>
26487 <colspec colwidth="6*" align="right"/>
26488 <tbody>
26489 <row>
26490 <entry><option>oracle_servers</option></entry>
26491 <entry>Use: <emphasis>main</emphasis></entry>
26492 <entry>Type: <emphasis>string list</emphasis></entry>
26493 <entry>Default: <emphasis>unset</emphasis></entry>
26494 </row>
26495 </tbody>
26496 </tgroup>
26497 </informaltable>
26498 <para>
26499 <indexterm role="concept">
26500 <primary>Oracle</primary>
26501 <secondary>server list</secondary>
26502 </indexterm>
26503 This option provides a list of Oracle servers and associated connection data,
26504 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
26505 The option is available only if Exim has been built with Oracle support.
26506 </para>
26507 <para>
26508 <indexterm role="option">
26509 <primary><option>percent_hack_domains</option></primary>
26510 </indexterm>
26511 </para>
26512 <informaltable frame="all">
26513 <tgroup cols="4" colsep="0" rowsep="0">
26514 <colspec colwidth="8*" align="left"/>
26515 <colspec colwidth="6*" align="center"/>
26516 <colspec colwidth="6*" align="center"/>
26517 <colspec colwidth="6*" align="right"/>
26518 <tbody>
26519 <row>
26520 <entry><option>percent_hack_domains</option></entry>
26521 <entry>Use: <emphasis>main</emphasis></entry>
26522 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26523 <entry>Default: <emphasis>unset</emphasis></entry>
26524 </row>
26525 </tbody>
26526 </tgroup>
26527 </informaltable>
26528 <para>
26529 <indexterm role="concept">
26530 <primary><quote>percent hack</quote></primary>
26531 </indexterm>
26532 <indexterm role="concept">
26533 <primary>source routing</primary>
26534 <secondary>in email address</secondary>
26535 </indexterm>
26536 <indexterm role="concept">
26537 <primary>address</primary>
26538 <secondary>source-routed</secondary>
26539 </indexterm>
26540 The <quote>percent hack</quote> is the convention whereby a local part containing a
26541 percent sign is re-interpreted as a new email address, with the percent
26542 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
26543 also applied to RFC 2822 addresses that begin with an @ character. If this
26544 option is set, Exim implements the percent facility for those domains listed,
26545 but no others. This happens before an incoming SMTP address is tested against
26546 an ACL.
26547 </para>
26548 <para>
26549 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
26550 trying to get round relaying restrictions. For this reason, it is best avoided
26551 if at all possible. Unfortunately, a number of less security-conscious MTAs
26552 implement it unconditionally. If you are running Exim on a gateway host, and
26553 routing mail through to internal MTAs without processing the local parts, it is
26554 a good idea to reject recipient addresses with percent characters in their
26555 local parts. Exim&#x2019;s default configuration does this.
26556 </para>
26557 <para>
26558 <indexterm role="option">
26559 <primary><option>perl_at_start</option></primary>
26560 </indexterm>
26561 </para>
26562 <informaltable frame="all">
26563 <tgroup cols="4" colsep="0" rowsep="0">
26564 <colspec colwidth="8*" align="left"/>
26565 <colspec colwidth="6*" align="center"/>
26566 <colspec colwidth="6*" align="center"/>
26567 <colspec colwidth="6*" align="right"/>
26568 <tbody>
26569 <row>
26570 <entry><option>perl_at_start</option></entry>
26571 <entry>Use: <emphasis>main</emphasis></entry>
26572 <entry>Type: <emphasis>boolean</emphasis></entry>
26573 <entry>Default: <emphasis>false</emphasis></entry>
26574 </row>
26575 </tbody>
26576 </tgroup>
26577 </informaltable>
26578 <para>
26579 This option is available only when Exim is built with an embedded Perl
26580 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26581 </para>
26582 <para>
26583 <indexterm role="option">
26584 <primary><option>perl_startup</option></primary>
26585 </indexterm>
26586 </para>
26587 <informaltable frame="all">
26588 <tgroup cols="4" colsep="0" rowsep="0">
26589 <colspec colwidth="8*" align="left"/>
26590 <colspec colwidth="6*" align="center"/>
26591 <colspec colwidth="6*" align="center"/>
26592 <colspec colwidth="6*" align="right"/>
26593 <tbody>
26594 <row>
26595 <entry><option>perl_startup</option></entry>
26596 <entry>Use: <emphasis>main</emphasis></entry>
26597 <entry>Type: <emphasis>string</emphasis></entry>
26598 <entry>Default: <emphasis>unset</emphasis></entry>
26599 </row>
26600 </tbody>
26601 </tgroup>
26602 </informaltable>
26603 <para>
26604 This option is available only when Exim is built with an embedded Perl
26605 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26606 </para>
26607 <para>
26608 <indexterm role="option">
26609 <primary><option>pgsql_servers</option></primary>
26610 </indexterm>
26611 </para>
26612 <informaltable frame="all">
26613 <tgroup cols="4" colsep="0" rowsep="0">
26614 <colspec colwidth="8*" align="left"/>
26615 <colspec colwidth="6*" align="center"/>
26616 <colspec colwidth="6*" align="center"/>
26617 <colspec colwidth="6*" align="right"/>
26618 <tbody>
26619 <row>
26620 <entry><option>pgsql_servers</option></entry>
26621 <entry>Use: <emphasis>main</emphasis></entry>
26622 <entry>Type: <emphasis>string list</emphasis></entry>
26623 <entry>Default: <emphasis>unset</emphasis></entry>
26624 </row>
26625 </tbody>
26626 </tgroup>
26627 </informaltable>
26628 <para>
26629 <indexterm role="concept">
26630 <primary>PostgreSQL lookup type</primary>
26631 <secondary>server list</secondary>
26632 </indexterm>
26633 This option provides a list of PostgreSQL servers and associated connection
26634 data, to be used in conjunction with <command>pgsql</command> lookups (see section
26635 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
26636 PostgreSQL support.
26637 </para>
26638 <para>
26639 <indexterm role="option">
26640 <primary><option>pid_file_path</option></primary>
26641 </indexterm>
26642 </para>
26643 <informaltable frame="all">
26644 <tgroup cols="4" colsep="0" rowsep="0">
26645 <colspec colwidth="8*" align="left"/>
26646 <colspec colwidth="6*" align="center"/>
26647 <colspec colwidth="6*" align="center"/>
26648 <colspec colwidth="6*" align="right"/>
26649 <tbody>
26650 <row>
26651 <entry><option>pid_file_path</option></entry>
26652 <entry>Use: <emphasis>main</emphasis></entry>
26653 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26654 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26655 </row>
26656 </tbody>
26657 </tgroup>
26658 </informaltable>
26659 <para>
26660 <indexterm role="concept">
26661 <primary>daemon</primary>
26662 <secondary>pid file path</secondary>
26663 </indexterm>
26664 <indexterm role="concept">
26665 <primary>pid file, path for</primary>
26666 </indexterm>
26667 This option sets the name of the file to which the Exim daemon writes its
26668 process id. The string is expanded, so it can contain, for example, references
26669 to the host name:
26670 </para>
26671 <literallayout class="monospaced">
26672 pid_file_path = /var/log/$primary_hostname/exim.pid
26673 </literallayout>
26674 <para>
26675 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
26676 spool directory.
26677 The value set by the option can be overridden by the <option>-oP</option> command line
26678 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
26679 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
26680 </para>
26681 <para>
26682 <indexterm role="option">
26683 <primary><option>pipelining_advertise_hosts</option></primary>
26684 </indexterm>
26685 </para>
26686 <informaltable frame="all">
26687 <tgroup cols="4" colsep="0" rowsep="0">
26688 <colspec colwidth="8*" align="left"/>
26689 <colspec colwidth="6*" align="center"/>
26690 <colspec colwidth="6*" align="center"/>
26691 <colspec colwidth="6*" align="right"/>
26692 <tbody>
26693 <row>
26694 <entry><option>pipelining_advertise_hosts</option></entry>
26695 <entry>Use: <emphasis>main</emphasis></entry>
26696 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26697 <entry>Default: <emphasis>*</emphasis></entry>
26698 </row>
26699 </tbody>
26700 </tgroup>
26701 </informaltable>
26702 <para>
26703 <indexterm role="concept">
26704 <primary>PIPELINING</primary>
26705 <secondary>suppressing advertising</secondary>
26706 </indexterm>
26707 This option can be used to suppress the advertisement of the SMTP
26708 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
26709 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
26710 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
26711 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
26712 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
26713 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
26714 </para>
26715 <para>
26716 <indexterm role="option">
26717 <primary><option>prdr_enable</option></primary>
26718 </indexterm>
26719 </para>
26720 <informaltable frame="all">
26721 <tgroup cols="4" colsep="0" rowsep="0">
26722 <colspec colwidth="8*" align="left"/>
26723 <colspec colwidth="6*" align="center"/>
26724 <colspec colwidth="6*" align="center"/>
26725 <colspec colwidth="6*" align="right"/>
26726 <tbody>
26727 <row>
26728 <entry><option>prdr_enable</option></entry>
26729 <entry>Use: <emphasis>main</emphasis></entry>
26730 <entry>Type: <emphasis>boolean</emphasis></entry>
26731 <entry>Default: <emphasis>false</emphasis></entry>
26732 </row>
26733 </tbody>
26734 </tgroup>
26735 </informaltable>
26736 <para>
26737 <indexterm role="concept">
26738 <primary>PRDR</primary>
26739 <secondary>enabling on server</secondary>
26740 </indexterm>
26741 This option can be used to enable the Per-Recipient Data Response extension
26742 to SMTP, defined by Eric Hall.
26743 If the option is set, PRDR is advertised by Exim when operating as a server.
26744 If the client requests PRDR, and more than one recipient, for a message 
26745 an additional ACL is called for each recipient after the message content
26746 is recieved.  See section <xref linkend="SECTPRDRACL"/>.
26747 </para>
26748 <para>
26749 <indexterm role="option">
26750 <primary><option>preserve_message_logs</option></primary>
26751 </indexterm>
26752 </para>
26753 <informaltable frame="all">
26754 <tgroup cols="4" colsep="0" rowsep="0">
26755 <colspec colwidth="8*" align="left"/>
26756 <colspec colwidth="6*" align="center"/>
26757 <colspec colwidth="6*" align="center"/>
26758 <colspec colwidth="6*" align="right"/>
26759 <tbody>
26760 <row>
26761 <entry><option>preserve_message_logs</option></entry>
26762 <entry>Use: <emphasis>main</emphasis></entry>
26763 <entry>Type: <emphasis>boolean</emphasis></entry>
26764 <entry>Default: <emphasis>false</emphasis></entry>
26765 </row>
26766 </tbody>
26767 </tgroup>
26768 </informaltable>
26769 <para>
26770 <indexterm role="concept">
26771 <primary>message logs</primary>
26772 <secondary>preserving</secondary>
26773 </indexterm>
26774 If this option is set, message log files are not deleted when messages are
26775 completed. Instead, they are moved to a sub-directory of the spool directory
26776 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
26777 purposes. This is a dangerous option to set on systems with any appreciable
26778 volume of mail. Use with care!
26779 </para>
26780 <para>
26781 <indexterm role="option">
26782 <primary><option>primary_hostname</option></primary>
26783 </indexterm>
26784 </para>
26785 <informaltable frame="all">
26786 <tgroup cols="4" colsep="0" rowsep="0">
26787 <colspec colwidth="8*" align="left"/>
26788 <colspec colwidth="6*" align="center"/>
26789 <colspec colwidth="6*" align="center"/>
26790 <colspec colwidth="6*" align="right"/>
26791 <tbody>
26792 <row>
26793 <entry><option>primary_hostname</option></entry>
26794 <entry>Use: <emphasis>main</emphasis></entry>
26795 <entry>Type: <emphasis>string</emphasis></entry>
26796 <entry>Default: <emphasis>see below</emphasis></entry>
26797 </row>
26798 </tbody>
26799 </tgroup>
26800 </informaltable>
26801 <para>
26802 <indexterm role="concept">
26803 <primary>name</primary>
26804 <secondary>of local host</secondary>
26805 </indexterm>
26806 <indexterm role="concept">
26807 <primary>host</primary>
26808 <secondary>name of local</secondary>
26809 </indexterm>
26810 <indexterm role="concept">
26811 <primary>local host</primary>
26812 <secondary>name of</secondary>
26813 </indexterm>
26814 <indexterm role="variable">
26815 <primary><varname>$primary_hostname</varname></primary>
26816 </indexterm>
26817 This specifies the name of the current host. It is used in the default EHLO or
26818 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
26819 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
26820 The value is also used by default in some SMTP response messages from an Exim
26821 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
26822 </para>
26823 <para>
26824 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
26825 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
26826 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
26827 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
26828 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
26829 explicitly by this option, or defaulted.
26830 </para>
26831 <para>
26832 <indexterm role="option">
26833 <primary><option>print_topbitchars</option></primary>
26834 </indexterm>
26835 </para>
26836 <informaltable frame="all">
26837 <tgroup cols="4" colsep="0" rowsep="0">
26838 <colspec colwidth="8*" align="left"/>
26839 <colspec colwidth="6*" align="center"/>
26840 <colspec colwidth="6*" align="center"/>
26841 <colspec colwidth="6*" align="right"/>
26842 <tbody>
26843 <row>
26844 <entry><option>print_topbitchars</option></entry>
26845 <entry>Use: <emphasis>main</emphasis></entry>
26846 <entry>Type: <emphasis>boolean</emphasis></entry>
26847 <entry>Default: <emphasis>false</emphasis></entry>
26848 </row>
26849 </tbody>
26850 </tgroup>
26851 </informaltable>
26852 <para>
26853 <indexterm role="concept">
26854 <primary>printing characters</primary>
26855 </indexterm>
26856 <indexterm role="concept">
26857 <primary>8-bit characters</primary>
26858 </indexterm>
26859 By default, Exim considers only those characters whose codes lie in the range
26860 32&ndash;126 to be printing characters. In a number of circumstances (for example,
26861 when writing log entries) non-printing characters are converted into escape
26862 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
26863 is set, code values of 128 and above are also considered to be printing
26864 characters.
26865 </para>
26866 <para>
26867 This option also affects the header syntax checks performed by the
26868 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
26869 the user&#x2019;s full name when constructing From: and Sender: addresses (as
26870 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
26871 Exim to generate eight bit message headers that do not conform to the
26872 standards.
26873 </para>
26874 <para>
26875 <indexterm role="option">
26876 <primary><option>process_log_path</option></primary>
26877 </indexterm>
26878 </para>
26879 <informaltable frame="all">
26880 <tgroup cols="4" colsep="0" rowsep="0">
26881 <colspec colwidth="8*" align="left"/>
26882 <colspec colwidth="6*" align="center"/>
26883 <colspec colwidth="6*" align="center"/>
26884 <colspec colwidth="6*" align="right"/>
26885 <tbody>
26886 <row>
26887 <entry><option>process_log_path</option></entry>
26888 <entry>Use: <emphasis>main</emphasis></entry>
26889 <entry>Type: <emphasis>string</emphasis></entry>
26890 <entry>Default: <emphasis>unset</emphasis></entry>
26891 </row>
26892 </tbody>
26893 </tgroup>
26894 </informaltable>
26895 <para>
26896 <indexterm role="concept">
26897 <primary>process log path</primary>
26898 </indexterm>
26899 <indexterm role="concept">
26900 <primary>log</primary>
26901 <secondary>process log</secondary>
26902 </indexterm>
26903 <indexterm role="concept">
26904 <primary><emphasis>exiwhat</emphasis></primary>
26905 </indexterm>
26906 This option sets the name of the file to which an Exim process writes its
26907 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
26908 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
26909 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
26910 can be useful in environments where two different Exims are running, using
26911 different spool directories.
26912 </para>
26913 <para>
26914 <indexterm role="option">
26915 <primary><option>prod_requires_admin</option></primary>
26916 </indexterm>
26917 </para>
26918 <informaltable frame="all">
26919 <tgroup cols="4" colsep="0" rowsep="0">
26920 <colspec colwidth="8*" align="left"/>
26921 <colspec colwidth="6*" align="center"/>
26922 <colspec colwidth="6*" align="center"/>
26923 <colspec colwidth="6*" align="right"/>
26924 <tbody>
26925 <row>
26926 <entry><option>prod_requires_admin</option></entry>
26927 <entry>Use: <emphasis>main</emphasis></entry>
26928 <entry>Type: <emphasis>boolean</emphasis></entry>
26929 <entry>Default: <emphasis>true</emphasis></entry>
26930 </row>
26931 </tbody>
26932 </tgroup>
26933 </informaltable>
26934 <para>
26935 <indexterm role="option">
26936 <primary><option>-M</option></primary>
26937 </indexterm>
26938 <indexterm role="option">
26939 <primary><option>-R</option></primary>
26940 </indexterm>
26941 <indexterm role="option">
26942 <primary><option>-q</option></primary>
26943 </indexterm>
26944 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
26945 admin user unless <option>prod_requires_admin</option> is set false. See also
26946 <option>queue_list_requires_admin</option>.
26947 </para>
26948 <para>
26949 <indexterm role="option">
26950 <primary><option>qualify_domain</option></primary>
26951 </indexterm>
26952 </para>
26953 <informaltable frame="all">
26954 <tgroup cols="4" colsep="0" rowsep="0">
26955 <colspec colwidth="8*" align="left"/>
26956 <colspec colwidth="6*" align="center"/>
26957 <colspec colwidth="6*" align="center"/>
26958 <colspec colwidth="6*" align="right"/>
26959 <tbody>
26960 <row>
26961 <entry><option>qualify_domain</option></entry>
26962 <entry>Use: <emphasis>main</emphasis></entry>
26963 <entry>Type: <emphasis>string</emphasis></entry>
26964 <entry>Default: <emphasis>see below</emphasis></entry>
26965 </row>
26966 </tbody>
26967 </tgroup>
26968 </informaltable>
26969 <para>
26970 <indexterm role="concept">
26971 <primary>domain</primary>
26972 <secondary>for qualifying addresses</secondary>
26973 </indexterm>
26974 <indexterm role="concept">
26975 <primary>address</primary>
26976 <secondary>qualification</secondary>
26977 </indexterm>
26978 This option specifies the domain name that is added to any envelope sender
26979 addresses that do not have a domain qualification. It also applies to
26980 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
26981 are accepted by default only for locally-generated messages. Qualification is
26982 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
26983 locally-generated messages, unless the <option>-bnq</option> command line option is used.
26984 </para>
26985 <para>
26986 Messages from external sources must always contain fully qualified addresses,
26987 unless the sending host matches <option>sender_unqualified_hosts</option> or
26988 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
26989 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
26990 necessary. Internally, Exim always works with fully qualified envelope
26991 addresses. If <option>qualify_domain</option> is not set, it defaults to the
26992 <option>primary_hostname</option> value.
26993 </para>
26994 <para>
26995 <indexterm role="option">
26996 <primary><option>qualify_recipient</option></primary>
26997 </indexterm>
26998 </para>
26999 <informaltable frame="all">
27000 <tgroup cols="4" colsep="0" rowsep="0">
27001 <colspec colwidth="8*" align="left"/>
27002 <colspec colwidth="6*" align="center"/>
27003 <colspec colwidth="6*" align="center"/>
27004 <colspec colwidth="6*" align="right"/>
27005 <tbody>
27006 <row>
27007 <entry><option>qualify_recipient</option></entry>
27008 <entry>Use: <emphasis>main</emphasis></entry>
27009 <entry>Type: <emphasis>string</emphasis></entry>
27010 <entry>Default: <emphasis>see below</emphasis></entry>
27011 </row>
27012 </tbody>
27013 </tgroup>
27014 </informaltable>
27015 <para>
27016 This option allows you to specify a different domain for qualifying recipient
27017 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
27018 </para>
27019 <para>
27020 <indexterm role="option">
27021 <primary><option>queue_domains</option></primary>
27022 </indexterm>
27023 </para>
27024 <informaltable frame="all">
27025 <tgroup cols="4" colsep="0" rowsep="0">
27026 <colspec colwidth="8*" align="left"/>
27027 <colspec colwidth="6*" align="center"/>
27028 <colspec colwidth="6*" align="center"/>
27029 <colspec colwidth="6*" align="right"/>
27030 <tbody>
27031 <row>
27032 <entry><option>queue_domains</option></entry>
27033 <entry>Use: <emphasis>main</emphasis></entry>
27034 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27035 <entry>Default: <emphasis>unset</emphasis></entry>
27036 </row>
27037 </tbody>
27038 </tgroup>
27039 </informaltable>
27040 <para>
27041 <indexterm role="concept">
27042 <primary>domain</primary>
27043 <secondary>specifying non-immediate delivery</secondary>
27044 </indexterm>
27045 <indexterm role="concept">
27046 <primary>queueing incoming messages</primary>
27047 </indexterm>
27048 <indexterm role="concept">
27049 <primary>message</primary>
27050 <secondary>queueing certain domains</secondary>
27051 </indexterm>
27052 This option lists domains for which immediate delivery is not required.
27053 A delivery process is started whenever a message is received, but only those
27054 domains that do not match are processed. All other deliveries wait until the
27055 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
27056 </para>
27057 <para>
27058 <indexterm role="option">
27059 <primary><option>queue_list_requires_admin</option></primary>
27060 </indexterm>
27061 </para>
27062 <informaltable frame="all">
27063 <tgroup cols="4" colsep="0" rowsep="0">
27064 <colspec colwidth="8*" align="left"/>
27065 <colspec colwidth="6*" align="center"/>
27066 <colspec colwidth="6*" align="center"/>
27067 <colspec colwidth="6*" align="right"/>
27068 <tbody>
27069 <row>
27070 <entry><option>queue_list_requires_admin</option></entry>
27071 <entry>Use: <emphasis>main</emphasis></entry>
27072 <entry>Type: <emphasis>boolean</emphasis></entry>
27073 <entry>Default: <emphasis>true</emphasis></entry>
27074 </row>
27075 </tbody>
27076 </tgroup>
27077 </informaltable>
27078 <para>
27079 <indexterm role="option">
27080 <primary><option>-bp</option></primary>
27081 </indexterm>
27082 The <option>-bp</option> command-line option, which lists the messages that are on the
27083 queue, requires the caller to be an admin user unless
27084 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
27085 </para>
27086 <para>
27087 <indexterm role="option">
27088 <primary><option>queue_only</option></primary>
27089 </indexterm>
27090 </para>
27091 <informaltable frame="all">
27092 <tgroup cols="4" colsep="0" rowsep="0">
27093 <colspec colwidth="8*" align="left"/>
27094 <colspec colwidth="6*" align="center"/>
27095 <colspec colwidth="6*" align="center"/>
27096 <colspec colwidth="6*" align="right"/>
27097 <tbody>
27098 <row>
27099 <entry><option>queue_only</option></entry>
27100 <entry>Use: <emphasis>main</emphasis></entry>
27101 <entry>Type: <emphasis>boolean</emphasis></entry>
27102 <entry>Default: <emphasis>false</emphasis></entry>
27103 </row>
27104 </tbody>
27105 </tgroup>
27106 </informaltable>
27107 <para>
27108 <indexterm role="concept">
27109 <primary>queueing incoming messages</primary>
27110 </indexterm>
27111 <indexterm role="concept">
27112 <primary>message</primary>
27113 <secondary>queueing unconditionally</secondary>
27114 </indexterm>
27115 If <option>queue_only</option> is set, a delivery process is not automatically started
27116 whenever a message is received. Instead, the message waits on the queue for the
27117 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
27118 delivered immediately when certain conditions (such as heavy load) occur.
27119 </para>
27120 <para>
27121 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
27122 and <option>-odi</option> command line options override <option>queue_only</option> unless
27123 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
27124 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
27125 </para>
27126 <para>
27127 <indexterm role="option">
27128 <primary><option>queue_only_file</option></primary>
27129 </indexterm>
27130 </para>
27131 <informaltable frame="all">
27132 <tgroup cols="4" colsep="0" rowsep="0">
27133 <colspec colwidth="8*" align="left"/>
27134 <colspec colwidth="6*" align="center"/>
27135 <colspec colwidth="6*" align="center"/>
27136 <colspec colwidth="6*" align="right"/>
27137 <tbody>
27138 <row>
27139 <entry><option>queue_only_file</option></entry>
27140 <entry>Use: <emphasis>main</emphasis></entry>
27141 <entry>Type: <emphasis>string</emphasis></entry>
27142 <entry>Default: <emphasis>unset</emphasis></entry>
27143 </row>
27144 </tbody>
27145 </tgroup>
27146 </informaltable>
27147 <para>
27148 <indexterm role="concept">
27149 <primary>queueing incoming messages</primary>
27150 </indexterm>
27151 <indexterm role="concept">
27152 <primary>message</primary>
27153 <secondary>queueing by file existence</secondary>
27154 </indexterm>
27155 This option can be set to a colon-separated list of absolute path names, each
27156 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
27157 it tests for the existence of each listed path using a call to <function>stat()</function>. For
27158 each path that exists, the corresponding queueing option is set.
27159 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
27160 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
27161 </para>
27162 <literallayout class="monospaced">
27163 queue_only_file = smtp/some/file
27164 </literallayout>
27165 <para>
27166 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
27167 <filename>/some/file</filename> exists.
27168 </para>
27169 <para>
27170 <indexterm role="option">
27171 <primary><option>queue_only_load</option></primary>
27172 </indexterm>
27173 </para>
27174 <informaltable frame="all">
27175 <tgroup cols="4" colsep="0" rowsep="0">
27176 <colspec colwidth="8*" align="left"/>
27177 <colspec colwidth="6*" align="center"/>
27178 <colspec colwidth="6*" align="center"/>
27179 <colspec colwidth="6*" align="right"/>
27180 <tbody>
27181 <row>
27182 <entry><option>queue_only_load</option></entry>
27183 <entry>Use: <emphasis>main</emphasis></entry>
27184 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27185 <entry>Default: <emphasis>unset</emphasis></entry>
27186 </row>
27187 </tbody>
27188 </tgroup>
27189 </informaltable>
27190 <para>
27191 <indexterm role="concept">
27192 <primary>load average</primary>
27193 </indexterm>
27194 <indexterm role="concept">
27195 <primary>queueing incoming messages</primary>
27196 </indexterm>
27197 <indexterm role="concept">
27198 <primary>message</primary>
27199 <secondary>queueing by load</secondary>
27200 </indexterm>
27201 If the system load average is higher than this value, incoming messages from
27202 all sources are queued, and no automatic deliveries are started. If this
27203 happens during local or remote SMTP input, all subsequent messages received on
27204 the same SMTP connection are queued by default, whatever happens to the load in
27205 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
27206 false.
27207 </para>
27208 <para>
27209 Deliveries will subsequently be performed by queue runner processes. This
27210 option has no effect on ancient operating systems on which Exim cannot
27211 determine the load average. See also <option>deliver_queue_load_max</option> and
27212 <option>smtp_load_reserve</option>.
27213 </para>
27214 <para>
27215 <indexterm role="option">
27216 <primary><option>queue_only_load_latch</option></primary>
27217 </indexterm>
27218 </para>
27219 <informaltable frame="all">
27220 <tgroup cols="4" colsep="0" rowsep="0">
27221 <colspec colwidth="8*" align="left"/>
27222 <colspec colwidth="6*" align="center"/>
27223 <colspec colwidth="6*" align="center"/>
27224 <colspec colwidth="6*" align="right"/>
27225 <tbody>
27226 <row>
27227 <entry><option>queue_only_load_latch</option></entry>
27228 <entry>Use: <emphasis>main</emphasis></entry>
27229 <entry>Type: <emphasis>boolean</emphasis></entry>
27230 <entry>Default: <emphasis>true</emphasis></entry>
27231 </row>
27232 </tbody>
27233 </tgroup>
27234 </informaltable>
27235 <para>
27236 <indexterm role="concept">
27237 <primary>load average</primary>
27238 <secondary>re-evaluating per message</secondary>
27239 </indexterm>
27240 When this option is true (the default), once one message has been queued
27241 because the load average is higher than the value set by <option>queue_only_load</option>,
27242 all subsequent messages received on the same SMTP connection are also queued.
27243 This is a deliberate choice; even though the load average may fall below the
27244 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
27245 connection when not delivering earlier ones. However, there are special
27246 circumstances such as very long-lived connections from scanning appliances
27247 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
27248 should be set false. This causes the value of the load average to be
27249 re-evaluated for each message.
27250 </para>
27251 <para>
27252 <indexterm role="option">
27253 <primary><option>queue_only_override</option></primary>
27254 </indexterm>
27255 </para>
27256 <informaltable frame="all">
27257 <tgroup cols="4" colsep="0" rowsep="0">
27258 <colspec colwidth="8*" align="left"/>
27259 <colspec colwidth="6*" align="center"/>
27260 <colspec colwidth="6*" align="center"/>
27261 <colspec colwidth="6*" align="right"/>
27262 <tbody>
27263 <row>
27264 <entry><option>queue_only_override</option></entry>
27265 <entry>Use: <emphasis>main</emphasis></entry>
27266 <entry>Type: <emphasis>boolean</emphasis></entry>
27267 <entry>Default: <emphasis>true</emphasis></entry>
27268 </row>
27269 </tbody>
27270 </tgroup>
27271 </informaltable>
27272 <para>
27273 <indexterm role="concept">
27274 <primary>queueing incoming messages</primary>
27275 </indexterm>
27276 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
27277 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
27278 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
27279 to override; they are accepted, but ignored.
27280 </para>
27281 <para>
27282 <indexterm role="option">
27283 <primary><option>queue_run_in_order</option></primary>
27284 </indexterm>
27285 </para>
27286 <informaltable frame="all">
27287 <tgroup cols="4" colsep="0" rowsep="0">
27288 <colspec colwidth="8*" align="left"/>
27289 <colspec colwidth="6*" align="center"/>
27290 <colspec colwidth="6*" align="center"/>
27291 <colspec colwidth="6*" align="right"/>
27292 <tbody>
27293 <row>
27294 <entry><option>queue_run_in_order</option></entry>
27295 <entry>Use: <emphasis>main</emphasis></entry>
27296 <entry>Type: <emphasis>boolean</emphasis></entry>
27297 <entry>Default: <emphasis>false</emphasis></entry>
27298 </row>
27299 </tbody>
27300 </tgroup>
27301 </informaltable>
27302 <para>
27303 <indexterm role="concept">
27304 <primary>queue runner</primary>
27305 <secondary>processing messages in order</secondary>
27306 </indexterm>
27307 If this option is set, queue runs happen in order of message arrival instead of
27308 in an arbitrary order. For this to happen, a complete list of the entire queue
27309 must be set up before the deliveries start. When the queue is all held in a
27310 single directory (the default), a single list is created for both the ordered
27311 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
27312 single list is not created when <option>queue_run_in_order</option> is false. In this case,
27313 the sub-directories are processed one at a time (in a random order), and this
27314 avoids setting up one huge list for the whole queue. Thus, setting
27315 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
27316 when the queue is large, because of the extra work in setting up the single,
27317 large list. In most situations, <option>queue_run_in_order</option> should not be set.
27318 </para>
27319 <para>
27320 <indexterm role="option">
27321 <primary><option>queue_run_max</option></primary>
27322 </indexterm>
27323 </para>
27324 <informaltable frame="all">
27325 <tgroup cols="4" colsep="0" rowsep="0">
27326 <colspec colwidth="8*" align="left"/>
27327 <colspec colwidth="6*" align="center"/>
27328 <colspec colwidth="6*" align="center"/>
27329 <colspec colwidth="6*" align="right"/>
27330 <tbody>
27331 <row>
27332 <entry><option>queue_run_max</option></entry>
27333 <entry>Use: <emphasis>main</emphasis></entry>
27334 <entry>Type: <emphasis>integer</emphasis></entry>
27335 <entry>Default: <emphasis>5</emphasis></entry>
27336 </row>
27337 </tbody>
27338 </tgroup>
27339 </informaltable>
27340 <para>
27341 <indexterm role="concept">
27342 <primary>queue runner</primary>
27343 <secondary>maximum number of</secondary>
27344 </indexterm>
27345 This controls the maximum number of queue runner processes that an Exim daemon
27346 can run simultaneously. This does not mean that it starts them all at once,
27347 but rather that if the maximum number are still running when the time comes to
27348 start another one, it refrains from starting another one. This can happen with
27349 very large queues and/or very sluggish deliveries. This option does not,
27350 however, interlock with other processes, so additional queue runners can be
27351 started by other means, or by killing and restarting the daemon.
27352 </para>
27353 <para>
27354 Setting this option to zero does not suppress queue runs; rather, it disables
27355 the limit, allowing any number of simultaneous queue runner processes to be
27356 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
27357 the daemon&#x2019;s command line.
27358 </para>
27359 <para>
27360 <indexterm role="option">
27361 <primary><option>queue_smtp_domains</option></primary>
27362 </indexterm>
27363 </para>
27364 <informaltable frame="all">
27365 <tgroup cols="4" colsep="0" rowsep="0">
27366 <colspec colwidth="8*" align="left"/>
27367 <colspec colwidth="6*" align="center"/>
27368 <colspec colwidth="6*" align="center"/>
27369 <colspec colwidth="6*" align="right"/>
27370 <tbody>
27371 <row>
27372 <entry><option>queue_smtp_domains</option></entry>
27373 <entry>Use: <emphasis>main</emphasis></entry>
27374 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27375 <entry>Default: <emphasis>unset</emphasis></entry>
27376 </row>
27377 </tbody>
27378 </tgroup>
27379 </informaltable>
27380 <para>
27381 <indexterm role="concept">
27382 <primary>queueing incoming messages</primary>
27383 </indexterm>
27384 <indexterm role="concept">
27385 <primary>message</primary>
27386 <secondary>queueing remote deliveries</secondary>
27387 </indexterm>
27388 When this option is set, a delivery process is started whenever a message is
27389 received, routing is performed, and local deliveries take place.
27390 However, if any SMTP deliveries are required for domains that match
27391 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
27392 message waits on the queue for the next queue run. Since routing of the message
27393 has taken place, Exim knows to which remote hosts it must be delivered, and so
27394 when the queue run happens, multiple messages for the same host are delivered
27395 over a single SMTP connection. The <option>-odqs</option> command line option causes all
27396 SMTP deliveries to be queued in this way, and is equivalent to setting
27397 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
27398 <option>queue_domains</option>.
27399 </para>
27400 <para>
27401 <indexterm role="option">
27402 <primary><option>receive_timeout</option></primary>
27403 </indexterm>
27404 </para>
27405 <informaltable frame="all">
27406 <tgroup cols="4" colsep="0" rowsep="0">
27407 <colspec colwidth="8*" align="left"/>
27408 <colspec colwidth="6*" align="center"/>
27409 <colspec colwidth="6*" align="center"/>
27410 <colspec colwidth="6*" align="right"/>
27411 <tbody>
27412 <row>
27413 <entry><option>receive_timeout</option></entry>
27414 <entry>Use: <emphasis>main</emphasis></entry>
27415 <entry>Type: <emphasis>time</emphasis></entry>
27416 <entry>Default: <emphasis>0s</emphasis></entry>
27417 </row>
27418 </tbody>
27419 </tgroup>
27420 </informaltable>
27421 <para>
27422 <indexterm role="concept">
27423 <primary>timeout</primary>
27424 <secondary>for non-SMTP input</secondary>
27425 </indexterm>
27426 This option sets the timeout for accepting a non-SMTP message, that is, the
27427 maximum time that Exim waits when reading a message on the standard input. If
27428 the value is zero, it will wait for ever. This setting is overridden by the
27429 <option>-or</option> command line option. The timeout for incoming SMTP messages is
27430 controlled by <option>smtp_receive_timeout</option>.
27431 </para>
27432 <para>
27433 <indexterm role="option">
27434 <primary><option>received_header_text</option></primary>
27435 </indexterm>
27436 </para>
27437 <informaltable frame="all">
27438 <tgroup cols="4" colsep="0" rowsep="0">
27439 <colspec colwidth="8*" align="left"/>
27440 <colspec colwidth="6*" align="center"/>
27441 <colspec colwidth="6*" align="center"/>
27442 <colspec colwidth="6*" align="right"/>
27443 <tbody>
27444 <row>
27445 <entry><option>received_header_text</option></entry>
27446 <entry>Use: <emphasis>main</emphasis></entry>
27447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27448 <entry>Default: <emphasis>see below</emphasis></entry>
27449 </row>
27450 </tbody>
27451 </tgroup>
27452 </informaltable>
27453 <para>
27454 <indexterm role="concept">
27455 <primary>customizing</primary>
27456 <secondary><emphasis>Received:</emphasis> header</secondary>
27457 </indexterm>
27458 <indexterm role="concept">
27459 <primary><emphasis>Received:</emphasis> header line</primary>
27460 <secondary>customizing</secondary>
27461 </indexterm>
27462 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
27463 added to each message, except for the timestamp, which is automatically added
27464 on at the end (preceded by a semicolon). The string is expanded each time it is
27465 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
27466 added to the message. Otherwise, the string should start with the text
27467 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
27468 header lines. The default setting is:
27469 </para>
27470 <literallayout class="monospaced">
27471 received_header_text = Received: \
27472   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
27473   {${if def:sender_ident \
27474   {from ${quote_local_part:$sender_ident} }}\
27475   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
27476   by $primary_hostname \
27477   ${if def:received_protocol {with $received_protocol}} \
27478   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
27479   (Exim $version_number)\n\t\
27480   ${if def:sender_address \
27481   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
27482   id $message_exim_id\
27483   ${if def:received_for {\n\tfor $received_for}}
27484 </literallayout>
27485 <para>
27486 The reference to the TLS cipher is omitted when Exim is built without TLS
27487 support. The use of conditional expansions ensures that this works for both
27488 locally generated messages and messages received from remote hosts, giving
27489 header lines such as the following:
27490 </para>
27491 <literallayout class="monospaced">
27492 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
27493 by marley.carol.example with esmtp (Exim 4.00)
27494 (envelope-from &lt;bob@carol.example&gt;)
27495 id 16IOWa-00019l-00
27496 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
27497 Received: by scrooge.carol.example with local (Exim 4.00)
27498 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
27499 </literallayout>
27500 <para>
27501 Until the body of the message has been received, the timestamp is the time when
27502 the message started to be received. Once the body has arrived, and all policy
27503 checks have taken place, the timestamp is updated to the time at which the
27504 message was accepted.
27505 </para>
27506 <para>
27507 <indexterm role="option">
27508 <primary><option>received_headers_max</option></primary>
27509 </indexterm>
27510 </para>
27511 <informaltable frame="all">
27512 <tgroup cols="4" colsep="0" rowsep="0">
27513 <colspec colwidth="8*" align="left"/>
27514 <colspec colwidth="6*" align="center"/>
27515 <colspec colwidth="6*" align="center"/>
27516 <colspec colwidth="6*" align="right"/>
27517 <tbody>
27518 <row>
27519 <entry><option>received_headers_max</option></entry>
27520 <entry>Use: <emphasis>main</emphasis></entry>
27521 <entry>Type: <emphasis>integer</emphasis></entry>
27522 <entry>Default: <emphasis>30</emphasis></entry>
27523 </row>
27524 </tbody>
27525 </tgroup>
27526 </informaltable>
27527 <para>
27528 <indexterm role="concept">
27529 <primary>loop</primary>
27530 <secondary>prevention</secondary>
27531 </indexterm>
27532 <indexterm role="concept">
27533 <primary>mail loop prevention</primary>
27534 </indexterm>
27535 <indexterm role="concept">
27536 <primary><emphasis>Received:</emphasis> header line</primary>
27537 <secondary>counting</secondary>
27538 </indexterm>
27539 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
27540 counted, and if it is greater than this parameter, a mail loop is assumed to
27541 have occurred, the delivery is abandoned, and an error message is generated.
27542 This applies to both local and remote deliveries.
27543 </para>
27544 <para>
27545 <indexterm role="option">
27546 <primary><option>recipient_unqualified_hosts</option></primary>
27547 </indexterm>
27548 </para>
27549 <informaltable frame="all">
27550 <tgroup cols="4" colsep="0" rowsep="0">
27551 <colspec colwidth="8*" align="left"/>
27552 <colspec colwidth="6*" align="center"/>
27553 <colspec colwidth="6*" align="center"/>
27554 <colspec colwidth="6*" align="right"/>
27555 <tbody>
27556 <row>
27557 <entry><option>recipient_unqualified_hosts</option></entry>
27558 <entry>Use: <emphasis>main</emphasis></entry>
27559 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27560 <entry>Default: <emphasis>unset</emphasis></entry>
27561 </row>
27562 </tbody>
27563 </tgroup>
27564 </informaltable>
27565 <para>
27566 <indexterm role="concept">
27567 <primary>unqualified addresses</primary>
27568 </indexterm>
27569 <indexterm role="concept">
27570 <primary>host</primary>
27571 <secondary>unqualified addresses from</secondary>
27572 </indexterm>
27573 This option lists those hosts from which Exim is prepared to accept unqualified
27574 recipient addresses in message envelopes. The addresses are made fully
27575 qualified by the addition of the <option>qualify_recipient</option> value. This option also
27576 affects message header lines. Exim does not reject unqualified recipient
27577 addresses in headers, but it qualifies them only if the message came from a
27578 host that matches <option>recipient_unqualified_hosts</option>,
27579 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
27580 option was not set.
27581 </para>
27582 <para>
27583 <indexterm role="option">
27584 <primary><option>recipients_max</option></primary>
27585 </indexterm>
27586 </para>
27587 <informaltable frame="all">
27588 <tgroup cols="4" colsep="0" rowsep="0">
27589 <colspec colwidth="8*" align="left"/>
27590 <colspec colwidth="6*" align="center"/>
27591 <colspec colwidth="6*" align="center"/>
27592 <colspec colwidth="6*" align="right"/>
27593 <tbody>
27594 <row>
27595 <entry><option>recipients_max</option></entry>
27596 <entry>Use: <emphasis>main</emphasis></entry>
27597 <entry>Type: <emphasis>integer</emphasis></entry>
27598 <entry>Default: <emphasis>0</emphasis></entry>
27599 </row>
27600 </tbody>
27601 </tgroup>
27602 </informaltable>
27603 <para>
27604 <indexterm role="concept">
27605 <primary>limit</primary>
27606 <secondary>number of recipients</secondary>
27607 </indexterm>
27608 <indexterm role="concept">
27609 <primary>recipient</primary>
27610 <secondary>maximum number</secondary>
27611 </indexterm>
27612 If this option is set greater than zero, it specifies the maximum number of
27613 original recipients for any message. Additional recipients that are generated
27614 by aliasing or forwarding do not count. SMTP messages get a 452 response for
27615 all recipients over the limit; earlier recipients are delivered as normal.
27616 Non-SMTP messages with too many recipients are failed, and no deliveries are
27617 done.
27618 </para>
27619 <para>
27620 <indexterm role="concept">
27621 <primary>RCPT</primary>
27622 <secondary>maximum number of incoming</secondary>
27623 </indexterm>
27624 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
27625 RCPT commands in a single message.
27626 </para>
27627 <para>
27628 <indexterm role="option">
27629 <primary><option>recipients_max_reject</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>recipients_max_reject</option></entry>
27641 <entry>Use: <emphasis>main</emphasis></entry>
27642 <entry>Type: <emphasis>boolean</emphasis></entry>
27643 <entry>Default: <emphasis>false</emphasis></entry>
27644 </row>
27645 </tbody>
27646 </tgroup>
27647 </informaltable>
27648 <para>
27649 If this option is set true, Exim rejects SMTP messages containing too many
27650 recipients by giving 552 errors to the surplus RCPT commands, and a 554
27651 error to the eventual DATA command. Otherwise (the default) it gives a 452
27652 error to the surplus RCPT commands and accepts the message on behalf of the
27653 initial set of recipients. The remote server should then re-send the message
27654 for the remaining recipients at a later time.
27655 </para>
27656 <para>
27657 <indexterm role="option">
27658 <primary><option>remote_max_parallel</option></primary>
27659 </indexterm>
27660 </para>
27661 <informaltable frame="all">
27662 <tgroup cols="4" colsep="0" rowsep="0">
27663 <colspec colwidth="8*" align="left"/>
27664 <colspec colwidth="6*" align="center"/>
27665 <colspec colwidth="6*" align="center"/>
27666 <colspec colwidth="6*" align="right"/>
27667 <tbody>
27668 <row>
27669 <entry><option>remote_max_parallel</option></entry>
27670 <entry>Use: <emphasis>main</emphasis></entry>
27671 <entry>Type: <emphasis>integer</emphasis></entry>
27672 <entry>Default: <emphasis>2</emphasis></entry>
27673 </row>
27674 </tbody>
27675 </tgroup>
27676 </informaltable>
27677 <para>
27678 <indexterm role="concept">
27679 <primary>delivery</primary>
27680 <secondary>parallelism for remote</secondary>
27681 </indexterm>
27682 This option controls parallel delivery of one message to a number of remote
27683 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
27684 does all the remote deliveries for a message one by one. Otherwise, if a single
27685 message has to be delivered to more than one remote host, or if several copies
27686 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
27687 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
27688 deliveries are required, the maximum number of processes are started, and as
27689 each one finishes, another is begun. The order of starting processes is the
27690 same as if sequential delivery were being done, and can be controlled by the
27691 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
27692 with debugging turned on, the debugging output from each delivery process is
27693 tagged with its process id.
27694 </para>
27695 <para>
27696 This option controls only the maximum number of parallel deliveries for one
27697 message in one Exim delivery process. Because Exim has no central queue
27698 manager, there is no way of controlling the total number of simultaneous
27699 deliveries if the configuration allows a delivery attempt as soon as a message
27700 is received.
27701 </para>
27702 <para>
27703 <indexterm role="concept">
27704 <primary>number of deliveries</primary>
27705 </indexterm>
27706 <indexterm role="concept">
27707 <primary>delivery</primary>
27708 <secondary>maximum number of</secondary>
27709 </indexterm>
27710 If you want to control the total number of deliveries on the system, you
27711 need to set the <option>queue_only</option> option. This ensures that all incoming messages
27712 are added to the queue without starting a delivery process. Then set up an Exim
27713 daemon to start queue runner processes at appropriate intervals (probably
27714 fairly often, for example, every minute), and limit the total number of queue
27715 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
27716 delivers only one message at a time, the maximum number of deliveries that can
27717 then take place at once is <option>queue_run_max</option> multiplied by
27718 <option>remote_max_parallel</option>.
27719 </para>
27720 <para>
27721 If it is purely remote deliveries you want to control, use
27722 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
27723 doing the SMTP routing before queueing, so that several messages for the same
27724 host will eventually get delivered down the same connection.
27725 </para>
27726 <para>
27727 <indexterm role="option">
27728 <primary><option>remote_sort_domains</option></primary>
27729 </indexterm>
27730 </para>
27731 <informaltable frame="all">
27732 <tgroup cols="4" colsep="0" rowsep="0">
27733 <colspec colwidth="8*" align="left"/>
27734 <colspec colwidth="6*" align="center"/>
27735 <colspec colwidth="6*" align="center"/>
27736 <colspec colwidth="6*" align="right"/>
27737 <tbody>
27738 <row>
27739 <entry><option>remote_sort_domains</option></entry>
27740 <entry>Use: <emphasis>main</emphasis></entry>
27741 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27742 <entry>Default: <emphasis>unset</emphasis></entry>
27743 </row>
27744 </tbody>
27745 </tgroup>
27746 </informaltable>
27747 <para>
27748 <indexterm role="concept">
27749 <primary>sorting remote deliveries</primary>
27750 </indexterm>
27751 <indexterm role="concept">
27752 <primary>delivery</primary>
27753 <secondary>sorting remote</secondary>
27754 </indexterm>
27755 When there are a number of remote deliveries for a message, they are sorted by
27756 domain into the order given by this list. For example,
27757 </para>
27758 <literallayout class="monospaced">
27759 remote_sort_domains = *.cam.ac.uk:*.uk
27760 </literallayout>
27761 <para>
27762 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
27763 then to those in the <option>uk</option> domain, then to any others.
27764 </para>
27765 <para>
27766 <indexterm role="option">
27767 <primary><option>retry_data_expire</option></primary>
27768 </indexterm>
27769 </para>
27770 <informaltable frame="all">
27771 <tgroup cols="4" colsep="0" rowsep="0">
27772 <colspec colwidth="8*" align="left"/>
27773 <colspec colwidth="6*" align="center"/>
27774 <colspec colwidth="6*" align="center"/>
27775 <colspec colwidth="6*" align="right"/>
27776 <tbody>
27777 <row>
27778 <entry><option>retry_data_expire</option></entry>
27779 <entry>Use: <emphasis>main</emphasis></entry>
27780 <entry>Type: <emphasis>time</emphasis></entry>
27781 <entry>Default: <emphasis>7d</emphasis></entry>
27782 </row>
27783 </tbody>
27784 </tgroup>
27785 </informaltable>
27786 <para>
27787 <indexterm role="concept">
27788 <primary>hints database</primary>
27789 <secondary>data expiry</secondary>
27790 </indexterm>
27791 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
27792 database. Any older retry data is ignored. This means that, for example, once a
27793 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
27794 past failures.
27795 </para>
27796 <para>
27797 <indexterm role="option">
27798 <primary><option>retry_interval_max</option></primary>
27799 </indexterm>
27800 </para>
27801 <informaltable frame="all">
27802 <tgroup cols="4" colsep="0" rowsep="0">
27803 <colspec colwidth="8*" align="left"/>
27804 <colspec colwidth="6*" align="center"/>
27805 <colspec colwidth="6*" align="center"/>
27806 <colspec colwidth="6*" align="right"/>
27807 <tbody>
27808 <row>
27809 <entry><option>retry_interval_max</option></entry>
27810 <entry>Use: <emphasis>main</emphasis></entry>
27811 <entry>Type: <emphasis>time</emphasis></entry>
27812 <entry>Default: <emphasis>24h</emphasis></entry>
27813 </row>
27814 </tbody>
27815 </tgroup>
27816 </informaltable>
27817 <para>
27818 <indexterm role="concept">
27819 <primary>retry</primary>
27820 <secondary>limit on interval</secondary>
27821 </indexterm>
27822 <indexterm role="concept">
27823 <primary>limit</primary>
27824 <secondary>on retry interval</secondary>
27825 </indexterm>
27826 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
27827 intervals between delivery attempts for messages that cannot be delivered
27828 straight away. This option sets an overall limit to the length of time between
27829 retries. It cannot be set greater than 24 hours; any attempt to do so forces
27830 the default value.
27831 </para>
27832 <para>
27833 <indexterm role="option">
27834 <primary><option>return_path_remove</option></primary>
27835 </indexterm>
27836 </para>
27837 <informaltable frame="all">
27838 <tgroup cols="4" colsep="0" rowsep="0">
27839 <colspec colwidth="8*" align="left"/>
27840 <colspec colwidth="6*" align="center"/>
27841 <colspec colwidth="6*" align="center"/>
27842 <colspec colwidth="6*" align="right"/>
27843 <tbody>
27844 <row>
27845 <entry><option>return_path_remove</option></entry>
27846 <entry>Use: <emphasis>main</emphasis></entry>
27847 <entry>Type: <emphasis>boolean</emphasis></entry>
27848 <entry>Default: <emphasis>true</emphasis></entry>
27849 </row>
27850 </tbody>
27851 </tgroup>
27852 </informaltable>
27853 <para>
27854 <indexterm role="concept">
27855 <primary><emphasis>Return-path:</emphasis> header line</primary>
27856 <secondary>removing</secondary>
27857 </indexterm>
27858 RFC 2821, section 4.4, states that an SMTP server must insert a
27859 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
27860 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
27861 MAIL command. This description implies that this header should not be present
27862 in an incoming message. If <option>return_path_remove</option> is true, any existing
27863 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
27864 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
27865 the time of delivery. They are normally used only for final local deliveries.
27866 </para>
27867 <para>
27868 <indexterm role="option">
27869 <primary><option>return_size_limit</option></primary>
27870 </indexterm>
27871 </para>
27872 <informaltable frame="all">
27873 <tgroup cols="4" colsep="0" rowsep="0">
27874 <colspec colwidth="8*" align="left"/>
27875 <colspec colwidth="6*" align="center"/>
27876 <colspec colwidth="6*" align="center"/>
27877 <colspec colwidth="6*" align="right"/>
27878 <tbody>
27879 <row>
27880 <entry><option>return_size_limit</option></entry>
27881 <entry>Use: <emphasis>main</emphasis></entry>
27882 <entry>Type: <emphasis>integer</emphasis></entry>
27883 <entry>Default: <emphasis>100K</emphasis></entry>
27884 </row>
27885 </tbody>
27886 </tgroup>
27887 </informaltable>
27888 <para>
27889 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
27890 </para>
27891 <para>
27892 <indexterm role="option">
27893 <primary><option>rfc1413_hosts</option></primary>
27894 </indexterm>
27895 </para>
27896 <informaltable frame="all">
27897 <tgroup cols="4" colsep="0" rowsep="0">
27898 <colspec colwidth="8*" align="left"/>
27899 <colspec colwidth="6*" align="center"/>
27900 <colspec colwidth="6*" align="center"/>
27901 <colspec colwidth="6*" align="right"/>
27902 <tbody>
27903 <row>
27904 <entry><option>rfc1413_hosts</option></entry>
27905 <entry>Use: <emphasis>main</emphasis></entry>
27906 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27907 <entry>Default: <emphasis>*</emphasis></entry>
27908 </row>
27909 </tbody>
27910 </tgroup>
27911 </informaltable>
27912 <para>
27913 <indexterm role="concept">
27914 <primary>RFC 1413</primary>
27915 </indexterm>
27916 <indexterm role="concept">
27917 <primary>host</primary>
27918 <secondary>for RFC 1413 calls</secondary>
27919 </indexterm>
27920 RFC 1413 identification calls are made to any client host which matches an item
27921 in the list.
27922 </para>
27923 <para>
27924 <indexterm role="option">
27925 <primary><option>rfc1413_query_timeout</option></primary>
27926 </indexterm>
27927 </para>
27928 <informaltable frame="all">
27929 <tgroup cols="4" colsep="0" rowsep="0">
27930 <colspec colwidth="8*" align="left"/>
27931 <colspec colwidth="6*" align="center"/>
27932 <colspec colwidth="6*" align="center"/>
27933 <colspec colwidth="6*" align="right"/>
27934 <tbody>
27935 <row>
27936 <entry><option>rfc1413_query_timeout</option></entry>
27937 <entry>Use: <emphasis>main</emphasis></entry>
27938 <entry>Type: <emphasis>time</emphasis></entry>
27939 <entry>Default: <emphasis>5s</emphasis></entry>
27940 </row>
27941 </tbody>
27942 </tgroup>
27943 </informaltable>
27944 <para>
27945 <indexterm role="concept">
27946 <primary>RFC 1413</primary>
27947 <secondary>query timeout</secondary>
27948 </indexterm>
27949 <indexterm role="concept">
27950 <primary>timeout</primary>
27951 <secondary>for RFC 1413 call</secondary>
27952 </indexterm>
27953 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
27954 no RFC 1413 calls are ever made.
27955 </para>
27956 <para>
27957 <indexterm role="option">
27958 <primary><option>sender_unqualified_hosts</option></primary>
27959 </indexterm>
27960 </para>
27961 <informaltable frame="all">
27962 <tgroup cols="4" colsep="0" rowsep="0">
27963 <colspec colwidth="8*" align="left"/>
27964 <colspec colwidth="6*" align="center"/>
27965 <colspec colwidth="6*" align="center"/>
27966 <colspec colwidth="6*" align="right"/>
27967 <tbody>
27968 <row>
27969 <entry><option>sender_unqualified_hosts</option></entry>
27970 <entry>Use: <emphasis>main</emphasis></entry>
27971 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27972 <entry>Default: <emphasis>unset</emphasis></entry>
27973 </row>
27974 </tbody>
27975 </tgroup>
27976 </informaltable>
27977 <para>
27978 <indexterm role="concept">
27979 <primary>unqualified addresses</primary>
27980 </indexterm>
27981 <indexterm role="concept">
27982 <primary>host</primary>
27983 <secondary>unqualified addresses from</secondary>
27984 </indexterm>
27985 This option lists those hosts from which Exim is prepared to accept unqualified
27986 sender addresses. The addresses are made fully qualified by the addition of
27987 <option>qualify_domain</option>. This option also affects message header lines. Exim does
27988 not reject unqualified addresses in headers that contain sender addresses, but
27989 it qualifies them only if the message came from a host that matches
27990 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
27991 using TCP/IP), and the <option>-bnq</option> option was not set.
27992 </para>
27993 <para>
27994 <indexterm role="option">
27995 <primary><option>set_environment</option></primary>
27996 </indexterm>
27997 </para>
27998 <informaltable frame="all">
27999 <tgroup cols="4" colsep="0" rowsep="0">
28000 <colspec colwidth="8*" align="left"/>
28001 <colspec colwidth="6*" align="center"/>
28002 <colspec colwidth="6*" align="center"/>
28003 <colspec colwidth="6*" align="right"/>
28004 <tbody>
28005 <row>
28006 <entry><option>set_environment</option></entry>
28007 <entry>Use: <emphasis>main</emphasis></entry>
28008 <entry>Type: <emphasis>string list</emphasis></entry>
28009 <entry>Default: <emphasis>empty</emphasis></entry>
28010 </row>
28011 </tbody>
28012 </tgroup>
28013 </informaltable>
28014 <para>
28015 <indexterm role="concept">
28016 <primary>environment</primary>
28017 </indexterm>
28018 This option allows to set individual environment variables that the
28019 currently linked libraries and programs in child processes use. The
28020 default list is empty,
28021 </para>
28022 <para>
28023 <indexterm role="option">
28024 <primary><option>smtp_accept_keepalive</option></primary>
28025 </indexterm>
28026 </para>
28027 <informaltable frame="all">
28028 <tgroup cols="4" colsep="0" rowsep="0">
28029 <colspec colwidth="8*" align="left"/>
28030 <colspec colwidth="6*" align="center"/>
28031 <colspec colwidth="6*" align="center"/>
28032 <colspec colwidth="6*" align="right"/>
28033 <tbody>
28034 <row>
28035 <entry><option>smtp_accept_keepalive</option></entry>
28036 <entry>Use: <emphasis>main</emphasis></entry>
28037 <entry>Type: <emphasis>boolean</emphasis></entry>
28038 <entry>Default: <emphasis>true</emphasis></entry>
28039 </row>
28040 </tbody>
28041 </tgroup>
28042 </informaltable>
28043 <para>
28044 <indexterm role="concept">
28045 <primary>keepalive</primary>
28046 <secondary>on incoming connection</secondary>
28047 </indexterm>
28048 This option controls the setting of the SO_KEEPALIVE option on incoming
28049 TCP/IP socket connections. When set, it causes the kernel to probe idle
28050 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
28051 other end of the connection should send an acknowledgment if the connection is
28052 still okay or a reset if the connection has been aborted. The reason for doing
28053 this is that it has the beneficial effect of freeing up certain types of
28054 connection that can get stuck when the remote host is disconnected without
28055 tidying up the TCP/IP call properly. The keepalive mechanism takes several
28056 hours to detect unreachable hosts.
28057 </para>
28058 <para>
28059 <indexterm role="option">
28060 <primary><option>smtp_accept_max</option></primary>
28061 </indexterm>
28062 </para>
28063 <informaltable frame="all">
28064 <tgroup cols="4" colsep="0" rowsep="0">
28065 <colspec colwidth="8*" align="left"/>
28066 <colspec colwidth="6*" align="center"/>
28067 <colspec colwidth="6*" align="center"/>
28068 <colspec colwidth="6*" align="right"/>
28069 <tbody>
28070 <row>
28071 <entry><option>smtp_accept_max</option></entry>
28072 <entry>Use: <emphasis>main</emphasis></entry>
28073 <entry>Type: <emphasis>integer</emphasis></entry>
28074 <entry>Default: <emphasis>20</emphasis></entry>
28075 </row>
28076 </tbody>
28077 </tgroup>
28078 </informaltable>
28079 <para>
28080 <indexterm role="concept">
28081 <primary>limit</primary>
28082 <secondary>incoming SMTP connections</secondary>
28083 </indexterm>
28084 <indexterm role="concept">
28085 <primary>SMTP</primary>
28086 <secondary>incoming connection count</secondary>
28087 </indexterm>
28088 <indexterm role="concept">
28089 <primary>inetd</primary>
28090 </indexterm>
28091 This option specifies the maximum number of simultaneous incoming SMTP calls
28092 that Exim will accept. It applies only to the listening daemon; there is no
28093 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
28094 value is set to zero, no limit is applied. However, it is required to be
28095 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
28096 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
28097 </para>
28098 <para>
28099 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
28100 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
28101 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
28102 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
28103 </para>
28104 <para>
28105 <indexterm role="option">
28106 <primary><option>smtp_accept_max_nonmail</option></primary>
28107 </indexterm>
28108 </para>
28109 <informaltable frame="all">
28110 <tgroup cols="4" colsep="0" rowsep="0">
28111 <colspec colwidth="8*" align="left"/>
28112 <colspec colwidth="6*" align="center"/>
28113 <colspec colwidth="6*" align="center"/>
28114 <colspec colwidth="6*" align="right"/>
28115 <tbody>
28116 <row>
28117 <entry><option>smtp_accept_max_nonmail</option></entry>
28118 <entry>Use: <emphasis>main</emphasis></entry>
28119 <entry>Type: <emphasis>integer</emphasis></entry>
28120 <entry>Default: <emphasis>10</emphasis></entry>
28121 </row>
28122 </tbody>
28123 </tgroup>
28124 </informaltable>
28125 <para>
28126 <indexterm role="concept">
28127 <primary>limit</primary>
28128 <secondary>non-mail SMTP commands</secondary>
28129 </indexterm>
28130 <indexterm role="concept">
28131 <primary>SMTP</primary>
28132 <secondary>limiting non-mail commands</secondary>
28133 </indexterm>
28134 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
28135 the connection if there are too many. This option defines <quote>too many</quote>. The
28136 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
28137 client looping sending EHLO, for example. The check is applied only if the
28138 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
28139 </para>
28140 <para>
28141 When a new message is expected, one occurrence of RSET is not counted. This
28142 allows a client to send one RSET between messages (this is not necessary,
28143 but some clients do it). Exim also allows one uncounted occurrence of HELO
28144 or EHLO, and one occurrence of STARTTLS between messages. After
28145 starting up a TLS session, another EHLO is expected, and so it too is not
28146 counted. The first occurrence of AUTH in a connection, or immediately
28147 following STARTTLS is not counted. Otherwise, all commands other than
28148 MAIL, RCPT, DATA, and QUIT are counted.
28149 </para>
28150 <para>
28151 <indexterm role="option">
28152 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
28153 </indexterm>
28154 </para>
28155 <informaltable frame="all">
28156 <tgroup cols="4" colsep="0" rowsep="0">
28157 <colspec colwidth="8*" align="left"/>
28158 <colspec colwidth="6*" align="center"/>
28159 <colspec colwidth="6*" align="center"/>
28160 <colspec colwidth="6*" align="right"/>
28161 <tbody>
28162 <row>
28163 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
28164 <entry>Use: <emphasis>main</emphasis></entry>
28165 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28166 <entry>Default: <emphasis>*</emphasis></entry>
28167 </row>
28168 </tbody>
28169 </tgroup>
28170 </informaltable>
28171 <para>
28172 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
28173 check by setting this option. The default value makes it apply to all hosts. By
28174 changing the value, you can exclude any badly-behaved hosts that you have to
28175 live with.
28176 </para>
28177 <para>
28178 <indexterm role="option">
28179 <primary><option>smtp_accept_max_per_connection</option></primary>
28180 </indexterm>
28181 </para>
28182 <informaltable frame="all">
28183 <tgroup cols="4" colsep="0" rowsep="0">
28184 <colspec colwidth="8*" align="left"/>
28185 <colspec colwidth="6*" align="center"/>
28186 <colspec colwidth="6*" align="center"/>
28187 <colspec colwidth="6*" align="right"/>
28188 <tbody>
28189 <row>
28190 <entry><option>smtp_accept_max_per_connection</option></entry>
28191 <entry>Use: <emphasis>main</emphasis></entry>
28192 <entry>Type: <emphasis>integer</emphasis></entry>
28193 <entry>Default: <emphasis>1000</emphasis></entry>
28194 </row>
28195 </tbody>
28196 </tgroup>
28197 </informaltable>
28198 <para>
28199 <indexterm role="concept">
28200 <primary>SMTP</primary>
28201 <secondary>limiting incoming message count</secondary>
28202 </indexterm>
28203 <indexterm role="concept">
28204 <primary>limit</primary>
28205 <secondary>messages per SMTP connection</secondary>
28206 </indexterm>
28207 The value of this option limits the number of MAIL commands that Exim is
28208 prepared to accept over a single SMTP connection, whether or not each command
28209 results in the transfer of a message. After the limit is reached, a 421
28210 response is given to subsequent MAIL commands. This limit is a safety
28211 precaution against a client that goes mad (incidents of this type have been
28212 seen).
28213 </para>
28214 <para>
28215 <indexterm role="option">
28216 <primary><option>smtp_accept_max_per_host</option></primary>
28217 </indexterm>
28218 </para>
28219 <informaltable frame="all">
28220 <tgroup cols="4" colsep="0" rowsep="0">
28221 <colspec colwidth="8*" align="left"/>
28222 <colspec colwidth="6*" align="center"/>
28223 <colspec colwidth="6*" align="center"/>
28224 <colspec colwidth="6*" align="right"/>
28225 <tbody>
28226 <row>
28227 <entry><option>smtp_accept_max_per_host</option></entry>
28228 <entry>Use: <emphasis>main</emphasis></entry>
28229 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28230 <entry>Default: <emphasis>unset</emphasis></entry>
28231 </row>
28232 </tbody>
28233 </tgroup>
28234 </informaltable>
28235 <para>
28236 <indexterm role="concept">
28237 <primary>limit</primary>
28238 <secondary>SMTP connections from one host</secondary>
28239 </indexterm>
28240 <indexterm role="concept">
28241 <primary>host</primary>
28242 <secondary>limiting SMTP connections from</secondary>
28243 </indexterm>
28244 This option restricts the number of simultaneous IP connections from a single
28245 host (strictly, from a single IP address) to the Exim daemon. The option is
28246 expanded, to enable different limits to be applied to different hosts by
28247 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
28248 connection attempts from the same host are rejected with error code 421. This
28249 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
28250 of zero imposes no limit. If this option is set greater than zero, it is
28251 required that <option>smtp_accept_max</option> be non-zero.
28252 </para>
28253 <para>
28254 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
28255 constructions that take an appreciable amount of time. The expansion and test
28256 happen in the main daemon loop, in order to reject additional connections
28257 without forking additional processes (otherwise a denial-of-service attack
28258 could cause a vast number or processes to be created). While the daemon is
28259 doing this processing, it cannot accept any other incoming connections.
28260 </para>
28261 <para>
28262 <indexterm role="option">
28263 <primary><option>smtp_accept_queue</option></primary>
28264 </indexterm>
28265 </para>
28266 <informaltable frame="all">
28267 <tgroup cols="4" colsep="0" rowsep="0">
28268 <colspec colwidth="8*" align="left"/>
28269 <colspec colwidth="6*" align="center"/>
28270 <colspec colwidth="6*" align="center"/>
28271 <colspec colwidth="6*" align="right"/>
28272 <tbody>
28273 <row>
28274 <entry><option>smtp_accept_queue</option></entry>
28275 <entry>Use: <emphasis>main</emphasis></entry>
28276 <entry>Type: <emphasis>integer</emphasis></entry>
28277 <entry>Default: <emphasis>0</emphasis></entry>
28278 </row>
28279 </tbody>
28280 </tgroup>
28281 </informaltable>
28282 <para>
28283 <indexterm role="concept">
28284 <primary>SMTP</primary>
28285 <secondary>incoming connection count</secondary>
28286 </indexterm>
28287 <indexterm role="concept">
28288 <primary>queueing incoming messages</primary>
28289 </indexterm>
28290 <indexterm role="concept">
28291 <primary>message</primary>
28292 <secondary>queueing by SMTP connection count</secondary>
28293 </indexterm>
28294 If the number of simultaneous incoming SMTP connections being handled via the
28295 listening daemon exceeds this value, messages received by SMTP are just placed
28296 on the queue; no delivery processes are started automatically. The count is
28297 fixed at the start of an SMTP connection. It cannot be updated in the
28298 subprocess that receives messages, and so the queueing or not queueing applies
28299 to all messages received in the same connection.
28300 </para>
28301 <para>
28302 A value of zero implies no limit, and clearly any non-zero value is useful only
28303 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
28304 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
28305 various <option>-od</option><emphasis>x</emphasis> command line options.
28306 </para>
28307 <para>
28308 <indexterm role="option">
28309 <primary><option>smtp_accept_queue_per_connection</option></primary>
28310 </indexterm>
28311 </para>
28312 <informaltable frame="all">
28313 <tgroup cols="4" colsep="0" rowsep="0">
28314 <colspec colwidth="8*" align="left"/>
28315 <colspec colwidth="6*" align="center"/>
28316 <colspec colwidth="6*" align="center"/>
28317 <colspec colwidth="6*" align="right"/>
28318 <tbody>
28319 <row>
28320 <entry><option>smtp_accept_queue_per_connection</option></entry>
28321 <entry>Use: <emphasis>main</emphasis></entry>
28322 <entry>Type: <emphasis>integer</emphasis></entry>
28323 <entry>Default: <emphasis>10</emphasis></entry>
28324 </row>
28325 </tbody>
28326 </tgroup>
28327 </informaltable>
28328 <para>
28329 <indexterm role="concept">
28330 <primary>queueing incoming messages</primary>
28331 </indexterm>
28332 <indexterm role="concept">
28333 <primary>message</primary>
28334 <secondary>queueing by message count</secondary>
28335 </indexterm>
28336 This option limits the number of delivery processes that Exim starts
28337 automatically when receiving messages via SMTP, whether via the daemon or by
28338 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
28339 and the number of messages received in a single SMTP session exceeds this
28340 number, subsequent messages are placed on the queue, but no delivery processes
28341 are started. This helps to limit the number of Exim processes when a server
28342 restarts after downtime and there is a lot of mail waiting for it on other
28343 systems. On large systems, the default should probably be increased, and on
28344 dial-in client systems it should probably be set to zero (that is, disabled).
28345 </para>
28346 <para>
28347 <indexterm role="option">
28348 <primary><option>smtp_accept_reserve</option></primary>
28349 </indexterm>
28350 </para>
28351 <informaltable frame="all">
28352 <tgroup cols="4" colsep="0" rowsep="0">
28353 <colspec colwidth="8*" align="left"/>
28354 <colspec colwidth="6*" align="center"/>
28355 <colspec colwidth="6*" align="center"/>
28356 <colspec colwidth="6*" align="right"/>
28357 <tbody>
28358 <row>
28359 <entry><option>smtp_accept_reserve</option></entry>
28360 <entry>Use: <emphasis>main</emphasis></entry>
28361 <entry>Type: <emphasis>integer</emphasis></entry>
28362 <entry>Default: <emphasis>0</emphasis></entry>
28363 </row>
28364 </tbody>
28365 </tgroup>
28366 </informaltable>
28367 <para>
28368 <indexterm role="concept">
28369 <primary>SMTP</primary>
28370 <secondary>incoming call count</secondary>
28371 </indexterm>
28372 <indexterm role="concept">
28373 <primary>host</primary>
28374 <secondary>reserved</secondary>
28375 </indexterm>
28376 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
28377 number of SMTP connections that are reserved for connections from the hosts
28378 that are specified in <option>smtp_reserve_hosts</option>. The value set in
28379 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
28380 restricted to this number of connections; the option specifies a minimum number
28381 of connection slots for them, not a maximum. It is a guarantee that this group
28382 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
28383 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
28384 individual host.
28385 </para>
28386 <para>
28387 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
28388 set to 5, once there are 45 active connections (from any hosts), new
28389 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
28390 provided the other criteria for acceptance are met.
28391 </para>
28392 <para>
28393 <indexterm role="option">
28394 <primary><option>smtp_active_hostname</option></primary>
28395 </indexterm>
28396 </para>
28397 <informaltable frame="all">
28398 <tgroup cols="4" colsep="0" rowsep="0">
28399 <colspec colwidth="8*" align="left"/>
28400 <colspec colwidth="6*" align="center"/>
28401 <colspec colwidth="6*" align="center"/>
28402 <colspec colwidth="6*" align="right"/>
28403 <tbody>
28404 <row>
28405 <entry><option>smtp_active_hostname</option></entry>
28406 <entry>Use: <emphasis>main</emphasis></entry>
28407 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28408 <entry>Default: <emphasis>unset</emphasis></entry>
28409 </row>
28410 </tbody>
28411 </tgroup>
28412 </informaltable>
28413 <para>
28414 <indexterm role="concept">
28415 <primary>host</primary>
28416 <secondary>name in SMTP responses</secondary>
28417 </indexterm>
28418 <indexterm role="concept">
28419 <primary>SMTP</primary>
28420 <secondary>host name in responses</secondary>
28421 </indexterm>
28422 <indexterm role="variable">
28423 <primary><varname>$primary_hostname</varname></primary>
28424 </indexterm>
28425 This option is provided for multi-homed servers that want to masquerade as
28426 several different hosts. At the start of an incoming SMTP connection, its value
28427 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
28428 responses. For example, it is used as domain name in the response to an
28429 incoming HELO or EHLO command.
28430 </para>
28431 <para>
28432 <indexterm role="variable">
28433 <primary><varname>$smtp_active_hostname</varname></primary>
28434 </indexterm>
28435 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
28436 is saved with any messages that are received. It is therefore available for use
28437 in routers and transports when the message is later delivered.
28438 </para>
28439 <para>
28440 If this option is unset, or if its expansion is forced to fail, or if the
28441 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
28442 used. Other expansion failures cause a message to be written to the main and
28443 panic logs, and the SMTP command receives a temporary error. Typically, the
28444 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
28445 For example:
28446 </para>
28447 <literallayout class="monospaced">
28448 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
28449   {cox.mydomain}{box.mydomain}}
28450 </literallayout>
28451 <para>
28452 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
28453 messages, it is also used as the default for HELO commands in callout
28454 verification if there is no remote transport from which to obtain a
28455 <option>helo_data</option> value.
28456 </para>
28457 <para>
28458 <indexterm role="option">
28459 <primary><option>smtp_banner</option></primary>
28460 </indexterm>
28461 </para>
28462 <informaltable frame="all">
28463 <tgroup cols="4" colsep="0" rowsep="0">
28464 <colspec colwidth="8*" align="left"/>
28465 <colspec colwidth="6*" align="center"/>
28466 <colspec colwidth="6*" align="center"/>
28467 <colspec colwidth="6*" align="right"/>
28468 <tbody>
28469 <row>
28470 <entry><option>smtp_banner</option></entry>
28471 <entry>Use: <emphasis>main</emphasis></entry>
28472 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28473 <entry>Default: <emphasis>see below</emphasis></entry>
28474 </row>
28475 </tbody>
28476 </tgroup>
28477 </informaltable>
28478 <para>
28479 <indexterm role="concept">
28480 <primary>SMTP</primary>
28481 <secondary>welcome banner</secondary>
28482 </indexterm>
28483 <indexterm role="concept">
28484 <primary>banner for SMTP</primary>
28485 </indexterm>
28486 <indexterm role="concept">
28487 <primary>welcome banner for SMTP</primary>
28488 </indexterm>
28489 <indexterm role="concept">
28490 <primary>customizing</primary>
28491 <secondary>SMTP banner</secondary>
28492 </indexterm>
28493 This string, which is expanded every time it is used, is output as the initial
28494 positive response to an SMTP connection. The default setting is:
28495 </para>
28496 <literallayout class="monospaced">
28497 smtp_banner = $smtp_active_hostname ESMTP Exim \
28498   $version_number $tod_full
28499 </literallayout>
28500 <para>
28501 Failure to expand the string causes a panic error. If you want to create a
28502 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
28503 appropriate points, but not at the end. Note that the 220 code is not included
28504 in this string. Exim adds it automatically (several times in the case of a
28505 multiline response).
28506 </para>
28507 <para>
28508 <indexterm role="option">
28509 <primary><option>smtp_check_spool_space</option></primary>
28510 </indexterm>
28511 </para>
28512 <informaltable frame="all">
28513 <tgroup cols="4" colsep="0" rowsep="0">
28514 <colspec colwidth="8*" align="left"/>
28515 <colspec colwidth="6*" align="center"/>
28516 <colspec colwidth="6*" align="center"/>
28517 <colspec colwidth="6*" align="right"/>
28518 <tbody>
28519 <row>
28520 <entry><option>smtp_check_spool_space</option></entry>
28521 <entry>Use: <emphasis>main</emphasis></entry>
28522 <entry>Type: <emphasis>boolean</emphasis></entry>
28523 <entry>Default: <emphasis>true</emphasis></entry>
28524 </row>
28525 </tbody>
28526 </tgroup>
28527 </informaltable>
28528 <para>
28529 <indexterm role="concept">
28530 <primary>checking disk space</primary>
28531 </indexterm>
28532 <indexterm role="concept">
28533 <primary>disk space, checking</primary>
28534 </indexterm>
28535 <indexterm role="concept">
28536 <primary>spool directory</primary>
28537 <secondary>checking space</secondary>
28538 </indexterm>
28539 When this option is set, if an incoming SMTP session encounters the SIZE
28540 option on a MAIL command, it checks that there is enough space in the
28541 spool directory&#x2019;s partition to accept a message of that size, while still
28542 leaving free the amount specified by <option>check_spool_space</option> (even if that value
28543 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
28544 </para>
28545 <para>
28546 <indexterm role="option">
28547 <primary><option>smtp_connect_backlog</option></primary>
28548 </indexterm>
28549 </para>
28550 <informaltable frame="all">
28551 <tgroup cols="4" colsep="0" rowsep="0">
28552 <colspec colwidth="8*" align="left"/>
28553 <colspec colwidth="6*" align="center"/>
28554 <colspec colwidth="6*" align="center"/>
28555 <colspec colwidth="6*" align="right"/>
28556 <tbody>
28557 <row>
28558 <entry><option>smtp_connect_backlog</option></entry>
28559 <entry>Use: <emphasis>main</emphasis></entry>
28560 <entry>Type: <emphasis>integer</emphasis></entry>
28561 <entry>Default: <emphasis>20</emphasis></entry>
28562 </row>
28563 </tbody>
28564 </tgroup>
28565 </informaltable>
28566 <para>
28567 <indexterm role="concept">
28568 <primary>connection backlog</primary>
28569 </indexterm>
28570 <indexterm role="concept">
28571 <primary>SMTP</primary>
28572 <secondary>connection backlog</secondary>
28573 </indexterm>
28574 <indexterm role="concept">
28575 <primary>backlog of connections</primary>
28576 </indexterm>
28577 This option specifies a maximum number of waiting SMTP connections. Exim passes
28578 this value to the TCP/IP system when it sets up its listener. Once this number
28579 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
28580 attempts are refused at the TCP/IP level. At least, that is what the manuals
28581 say; in some circumstances such connection attempts have been observed to time
28582 out instead. For large systems it is probably a good idea to increase the
28583 value (to 50, say). It also gives some protection against denial-of-service
28584 attacks by SYN flooding.
28585 </para>
28586 <para>
28587 <indexterm role="option">
28588 <primary><option>smtp_enforce_sync</option></primary>
28589 </indexterm>
28590 </para>
28591 <informaltable frame="all">
28592 <tgroup cols="4" colsep="0" rowsep="0">
28593 <colspec colwidth="8*" align="left"/>
28594 <colspec colwidth="6*" align="center"/>
28595 <colspec colwidth="6*" align="center"/>
28596 <colspec colwidth="6*" align="right"/>
28597 <tbody>
28598 <row>
28599 <entry><option>smtp_enforce_sync</option></entry>
28600 <entry>Use: <emphasis>main</emphasis></entry>
28601 <entry>Type: <emphasis>boolean</emphasis></entry>
28602 <entry>Default: <emphasis>true</emphasis></entry>
28603 </row>
28604 </tbody>
28605 </tgroup>
28606 </informaltable>
28607 <para>
28608 <indexterm role="concept">
28609 <primary>SMTP</primary>
28610 <secondary>synchronization checking</secondary>
28611 </indexterm>
28612 <indexterm role="concept">
28613 <primary>synchronization checking in SMTP</primary>
28614 </indexterm>
28615 The SMTP protocol specification requires the client to wait for a response from
28616 the server at certain points in the dialogue. Without PIPELINING these
28617 synchronization points are after every command; with PIPELINING they are
28618 fewer, but they still exist.
28619 </para>
28620 <para>
28621 Some spamming sites send out a complete set of SMTP commands without waiting
28622 for any response. Exim protects against this by rejecting a message if the
28623 client has sent further input when it should not have. The error response <quote>554
28624 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
28625 for this error cannot be perfect because of transmission delays (unexpected
28626 input may be on its way but not yet received when Exim checks). However, it
28627 does detect many instances.
28628 </para>
28629 <para>
28630 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
28631 If you want to disable the check selectively (for example, only for certain
28632 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
28633 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
28634 </para>
28635 <para>
28636 <indexterm role="option">
28637 <primary><option>smtp_etrn_command</option></primary>
28638 </indexterm>
28639 </para>
28640 <informaltable frame="all">
28641 <tgroup cols="4" colsep="0" rowsep="0">
28642 <colspec colwidth="8*" align="left"/>
28643 <colspec colwidth="6*" align="center"/>
28644 <colspec colwidth="6*" align="center"/>
28645 <colspec colwidth="6*" align="right"/>
28646 <tbody>
28647 <row>
28648 <entry><option>smtp_etrn_command</option></entry>
28649 <entry>Use: <emphasis>main</emphasis></entry>
28650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28651 <entry>Default: <emphasis>unset</emphasis></entry>
28652 </row>
28653 </tbody>
28654 </tgroup>
28655 </informaltable>
28656 <para>
28657 <indexterm role="concept">
28658 <primary>ETRN</primary>
28659 <secondary>command to be run</secondary>
28660 </indexterm>
28661 <indexterm role="variable">
28662 <primary><varname>$domain</varname></primary>
28663 </indexterm>
28664 If this option is set, the given command is run whenever an SMTP ETRN
28665 command is received from a host that is permitted to issue such commands (see
28666 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
28667 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
28668 argument of the ETRN command, and no syntax checking is done on it. For
28669 example:
28670 </para>
28671 <literallayout class="monospaced">
28672 smtp_etrn_command = /etc/etrn_command $domain \
28673                     $sender_host_address
28674 </literallayout>
28675 <para>
28676 A new process is created to run the command, but Exim does not wait for it to
28677 complete. Consequently, its status cannot be checked. If the command cannot be
28678 run, a line is written to the panic log, but the ETRN caller still receives
28679 a 250 success response. Exim is normally running under its own uid when
28680 receiving SMTP, so it is not possible for it to change the uid before running
28681 the command.
28682 </para>
28683 <para>
28684 <indexterm role="option">
28685 <primary><option>smtp_etrn_serialize</option></primary>
28686 </indexterm>
28687 </para>
28688 <informaltable frame="all">
28689 <tgroup cols="4" colsep="0" rowsep="0">
28690 <colspec colwidth="8*" align="left"/>
28691 <colspec colwidth="6*" align="center"/>
28692 <colspec colwidth="6*" align="center"/>
28693 <colspec colwidth="6*" align="right"/>
28694 <tbody>
28695 <row>
28696 <entry><option>smtp_etrn_serialize</option></entry>
28697 <entry>Use: <emphasis>main</emphasis></entry>
28698 <entry>Type: <emphasis>boolean</emphasis></entry>
28699 <entry>Default: <emphasis>true</emphasis></entry>
28700 </row>
28701 </tbody>
28702 </tgroup>
28703 </informaltable>
28704 <para>
28705 <indexterm role="concept">
28706 <primary>ETRN</primary>
28707 <secondary>serializing</secondary>
28708 </indexterm>
28709 When this option is set, it prevents the simultaneous execution of more than
28710 one identical command as a result of ETRN in an SMTP connection. See
28711 section <xref linkend="SECTETRN"/> for details.
28712 </para>
28713 <para>
28714 <indexterm role="option">
28715 <primary><option>smtp_load_reserve</option></primary>
28716 </indexterm>
28717 </para>
28718 <informaltable frame="all">
28719 <tgroup cols="4" colsep="0" rowsep="0">
28720 <colspec colwidth="8*" align="left"/>
28721 <colspec colwidth="6*" align="center"/>
28722 <colspec colwidth="6*" align="center"/>
28723 <colspec colwidth="6*" align="right"/>
28724 <tbody>
28725 <row>
28726 <entry><option>smtp_load_reserve</option></entry>
28727 <entry>Use: <emphasis>main</emphasis></entry>
28728 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28729 <entry>Default: <emphasis>unset</emphasis></entry>
28730 </row>
28731 </tbody>
28732 </tgroup>
28733 </informaltable>
28734 <para>
28735 <indexterm role="concept">
28736 <primary>load average</primary>
28737 </indexterm>
28738 If the system load average ever gets higher than this, incoming SMTP calls are
28739 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
28740 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
28741 the load is over the limit. The option has no effect on ancient operating
28742 systems on which Exim cannot determine the load average. See also
28743 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
28744 </para>
28745 <para>
28746 <indexterm role="option">
28747 <primary><option>smtp_max_synprot_errors</option></primary>
28748 </indexterm>
28749 </para>
28750 <informaltable frame="all">
28751 <tgroup cols="4" colsep="0" rowsep="0">
28752 <colspec colwidth="8*" align="left"/>
28753 <colspec colwidth="6*" align="center"/>
28754 <colspec colwidth="6*" align="center"/>
28755 <colspec colwidth="6*" align="right"/>
28756 <tbody>
28757 <row>
28758 <entry><option>smtp_max_synprot_errors</option></entry>
28759 <entry>Use: <emphasis>main</emphasis></entry>
28760 <entry>Type: <emphasis>integer</emphasis></entry>
28761 <entry>Default: <emphasis>3</emphasis></entry>
28762 </row>
28763 </tbody>
28764 </tgroup>
28765 </informaltable>
28766 <para>
28767 <indexterm role="concept">
28768 <primary>SMTP</primary>
28769 <secondary>limiting syntax and protocol errors</secondary>
28770 </indexterm>
28771 <indexterm role="concept">
28772 <primary>limit</primary>
28773 <secondary>SMTP syntax and protocol errors</secondary>
28774 </indexterm>
28775 Exim rejects SMTP commands that contain syntax or protocol errors. In
28776 particular, a syntactically invalid email address, as in this command:
28777 </para>
28778 <literallayout class="monospaced">
28779 RCPT TO:&lt;abc xyz@a.b.c&gt;
28780 </literallayout>
28781 <para>
28782 causes immediate rejection of the command, before any other tests are done.
28783 (The ACL cannot be run if there is no valid address to set up for it.) An
28784 example of a protocol error is receiving RCPT before MAIL. If there are
28785 too many syntax or protocol errors in one SMTP session, the connection is
28786 dropped. The limit is set by this option.
28787 </para>
28788 <para>
28789 <indexterm role="concept">
28790 <primary>PIPELINING</primary>
28791 <secondary>expected errors</secondary>
28792 </indexterm>
28793 When the PIPELINING extension to SMTP is in use, some protocol errors are
28794 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
28795 Exim assumes that PIPELINING will be used if it advertises it (see
28796 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
28797 not count towards the limit.
28798 </para>
28799 <para>
28800 <indexterm role="option">
28801 <primary><option>smtp_max_unknown_commands</option></primary>
28802 </indexterm>
28803 </para>
28804 <informaltable frame="all">
28805 <tgroup cols="4" colsep="0" rowsep="0">
28806 <colspec colwidth="8*" align="left"/>
28807 <colspec colwidth="6*" align="center"/>
28808 <colspec colwidth="6*" align="center"/>
28809 <colspec colwidth="6*" align="right"/>
28810 <tbody>
28811 <row>
28812 <entry><option>smtp_max_unknown_commands</option></entry>
28813 <entry>Use: <emphasis>main</emphasis></entry>
28814 <entry>Type: <emphasis>integer</emphasis></entry>
28815 <entry>Default: <emphasis>3</emphasis></entry>
28816 </row>
28817 </tbody>
28818 </tgroup>
28819 </informaltable>
28820 <para>
28821 <indexterm role="concept">
28822 <primary>SMTP</primary>
28823 <secondary>limiting unknown commands</secondary>
28824 </indexterm>
28825 <indexterm role="concept">
28826 <primary>limit</primary>
28827 <secondary>unknown SMTP commands</secondary>
28828 </indexterm>
28829 If there are too many unrecognized commands in an incoming SMTP session, an
28830 Exim server drops the connection. This is a defence against some kinds of abuse
28831 that subvert web
28832 clients
28833 into making connections to SMTP ports; in these circumstances, a number of
28834 non-SMTP command lines are sent first.
28835 </para>
28836 <para>
28837 <indexterm role="option">
28838 <primary><option>smtp_ratelimit_hosts</option></primary>
28839 </indexterm>
28840 </para>
28841 <informaltable frame="all">
28842 <tgroup cols="4" colsep="0" rowsep="0">
28843 <colspec colwidth="8*" align="left"/>
28844 <colspec colwidth="6*" align="center"/>
28845 <colspec colwidth="6*" align="center"/>
28846 <colspec colwidth="6*" align="right"/>
28847 <tbody>
28848 <row>
28849 <entry><option>smtp_ratelimit_hosts</option></entry>
28850 <entry>Use: <emphasis>main</emphasis></entry>
28851 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28852 <entry>Default: <emphasis>unset</emphasis></entry>
28853 </row>
28854 </tbody>
28855 </tgroup>
28856 </informaltable>
28857 <para>
28858 <indexterm role="concept">
28859 <primary>SMTP</primary>
28860 <secondary>rate limiting</secondary>
28861 </indexterm>
28862 <indexterm role="concept">
28863 <primary>limit</primary>
28864 <secondary>rate of message arrival</secondary>
28865 </indexterm>
28866 <indexterm role="concept">
28867 <primary>RCPT</primary>
28868 <secondary>rate limiting</secondary>
28869 </indexterm>
28870 Some sites find it helpful to be able to limit the rate at which certain hosts
28871 can send them messages, and the rate at which an individual message can specify
28872 recipients.
28873 </para>
28874 <para>
28875 Exim has two rate-limiting facilities. This section describes the older
28876 facility, which can limit rates within a single connection. The newer
28877 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
28878 <xref linkend="SECTratelimiting"/> for details of the newer facility.
28879 </para>
28880 <para>
28881 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
28882 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
28883 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
28884 respectively. Each option, if set, must contain a set of four comma-separated
28885 values:
28886 </para>
28887 <itemizedlist>
28888 <listitem>
28889 <para>
28890 A threshold, before which there is no rate limiting.
28891 </para>
28892 </listitem>
28893 <listitem>
28894 <para>
28895 An initial time delay. Unlike other times in Exim, numbers with decimal
28896 fractional parts are allowed here.
28897 </para>
28898 </listitem>
28899 <listitem>
28900 <para>
28901 A factor by which to increase the delay each time.
28902 </para>
28903 </listitem>
28904 <listitem>
28905 <para>
28906 A maximum value for the delay. This should normally be less than 5 minutes,
28907 because after that time, the client is liable to timeout the SMTP command.
28908 </para>
28909 </listitem>
28910 </itemizedlist>
28911 <para>
28912 For example, these settings have been used successfully at the site which
28913 first suggested this feature, for controlling mail from their customers:
28914 </para>
28915 <literallayout class="monospaced">
28916 smtp_ratelimit_mail = 2,0.5s,1.05,4m
28917 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
28918 </literallayout>
28919 <para>
28920 The first setting specifies delays that are applied to MAIL commands after
28921 two have been received over a single connection. The initial delay is 0.5
28922 seconds, increasing by a factor of 1.05 each time. The second setting applies
28923 delays to RCPT commands when more than four occur in a single message.
28924 </para>
28925 <para>
28926 <indexterm role="option">
28927 <primary><option>smtp_ratelimit_mail</option></primary>
28928 </indexterm>
28929 </para>
28930 <informaltable frame="all">
28931 <tgroup cols="4" colsep="0" rowsep="0">
28932 <colspec colwidth="8*" align="left"/>
28933 <colspec colwidth="6*" align="center"/>
28934 <colspec colwidth="6*" align="center"/>
28935 <colspec colwidth="6*" align="right"/>
28936 <tbody>
28937 <row>
28938 <entry><option>smtp_ratelimit_mail</option></entry>
28939 <entry>Use: <emphasis>main</emphasis></entry>
28940 <entry>Type: <emphasis>string</emphasis></entry>
28941 <entry>Default: <emphasis>unset</emphasis></entry>
28942 </row>
28943 </tbody>
28944 </tgroup>
28945 </informaltable>
28946 <para>
28947 See <option>smtp_ratelimit_hosts</option> above.
28948 </para>
28949 <para>
28950 <indexterm role="option">
28951 <primary><option>smtp_ratelimit_rcpt</option></primary>
28952 </indexterm>
28953 </para>
28954 <informaltable frame="all">
28955 <tgroup cols="4" colsep="0" rowsep="0">
28956 <colspec colwidth="8*" align="left"/>
28957 <colspec colwidth="6*" align="center"/>
28958 <colspec colwidth="6*" align="center"/>
28959 <colspec colwidth="6*" align="right"/>
28960 <tbody>
28961 <row>
28962 <entry><option>smtp_ratelimit_rcpt</option></entry>
28963 <entry>Use: <emphasis>main</emphasis></entry>
28964 <entry>Type: <emphasis>string</emphasis></entry>
28965 <entry>Default: <emphasis>unset</emphasis></entry>
28966 </row>
28967 </tbody>
28968 </tgroup>
28969 </informaltable>
28970 <para>
28971 See <option>smtp_ratelimit_hosts</option> above.
28972 </para>
28973 <para>
28974 <indexterm role="option">
28975 <primary><option>smtp_receive_timeout</option></primary>
28976 </indexterm>
28977 </para>
28978 <informaltable frame="all">
28979 <tgroup cols="4" colsep="0" rowsep="0">
28980 <colspec colwidth="8*" align="left"/>
28981 <colspec colwidth="6*" align="center"/>
28982 <colspec colwidth="6*" align="center"/>
28983 <colspec colwidth="6*" align="right"/>
28984 <tbody>
28985 <row>
28986 <entry><option>smtp_receive_timeout</option></entry>
28987 <entry>Use: <emphasis>main</emphasis></entry>
28988 <entry>Type: <emphasis>time</emphasis></entry>
28989 <entry>Default: <emphasis>5m</emphasis></entry>
28990 </row>
28991 </tbody>
28992 </tgroup>
28993 </informaltable>
28994 <para>
28995 <indexterm role="concept">
28996 <primary>timeout</primary>
28997 <secondary>for SMTP input</secondary>
28998 </indexterm>
28999 <indexterm role="concept">
29000 <primary>SMTP</primary>
29001 <secondary>input timeout</secondary>
29002 </indexterm>
29003 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
29004 input, including batch SMTP. If a line of input (either an SMTP command or a
29005 data line) is not received within this time, the SMTP connection is dropped and
29006 the message is abandoned.
29007 A line is written to the log containing one of the following messages:
29008 </para>
29009 <literallayout class="monospaced">
29010 SMTP command timeout on connection from...
29011 SMTP data timeout on connection from...
29012 </literallayout>
29013 <para>
29014 The former means that Exim was expecting to read an SMTP command; the latter
29015 means that it was in the DATA phase, reading the contents of a message.
29016 </para>
29017 <para>
29018 <indexterm role="option">
29019 <primary><option>-os</option></primary>
29020 </indexterm>
29021 The value set by this option can be overridden by the
29022 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
29023 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
29024 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
29025 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
29026 </para>
29027 <para>
29028 <indexterm role="option">
29029 <primary><option>smtp_reserve_hosts</option></primary>
29030 </indexterm>
29031 </para>
29032 <informaltable frame="all">
29033 <tgroup cols="4" colsep="0" rowsep="0">
29034 <colspec colwidth="8*" align="left"/>
29035 <colspec colwidth="6*" align="center"/>
29036 <colspec colwidth="6*" align="center"/>
29037 <colspec colwidth="6*" align="right"/>
29038 <tbody>
29039 <row>
29040 <entry><option>smtp_reserve_hosts</option></entry>
29041 <entry>Use: <emphasis>main</emphasis></entry>
29042 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29043 <entry>Default: <emphasis>unset</emphasis></entry>
29044 </row>
29045 </tbody>
29046 </tgroup>
29047 </informaltable>
29048 <para>
29049 This option defines hosts for which SMTP connections are reserved; see
29050 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
29051 </para>
29052 <para>
29053 <indexterm role="option">
29054 <primary><option>smtp_return_error_details</option></primary>
29055 </indexterm>
29056 </para>
29057 <informaltable frame="all">
29058 <tgroup cols="4" colsep="0" rowsep="0">
29059 <colspec colwidth="8*" align="left"/>
29060 <colspec colwidth="6*" align="center"/>
29061 <colspec colwidth="6*" align="center"/>
29062 <colspec colwidth="6*" align="right"/>
29063 <tbody>
29064 <row>
29065 <entry><option>smtp_return_error_details</option></entry>
29066 <entry>Use: <emphasis>main</emphasis></entry>
29067 <entry>Type: <emphasis>boolean</emphasis></entry>
29068 <entry>Default: <emphasis>false</emphasis></entry>
29069 </row>
29070 </tbody>
29071 </tgroup>
29072 </informaltable>
29073 <para>
29074 <indexterm role="concept">
29075 <primary>SMTP</primary>
29076 <secondary>details policy failures</secondary>
29077 </indexterm>
29078 <indexterm role="concept">
29079 <primary>policy control</primary>
29080 <secondary>rejection, returning details</secondary>
29081 </indexterm>
29082 In the default state, Exim uses bland messages such as
29083 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
29084 reasons. Many sysadmins like this because it gives away little information
29085 to spammers. However, some other sysadmins who are applying strict checking
29086 policies want to give out much fuller information about failures. Setting
29087 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
29088 example, instead of <quote>Administrative prohibition</quote>, it might give:
29089 </para>
29090 <literallayout class="monospaced">
29091 550-Rejected after DATA: '&gt;' missing at end of address:
29092 550 failing address in "From" header is: &lt;user@dom.ain
29093 </literallayout>
29094 <para>
29095 <indexterm role="option">
29096 <primary><option>spamd_address</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>spamd_address</option></entry>
29108 <entry>Use: <emphasis>main</emphasis></entry>
29109 <entry>Type: <emphasis>string</emphasis></entry>
29110 <entry>Default: <emphasis>see below</emphasis></entry>
29111 </row>
29112 </tbody>
29113 </tgroup>
29114 </informaltable>
29115 <para>
29116 This option is available when Exim is compiled with the content-scanning
29117 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
29118 The default value is
29119 </para>
29120 <literallayout class="monospaced">
29121 127.0.0.1 783
29122 </literallayout>
29123 <para>
29124 See section <xref linkend="SECTscanspamass"/> for more details.
29125 </para>
29126 <para>
29127 <indexterm role="option">
29128 <primary><option>split_spool_directory</option></primary>
29129 </indexterm>
29130 </para>
29131 <informaltable frame="all">
29132 <tgroup cols="4" colsep="0" rowsep="0">
29133 <colspec colwidth="8*" align="left"/>
29134 <colspec colwidth="6*" align="center"/>
29135 <colspec colwidth="6*" align="center"/>
29136 <colspec colwidth="6*" align="right"/>
29137 <tbody>
29138 <row>
29139 <entry><option>split_spool_directory</option></entry>
29140 <entry>Use: <emphasis>main</emphasis></entry>
29141 <entry>Type: <emphasis>boolean</emphasis></entry>
29142 <entry>Default: <emphasis>false</emphasis></entry>
29143 </row>
29144 </tbody>
29145 </tgroup>
29146 </informaltable>
29147 <para>
29148 <indexterm role="concept">
29149 <primary>multiple spool directories</primary>
29150 </indexterm>
29151 <indexterm role="concept">
29152 <primary>spool directory</primary>
29153 <secondary>split</secondary>
29154 </indexterm>
29155 <indexterm role="concept">
29156 <primary>directories, multiple</primary>
29157 </indexterm>
29158 If this option is set, it causes Exim to split its input directory into 62
29159 subdirectories, each with a single alphanumeric character as its name. The
29160 sixth character of the message id is used to allocate messages to
29161 subdirectories; this is the least significant base-62 digit of the time of
29162 arrival of the message.
29163 </para>
29164 <para>
29165 Splitting up the spool in this way may provide better performance on systems
29166 where there are long mail queues, by reducing the number of files in any one
29167 directory. The msglog directory is also split up in a similar way to the input
29168 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
29169 are still placed in the single directory <filename>msglog.OLD</filename>.
29170 </para>
29171 <para>
29172 It is not necessary to take any special action for existing messages when
29173 changing <option>split_spool_directory</option>. Exim notices messages that are in the
29174 <quote>wrong</quote> place, and continues to process them. If the option is turned off
29175 after a period of being on, the subdirectories will eventually empty and be
29176 automatically deleted.
29177 </para>
29178 <para>
29179 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
29180 changes. Instead of creating a list of all messages in the queue, and then
29181 trying to deliver each one in turn, it constructs a list of those in one
29182 sub-directory and tries to deliver them, before moving on to the next
29183 sub-directory. The sub-directories are processed in a random order. This
29184 spreads out the scanning of the input directories, and uses less memory. It is
29185 particularly beneficial when there are lots of messages on the queue. However,
29186 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
29187 entire queue has to be scanned and sorted before any deliveries can start.
29188 </para>
29189 <para>
29190 <indexterm role="option">
29191 <primary><option>spool_directory</option></primary>
29192 </indexterm>
29193 </para>
29194 <informaltable frame="all">
29195 <tgroup cols="4" colsep="0" rowsep="0">
29196 <colspec colwidth="8*" align="left"/>
29197 <colspec colwidth="6*" align="center"/>
29198 <colspec colwidth="6*" align="center"/>
29199 <colspec colwidth="6*" align="right"/>
29200 <tbody>
29201 <row>
29202 <entry><option>spool_directory</option></entry>
29203 <entry>Use: <emphasis>main</emphasis></entry>
29204 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29205 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29206 </row>
29207 </tbody>
29208 </tgroup>
29209 </informaltable>
29210 <para>
29211 <indexterm role="concept">
29212 <primary>spool directory</primary>
29213 <secondary>path to</secondary>
29214 </indexterm>
29215 This defines the directory in which Exim keeps its spool, that is, the messages
29216 it is waiting to deliver. The default value is taken from the compile-time
29217 configuration setting, if there is one. If not, this option must be set. The
29218 string is expanded, so it can contain, for example, a reference to
29219 <varname>$primary_hostname</varname>.
29220 </para>
29221 <para>
29222 If the spool directory name is fixed on your installation, it is recommended
29223 that you set it at build time rather than from this option, particularly if the
29224 log files are being written to the spool directory (see <option>log_file_path</option>).
29225 Otherwise log files cannot be used for errors that are detected early on, such
29226 as failures in the configuration file.
29227 </para>
29228 <para>
29229 By using this option to override the compiled-in path, it is possible to run
29230 tests of Exim without using the standard spool.
29231 </para>
29232 <para>
29233 <indexterm role="option">
29234 <primary><option>sqlite_lock_timeout</option></primary>
29235 </indexterm>
29236 </para>
29237 <informaltable frame="all">
29238 <tgroup cols="4" colsep="0" rowsep="0">
29239 <colspec colwidth="8*" align="left"/>
29240 <colspec colwidth="6*" align="center"/>
29241 <colspec colwidth="6*" align="center"/>
29242 <colspec colwidth="6*" align="right"/>
29243 <tbody>
29244 <row>
29245 <entry><option>sqlite_lock_timeout</option></entry>
29246 <entry>Use: <emphasis>main</emphasis></entry>
29247 <entry>Type: <emphasis>time</emphasis></entry>
29248 <entry>Default: <emphasis>5s</emphasis></entry>
29249 </row>
29250 </tbody>
29251 </tgroup>
29252 </informaltable>
29253 <para>
29254 <indexterm role="concept">
29255 <primary>sqlite lookup type</primary>
29256 <secondary>lock timeout</secondary>
29257 </indexterm>
29258 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
29259 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
29260 </para>
29261 <para>
29262 <indexterm role="option">
29263 <primary><option>strict_acl_vars</option></primary>
29264 </indexterm>
29265 </para>
29266 <informaltable frame="all">
29267 <tgroup cols="4" colsep="0" rowsep="0">
29268 <colspec colwidth="8*" align="left"/>
29269 <colspec colwidth="6*" align="center"/>
29270 <colspec colwidth="6*" align="center"/>
29271 <colspec colwidth="6*" align="right"/>
29272 <tbody>
29273 <row>
29274 <entry><option>strict_acl_vars</option></entry>
29275 <entry>Use: <emphasis>main</emphasis></entry>
29276 <entry>Type: <emphasis>boolean</emphasis></entry>
29277 <entry>Default: <emphasis>false</emphasis></entry>
29278 </row>
29279 </tbody>
29280 </tgroup>
29281 </informaltable>
29282 <para>
29283 <indexterm role="concept">
29284 <primary>access control lists (ACLs)</primary>
29285 <secondary>variables, handling unset</secondary>
29286 </indexterm>
29287 This option controls what happens if a syntactically valid but undefined ACL
29288 variable is referenced. If it is false (the default), an empty string
29289 is substituted; if it is true, an error is generated. See section
29290 <xref linkend="SECTaclvariables"/> for details of ACL variables.
29291 </para>
29292 <para>
29293 <indexterm role="option">
29294 <primary><option>strip_excess_angle_brackets</option></primary>
29295 </indexterm>
29296 </para>
29297 <informaltable frame="all">
29298 <tgroup cols="4" colsep="0" rowsep="0">
29299 <colspec colwidth="8*" align="left"/>
29300 <colspec colwidth="6*" align="center"/>
29301 <colspec colwidth="6*" align="center"/>
29302 <colspec colwidth="6*" align="right"/>
29303 <tbody>
29304 <row>
29305 <entry><option>strip_excess_angle_brackets</option></entry>
29306 <entry>Use: <emphasis>main</emphasis></entry>
29307 <entry>Type: <emphasis>boolean</emphasis></entry>
29308 <entry>Default: <emphasis>false</emphasis></entry>
29309 </row>
29310 </tbody>
29311 </tgroup>
29312 </informaltable>
29313 <para>
29314 <indexterm role="concept">
29315 <primary>angle brackets, excess</primary>
29316 </indexterm>
29317 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
29318 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
29319 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
29320 passed on to another MTA, the excess angle brackets are not passed on. If this
29321 option is not set, multiple pairs of angle brackets cause a syntax error.
29322 </para>
29323 <para>
29324 <indexterm role="option">
29325 <primary><option>strip_trailing_dot</option></primary>
29326 </indexterm>
29327 </para>
29328 <informaltable frame="all">
29329 <tgroup cols="4" colsep="0" rowsep="0">
29330 <colspec colwidth="8*" align="left"/>
29331 <colspec colwidth="6*" align="center"/>
29332 <colspec colwidth="6*" align="center"/>
29333 <colspec colwidth="6*" align="right"/>
29334 <tbody>
29335 <row>
29336 <entry><option>strip_trailing_dot</option></entry>
29337 <entry>Use: <emphasis>main</emphasis></entry>
29338 <entry>Type: <emphasis>boolean</emphasis></entry>
29339 <entry>Default: <emphasis>false</emphasis></entry>
29340 </row>
29341 </tbody>
29342 </tgroup>
29343 </informaltable>
29344 <para>
29345 <indexterm role="concept">
29346 <primary>trailing dot on domain</primary>
29347 </indexterm>
29348 <indexterm role="concept">
29349 <primary>dot</primary>
29350 <secondary>trailing on domain</secondary>
29351 </indexterm>
29352 If this option is set, a trailing dot at the end of a domain in an address is
29353 ignored. If this is in the envelope and the message is passed on to another
29354 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
29355 domain causes a syntax error.
29356 However, addresses in header lines are checked only when an ACL requests header
29357 syntax checking.
29358 </para>
29359 <para>
29360 <indexterm role="option">
29361 <primary><option>syslog_duplication</option></primary>
29362 </indexterm>
29363 </para>
29364 <informaltable frame="all">
29365 <tgroup cols="4" colsep="0" rowsep="0">
29366 <colspec colwidth="8*" align="left"/>
29367 <colspec colwidth="6*" align="center"/>
29368 <colspec colwidth="6*" align="center"/>
29369 <colspec colwidth="6*" align="right"/>
29370 <tbody>
29371 <row>
29372 <entry><option>syslog_duplication</option></entry>
29373 <entry>Use: <emphasis>main</emphasis></entry>
29374 <entry>Type: <emphasis>boolean</emphasis></entry>
29375 <entry>Default: <emphasis>true</emphasis></entry>
29376 </row>
29377 </tbody>
29378 </tgroup>
29379 </informaltable>
29380 <para>
29381 <indexterm role="concept">
29382 <primary>syslog</primary>
29383 <secondary>duplicate log lines; suppressing</secondary>
29384 </indexterm>
29385 When Exim is logging to syslog, it writes the log lines for its three
29386 separate logs at different syslog priorities so that they can in principle
29387 be separated on the logging hosts. Some installations do not require this
29388 separation, and in those cases, the duplication of certain log lines is a
29389 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
29390 particular log line is written to syslog. For lines that normally go to
29391 both the main log and the reject log, the reject log version (possibly
29392 containing message header lines) is written, at LOG_NOTICE priority.
29393 Lines that normally go to both the main and the panic log are written at
29394 the LOG_ALERT priority.
29395 </para>
29396 <para>
29397 <indexterm role="option">
29398 <primary><option>syslog_facility</option></primary>
29399 </indexterm>
29400 </para>
29401 <informaltable frame="all">
29402 <tgroup cols="4" colsep="0" rowsep="0">
29403 <colspec colwidth="8*" align="left"/>
29404 <colspec colwidth="6*" align="center"/>
29405 <colspec colwidth="6*" align="center"/>
29406 <colspec colwidth="6*" align="right"/>
29407 <tbody>
29408 <row>
29409 <entry><option>syslog_facility</option></entry>
29410 <entry>Use: <emphasis>main</emphasis></entry>
29411 <entry>Type: <emphasis>string</emphasis></entry>
29412 <entry>Default: <emphasis>unset</emphasis></entry>
29413 </row>
29414 </tbody>
29415 </tgroup>
29416 </informaltable>
29417 <para>
29418 <indexterm role="concept">
29419 <primary>syslog</primary>
29420 <secondary>facility; setting</secondary>
29421 </indexterm>
29422 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
29423 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
29424 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
29425 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
29426 details of Exim&#x2019;s logging.
29427 </para>
29428 <para>
29429 <indexterm role="option">
29430 <primary><option>syslog_processname</option></primary>
29431 </indexterm>
29432 </para>
29433 <informaltable frame="all">
29434 <tgroup cols="4" colsep="0" rowsep="0">
29435 <colspec colwidth="8*" align="left"/>
29436 <colspec colwidth="6*" align="center"/>
29437 <colspec colwidth="6*" align="center"/>
29438 <colspec colwidth="6*" align="right"/>
29439 <tbody>
29440 <row>
29441 <entry><option>syslog_processname</option></entry>
29442 <entry>Use: <emphasis>main</emphasis></entry>
29443 <entry>Type: <emphasis>string</emphasis></entry>
29444 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
29445 </row>
29446 </tbody>
29447 </tgroup>
29448 </informaltable>
29449 <para>
29450 <indexterm role="concept">
29451 <primary>syslog</primary>
29452 <secondary>process name; setting</secondary>
29453 </indexterm>
29454 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
29455 syslog. The value must be no longer than 32 characters. See chapter
29456 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
29457 </para>
29458 <para>
29459 <indexterm role="option">
29460 <primary><option>syslog_timestamp</option></primary>
29461 </indexterm>
29462 </para>
29463 <informaltable frame="all">
29464 <tgroup cols="4" colsep="0" rowsep="0">
29465 <colspec colwidth="8*" align="left"/>
29466 <colspec colwidth="6*" align="center"/>
29467 <colspec colwidth="6*" align="center"/>
29468 <colspec colwidth="6*" align="right"/>
29469 <tbody>
29470 <row>
29471 <entry><option>syslog_timestamp</option></entry>
29472 <entry>Use: <emphasis>main</emphasis></entry>
29473 <entry>Type: <emphasis>boolean</emphasis></entry>
29474 <entry>Default: <emphasis>true</emphasis></entry>
29475 </row>
29476 </tbody>
29477 </tgroup>
29478 </informaltable>
29479 <para>
29480 <indexterm role="concept">
29481 <primary>syslog</primary>
29482 <secondary>timestamps</secondary>
29483 </indexterm>
29484 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
29485 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
29486 details of Exim&#x2019;s logging.
29487 </para>
29488 <para>
29489 <indexterm role="option">
29490 <primary><option>system_filter</option></primary>
29491 </indexterm>
29492 </para>
29493 <informaltable frame="all">
29494 <tgroup cols="4" colsep="0" rowsep="0">
29495 <colspec colwidth="8*" align="left"/>
29496 <colspec colwidth="6*" align="center"/>
29497 <colspec colwidth="6*" align="center"/>
29498 <colspec colwidth="6*" align="right"/>
29499 <tbody>
29500 <row>
29501 <entry><option>system_filter</option></entry>
29502 <entry>Use: <emphasis>main</emphasis></entry>
29503 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29504 <entry>Default: <emphasis>unset</emphasis></entry>
29505 </row>
29506 </tbody>
29507 </tgroup>
29508 </informaltable>
29509 <para>
29510 <indexterm role="concept">
29511 <primary>filter</primary>
29512 <secondary>system filter</secondary>
29513 </indexterm>
29514 <indexterm role="concept">
29515 <primary>system filter</primary>
29516 <secondary>specifying</secondary>
29517 </indexterm>
29518 <indexterm role="concept">
29519 <primary>Sieve filter</primary>
29520 <secondary>not available for system filter</secondary>
29521 </indexterm>
29522 This option specifies an Exim filter file that is applied to all messages at
29523 the start of each delivery attempt, before any routing is done. System filters
29524 must be Exim filters; they cannot be Sieve filters. If the system filter
29525 generates any deliveries to files or pipes, or any new mail messages, the
29526 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
29527 which transports are to be used. Details of this facility are given in chapter
29528 <xref linkend="CHAPsystemfilter"/>.
29529 </para>
29530 <para>
29531 <indexterm role="option">
29532 <primary><option>system_filter_directory_transport</option></primary>
29533 </indexterm>
29534 </para>
29535 <informaltable frame="all">
29536 <tgroup cols="4" colsep="0" rowsep="0">
29537 <colspec colwidth="8*" align="left"/>
29538 <colspec colwidth="6*" align="center"/>
29539 <colspec colwidth="6*" align="center"/>
29540 <colspec colwidth="6*" align="right"/>
29541 <tbody>
29542 <row>
29543 <entry><option>system_filter_directory_transport</option></entry>
29544 <entry>Use: <emphasis>main</emphasis></entry>
29545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29546 <entry>Default: <emphasis>unset</emphasis></entry>
29547 </row>
29548 </tbody>
29549 </tgroup>
29550 </informaltable>
29551 <para>
29552 <indexterm role="variable">
29553 <primary><varname>$address_file</varname></primary>
29554 </indexterm>
29555 This sets the name of the transport driver that is to be used when the
29556 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
29557 implying delivery of each message into a separate file in some directory.
29558 During the delivery, the variable <varname>$address_file</varname> contains the path name.
29559 </para>
29560 <para>
29561 <indexterm role="option">
29562 <primary><option>system_filter_file_transport</option></primary>
29563 </indexterm>
29564 </para>
29565 <informaltable frame="all">
29566 <tgroup cols="4" colsep="0" rowsep="0">
29567 <colspec colwidth="8*" align="left"/>
29568 <colspec colwidth="6*" align="center"/>
29569 <colspec colwidth="6*" align="center"/>
29570 <colspec colwidth="6*" align="right"/>
29571 <tbody>
29572 <row>
29573 <entry><option>system_filter_file_transport</option></entry>
29574 <entry>Use: <emphasis>main</emphasis></entry>
29575 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29576 <entry>Default: <emphasis>unset</emphasis></entry>
29577 </row>
29578 </tbody>
29579 </tgroup>
29580 </informaltable>
29581 <para>
29582 <indexterm role="concept">
29583 <primary>file</primary>
29584 <secondary>transport for system filter</secondary>
29585 </indexterm>
29586 This sets the name of the transport driver that is to be used when the <option>save</option>
29587 command in a system message filter specifies a path not ending in <quote>/</quote>. During
29588 the delivery, the variable <varname>$address_file</varname> contains the path name.
29589 </para>
29590 <para>
29591 <indexterm role="option">
29592 <primary><option>system_filter_group</option></primary>
29593 </indexterm>
29594 </para>
29595 <informaltable frame="all">
29596 <tgroup cols="4" colsep="0" rowsep="0">
29597 <colspec colwidth="8*" align="left"/>
29598 <colspec colwidth="6*" align="center"/>
29599 <colspec colwidth="6*" align="center"/>
29600 <colspec colwidth="6*" align="right"/>
29601 <tbody>
29602 <row>
29603 <entry><option>system_filter_group</option></entry>
29604 <entry>Use: <emphasis>main</emphasis></entry>
29605 <entry>Type: <emphasis>string</emphasis></entry>
29606 <entry>Default: <emphasis>unset</emphasis></entry>
29607 </row>
29608 </tbody>
29609 </tgroup>
29610 </informaltable>
29611 <para>
29612 <indexterm role="concept">
29613 <primary>gid (group id)</primary>
29614 <secondary>system filter</secondary>
29615 </indexterm>
29616 This option is used only when <option>system_filter_user</option> is also set. It sets the
29617 gid under which the system filter is run, overriding any gid that is associated
29618 with the user. The value may be numerical or symbolic.
29619 </para>
29620 <para>
29621 <indexterm role="option">
29622 <primary><option>system_filter_pipe_transport</option></primary>
29623 </indexterm>
29624 </para>
29625 <informaltable frame="all">
29626 <tgroup cols="4" colsep="0" rowsep="0">
29627 <colspec colwidth="8*" align="left"/>
29628 <colspec colwidth="6*" align="center"/>
29629 <colspec colwidth="6*" align="center"/>
29630 <colspec colwidth="6*" align="right"/>
29631 <tbody>
29632 <row>
29633 <entry><option>system_filter_pipe_transport</option></entry>
29634 <entry>Use: <emphasis>main</emphasis></entry>
29635 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29636 <entry>Default: <emphasis>unset</emphasis></entry>
29637 </row>
29638 </tbody>
29639 </tgroup>
29640 </informaltable>
29641 <para>
29642 <indexterm role="concept">
29643 <primary><command>pipe</command> transport</primary>
29644 <secondary>for system filter</secondary>
29645 </indexterm>
29646 <indexterm role="variable">
29647 <primary><varname>$address_pipe</varname></primary>
29648 </indexterm>
29649 This specifies the transport driver that is to be used when a <option>pipe</option> command
29650 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
29651 contains the pipe command.
29652 </para>
29653 <para>
29654 <indexterm role="option">
29655 <primary><option>system_filter_reply_transport</option></primary>
29656 </indexterm>
29657 </para>
29658 <informaltable frame="all">
29659 <tgroup cols="4" colsep="0" rowsep="0">
29660 <colspec colwidth="8*" align="left"/>
29661 <colspec colwidth="6*" align="center"/>
29662 <colspec colwidth="6*" align="center"/>
29663 <colspec colwidth="6*" align="right"/>
29664 <tbody>
29665 <row>
29666 <entry><option>system_filter_reply_transport</option></entry>
29667 <entry>Use: <emphasis>main</emphasis></entry>
29668 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29669 <entry>Default: <emphasis>unset</emphasis></entry>
29670 </row>
29671 </tbody>
29672 </tgroup>
29673 </informaltable>
29674 <para>
29675 <indexterm role="concept">
29676 <primary><command>autoreply</command> transport</primary>
29677 <secondary>for system filter</secondary>
29678 </indexterm>
29679 This specifies the transport driver that is to be used when a <option>mail</option> command
29680 is used in a system filter.
29681 </para>
29682 <para>
29683 <indexterm role="option">
29684 <primary><option>system_filter_user</option></primary>
29685 </indexterm>
29686 </para>
29687 <informaltable frame="all">
29688 <tgroup cols="4" colsep="0" rowsep="0">
29689 <colspec colwidth="8*" align="left"/>
29690 <colspec colwidth="6*" align="center"/>
29691 <colspec colwidth="6*" align="center"/>
29692 <colspec colwidth="6*" align="right"/>
29693 <tbody>
29694 <row>
29695 <entry><option>system_filter_user</option></entry>
29696 <entry>Use: <emphasis>main</emphasis></entry>
29697 <entry>Type: <emphasis>string</emphasis></entry>
29698 <entry>Default: <emphasis>unset</emphasis></entry>
29699 </row>
29700 </tbody>
29701 </tgroup>
29702 </informaltable>
29703 <para>
29704 <indexterm role="concept">
29705 <primary>uid (user id)</primary>
29706 <secondary>system filter</secondary>
29707 </indexterm>
29708 If this option is set to root, the system filter is run in the main Exim
29709 delivery process, as root.  Otherwise, the system filter runs in a separate
29710 process, as the given user, defaulting to the Exim run-time user.
29711 Unless the string consists entirely of digits, it
29712 is looked up in the password data. Failure to find the named user causes a
29713 configuration error. The gid is either taken from the password data, or
29714 specified by <option>system_filter_group</option>. When the uid is specified numerically,
29715 <option>system_filter_group</option> is required to be set.
29716 </para>
29717 <para>
29718 If the system filter generates any pipe, file, or reply deliveries, the uid
29719 under which the filter is run is used when transporting them, unless a
29720 transport option overrides.
29721 </para>
29722 <para>
29723 <indexterm role="option">
29724 <primary><option>tcp_nodelay</option></primary>
29725 </indexterm>
29726 </para>
29727 <informaltable frame="all">
29728 <tgroup cols="4" colsep="0" rowsep="0">
29729 <colspec colwidth="8*" align="left"/>
29730 <colspec colwidth="6*" align="center"/>
29731 <colspec colwidth="6*" align="center"/>
29732 <colspec colwidth="6*" align="right"/>
29733 <tbody>
29734 <row>
29735 <entry><option>tcp_nodelay</option></entry>
29736 <entry>Use: <emphasis>main</emphasis></entry>
29737 <entry>Type: <emphasis>boolean</emphasis></entry>
29738 <entry>Default: <emphasis>true</emphasis></entry>
29739 </row>
29740 </tbody>
29741 </tgroup>
29742 </informaltable>
29743 <para>
29744 <indexterm role="concept">
29745 <primary>daemon</primary>
29746 <secondary>TCP_NODELAY on sockets</secondary>
29747 </indexterm>
29748 <indexterm role="concept">
29749 <primary>Nagle algorithm</primary>
29750 </indexterm>
29751 <indexterm role="concept">
29752 <primary>TCP_NODELAY on listening sockets</primary>
29753 </indexterm>
29754 If this option is set false, it stops the Exim daemon setting the
29755 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
29756 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
29757 performance in interactive (character-by-character) situations. Turning it off
29758 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
29759 However, it appears that some broken clients cannot cope, and time out. Hence
29760 this option. It affects only those sockets that are set up for listening by the
29761 daemon. Sockets created by the smtp transport for delivering mail always set
29762 TCP_NODELAY.
29763 </para>
29764 <para>
29765 <indexterm role="option">
29766 <primary><option>timeout_frozen_after</option></primary>
29767 </indexterm>
29768 </para>
29769 <informaltable frame="all">
29770 <tgroup cols="4" colsep="0" rowsep="0">
29771 <colspec colwidth="8*" align="left"/>
29772 <colspec colwidth="6*" align="center"/>
29773 <colspec colwidth="6*" align="center"/>
29774 <colspec colwidth="6*" align="right"/>
29775 <tbody>
29776 <row>
29777 <entry><option>timeout_frozen_after</option></entry>
29778 <entry>Use: <emphasis>main</emphasis></entry>
29779 <entry>Type: <emphasis>time</emphasis></entry>
29780 <entry>Default: <emphasis>0s</emphasis></entry>
29781 </row>
29782 </tbody>
29783 </tgroup>
29784 </informaltable>
29785 <para>
29786 <indexterm role="concept">
29787 <primary>frozen messages</primary>
29788 <secondary>timing out</secondary>
29789 </indexterm>
29790 <indexterm role="concept">
29791 <primary>timeout</primary>
29792 <secondary>frozen messages</secondary>
29793 </indexterm>
29794 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
29795 message of any kind that has been on the queue for longer than the given time
29796 is automatically cancelled at the next queue run. If the frozen message is a
29797 bounce message, it is just discarded; otherwise, a bounce is sent to the
29798 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
29799 If you want to timeout frozen bounce messages earlier than other kinds of
29800 frozen message, see <option>ignore_bounce_errors_after</option>.
29801 </para>
29802 <para>
29803 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
29804 frozen messages remain on the queue forever (except for any frozen bounce
29805 messages that are released by <option>ignore_bounce_errors_after</option>).
29806 </para>
29807 <para>
29808 <indexterm role="option">
29809 <primary><option>timezone</option></primary>
29810 </indexterm>
29811 </para>
29812 <informaltable frame="all">
29813 <tgroup cols="4" colsep="0" rowsep="0">
29814 <colspec colwidth="8*" align="left"/>
29815 <colspec colwidth="6*" align="center"/>
29816 <colspec colwidth="6*" align="center"/>
29817 <colspec colwidth="6*" align="right"/>
29818 <tbody>
29819 <row>
29820 <entry><option>timezone</option></entry>
29821 <entry>Use: <emphasis>main</emphasis></entry>
29822 <entry>Type: <emphasis>string</emphasis></entry>
29823 <entry>Default: <emphasis>unset</emphasis></entry>
29824 </row>
29825 </tbody>
29826 </tgroup>
29827 </informaltable>
29828 <para>
29829 <indexterm role="concept">
29830 <primary>timezone, setting</primary>
29831 </indexterm>
29832 The value of <option>timezone</option> is used to set the environment variable TZ while
29833 running Exim (if it is different on entry). This ensures that all timestamps
29834 created by Exim are in the required timezone. If you want all your timestamps
29835 to be in UTC (aka GMT) you should set
29836 </para>
29837 <literallayout class="monospaced">
29838 timezone = UTC
29839 </literallayout>
29840 <para>
29841 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
29842 or, if that is not set, from the value of the TZ environment variable when Exim
29843 is built. If <option>timezone</option> is set to the empty string, either at build or run
29844 time, any existing TZ variable is removed from the environment when Exim
29845 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
29846 unfortunately not all, operating systems.
29847 </para>
29848 <para>
29849 <indexterm role="option">
29850 <primary><option>tls_advertise_hosts</option></primary>
29851 </indexterm>
29852 </para>
29853 <informaltable frame="all">
29854 <tgroup cols="4" colsep="0" rowsep="0">
29855 <colspec colwidth="8*" align="left"/>
29856 <colspec colwidth="6*" align="center"/>
29857 <colspec colwidth="6*" align="center"/>
29858 <colspec colwidth="6*" align="right"/>
29859 <tbody>
29860 <row>
29861 <entry><option>tls_advertise_hosts</option></entry>
29862 <entry>Use: <emphasis>main</emphasis></entry>
29863 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29864 <entry>Default: <emphasis>unset</emphasis></entry>
29865 </row>
29866 </tbody>
29867 </tgroup>
29868 </informaltable>
29869 <para>
29870 <indexterm role="concept">
29871 <primary>TLS</primary>
29872 <secondary>advertising</secondary>
29873 </indexterm>
29874 <indexterm role="concept">
29875 <primary>encryption</primary>
29876 <secondary>on SMTP connection</secondary>
29877 </indexterm>
29878 <indexterm role="concept">
29879 <primary>SMTP</primary>
29880 <secondary>encrypted connection</secondary>
29881 </indexterm>
29882 When Exim is built with support for TLS encrypted connections, the availability
29883 of the STARTTLS command to set up an encrypted session is advertised in
29884 response to EHLO only to those client hosts that match this option. See
29885 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
29886 </para>
29887 <para>
29888 <indexterm role="option">
29889 <primary><option>tls_certificate</option></primary>
29890 </indexterm>
29891 </para>
29892 <informaltable frame="all">
29893 <tgroup cols="4" colsep="0" rowsep="0">
29894 <colspec colwidth="8*" align="left"/>
29895 <colspec colwidth="6*" align="center"/>
29896 <colspec colwidth="6*" align="center"/>
29897 <colspec colwidth="6*" align="right"/>
29898 <tbody>
29899 <row>
29900 <entry><option>tls_certificate</option></entry>
29901 <entry>Use: <emphasis>main</emphasis></entry>
29902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29903 <entry>Default: <emphasis>unset</emphasis></entry>
29904 </row>
29905 </tbody>
29906 </tgroup>
29907 </informaltable>
29908 <para>
29909 <indexterm role="concept">
29910 <primary>TLS</primary>
29911 <secondary>server certificate; location of</secondary>
29912 </indexterm>
29913 <indexterm role="concept">
29914 <primary>certificate</primary>
29915 <secondary>server, location of</secondary>
29916 </indexterm>
29917 The value of this option is expanded, and must then be the absolute path to a
29918 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
29919 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
29920 <xref linkend="CHAPTLS"/> for further details.
29921 </para>
29922 <para>
29923 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
29924 receiving incoming messages as a server. If you want to supply certificates for
29925 use when sending messages as a client, you must set the <option>tls_certificate</option>
29926 option in the relevant <command>smtp</command> transport.
29927 </para>
29928 <para>
29929 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
29930 if the OpenSSL build supports TLS extensions and the TLS client sends the
29931 Server Name Indication extension, then this option and others documented in
29932 <xref linkend="SECTtlssni"/> will be re-expanded.
29933 </para>
29934 <para>
29935 <indexterm role="option">
29936 <primary><option>tls_crl</option></primary>
29937 </indexterm>
29938 </para>
29939 <informaltable frame="all">
29940 <tgroup cols="4" colsep="0" rowsep="0">
29941 <colspec colwidth="8*" align="left"/>
29942 <colspec colwidth="6*" align="center"/>
29943 <colspec colwidth="6*" align="center"/>
29944 <colspec colwidth="6*" align="right"/>
29945 <tbody>
29946 <row>
29947 <entry><option>tls_crl</option></entry>
29948 <entry>Use: <emphasis>main</emphasis></entry>
29949 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29950 <entry>Default: <emphasis>unset</emphasis></entry>
29951 </row>
29952 </tbody>
29953 </tgroup>
29954 </informaltable>
29955 <para>
29956 <indexterm role="concept">
29957 <primary>TLS</primary>
29958 <secondary>server certificate revocation list</secondary>
29959 </indexterm>
29960 <indexterm role="concept">
29961 <primary>certificate</primary>
29962 <secondary>revocation list for server</secondary>
29963 </indexterm>
29964 This option specifies a certificate revocation list. The expanded value must
29965 be the name of a file that contains a CRL in PEM format.
29966 </para>
29967 <para>
29968 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29969 </para>
29970 <para>
29971 <indexterm role="option">
29972 <primary><option>tls_dh_max_bits</option></primary>
29973 </indexterm>
29974 </para>
29975 <informaltable frame="all">
29976 <tgroup cols="4" colsep="0" rowsep="0">
29977 <colspec colwidth="8*" align="left"/>
29978 <colspec colwidth="6*" align="center"/>
29979 <colspec colwidth="6*" align="center"/>
29980 <colspec colwidth="6*" align="right"/>
29981 <tbody>
29982 <row>
29983 <entry><option>tls_dh_max_bits</option></entry>
29984 <entry>Use: <emphasis>main</emphasis></entry>
29985 <entry>Type: <emphasis>integer</emphasis></entry>
29986 <entry>Default: <emphasis>2236</emphasis></entry>
29987 </row>
29988 </tbody>
29989 </tgroup>
29990 </informaltable>
29991 <para>
29992 <indexterm role="concept">
29993 <primary>TLS</primary>
29994 <secondary>D-H bit count</secondary>
29995 </indexterm>
29996 The number of bits used for Diffie-Hellman key-exchange may be suggested by
29997 the chosen TLS library.  That value might prove to be too high for
29998 interoperability.  This option provides a maximum clamp on the value
29999 suggested, trading off security for interoperability.
30000 </para>
30001 <para>
30002 The value must be at least 1024.
30003 </para>
30004 <para>
30005 The value 2236 was chosen because, at time of adding the option, it was the
30006 hard-coded maximum value supported by the NSS cryptographic library, as used
30007 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
30008 </para>
30009 <para>
30010 If you prefer more security and are willing to break some clients, raise this
30011 number.
30012 </para>
30013 <para>
30014 Note that the value passed to GnuTLS for *generating* a new prime may be a
30015 little less than this figure, because GnuTLS is inexact and may produce a
30016 larger prime than requested.
30017 </para>
30018 <para>
30019 <indexterm role="option">
30020 <primary><option>tls_dhparam</option></primary>
30021 </indexterm>
30022 </para>
30023 <informaltable frame="all">
30024 <tgroup cols="4" colsep="0" rowsep="0">
30025 <colspec colwidth="8*" align="left"/>
30026 <colspec colwidth="6*" align="center"/>
30027 <colspec colwidth="6*" align="center"/>
30028 <colspec colwidth="6*" align="right"/>
30029 <tbody>
30030 <row>
30031 <entry><option>tls_dhparam</option></entry>
30032 <entry>Use: <emphasis>main</emphasis></entry>
30033 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30034 <entry>Default: <emphasis>unset</emphasis></entry>
30035 </row>
30036 </tbody>
30037 </tgroup>
30038 </informaltable>
30039 <para>
30040 <indexterm role="concept">
30041 <primary>TLS</primary>
30042 <secondary>D-H parameters for server</secondary>
30043 </indexterm>
30044 The value of this option is expanded and indicates the source of DH parameters
30045 to be used by Exim.
30046 </para>
30047 <para>
30048 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
30049 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
30050 PKCS#3 representation of the DH prime.  If the file does not exist, for
30051 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
30052 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
30053 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
30054 and treated as though the <option>tls_dhparam</option> were set to "none".
30055 </para>
30056 <para>
30057 If this option expands to the string "none", then no DH parameters will be
30058 loaded by Exim.
30059 </para>
30060 <para>
30061 If this option expands to the string "historic" and Exim is using GnuTLS, then
30062 Exim will attempt to load a file from inside the spool directory.  If the file
30063 does not exist, Exim will attempt to create it.
30064 See section <xref linkend="SECTgnutlsparam"/> for further details.
30065 </para>
30066 <para>
30067 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
30068 a default DH prime; the default is the 2048 bit prime described in section
30069 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
30070 in IKE is assigned number 23.
30071 </para>
30072 <para>
30073 Otherwise, the option must expand to the name used by Exim for any of a number
30074 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
30075 "ike" followed by the number used by IKE, of "default" which corresponds to
30076 "ike23".
30077 </para>
30078 <para>
30079 The available primes are:
30080 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
30081 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
30082 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
30083 </para>
30084 <para>
30085 Some of these will be too small to be accepted by clients.
30086 Some may be too large to be accepted by clients.
30087 </para>
30088 <para>
30089 The TLS protocol does not negotiate an acceptable size for this; clients tend
30090 to hard-drop connections if what is offered by the server is unacceptable,
30091 whether too large or too small, and there&#x2019;s no provision for the client to
30092 tell the server what these constraints are.  Thus, as a server operator, you
30093 need to make an educated guess as to what is most likely to work for your
30094 userbase.
30095 </para>
30096 <para>
30097 Some known size constraints suggest that a bit-size in the range 2048 to 2236
30098 is most likely to maximise interoperability.  The upper bound comes from
30099 applications using the Mozilla Network Security Services (NSS) library, which
30100 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
30101 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
30102 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
30103 acceptable bound from 1024 to 2048.
30104 </para>
30105 <para>
30106 <indexterm role="option">
30107 <primary><option>tls_ocsp_file</option></primary>
30108 </indexterm>
30109 </para>
30110 <informaltable frame="all">
30111 <tgroup cols="4" colsep="0" rowsep="0">
30112 <colspec colwidth="8*" align="left"/>
30113 <colspec colwidth="6*" align="center"/>
30114 <colspec colwidth="6*" align="center"/>
30115 <colspec colwidth="6*" align="right"/>
30116 <tbody>
30117 <row>
30118 <entry><option>tls_ocsp_file</option></entry>
30119 <entry>Use: <emphasis>main</emphasis></entry>
30120 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30121 <entry>Default: <emphasis>unset</emphasis></entry>
30122 </row>
30123 </tbody>
30124 </tgroup>
30125 </informaltable>
30126 <para>
30127 This option
30128 must if set expand to the absolute path to a file which contains a current
30129 status proof for the server&#x2019;s certificate, as obtained from the
30130 Certificate Authority.
30131 </para>
30132 <para>
30133 <indexterm role="option">
30134 <primary><option>tls_on_connect_ports</option></primary>
30135 </indexterm>
30136 </para>
30137 <informaltable frame="all">
30138 <tgroup cols="4" colsep="0" rowsep="0">
30139 <colspec colwidth="8*" align="left"/>
30140 <colspec colwidth="6*" align="center"/>
30141 <colspec colwidth="6*" align="center"/>
30142 <colspec colwidth="6*" align="right"/>
30143 <tbody>
30144 <row>
30145 <entry><option>tls_on_connect_ports</option></entry>
30146 <entry>Use: <emphasis>main</emphasis></entry>
30147 <entry>Type: <emphasis>string list</emphasis></entry>
30148 <entry>Default: <emphasis>unset</emphasis></entry>
30149 </row>
30150 </tbody>
30151 </tgroup>
30152 </informaltable>
30153 <para>
30154 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
30155 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
30156 set up without waiting for the client to issue a STARTTLS command. For
30157 further details, see section <xref linkend="SECTsupobssmt"/>.
30158 </para>
30159 <para>
30160 <indexterm role="option">
30161 <primary><option>tls_privatekey</option></primary>
30162 </indexterm>
30163 </para>
30164 <informaltable frame="all">
30165 <tgroup cols="4" colsep="0" rowsep="0">
30166 <colspec colwidth="8*" align="left"/>
30167 <colspec colwidth="6*" align="center"/>
30168 <colspec colwidth="6*" align="center"/>
30169 <colspec colwidth="6*" align="right"/>
30170 <tbody>
30171 <row>
30172 <entry><option>tls_privatekey</option></entry>
30173 <entry>Use: <emphasis>main</emphasis></entry>
30174 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30175 <entry>Default: <emphasis>unset</emphasis></entry>
30176 </row>
30177 </tbody>
30178 </tgroup>
30179 </informaltable>
30180 <para>
30181 <indexterm role="concept">
30182 <primary>TLS</primary>
30183 <secondary>server private key; location of</secondary>
30184 </indexterm>
30185 The value of this option is expanded, and must then be the absolute path to a
30186 file which contains the server&#x2019;s private key. If this option is unset, or if
30187 the expansion is forced to fail, or the result is an empty string, the private
30188 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
30189 <xref linkend="CHAPTLS"/> for further details.
30190 </para>
30191 <para>
30192 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30193 </para>
30194 <para>
30195 <indexterm role="option">
30196 <primary><option>tls_remember_esmtp</option></primary>
30197 </indexterm>
30198 </para>
30199 <informaltable frame="all">
30200 <tgroup cols="4" colsep="0" rowsep="0">
30201 <colspec colwidth="8*" align="left"/>
30202 <colspec colwidth="6*" align="center"/>
30203 <colspec colwidth="6*" align="center"/>
30204 <colspec colwidth="6*" align="right"/>
30205 <tbody>
30206 <row>
30207 <entry><option>tls_remember_esmtp</option></entry>
30208 <entry>Use: <emphasis>main</emphasis></entry>
30209 <entry>Type: <emphasis>boolean</emphasis></entry>
30210 <entry>Default: <emphasis>false</emphasis></entry>
30211 </row>
30212 </tbody>
30213 </tgroup>
30214 </informaltable>
30215 <para>
30216 <indexterm role="concept">
30217 <primary>TLS</primary>
30218 <secondary>esmtp state; remembering</secondary>
30219 </indexterm>
30220 <indexterm role="concept">
30221 <primary>TLS</primary>
30222 <secondary>broken clients</secondary>
30223 </indexterm>
30224 If this option is set true, Exim violates the RFCs by remembering that it is in
30225 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
30226 support for broken clients that fail to send a new EHLO after starting a
30227 TLS session.
30228 </para>
30229 <para>
30230 <indexterm role="option">
30231 <primary><option>tls_require_ciphers</option></primary>
30232 </indexterm>
30233 </para>
30234 <informaltable frame="all">
30235 <tgroup cols="4" colsep="0" rowsep="0">
30236 <colspec colwidth="8*" align="left"/>
30237 <colspec colwidth="6*" align="center"/>
30238 <colspec colwidth="6*" align="center"/>
30239 <colspec colwidth="6*" align="right"/>
30240 <tbody>
30241 <row>
30242 <entry><option>tls_require_ciphers</option></entry>
30243 <entry>Use: <emphasis>main</emphasis></entry>
30244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30245 <entry>Default: <emphasis>unset</emphasis></entry>
30246 </row>
30247 </tbody>
30248 </tgroup>
30249 </informaltable>
30250 <para>
30251 <indexterm role="concept">
30252 <primary>TLS</primary>
30253 <secondary>requiring specific ciphers</secondary>
30254 </indexterm>
30255 <indexterm role="concept">
30256 <primary>cipher</primary>
30257 <secondary>requiring specific</secondary>
30258 </indexterm>
30259 This option controls which ciphers can be used for incoming TLS connections.
30260 The <command>smtp</command> transport has an option of the same name for controlling outgoing
30261 connections. This option is expanded for each connection, so can be varied for
30262 different clients if required. The value of this option must be a list of
30263 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
30264 in somewhat different ways. If GnuTLS is being used, the client controls the
30265 preference order of the available ciphers. Details are given in sections
30266 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
30267 </para>
30268 <para>
30269 <indexterm role="option">
30270 <primary><option>tls_try_verify_hosts</option></primary>
30271 </indexterm>
30272 </para>
30273 <informaltable frame="all">
30274 <tgroup cols="4" colsep="0" rowsep="0">
30275 <colspec colwidth="8*" align="left"/>
30276 <colspec colwidth="6*" align="center"/>
30277 <colspec colwidth="6*" align="center"/>
30278 <colspec colwidth="6*" align="right"/>
30279 <tbody>
30280 <row>
30281 <entry><option>tls_try_verify_hosts</option></entry>
30282 <entry>Use: <emphasis>main</emphasis></entry>
30283 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30284 <entry>Default: <emphasis>unset</emphasis></entry>
30285 </row>
30286 </tbody>
30287 </tgroup>
30288 </informaltable>
30289 <para>
30290 <indexterm role="concept">
30291 <primary>TLS</primary>
30292 <secondary>client certificate verification</secondary>
30293 </indexterm>
30294 <indexterm role="concept">
30295 <primary>certificate</primary>
30296 <secondary>verification of client</secondary>
30297 </indexterm>
30298 See <option>tls_verify_hosts</option> below.
30299 </para>
30300 <para>
30301 <indexterm role="option">
30302 <primary><option>tls_verify_certificates</option></primary>
30303 </indexterm>
30304 </para>
30305 <informaltable frame="all">
30306 <tgroup cols="4" colsep="0" rowsep="0">
30307 <colspec colwidth="8*" align="left"/>
30308 <colspec colwidth="6*" align="center"/>
30309 <colspec colwidth="6*" align="center"/>
30310 <colspec colwidth="6*" align="right"/>
30311 <tbody>
30312 <row>
30313 <entry><option>tls_verify_certificates</option></entry>
30314 <entry>Use: <emphasis>main</emphasis></entry>
30315 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30316 <entry>Default: <emphasis>unset</emphasis></entry>
30317 </row>
30318 </tbody>
30319 </tgroup>
30320 </informaltable>
30321 <para>
30322 <indexterm role="concept">
30323 <primary>TLS</primary>
30324 <secondary>client certificate verification</secondary>
30325 </indexterm>
30326 <indexterm role="concept">
30327 <primary>certificate</primary>
30328 <secondary>verification of client</secondary>
30329 </indexterm>
30330 The value of this option is expanded, and must then be the absolute path to
30331 a file containing permitted certificates for clients that
30332 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
30333 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
30334 directory containing certificate files. This does not work with GnuTLS; the
30335 option must be set to the name of a single file if you are using GnuTLS.
30336 </para>
30337 <para>
30338 These certificates should be for the certificate authorities trusted, rather
30339 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
30340 the value is a file then the certificates are sent by Exim as a server to
30341 connecting clients, defining the list of accepted certificate authorities.
30342 Thus the values defined should be considered public data.  To avoid this,
30343 use OpenSSL with a directory.
30344 </para>
30345 <para>
30346 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30347 </para>
30348 <para>
30349 A forced expansion failure or setting to an empty string is equivalent to
30350 being unset.
30351 </para>
30352 <para>
30353 <indexterm role="option">
30354 <primary><option>tls_verify_hosts</option></primary>
30355 </indexterm>
30356 </para>
30357 <informaltable frame="all">
30358 <tgroup cols="4" colsep="0" rowsep="0">
30359 <colspec colwidth="8*" align="left"/>
30360 <colspec colwidth="6*" align="center"/>
30361 <colspec colwidth="6*" align="center"/>
30362 <colspec colwidth="6*" align="right"/>
30363 <tbody>
30364 <row>
30365 <entry><option>tls_verify_hosts</option></entry>
30366 <entry>Use: <emphasis>main</emphasis></entry>
30367 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30368 <entry>Default: <emphasis>unset</emphasis></entry>
30369 </row>
30370 </tbody>
30371 </tgroup>
30372 </informaltable>
30373 <para>
30374 <indexterm role="concept">
30375 <primary>TLS</primary>
30376 <secondary>client certificate verification</secondary>
30377 </indexterm>
30378 <indexterm role="concept">
30379 <primary>certificate</primary>
30380 <secondary>verification of client</secondary>
30381 </indexterm>
30382 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
30383 certificates from clients. The expected certificates are defined by
30384 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
30385 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
30386 <option>tls_verify_certificates</option> is not set.
30387 </para>
30388 <para>
30389 Any client that matches <option>tls_verify_hosts</option> is constrained by
30390 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
30391 present one of the listed certificates. If it does not, the connection is
30392 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
30393 the host to use TLS. It can still send SMTP commands through unencrypted
30394 connections. Forcing a client to use TLS has to be done separately using an
30395 ACL to reject inappropriate commands when the connection is not encrypted.
30396 </para>
30397 <para>
30398 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
30399 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
30400 certificate and checks it against <option>tls_verify_certificates</option>, but does not
30401 abort the connection if there is no certificate or if it does not match. This
30402 state can be detected in an ACL, which makes it possible to implement policies
30403 such as <quote>accept for relay only if a verified certificate has been received,
30404 but accept for local delivery if encrypted, even without a verified
30405 certificate</quote>.
30406 </para>
30407 <para>
30408 Client hosts that match neither of these lists are not asked to present
30409 certificates.
30410 </para>
30411 <para>
30412 <indexterm role="option">
30413 <primary><option>trusted_groups</option></primary>
30414 </indexterm>
30415 </para>
30416 <informaltable frame="all">
30417 <tgroup cols="4" colsep="0" rowsep="0">
30418 <colspec colwidth="8*" align="left"/>
30419 <colspec colwidth="6*" align="center"/>
30420 <colspec colwidth="6*" align="center"/>
30421 <colspec colwidth="6*" align="right"/>
30422 <tbody>
30423 <row>
30424 <entry><option>trusted_groups</option></entry>
30425 <entry>Use: <emphasis>main</emphasis></entry>
30426 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30427 <entry>Default: <emphasis>unset</emphasis></entry>
30428 </row>
30429 </tbody>
30430 </tgroup>
30431 </informaltable>
30432 <para>
30433 <indexterm role="concept">
30434 <primary>trusted groups</primary>
30435 </indexterm>
30436 <indexterm role="concept">
30437 <primary>groups</primary>
30438 <secondary>trusted</secondary>
30439 </indexterm>
30440 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30441 option is set, any process that is running in one of the listed groups, or
30442 which has one of them as a supplementary group, is trusted. The groups can be
30443 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
30444 details of what trusted callers are permitted to do. If neither
30445 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
30446 are trusted.
30447 </para>
30448 <para>
30449 <indexterm role="option">
30450 <primary><option>trusted_users</option></primary>
30451 </indexterm>
30452 </para>
30453 <informaltable frame="all">
30454 <tgroup cols="4" colsep="0" rowsep="0">
30455 <colspec colwidth="8*" align="left"/>
30456 <colspec colwidth="6*" align="center"/>
30457 <colspec colwidth="6*" align="center"/>
30458 <colspec colwidth="6*" align="right"/>
30459 <tbody>
30460 <row>
30461 <entry><option>trusted_users</option></entry>
30462 <entry>Use: <emphasis>main</emphasis></entry>
30463 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30464 <entry>Default: <emphasis>unset</emphasis></entry>
30465 </row>
30466 </tbody>
30467 </tgroup>
30468 </informaltable>
30469 <para>
30470 <indexterm role="concept">
30471 <primary>trusted users</primary>
30472 </indexterm>
30473 <indexterm role="concept">
30474 <primary>user</primary>
30475 <secondary>trusted</secondary>
30476 </indexterm>
30477 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30478 option is set, any process that is running as one of the listed users is
30479 trusted. The users can be specified numerically or by name. See section
30480 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
30481 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
30482 Exim user are trusted.
30483 </para>
30484 <para>
30485 <indexterm role="option">
30486 <primary><option>unknown_login</option></primary>
30487 </indexterm>
30488 </para>
30489 <informaltable frame="all">
30490 <tgroup cols="4" colsep="0" rowsep="0">
30491 <colspec colwidth="8*" align="left"/>
30492 <colspec colwidth="6*" align="center"/>
30493 <colspec colwidth="6*" align="center"/>
30494 <colspec colwidth="6*" align="right"/>
30495 <tbody>
30496 <row>
30497 <entry><option>unknown_login</option></entry>
30498 <entry>Use: <emphasis>main</emphasis></entry>
30499 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30500 <entry>Default: <emphasis>unset</emphasis></entry>
30501 </row>
30502 </tbody>
30503 </tgroup>
30504 </informaltable>
30505 <para>
30506 <indexterm role="concept">
30507 <primary>uid (user id)</primary>
30508 <secondary>unknown caller</secondary>
30509 </indexterm>
30510 <indexterm role="variable">
30511 <primary><varname>$caller_uid</varname></primary>
30512 </indexterm>
30513 This is a specialized feature for use in unusual configurations. By default, if
30514 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
30515 gives up. The <option>unknown_login</option> option can be used to set a login name to be
30516 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
30517 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
30518 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
30519 <option>-F</option> option.
30520 </para>
30521 <para>
30522 <indexterm role="option">
30523 <primary><option>unknown_username</option></primary>
30524 </indexterm>
30525 </para>
30526 <informaltable frame="all">
30527 <tgroup cols="4" colsep="0" rowsep="0">
30528 <colspec colwidth="8*" align="left"/>
30529 <colspec colwidth="6*" align="center"/>
30530 <colspec colwidth="6*" align="center"/>
30531 <colspec colwidth="6*" align="right"/>
30532 <tbody>
30533 <row>
30534 <entry><option>unknown_username</option></entry>
30535 <entry>Use: <emphasis>main</emphasis></entry>
30536 <entry>Type: <emphasis>string</emphasis></entry>
30537 <entry>Default: <emphasis>unset</emphasis></entry>
30538 </row>
30539 </tbody>
30540 </tgroup>
30541 </informaltable>
30542 <para>
30543 See <option>unknown_login</option>.
30544 </para>
30545 <para>
30546 <indexterm role="option">
30547 <primary><option>untrusted_set_sender</option></primary>
30548 </indexterm>
30549 </para>
30550 <informaltable frame="all">
30551 <tgroup cols="4" colsep="0" rowsep="0">
30552 <colspec colwidth="8*" align="left"/>
30553 <colspec colwidth="6*" align="center"/>
30554 <colspec colwidth="6*" align="center"/>
30555 <colspec colwidth="6*" align="right"/>
30556 <tbody>
30557 <row>
30558 <entry><option>untrusted_set_sender</option></entry>
30559 <entry>Use: <emphasis>main</emphasis></entry>
30560 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30561 <entry>Default: <emphasis>unset</emphasis></entry>
30562 </row>
30563 </tbody>
30564 </tgroup>
30565 </informaltable>
30566 <para>
30567 <indexterm role="concept">
30568 <primary>trusted users</primary>
30569 </indexterm>
30570 <indexterm role="concept">
30571 <primary>sender</primary>
30572 <secondary>setting by untrusted user</secondary>
30573 </indexterm>
30574 <indexterm role="concept">
30575 <primary>untrusted user setting sender</primary>
30576 </indexterm>
30577 <indexterm role="concept">
30578 <primary>user</primary>
30579 <secondary>untrusted setting sender</secondary>
30580 </indexterm>
30581 <indexterm role="concept">
30582 <primary>envelope sender</primary>
30583 </indexterm>
30584 When an untrusted user submits a message to Exim using the standard input, Exim
30585 normally creates an envelope sender address from the user&#x2019;s login and the
30586 default qualification domain. Data from the <option>-f</option> option (for setting envelope
30587 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
30588 is used) is ignored.
30589 </para>
30590 <para>
30591 However, untrusted users are permitted to set an empty envelope sender address,
30592 to declare that a message should never generate any bounces. For example:
30593 </para>
30594 <literallayout class="monospaced">
30595 exim -f '&lt;&gt;' user@domain.example
30596 </literallayout>
30597 <para>
30598 <indexterm role="variable">
30599 <primary><varname>$sender_ident</varname></primary>
30600 </indexterm>
30601 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
30602 other envelope sender addresses in a controlled way. When it is set, untrusted
30603 users are allowed to set envelope sender addresses that match any of the
30604 patterns in the list. Like all address lists, the string is expanded. The
30605 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
30606 users to setting senders that start with their login ids
30607 followed by a hyphen
30608 by a setting like this:
30609 </para>
30610 <literallayout class="monospaced">
30611 untrusted_set_sender = ^$sender_ident-
30612 </literallayout>
30613 <para>
30614 If you want to allow untrusted users to set envelope sender addresses without
30615 restriction, you can use
30616 </para>
30617 <literallayout class="monospaced">
30618 untrusted_set_sender = *
30619 </literallayout>
30620 <para>
30621 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
30622 only to the setting of the envelope sender. It does not permit untrusted users
30623 to use the other options which trusted user can use to override message
30624 parameters. Furthermore, it does not stop Exim from removing an existing
30625 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
30626 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
30627 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
30628 described in section <xref linkend="SECTthesenhea"/>.
30629 </para>
30630 <para>
30631 The log line for a message&#x2019;s arrival shows the envelope sender following
30632 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
30633 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
30634 envelope sender address, the user&#x2019;s login is shown in parentheses after the
30635 sender address.
30636 </para>
30637 <para>
30638 <indexterm role="option">
30639 <primary><option>uucp_from_pattern</option></primary>
30640 </indexterm>
30641 </para>
30642 <informaltable frame="all">
30643 <tgroup cols="4" colsep="0" rowsep="0">
30644 <colspec colwidth="8*" align="left"/>
30645 <colspec colwidth="6*" align="center"/>
30646 <colspec colwidth="6*" align="center"/>
30647 <colspec colwidth="6*" align="right"/>
30648 <tbody>
30649 <row>
30650 <entry><option>uucp_from_pattern</option></entry>
30651 <entry>Use: <emphasis>main</emphasis></entry>
30652 <entry>Type: <emphasis>string</emphasis></entry>
30653 <entry>Default: <emphasis>see below</emphasis></entry>
30654 </row>
30655 </tbody>
30656 </tgroup>
30657 </informaltable>
30658 <para>
30659 <indexterm role="concept">
30660 <primary><quote>From</quote> line</primary>
30661 </indexterm>
30662 <indexterm role="concept">
30663 <primary>UUCP</primary>
30664 <secondary><quote>From</quote> line</secondary>
30665 </indexterm>
30666 Some applications that pass messages to an MTA via a command line interface use
30667 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
30668 particular, this is used by UUCP software. Exim recognizes such a line by means
30669 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
30670 matches, the sender address is constructed by expanding the contents of
30671 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
30672 default pattern recognizes lines in the following two forms:
30673 </para>
30674 <literallayout class="monospaced">
30675 From ph10 Fri Jan  5 12:35 GMT 1996
30676 From ph10 Fri, 7 Jan 97 14:00:00 GMT
30677 </literallayout>
30678 <para>
30679 The pattern can be seen by running
30680 </para>
30681 <literallayout class="monospaced">
30682 exim -bP uucp_from_pattern
30683 </literallayout>
30684 <para>
30685 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
30686 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
30687 regular expression by a parenthesized subpattern. The default value for
30688 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
30689 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
30690 <option>ignore_fromline_hosts</option>.
30691 </para>
30692 <para>
30693 <indexterm role="option">
30694 <primary><option>uucp_from_sender</option></primary>
30695 </indexterm>
30696 </para>
30697 <informaltable frame="all">
30698 <tgroup cols="4" colsep="0" rowsep="0">
30699 <colspec colwidth="8*" align="left"/>
30700 <colspec colwidth="6*" align="center"/>
30701 <colspec colwidth="6*" align="center"/>
30702 <colspec colwidth="6*" align="right"/>
30703 <tbody>
30704 <row>
30705 <entry><option>uucp_from_sender</option></entry>
30706 <entry>Use: <emphasis>main</emphasis></entry>
30707 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30708 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
30709 </row>
30710 </tbody>
30711 </tgroup>
30712 </informaltable>
30713 <para>
30714 See <option>uucp_from_pattern</option> above.
30715 </para>
30716 <para>
30717 <indexterm role="option">
30718 <primary><option>warn_message_file</option></primary>
30719 </indexterm>
30720 </para>
30721 <informaltable frame="all">
30722 <tgroup cols="4" colsep="0" rowsep="0">
30723 <colspec colwidth="8*" align="left"/>
30724 <colspec colwidth="6*" align="center"/>
30725 <colspec colwidth="6*" align="center"/>
30726 <colspec colwidth="6*" align="right"/>
30727 <tbody>
30728 <row>
30729 <entry><option>warn_message_file</option></entry>
30730 <entry>Use: <emphasis>main</emphasis></entry>
30731 <entry>Type: <emphasis>string</emphasis></entry>
30732 <entry>Default: <emphasis>unset</emphasis></entry>
30733 </row>
30734 </tbody>
30735 </tgroup>
30736 </informaltable>
30737 <para>
30738 <indexterm role="concept">
30739 <primary>warning of delay</primary>
30740 <secondary>customizing the message</secondary>
30741 </indexterm>
30742 <indexterm role="concept">
30743 <primary>customizing</primary>
30744 <secondary>warning message</secondary>
30745 </indexterm>
30746 This option defines a template file containing paragraphs of text to be used
30747 for constructing the warning message which is sent by Exim when a message has
30748 been on the queue for a specified amount of time, as specified by
30749 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
30750 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
30751 </para>
30752 <para>
30753 <indexterm role="option">
30754 <primary><option>write_rejectlog</option></primary>
30755 </indexterm>
30756 </para>
30757 <informaltable frame="all">
30758 <tgroup cols="4" colsep="0" rowsep="0">
30759 <colspec colwidth="8*" align="left"/>
30760 <colspec colwidth="6*" align="center"/>
30761 <colspec colwidth="6*" align="center"/>
30762 <colspec colwidth="6*" align="right"/>
30763 <tbody>
30764 <row>
30765 <entry><option>write_rejectlog</option></entry>
30766 <entry>Use: <emphasis>main</emphasis></entry>
30767 <entry>Type: <emphasis>boolean</emphasis></entry>
30768 <entry>Default: <emphasis>true</emphasis></entry>
30769 </row>
30770 </tbody>
30771 </tgroup>
30772 </informaltable>
30773 <para>
30774 <indexterm role="concept">
30775 <primary>reject log</primary>
30776 <secondary>disabling</secondary>
30777 </indexterm>
30778 If this option is set false, Exim no longer writes anything to the reject log.
30779 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
30780 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
30781 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
30782 </para>
30783 </section>
30784 </chapter>
30785
30786 <chapter id="CHAProutergeneric">
30787 <title>Generic options for routers</title>
30788 <para>
30789 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
30790 <primary>options</primary>
30791 <secondary>generic; for routers</secondary>
30792 </indexterm>
30793 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
30794 <primary>generic options</primary>
30795 <secondary>router</secondary>
30796 </indexterm>
30797 This chapter describes the generic options that apply to all routers.
30798 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
30799 </para>
30800 <para>
30801 For a general description of how a router operates, see sections
30802 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
30803 which the preconditions are tested. The order of expansion of the options that
30804 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
30805 <option>headers_remove</option>, <option>transport</option>.
30806 </para>
30807 <para>
30808 <indexterm role="option">
30809 <primary><option>address_data</option></primary>
30810 </indexterm>
30811 </para>
30812 <informaltable frame="all">
30813 <tgroup cols="4" colsep="0" rowsep="0">
30814 <colspec colwidth="8*" align="left"/>
30815 <colspec colwidth="6*" align="center"/>
30816 <colspec colwidth="6*" align="center"/>
30817 <colspec colwidth="6*" align="right"/>
30818 <tbody>
30819 <row>
30820 <entry><option>address_data</option></entry>
30821 <entry>Use: <emphasis>routers</emphasis></entry>
30822 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30823 <entry>Default: <emphasis>unset</emphasis></entry>
30824 </row>
30825 </tbody>
30826 </tgroup>
30827 </informaltable>
30828 <para>
30829 <indexterm role="concept">
30830 <primary>router</primary>
30831 <secondary>data attached to address</secondary>
30832 </indexterm>
30833 The string is expanded just before the router is run, that is, after all the
30834 precondition tests have succeeded. If the expansion is forced to fail, the
30835 router declines, the value of <option>address_data</option> remains unchanged, and the
30836 <option>more</option> option controls what happens next. Other expansion failures cause
30837 delivery of the address to be deferred.
30838 </para>
30839 <para>
30840 <indexterm role="variable">
30841 <primary><varname>$address_data</varname></primary>
30842 </indexterm>
30843 When the expansion succeeds, the value is retained with the address, and can be
30844 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
30845 routers, and the eventual transport.
30846 </para>
30847 <para>
30848 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
30849 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
30850 in the filter. This is not normally a problem, because such data is usually
30851 either not confidential or it <quote>belongs</quote> to the current user, but if you do
30852 put confidential data into <varname>$address_data</varname> you need to remember this point.
30853 </para>
30854 <para>
30855 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
30856 with the address, though it can be changed by another <option>address_data</option> setting
30857 on a subsequent router. If a router generates child addresses, the value of
30858 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
30859 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
30860 </para>
30861 <para>
30862 The idea of <option>address_data</option> is that you can use it to look up a lot of data
30863 for the address once, and then pick out parts of the data later. For example,
30864 you could use a single LDAP lookup to return a string of the form
30865 </para>
30866 <literallayout class="monospaced">
30867 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
30868 </literallayout>
30869 <para>
30870 In the transport you could pick out the mailbox by a setting such as
30871 </para>
30872 <literallayout class="monospaced">
30873 file = ${extract{mailbox}{$address_data}}
30874 </literallayout>
30875 <para>
30876 This makes the configuration file less messy, and also reduces the number of
30877 lookups (though Exim does cache lookups).
30878 </para>
30879 <para>
30880 <indexterm role="variable">
30881 <primary><varname>$sender_address_data</varname></primary>
30882 </indexterm>
30883 <indexterm role="variable">
30884 <primary><varname>$address_data</varname></primary>
30885 </indexterm>
30886 The <option>address_data</option> facility is also useful as a means of passing information
30887 from one router to another, and from a router to a transport. In addition, if
30888 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
30889 ACL, it remains available for use in the rest of the ACL statement. After
30890 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
30891 </para>
30892 <para>
30893 <indexterm role="option">
30894 <primary><option>address_test</option></primary>
30895 </indexterm>
30896 </para>
30897 <informaltable frame="all">
30898 <tgroup cols="4" colsep="0" rowsep="0">
30899 <colspec colwidth="8*" align="left"/>
30900 <colspec colwidth="6*" align="center"/>
30901 <colspec colwidth="6*" align="center"/>
30902 <colspec colwidth="6*" align="right"/>
30903 <tbody>
30904 <row>
30905 <entry><option>address_test</option></entry>
30906 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30907 <entry>Type: <emphasis>boolean</emphasis></entry>
30908 <entry>Default: <emphasis>true</emphasis></entry>
30909 </row>
30910 </tbody>
30911 </tgroup>
30912 </informaltable>
30913 <para>
30914 <indexterm role="option">
30915 <primary><option>-bt</option></primary>
30916 </indexterm>
30917 <indexterm role="concept">
30918 <primary>router</primary>
30919 <secondary>skipping when address testing</secondary>
30920 </indexterm>
30921 If this option is set false, the router is skipped when routing is being tested
30922 by means of the <option>-bt</option> command line option. This can be a convenience when
30923 your first router sends messages to an external scanner, because it saves you
30924 having to set the <quote>already scanned</quote> indicator when testing real address
30925 routing.
30926 </para>
30927 <para>
30928 <indexterm role="option">
30929 <primary><option>cannot_route_message</option></primary>
30930 </indexterm>
30931 </para>
30932 <informaltable frame="all">
30933 <tgroup cols="4" colsep="0" rowsep="0">
30934 <colspec colwidth="8*" align="left"/>
30935 <colspec colwidth="6*" align="center"/>
30936 <colspec colwidth="6*" align="center"/>
30937 <colspec colwidth="6*" align="right"/>
30938 <tbody>
30939 <row>
30940 <entry><option>cannot_route_message</option></entry>
30941 <entry>Use: <emphasis>routers</emphasis></entry>
30942 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30943 <entry>Default: <emphasis>unset</emphasis></entry>
30944 </row>
30945 </tbody>
30946 </tgroup>
30947 </informaltable>
30948 <para>
30949 <indexterm role="concept">
30950 <primary>router</primary>
30951 <secondary>customizing <quote>cannot route</quote> message</secondary>
30952 </indexterm>
30953 <indexterm role="concept">
30954 <primary>customizing</primary>
30955 <secondary><quote>cannot route</quote> message</secondary>
30956 </indexterm>
30957 This option specifies a text message that is used when an address cannot be
30958 routed because Exim has run out of routers. The default message is
30959 <quote>Unrouteable address</quote>. This option is useful only on routers that have
30960 <option>more</option> set false, or on the very last router in a configuration, because the
30961 value that is used is taken from the last router that is considered. This
30962 includes a router that is skipped because its preconditions are not met, as
30963 well as a router that declines. For example, using the default configuration,
30964 you could put:
30965 </para>
30966 <literallayout class="monospaced">
30967 cannot_route_message = Remote domain not found in DNS
30968 </literallayout>
30969 <para>
30970 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
30971 and
30972 </para>
30973 <literallayout class="monospaced">
30974 cannot_route_message = Unknown local user
30975 </literallayout>
30976 <para>
30977 on the final router that checks for local users. If string expansion fails for
30978 this option, the default message is used. Unless the expansion failure was
30979 explicitly forced, a message about the failure is written to the main and panic
30980 logs, in addition to the normal message about the routing failure.
30981 </para>
30982 <para>
30983 <indexterm role="option">
30984 <primary><option>caseful_local_part</option></primary>
30985 </indexterm>
30986 </para>
30987 <informaltable frame="all">
30988 <tgroup cols="4" colsep="0" rowsep="0">
30989 <colspec colwidth="8*" align="left"/>
30990 <colspec colwidth="6*" align="center"/>
30991 <colspec colwidth="6*" align="center"/>
30992 <colspec colwidth="6*" align="right"/>
30993 <tbody>
30994 <row>
30995 <entry><option>caseful_local_part</option></entry>
30996 <entry>Use: <emphasis>routers</emphasis></entry>
30997 <entry>Type: <emphasis>boolean</emphasis></entry>
30998 <entry>Default: <emphasis>false</emphasis></entry>
30999 </row>
31000 </tbody>
31001 </tgroup>
31002 </informaltable>
31003 <para>
31004 <indexterm role="concept">
31005 <primary>case of local parts</primary>
31006 </indexterm>
31007 <indexterm role="concept">
31008 <primary>router</primary>
31009 <secondary>case of local parts</secondary>
31010 </indexterm>
31011 By default, routers handle the local parts of addresses in a case-insensitive
31012 manner, though the actual case is preserved for transmission with the message.
31013 If you want the case of letters to be significant in a router, you must set
31014 this option true. For individual router options that contain address or local
31015 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
31016 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
31017 more details.
31018 </para>
31019 <para>
31020 <indexterm role="variable">
31021 <primary><varname>$local_part</varname></primary>
31022 </indexterm>
31023 <indexterm role="variable">
31024 <primary><varname>$original_local_part</varname></primary>
31025 </indexterm>
31026 <indexterm role="variable">
31027 <primary><varname>$parent_local_part</varname></primary>
31028 </indexterm>
31029 The value of the <varname>$local_part</varname> variable is forced to lower case while a
31030 router is running unless <option>caseful_local_part</option> is set. When a router assigns
31031 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
31032 is the same as it was in the router. Similarly, when a router generates child
31033 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
31034 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
31035 </para>
31036 <para>
31037 This option applies to the processing of an address by a router. When a
31038 recipient address is being processed in an ACL, there is a separate <option>control</option>
31039 modifier that can be used to specify case-sensitive processing within the ACL
31040 (see section <xref linkend="SECTcontrols"/>).
31041 </para>
31042 <para>
31043 <indexterm role="option">
31044 <primary><option>check_local_user</option></primary>
31045 </indexterm>
31046 </para>
31047 <informaltable frame="all">
31048 <tgroup cols="4" colsep="0" rowsep="0">
31049 <colspec colwidth="8*" align="left"/>
31050 <colspec colwidth="6*" align="center"/>
31051 <colspec colwidth="6*" align="center"/>
31052 <colspec colwidth="6*" align="right"/>
31053 <tbody>
31054 <row>
31055 <entry><option>check_local_user</option></entry>
31056 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31057 <entry>Type: <emphasis>boolean</emphasis></entry>
31058 <entry>Default: <emphasis>false</emphasis></entry>
31059 </row>
31060 </tbody>
31061 </tgroup>
31062 </informaltable>
31063 <para>
31064 <indexterm role="concept">
31065 <primary>local user, checking in router</primary>
31066 </indexterm>
31067 <indexterm role="concept">
31068 <primary>router</primary>
31069 <secondary>checking for local user</secondary>
31070 </indexterm>
31071 <indexterm role="concept">
31072 <primary><filename>/etc/passwd</filename></primary>
31073 </indexterm>
31074 <indexterm role="variable">
31075 <primary><varname>$home</varname></primary>
31076 </indexterm>
31077 When this option is true, Exim checks that the local part of the recipient
31078 address (with affixes removed if relevant) is the name of an account on the
31079 local system. The check is done by calling the <function>getpwnam()</function> function rather
31080 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
31081 holding password data (such as NIS) are supported. If the local part is a local
31082 user, <varname>$home</varname> is set from the password data, and can be tested in other
31083 preconditions that are evaluated after this one (the order of evaluation is
31084 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
31085 overridden by <option>router_home_directory</option>. If the local part is not a local user,
31086 the router is skipped.
31087 </para>
31088 <para>
31089 If you want to check that the local part is either the name of a local user
31090 or matches something else, you cannot combine <option>check_local_user</option> with a
31091 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
31092 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
31093 setting to achieve this. For example:
31094 </para>
31095 <literallayout class="monospaced">
31096 local_parts = passwd;$local_part : lsearch;/etc/other/users
31097 </literallayout>
31098 <para>
31099 Note, however, that the side effects of <option>check_local_user</option> (such as setting
31100 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
31101 <option>local_parts</option> (or any other) precondition.
31102 </para>
31103 <para>
31104 <indexterm role="option">
31105 <primary><option>condition</option></primary>
31106 </indexterm>
31107 </para>
31108 <informaltable frame="all">
31109 <tgroup cols="4" colsep="0" rowsep="0">
31110 <colspec colwidth="8*" align="left"/>
31111 <colspec colwidth="6*" align="center"/>
31112 <colspec colwidth="6*" align="center"/>
31113 <colspec colwidth="6*" align="right"/>
31114 <tbody>
31115 <row>
31116 <entry><option>condition</option></entry>
31117 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31118 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31119 <entry>Default: <emphasis>unset</emphasis></entry>
31120 </row>
31121 </tbody>
31122 </tgroup>
31123 </informaltable>
31124 <para>
31125 <indexterm role="concept">
31126 <primary>router</primary>
31127 <secondary>customized precondition</secondary>
31128 </indexterm>
31129 This option specifies a general precondition test that has to succeed for the
31130 router to be called. The <option>condition</option> option is the last precondition to be
31131 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
31132 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
31133 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
31134 router is skipped, and the address is offered to the next one.
31135 </para>
31136 <para>
31137 If the result is any other value, the router is run (as this is the last
31138 precondition to be evaluated, all the other preconditions must be true).
31139 </para>
31140 <para>
31141 This option is unusual in that multiple <option>condition</option> options may be present.
31142 All <option>condition</option> options must succeed.
31143 </para>
31144 <para>
31145 The <option>condition</option> option provides a means of applying custom conditions to the
31146 running of routers. Note that in the case of a simple conditional expansion,
31147 the default expansion values are exactly what is wanted. For example:
31148 </para>
31149 <literallayout class="monospaced">
31150 condition = ${if &gt;{$message_age}{600}}
31151 </literallayout>
31152 <para>
31153 Because of the default behaviour of the string expansion, this is equivalent to
31154 </para>
31155 <literallayout class="monospaced">
31156 condition = ${if &gt;{$message_age}{600}{true}{}}
31157 </literallayout>
31158 <para>
31159 A multiple condition example, which succeeds:
31160 </para>
31161 <literallayout class="monospaced">
31162 condition = ${if &gt;{$message_age}{600}}
31163 condition = ${if !eq{${lc:$local_part}}{postmaster}}
31164 condition = foobar
31165 </literallayout>
31166 <para>
31167 If the expansion fails (other than forced failure) delivery is deferred. Some
31168 of the other precondition options are common special cases that could in fact
31169 be specified using <option>condition</option>.
31170 </para>
31171 <para>
31172 <indexterm role="option">
31173 <primary><option>debug_print</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>debug_print</option></entry>
31185 <entry>Use: <emphasis>routers</emphasis></entry>
31186 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31187 <entry>Default: <emphasis>unset</emphasis></entry>
31188 </row>
31189 </tbody>
31190 </tgroup>
31191 </informaltable>
31192 <para>
31193 <indexterm role="concept">
31194 <primary>testing</primary>
31195 <secondary>variables in drivers</secondary>
31196 </indexterm>
31197 If this option is set and debugging is enabled (see the <option>-d</option> command line
31198 option) or in address-testing mode (see the <option>-bt</option> command line option),
31199 the string is expanded and included in the debugging output.
31200 If expansion of the string fails, the error message is written to the debugging
31201 output, and Exim carries on processing.
31202 This option is provided to help with checking out the values of variables and
31203 so on when debugging router configurations. For example, if a <option>condition</option>
31204 option appears not to be working, <option>debug_print</option> can be used to output the
31205 variables it references. The output happens after checks for <option>domains</option>,
31206 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
31207 are tested. A newline is added to the text if it does not end with one.
31208 The variable <varname>$router_name</varname> contains the name of the router.
31209 </para>
31210 <para>
31211 <indexterm role="option">
31212 <primary><option>disable_logging</option></primary>
31213 </indexterm>
31214 </para>
31215 <informaltable frame="all">
31216 <tgroup cols="4" colsep="0" rowsep="0">
31217 <colspec colwidth="8*" align="left"/>
31218 <colspec colwidth="6*" align="center"/>
31219 <colspec colwidth="6*" align="center"/>
31220 <colspec colwidth="6*" align="right"/>
31221 <tbody>
31222 <row>
31223 <entry><option>disable_logging</option></entry>
31224 <entry>Use: <emphasis>routers</emphasis></entry>
31225 <entry>Type: <emphasis>boolean</emphasis></entry>
31226 <entry>Default: <emphasis>false</emphasis></entry>
31227 </row>
31228 </tbody>
31229 </tgroup>
31230 </informaltable>
31231 <para>
31232 If this option is set true, nothing is logged for any routing errors
31233 or for any deliveries caused by this router. You should not set this option
31234 unless you really, really know what you are doing. See also the generic
31235 transport option of the same name.
31236 </para>
31237 <para>
31238 <indexterm role="option">
31239 <primary><option>domains</option></primary>
31240 </indexterm>
31241 </para>
31242 <informaltable frame="all">
31243 <tgroup cols="4" colsep="0" rowsep="0">
31244 <colspec colwidth="8*" align="left"/>
31245 <colspec colwidth="6*" align="center"/>
31246 <colspec colwidth="6*" align="center"/>
31247 <colspec colwidth="6*" align="right"/>
31248 <tbody>
31249 <row>
31250 <entry><option>domains</option></entry>
31251 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31252 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31253 <entry>Default: <emphasis>unset</emphasis></entry>
31254 </row>
31255 </tbody>
31256 </tgroup>
31257 </informaltable>
31258 <para>
31259 <indexterm role="concept">
31260 <primary>router</primary>
31261 <secondary>restricting to specific domains</secondary>
31262 </indexterm>
31263 <indexterm role="variable">
31264 <primary><varname>$domain_data</varname></primary>
31265 </indexterm>
31266 If this option is set, the router is skipped unless the current domain matches
31267 the list. If the match is achieved by means of a file lookup, the data that the
31268 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
31269 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
31270 a list of the order in which preconditions are evaluated.
31271 </para>
31272 <para>
31273 <indexterm role="option">
31274 <primary><option>driver</option></primary>
31275 </indexterm>
31276 </para>
31277 <informaltable frame="all">
31278 <tgroup cols="4" colsep="0" rowsep="0">
31279 <colspec colwidth="8*" align="left"/>
31280 <colspec colwidth="6*" align="center"/>
31281 <colspec colwidth="6*" align="center"/>
31282 <colspec colwidth="6*" align="right"/>
31283 <tbody>
31284 <row>
31285 <entry><option>driver</option></entry>
31286 <entry>Use: <emphasis>routers</emphasis></entry>
31287 <entry>Type: <emphasis>string</emphasis></entry>
31288 <entry>Default: <emphasis>unset</emphasis></entry>
31289 </row>
31290 </tbody>
31291 </tgroup>
31292 </informaltable>
31293 <para>
31294 This option must always be set. It specifies which of the available routers is
31295 to be used.
31296 </para>
31297 <para>
31298 <indexterm role="option">
31299 <primary><option>errors_to</option></primary>
31300 </indexterm>
31301 </para>
31302 <informaltable frame="all">
31303 <tgroup cols="4" colsep="0" rowsep="0">
31304 <colspec colwidth="8*" align="left"/>
31305 <colspec colwidth="6*" align="center"/>
31306 <colspec colwidth="6*" align="center"/>
31307 <colspec colwidth="6*" align="right"/>
31308 <tbody>
31309 <row>
31310 <entry><option>errors_to</option></entry>
31311 <entry>Use: <emphasis>routers</emphasis></entry>
31312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31313 <entry>Default: <emphasis>unset</emphasis></entry>
31314 </row>
31315 </tbody>
31316 </tgroup>
31317 </informaltable>
31318 <para>
31319 <indexterm role="concept">
31320 <primary>envelope sender</primary>
31321 </indexterm>
31322 <indexterm role="concept">
31323 <primary>router</primary>
31324 <secondary>changing address for errors</secondary>
31325 </indexterm>
31326 If a router successfully handles an address, it may assign the address to a
31327 transport for delivery or it may generate child addresses. In both cases, if
31328 there is a delivery problem during later processing, the resulting bounce
31329 message is sent to the address that results from expanding this string,
31330 provided that the address verifies successfully. The <option>errors_to</option> option is
31331 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
31332 </para>
31333 <para>
31334 The <option>errors_to</option> setting associated with an address can be overridden if it
31335 subsequently passes through other routers that have their own <option>errors_to</option>
31336 settings, or if the message is delivered by a transport with a <option>return_path</option>
31337 setting.
31338 </para>
31339 <para>
31340 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
31341 the expansion fails to verify, the errors address associated with the incoming
31342 address is used. At top level, this is the envelope sender. A non-forced
31343 expansion failure causes delivery to be deferred.
31344 </para>
31345 <para>
31346 If an address for which <option>errors_to</option> has been set ends up being delivered over
31347 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
31348 any bounces that are generated by other MTAs on the delivery route are also
31349 sent there. You can set <option>errors_to</option> to the empty string by either of these
31350 settings:
31351 </para>
31352 <literallayout class="monospaced">
31353 errors_to =
31354 errors_to = ""
31355 </literallayout>
31356 <para>
31357 An expansion item that yields an empty string has the same effect. If you do
31358 this, a locally detected delivery error for addresses processed by this router
31359 no longer gives rise to a bounce message; the error is discarded. If the
31360 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
31361 overridden by the <option>return_path</option> option on the transport.
31362 </para>
31363 <para>
31364 <indexterm role="variable">
31365 <primary><varname>$address_data</varname></primary>
31366 </indexterm>
31367 If for some reason you want to discard local errors, but use a non-empty
31368 MAIL command for remote delivery, you can preserve the original return
31369 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
31370 setting <option>return_path</option>.
31371 </para>
31372 <para>
31373 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
31374 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
31375 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
31376 </para>
31377 <para>
31378 <indexterm role="option">
31379 <primary><option>expn</option></primary>
31380 </indexterm>
31381 </para>
31382 <informaltable frame="all">
31383 <tgroup cols="4" colsep="0" rowsep="0">
31384 <colspec colwidth="8*" align="left"/>
31385 <colspec colwidth="6*" align="center"/>
31386 <colspec colwidth="6*" align="center"/>
31387 <colspec colwidth="6*" align="right"/>
31388 <tbody>
31389 <row>
31390 <entry><option>expn</option></entry>
31391 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31392 <entry>Type: <emphasis>boolean</emphasis></entry>
31393 <entry>Default: <emphasis>true</emphasis></entry>
31394 </row>
31395 </tbody>
31396 </tgroup>
31397 </informaltable>
31398 <para>
31399 <indexterm role="concept">
31400 <primary>address</primary>
31401 <secondary>testing</secondary>
31402 </indexterm>
31403 <indexterm role="concept">
31404 <primary>testing</primary>
31405 <secondary>addresses</secondary>
31406 </indexterm>
31407 <indexterm role="concept">
31408 <primary>EXPN</primary>
31409 <secondary>router skipping</secondary>
31410 </indexterm>
31411 <indexterm role="concept">
31412 <primary>router</primary>
31413 <secondary>skipping for EXPN</secondary>
31414 </indexterm>
31415 If this option is turned off, the router is skipped when testing an address
31416 as a result of processing an SMTP EXPN command. You might, for example,
31417 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
31418 on for the system alias file.
31419 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31420 are evaluated.
31421 </para>
31422 <para>
31423 The use of the SMTP EXPN command is controlled by an ACL (see chapter
31424 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
31425 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
31426 </para>
31427 <para>
31428 <indexterm role="option">
31429 <primary><option>fail_verify</option></primary>
31430 </indexterm>
31431 </para>
31432 <informaltable frame="all">
31433 <tgroup cols="4" colsep="0" rowsep="0">
31434 <colspec colwidth="8*" align="left"/>
31435 <colspec colwidth="6*" align="center"/>
31436 <colspec colwidth="6*" align="center"/>
31437 <colspec colwidth="6*" align="right"/>
31438 <tbody>
31439 <row>
31440 <entry><option>fail_verify</option></entry>
31441 <entry>Use: <emphasis>routers</emphasis></entry>
31442 <entry>Type: <emphasis>boolean</emphasis></entry>
31443 <entry>Default: <emphasis>false</emphasis></entry>
31444 </row>
31445 </tbody>
31446 </tgroup>
31447 </informaltable>
31448 <para>
31449 <indexterm role="concept">
31450 <primary>router</primary>
31451 <secondary>forcing verification failure</secondary>
31452 </indexterm>
31453 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
31454 <option>fail_verify_recipient</option> to the same value.
31455 </para>
31456 <para>
31457 <indexterm role="option">
31458 <primary><option>fail_verify_recipient</option></primary>
31459 </indexterm>
31460 </para>
31461 <informaltable frame="all">
31462 <tgroup cols="4" colsep="0" rowsep="0">
31463 <colspec colwidth="8*" align="left"/>
31464 <colspec colwidth="6*" align="center"/>
31465 <colspec colwidth="6*" align="center"/>
31466 <colspec colwidth="6*" align="right"/>
31467 <tbody>
31468 <row>
31469 <entry><option>fail_verify_recipient</option></entry>
31470 <entry>Use: <emphasis>routers</emphasis></entry>
31471 <entry>Type: <emphasis>boolean</emphasis></entry>
31472 <entry>Default: <emphasis>false</emphasis></entry>
31473 </row>
31474 </tbody>
31475 </tgroup>
31476 </informaltable>
31477 <para>
31478 If this option is true and an address is accepted by this router when
31479 verifying a recipient, verification fails.
31480 </para>
31481 <para>
31482 <indexterm role="option">
31483 <primary><option>fail_verify_sender</option></primary>
31484 </indexterm>
31485 </para>
31486 <informaltable frame="all">
31487 <tgroup cols="4" colsep="0" rowsep="0">
31488 <colspec colwidth="8*" align="left"/>
31489 <colspec colwidth="6*" align="center"/>
31490 <colspec colwidth="6*" align="center"/>
31491 <colspec colwidth="6*" align="right"/>
31492 <tbody>
31493 <row>
31494 <entry><option>fail_verify_sender</option></entry>
31495 <entry>Use: <emphasis>routers</emphasis></entry>
31496 <entry>Type: <emphasis>boolean</emphasis></entry>
31497 <entry>Default: <emphasis>false</emphasis></entry>
31498 </row>
31499 </tbody>
31500 </tgroup>
31501 </informaltable>
31502 <para>
31503 If this option is true and an address is accepted by this router when
31504 verifying a sender, verification fails.
31505 </para>
31506 <para>
31507 <indexterm role="option">
31508 <primary><option>fallback_hosts</option></primary>
31509 </indexterm>
31510 </para>
31511 <informaltable frame="all">
31512 <tgroup cols="4" colsep="0" rowsep="0">
31513 <colspec colwidth="8*" align="left"/>
31514 <colspec colwidth="6*" align="center"/>
31515 <colspec colwidth="6*" align="center"/>
31516 <colspec colwidth="6*" align="right"/>
31517 <tbody>
31518 <row>
31519 <entry><option>fallback_hosts</option></entry>
31520 <entry>Use: <emphasis>routers</emphasis></entry>
31521 <entry>Type: <emphasis>string list</emphasis></entry>
31522 <entry>Default: <emphasis>unset</emphasis></entry>
31523 </row>
31524 </tbody>
31525 </tgroup>
31526 </informaltable>
31527 <para>
31528 <indexterm role="concept">
31529 <primary>router</primary>
31530 <secondary>fallback hosts</secondary>
31531 </indexterm>
31532 <indexterm role="concept">
31533 <primary>fallback</primary>
31534 <secondary>hosts specified on router</secondary>
31535 </indexterm>
31536 String expansion is not applied to this option. The argument must be a
31537 colon-separated list of host names or IP addresses. The list separator can be
31538 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
31539 each name or address. In fact, the format of each item is exactly the same as
31540 defined for the list of hosts in a <command>manualroute</command> router (see section
31541 <xref linkend="SECTformatonehostitem"/>).
31542 </para>
31543 <para>
31544 If a router queues an address for a remote transport, this host list is
31545 associated with the address, and used instead of the transport&#x2019;s fallback host
31546 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
31547 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
31548 transport for further details.
31549 </para>
31550 <para>
31551 <indexterm role="option">
31552 <primary><option>group</option></primary>
31553 </indexterm>
31554 </para>
31555 <informaltable frame="all">
31556 <tgroup cols="4" colsep="0" rowsep="0">
31557 <colspec colwidth="8*" align="left"/>
31558 <colspec colwidth="6*" align="center"/>
31559 <colspec colwidth="6*" align="center"/>
31560 <colspec colwidth="6*" align="right"/>
31561 <tbody>
31562 <row>
31563 <entry><option>group</option></entry>
31564 <entry>Use: <emphasis>routers</emphasis></entry>
31565 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31566 <entry>Default: <emphasis>see below</emphasis></entry>
31567 </row>
31568 </tbody>
31569 </tgroup>
31570 </informaltable>
31571 <para>
31572 <indexterm role="concept">
31573 <primary>gid (group id)</primary>
31574 <secondary>local delivery</secondary>
31575 </indexterm>
31576 <indexterm role="concept">
31577 <primary>local transports</primary>
31578 <secondary>uid and gid</secondary>
31579 </indexterm>
31580 <indexterm role="concept">
31581 <primary>transport</primary>
31582 <secondary>local</secondary>
31583 </indexterm>
31584 <indexterm role="concept">
31585 <primary>router</primary>
31586 <secondary>setting group</secondary>
31587 </indexterm>
31588 When a router queues an address for a transport, and the transport does not
31589 specify a group, the group given here is used when running the delivery
31590 process.
31591 The group may be specified numerically or by name. If expansion fails, the
31592 error is logged and delivery is deferred.
31593 The default is unset, unless <option>check_local_user</option> is set, when the default
31594 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
31595 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31596 </para>
31597 <para>
31598 <indexterm role="option">
31599 <primary><option>headers_add</option></primary>
31600 </indexterm>
31601 </para>
31602 <informaltable frame="all">
31603 <tgroup cols="4" colsep="0" rowsep="0">
31604 <colspec colwidth="8*" align="left"/>
31605 <colspec colwidth="6*" align="center"/>
31606 <colspec colwidth="6*" align="center"/>
31607 <colspec colwidth="6*" align="right"/>
31608 <tbody>
31609 <row>
31610 <entry><option>headers_add</option></entry>
31611 <entry>Use: <emphasis>routers</emphasis></entry>
31612 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31613 <entry>Default: <emphasis>unset</emphasis></entry>
31614 </row>
31615 </tbody>
31616 </tgroup>
31617 </informaltable>
31618 <para>
31619 <indexterm role="concept">
31620 <primary>header lines</primary>
31621 <secondary>adding</secondary>
31622 </indexterm>
31623 <indexterm role="concept">
31624 <primary>router</primary>
31625 <secondary>adding header lines</secondary>
31626 </indexterm>
31627 This option specifies a list of text headers, newline-separated,
31628 that is associated with any addresses that are accepted by the router.
31629 Each item is separately expanded, at routing time.  However, this
31630 option has no effect when an address is just being verified. The way in which
31631 the text is used to add header lines at transport time is described in section
31632 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
31633 message is in the process of being transported. This means that references to
31634 header lines in string expansions in the transport&#x2019;s configuration do not
31635 <quote>see</quote> the added header lines.
31636 </para>
31637 <para>
31638 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
31639 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
31640 an item expansion is forced to fail, the item has no effect. Other expansion
31641 failures are treated as configuration errors.
31642 </para>
31643 <para>
31644 Unlike most options, <option>headers_add</option> can be specified multiple times
31645 for a router; all listed headers are added.
31646 </para>
31647 <para>
31648 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
31649 router that has the <option>one_time</option> option set.
31650 </para>
31651 <para>
31652 <indexterm role="concept">
31653 <primary>duplicate addresses</primary>
31654 </indexterm>
31655 <indexterm role="option">
31656 <primary><option>unseen</option></primary>
31657 </indexterm>
31658 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31659 additions are deleted when the address is passed on to subsequent routers.
31660 For a <option>redirect</option> router, if a generated address is the same as the incoming
31661 address, this can lead to duplicate addresses with different header
31662 modifications. Exim does not do duplicate deliveries (except, in certain
31663 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
31664 which of the duplicates is discarded, so this ambiguous situation should be
31665 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
31666 </para>
31667 <para>
31668 <indexterm role="option">
31669 <primary><option>headers_remove</option></primary>
31670 </indexterm>
31671 </para>
31672 <informaltable frame="all">
31673 <tgroup cols="4" colsep="0" rowsep="0">
31674 <colspec colwidth="8*" align="left"/>
31675 <colspec colwidth="6*" align="center"/>
31676 <colspec colwidth="6*" align="center"/>
31677 <colspec colwidth="6*" align="right"/>
31678 <tbody>
31679 <row>
31680 <entry><option>headers_remove</option></entry>
31681 <entry>Use: <emphasis>routers</emphasis></entry>
31682 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31683 <entry>Default: <emphasis>unset</emphasis></entry>
31684 </row>
31685 </tbody>
31686 </tgroup>
31687 </informaltable>
31688 <para>
31689 <indexterm role="concept">
31690 <primary>header lines</primary>
31691 <secondary>removing</secondary>
31692 </indexterm>
31693 <indexterm role="concept">
31694 <primary>router</primary>
31695 <secondary>removing header lines</secondary>
31696 </indexterm>
31697 This option specifies a list of text headers, colon-separated,
31698 that is associated with any addresses that are accepted by the router.
31699 Each item is separately expanded, at routing time.  However, this
31700 option has no effect when an address is just being verified. The way in which
31701 the text is used to remove header lines at transport time is described in
31702 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
31703 the message is in the process of being transported. This means that references
31704 to header lines in string expansions in the transport&#x2019;s configuration still
31705 <quote>see</quote> the original header lines.
31706 </para>
31707 <para>
31708 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
31709 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
31710 the item has no effect. Other expansion failures are treated as configuration
31711 errors.
31712 </para>
31713 <para>
31714 Unlike most options, <option>headers_remove</option> can be specified multiple times
31715 for a router; all listed headers are removed.
31716 </para>
31717 <para>
31718 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
31719 router that has the <option>one_time</option> option set.
31720 </para>
31721 <para>
31722 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31723 removal requests are deleted when the address is passed on to subsequent
31724 routers, and this can lead to problems with duplicates -- see the similar
31725 warning for <option>headers_add</option> above.
31726 </para>
31727 <para>
31728 <indexterm role="option">
31729 <primary><option>ignore_target_hosts</option></primary>
31730 </indexterm>
31731 </para>
31732 <informaltable frame="all">
31733 <tgroup cols="4" colsep="0" rowsep="0">
31734 <colspec colwidth="8*" align="left"/>
31735 <colspec colwidth="6*" align="center"/>
31736 <colspec colwidth="6*" align="center"/>
31737 <colspec colwidth="6*" align="right"/>
31738 <tbody>
31739 <row>
31740 <entry><option>ignore_target_hosts</option></entry>
31741 <entry>Use: <emphasis>routers</emphasis></entry>
31742 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31743 <entry>Default: <emphasis>unset</emphasis></entry>
31744 </row>
31745 </tbody>
31746 </tgroup>
31747 </informaltable>
31748 <para>
31749 <indexterm role="concept">
31750 <primary>IP address</primary>
31751 <secondary>discarding</secondary>
31752 </indexterm>
31753 <indexterm role="concept">
31754 <primary>router</primary>
31755 <secondary>discarding IP addresses</secondary>
31756 </indexterm>
31757 Although this option is a host list, it should normally contain IP address
31758 entries rather than names. If any host that is looked up by the router has an
31759 IP address that matches an item in this list, Exim behaves as if that IP
31760 address did not exist. This option allows you to cope with rogue DNS entries
31761 like
31762 </para>
31763 <literallayout class="monospaced">
31764 remote.domain.example.  A  127.0.0.1
31765 </literallayout>
31766 <para>
31767 by setting
31768 </para>
31769 <literallayout class="monospaced">
31770 ignore_target_hosts = 127.0.0.1
31771 </literallayout>
31772 <para>
31773 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
31774 discarded in this way, the router declines. In a conventional configuration, an
31775 attempt to mail to such a domain would normally provoke the <quote>unrouteable
31776 domain</quote> error, and an attempt to verify an address in the domain would fail.
31777 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
31778 router declines if presented with one of the listed addresses.
31779 </para>
31780 <para>
31781 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
31782 means of the first or the second of the following settings, respectively:
31783 </para>
31784 <literallayout class="monospaced">
31785 ignore_target_hosts = 0.0.0.0/0
31786 ignore_target_hosts = &lt;; 0::0/0
31787 </literallayout>
31788 <para>
31789 The pattern in the first line matches all IPv4 addresses, whereas the pattern
31790 in the second line matches all IPv6 addresses.
31791 </para>
31792 <para>
31793 This option may also be useful for ignoring link-local and site-local IPv6
31794 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
31795 is expanded before use as a list, it is possible to make it dependent on the
31796 domain that is being routed.
31797 </para>
31798 <para>
31799 <indexterm role="variable">
31800 <primary><varname>$host_address</varname></primary>
31801 </indexterm>
31802 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
31803 checked.
31804 </para>
31805 <para>
31806 <indexterm role="option">
31807 <primary><option>initgroups</option></primary>
31808 </indexterm>
31809 </para>
31810 <informaltable frame="all">
31811 <tgroup cols="4" colsep="0" rowsep="0">
31812 <colspec colwidth="8*" align="left"/>
31813 <colspec colwidth="6*" align="center"/>
31814 <colspec colwidth="6*" align="center"/>
31815 <colspec colwidth="6*" align="right"/>
31816 <tbody>
31817 <row>
31818 <entry><option>initgroups</option></entry>
31819 <entry>Use: <emphasis>routers</emphasis></entry>
31820 <entry>Type: <emphasis>boolean</emphasis></entry>
31821 <entry>Default: <emphasis>false</emphasis></entry>
31822 </row>
31823 </tbody>
31824 </tgroup>
31825 </informaltable>
31826 <para>
31827 <indexterm role="concept">
31828 <primary>additional groups</primary>
31829 </indexterm>
31830 <indexterm role="concept">
31831 <primary>groups</primary>
31832 <secondary>additional</secondary>
31833 </indexterm>
31834 <indexterm role="concept">
31835 <primary>local transports</primary>
31836 <secondary>uid and gid</secondary>
31837 </indexterm>
31838 <indexterm role="concept">
31839 <primary>transport</primary>
31840 <secondary>local</secondary>
31841 </indexterm>
31842 If the router queues an address for a transport, and this option is true, and
31843 the uid supplied by the router is not overridden by the transport, the
31844 <function>initgroups()</function> function is called when running the transport to ensure that
31845 any additional groups associated with the uid are set up. See also <option>group</option>
31846 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31847 </para>
31848 <para>
31849 <indexterm role="option">
31850 <primary><option>local_part_prefix</option></primary>
31851 </indexterm>
31852 </para>
31853 <informaltable frame="all">
31854 <tgroup cols="4" colsep="0" rowsep="0">
31855 <colspec colwidth="8*" align="left"/>
31856 <colspec colwidth="6*" align="center"/>
31857 <colspec colwidth="6*" align="center"/>
31858 <colspec colwidth="6*" align="right"/>
31859 <tbody>
31860 <row>
31861 <entry><option>local_part_prefix</option></entry>
31862 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31863 <entry>Type: <emphasis>string list</emphasis></entry>
31864 <entry>Default: <emphasis>unset</emphasis></entry>
31865 </row>
31866 </tbody>
31867 </tgroup>
31868 </informaltable>
31869 <para>
31870 <indexterm role="concept">
31871 <primary>router</primary>
31872 <secondary>prefix for local part</secondary>
31873 </indexterm>
31874 <indexterm role="concept">
31875 <primary>prefix</primary>
31876 <secondary>for local part, used in router</secondary>
31877 </indexterm>
31878 If this option is set, the router is skipped unless the local part starts with
31879 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
31880 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
31881 evaluated.
31882 </para>
31883 <para>
31884 The list is scanned from left to right, and the first prefix that matches is
31885 used. A limited form of wildcard is available; if the prefix begins with an
31886 asterisk, it matches the longest possible sequence of arbitrary characters at
31887 the start of the local part. An asterisk should therefore always be followed by
31888 some character that does not occur in normal local parts.
31889 <indexterm role="concept">
31890 <primary>multiple mailboxes</primary>
31891 </indexterm>
31892 <indexterm role="concept">
31893 <primary>mailbox</primary>
31894 <secondary>multiple</secondary>
31895 </indexterm>
31896 Wildcarding can be used to set up multiple user mailboxes, as described in
31897 section <xref linkend="SECTmulbox"/>.
31898 </para>
31899 <para>
31900 <indexterm role="variable">
31901 <primary><varname>$local_part</varname></primary>
31902 </indexterm>
31903 <indexterm role="variable">
31904 <primary><varname>$local_part_prefix</varname></primary>
31905 </indexterm>
31906 During the testing of the <option>local_parts</option> option, and while the router is
31907 running, the prefix is removed from the local part, and is available in the
31908 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
31909 the router accepts the address, this remains true during subsequent delivery by
31910 a transport. In particular, the local part that is transmitted in the RCPT
31911 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
31912 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
31913 the relevant transport.
31914 </para>
31915 <para>
31916 When an address is being verified, <option>local_part_prefix</option> affects only the
31917 behaviour of the router. If the callout feature of verification is in use, this
31918 means that the full address, including the prefix, will be used during the
31919 callout.
31920 </para>
31921 <para>
31922 The prefix facility is commonly used to handle local parts of the form
31923 <option>owner-something</option>. Another common use is to support local parts of the form
31924 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
31925 to tell a user their forwarding is broken &ndash; by placing a router like this one
31926 immediately before the router that handles <filename>.forward</filename> files:
31927 </para>
31928 <literallayout class="monospaced">
31929 real_localuser:
31930   driver = accept
31931   local_part_prefix = real-
31932   check_local_user
31933   transport = local_delivery
31934 </literallayout>
31935 <para>
31936 For security, it would probably be a good idea to restrict the use of this
31937 router to locally-generated messages, using a condition such as this:
31938 </para>
31939 <literallayout class="monospaced">
31940   condition = ${if match {$sender_host_address}\
31941                          {\N^(|127\.0\.0\.1)$\N}}
31942 </literallayout>
31943 <para>
31944 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
31945 both conditions must be met if not optional. Care must be taken if wildcards
31946 are used in both a prefix and a suffix on the same router. Different
31947 separator characters must be used to avoid ambiguity.
31948 </para>
31949 <para>
31950 <indexterm role="option">
31951 <primary><option>local_part_prefix_optional</option></primary>
31952 </indexterm>
31953 </para>
31954 <informaltable frame="all">
31955 <tgroup cols="4" colsep="0" rowsep="0">
31956 <colspec colwidth="8*" align="left"/>
31957 <colspec colwidth="6*" align="center"/>
31958 <colspec colwidth="6*" align="center"/>
31959 <colspec colwidth="6*" align="right"/>
31960 <tbody>
31961 <row>
31962 <entry><option>local_part_prefix_optional</option></entry>
31963 <entry>Use: <emphasis>routers</emphasis></entry>
31964 <entry>Type: <emphasis>boolean</emphasis></entry>
31965 <entry>Default: <emphasis>false</emphasis></entry>
31966 </row>
31967 </tbody>
31968 </tgroup>
31969 </informaltable>
31970 <para>
31971 See <option>local_part_prefix</option> above.
31972 </para>
31973 <para>
31974 <indexterm role="option">
31975 <primary><option>local_part_suffix</option></primary>
31976 </indexterm>
31977 </para>
31978 <informaltable frame="all">
31979 <tgroup cols="4" colsep="0" rowsep="0">
31980 <colspec colwidth="8*" align="left"/>
31981 <colspec colwidth="6*" align="center"/>
31982 <colspec colwidth="6*" align="center"/>
31983 <colspec colwidth="6*" align="right"/>
31984 <tbody>
31985 <row>
31986 <entry><option>local_part_suffix</option></entry>
31987 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31988 <entry>Type: <emphasis>string list</emphasis></entry>
31989 <entry>Default: <emphasis>unset</emphasis></entry>
31990 </row>
31991 </tbody>
31992 </tgroup>
31993 </informaltable>
31994 <para>
31995 <indexterm role="concept">
31996 <primary>router</primary>
31997 <secondary>suffix for local part</secondary>
31998 </indexterm>
31999 <indexterm role="concept">
32000 <primary>suffix for local part</primary>
32001 <secondary>used in router</secondary>
32002 </indexterm>
32003 This option operates in the same way as <option>local_part_prefix</option>, except that the
32004 local part must end (rather than start) with the given string, the
32005 <option>local_part_suffix_optional</option> option determines whether the suffix is
32006 mandatory, and the wildcard * character, if present, must be the last
32007 character of the suffix. This option facility is commonly used to handle local
32008 parts of the form <option>something-request</option> and multiple user mailboxes of the form
32009 <option>username-foo</option>.
32010 </para>
32011 <para>
32012 <indexterm role="option">
32013 <primary><option>local_part_suffix_optional</option></primary>
32014 </indexterm>
32015 </para>
32016 <informaltable frame="all">
32017 <tgroup cols="4" colsep="0" rowsep="0">
32018 <colspec colwidth="8*" align="left"/>
32019 <colspec colwidth="6*" align="center"/>
32020 <colspec colwidth="6*" align="center"/>
32021 <colspec colwidth="6*" align="right"/>
32022 <tbody>
32023 <row>
32024 <entry><option>local_part_suffix_optional</option></entry>
32025 <entry>Use: <emphasis>routers</emphasis></entry>
32026 <entry>Type: <emphasis>boolean</emphasis></entry>
32027 <entry>Default: <emphasis>false</emphasis></entry>
32028 </row>
32029 </tbody>
32030 </tgroup>
32031 </informaltable>
32032 <para>
32033 See <option>local_part_suffix</option> above.
32034 </para>
32035 <para>
32036 <indexterm role="option">
32037 <primary><option>local_parts</option></primary>
32038 </indexterm>
32039 </para>
32040 <informaltable frame="all">
32041 <tgroup cols="4" colsep="0" rowsep="0">
32042 <colspec colwidth="8*" align="left"/>
32043 <colspec colwidth="6*" align="center"/>
32044 <colspec colwidth="6*" align="center"/>
32045 <colspec colwidth="6*" align="right"/>
32046 <tbody>
32047 <row>
32048 <entry><option>local_parts</option></entry>
32049 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32050 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
32051 <entry>Default: <emphasis>unset</emphasis></entry>
32052 </row>
32053 </tbody>
32054 </tgroup>
32055 </informaltable>
32056 <para>
32057 <indexterm role="concept">
32058 <primary>router</primary>
32059 <secondary>restricting to specific local parts</secondary>
32060 </indexterm>
32061 <indexterm role="concept">
32062 <primary>local part</primary>
32063 <secondary>checking in router</secondary>
32064 </indexterm>
32065 The router is run only if the local part of the address matches the list.
32066 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32067 are evaluated, and
32068 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
32069 string is expanded, it is possible to make it depend on the domain, for
32070 example:
32071 </para>
32072 <literallayout class="monospaced">
32073 local_parts = dbm;/usr/local/specials/$domain
32074 </literallayout>
32075 <para>
32076 <indexterm role="variable">
32077 <primary><varname>$local_part_data</varname></primary>
32078 </indexterm>
32079 If the match is achieved by a lookup, the data that the lookup returned
32080 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
32081 expansions of the router&#x2019;s private options. You might use this option, for
32082 example, if you have a large number of local virtual domains, and you want to
32083 send all postmaster mail to the same place without having to set up an alias in
32084 each virtual domain:
32085 </para>
32086 <literallayout class="monospaced">
32087 postmaster:
32088   driver = redirect
32089   local_parts = postmaster
32090   data = postmaster@real.domain.example
32091 </literallayout>
32092 <para>
32093 <indexterm role="option">
32094 <primary><option>log_as_local</option></primary>
32095 </indexterm>
32096 </para>
32097 <informaltable frame="all">
32098 <tgroup cols="4" colsep="0" rowsep="0">
32099 <colspec colwidth="8*" align="left"/>
32100 <colspec colwidth="6*" align="center"/>
32101 <colspec colwidth="6*" align="center"/>
32102 <colspec colwidth="6*" align="right"/>
32103 <tbody>
32104 <row>
32105 <entry><option>log_as_local</option></entry>
32106 <entry>Use: <emphasis>routers</emphasis></entry>
32107 <entry>Type: <emphasis>boolean</emphasis></entry>
32108 <entry>Default: <emphasis>see below</emphasis></entry>
32109 </row>
32110 </tbody>
32111 </tgroup>
32112 </informaltable>
32113 <para>
32114 <indexterm role="concept">
32115 <primary>log</primary>
32116 <secondary>delivery line</secondary>
32117 </indexterm>
32118 <indexterm role="concept">
32119 <primary>delivery</primary>
32120 <secondary>log line format</secondary>
32121 </indexterm>
32122 Exim has two logging styles for delivery, the idea being to make local
32123 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
32124 recipient address is given just as the local part, without a domain. The use of
32125 this style is controlled by this option. It defaults to true for the <command>accept</command>
32126 router, and false for all the others. This option applies only when a
32127 router assigns an address to a transport. It has no effect on routers that
32128 redirect addresses.
32129 </para>
32130 <para>
32131 <indexterm role="option">
32132 <primary><option>more</option></primary>
32133 </indexterm>
32134 </para>
32135 <informaltable frame="all">
32136 <tgroup cols="4" colsep="0" rowsep="0">
32137 <colspec colwidth="8*" align="left"/>
32138 <colspec colwidth="6*" align="center"/>
32139 <colspec colwidth="6*" align="center"/>
32140 <colspec colwidth="6*" align="right"/>
32141 <tbody>
32142 <row>
32143 <entry><option>more</option></entry>
32144 <entry>Use: <emphasis>routers</emphasis></entry>
32145 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32146 <entry>Default: <emphasis>true</emphasis></entry>
32147 </row>
32148 </tbody>
32149 </tgroup>
32150 </informaltable>
32151 <para>
32152 The result of string expansion for this option must be a valid boolean value,
32153 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32154 result causes an error, and delivery is deferred. If the expansion is forced to
32155 fail, the default value for the option (true) is used. Other failures cause
32156 delivery to be deferred.
32157 </para>
32158 <para>
32159 If this option is set false, and the router declines to handle the address, no
32160 further routers are tried, routing fails, and the address is bounced.
32161 <indexterm role="option">
32162 <primary><option>self</option></primary>
32163 </indexterm>
32164 However, if the router explicitly passes an address to the following router by
32165 means of the setting
32166 </para>
32167 <literallayout class="monospaced">
32168 self = pass
32169 </literallayout>
32170 <para>
32171 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
32172 does not affect the behaviour if one of the precondition tests fails. In that
32173 case, the address is always passed to the next router.
32174 </para>
32175 <para>
32176 Note that <option>address_data</option> is not considered to be a precondition. If its
32177 expansion is forced to fail, the router declines, and the value of <option>more</option>
32178 controls what happens next.
32179 </para>
32180 <para>
32181 <indexterm role="option">
32182 <primary><option>pass_on_timeout</option></primary>
32183 </indexterm>
32184 </para>
32185 <informaltable frame="all">
32186 <tgroup cols="4" colsep="0" rowsep="0">
32187 <colspec colwidth="8*" align="left"/>
32188 <colspec colwidth="6*" align="center"/>
32189 <colspec colwidth="6*" align="center"/>
32190 <colspec colwidth="6*" align="right"/>
32191 <tbody>
32192 <row>
32193 <entry><option>pass_on_timeout</option></entry>
32194 <entry>Use: <emphasis>routers</emphasis></entry>
32195 <entry>Type: <emphasis>boolean</emphasis></entry>
32196 <entry>Default: <emphasis>false</emphasis></entry>
32197 </row>
32198 </tbody>
32199 </tgroup>
32200 </informaltable>
32201 <para>
32202 <indexterm role="concept">
32203 <primary>timeout</primary>
32204 <secondary>of router</secondary>
32205 </indexterm>
32206 <indexterm role="concept">
32207 <primary>router</primary>
32208 <secondary>timeout</secondary>
32209 </indexterm>
32210 If a router times out during a host lookup, it normally causes deferral of the
32211 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
32212 router, overriding <option>no_more</option>. This may be helpful for systems that are
32213 intermittently connected to the Internet, or those that want to pass to a smart
32214 host any messages that cannot immediately be delivered.
32215 </para>
32216 <para>
32217 There are occasional other temporary errors that can occur while doing DNS
32218 lookups. They are treated in the same way as a timeout, and this option
32219 applies to all of them.
32220 </para>
32221 <para>
32222 <indexterm role="option">
32223 <primary><option>pass_router</option></primary>
32224 </indexterm>
32225 </para>
32226 <informaltable frame="all">
32227 <tgroup cols="4" colsep="0" rowsep="0">
32228 <colspec colwidth="8*" align="left"/>
32229 <colspec colwidth="6*" align="center"/>
32230 <colspec colwidth="6*" align="center"/>
32231 <colspec colwidth="6*" align="right"/>
32232 <tbody>
32233 <row>
32234 <entry><option>pass_router</option></entry>
32235 <entry>Use: <emphasis>routers</emphasis></entry>
32236 <entry>Type: <emphasis>string</emphasis></entry>
32237 <entry>Default: <emphasis>unset</emphasis></entry>
32238 </row>
32239 </tbody>
32240 </tgroup>
32241 </informaltable>
32242 <para>
32243 <indexterm role="concept">
32244 <primary>router</primary>
32245 <secondary>go to after <quote>pass</quote></secondary>
32246 </indexterm>
32247 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
32248 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
32249 routing to continue, and overriding a false setting of <option>more</option>. When one of
32250 these routers returns <quote>pass</quote>, the address is normally handed on to the next
32251 router in sequence. This can be changed by setting <option>pass_router</option> to the name
32252 of another router. However (unlike <option>redirect_router</option>) the named router must
32253 be below the current router, to avoid loops. Note that this option applies only
32254 to the special case of <quote>pass</quote>. It does not apply when a router returns
32255 <quote>decline</quote> because it cannot handle an address.
32256 </para>
32257 <para>
32258 <indexterm role="option">
32259 <primary><option>redirect_router</option></primary>
32260 </indexterm>
32261 </para>
32262 <informaltable frame="all">
32263 <tgroup cols="4" colsep="0" rowsep="0">
32264 <colspec colwidth="8*" align="left"/>
32265 <colspec colwidth="6*" align="center"/>
32266 <colspec colwidth="6*" align="center"/>
32267 <colspec colwidth="6*" align="right"/>
32268 <tbody>
32269 <row>
32270 <entry><option>redirect_router</option></entry>
32271 <entry>Use: <emphasis>routers</emphasis></entry>
32272 <entry>Type: <emphasis>string</emphasis></entry>
32273 <entry>Default: <emphasis>unset</emphasis></entry>
32274 </row>
32275 </tbody>
32276 </tgroup>
32277 </informaltable>
32278 <para>
32279 <indexterm role="concept">
32280 <primary>router</primary>
32281 <secondary>start at after redirection</secondary>
32282 </indexterm>
32283 Sometimes an administrator knows that it is pointless to reprocess addresses
32284 generated from alias or forward files with the same router again. For
32285 example, if an alias file translates real names into login ids there is no
32286 point searching the alias file a second time, especially if it is a large file.
32287 </para>
32288 <para>
32289 The <option>redirect_router</option> option can be set to the name of any router instance.
32290 It causes the routing of any generated addresses to start at the named router
32291 instead of at the first router. This option has no effect if the router in
32292 which it is set does not generate new addresses.
32293 </para>
32294 <para>
32295 <indexterm role="option">
32296 <primary><option>require_files</option></primary>
32297 </indexterm>
32298 </para>
32299 <informaltable frame="all">
32300 <tgroup cols="4" colsep="0" rowsep="0">
32301 <colspec colwidth="8*" align="left"/>
32302 <colspec colwidth="6*" align="center"/>
32303 <colspec colwidth="6*" align="center"/>
32304 <colspec colwidth="6*" align="right"/>
32305 <tbody>
32306 <row>
32307 <entry><option>require_files</option></entry>
32308 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32309 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32310 <entry>Default: <emphasis>unset</emphasis></entry>
32311 </row>
32312 </tbody>
32313 </tgroup>
32314 </informaltable>
32315 <para>
32316 <indexterm role="concept">
32317 <primary>file</primary>
32318 <secondary>requiring for router</secondary>
32319 </indexterm>
32320 <indexterm role="concept">
32321 <primary>router</primary>
32322 <secondary>requiring file existence</secondary>
32323 </indexterm>
32324 This option provides a general mechanism for predicating the running of a
32325 router on the existence or non-existence of certain files or directories.
32326 Before running a router, as one of its precondition tests, Exim works its way
32327 through the <option>require_files</option> list, expanding each item separately.
32328 </para>
32329 <para>
32330 Because the list is split before expansion, any colons in expansion items must
32331 be doubled, or the facility for using a different list separator must be used.
32332 If any expansion is forced to fail, the item is ignored. Other expansion
32333 failures cause routing of the address to be deferred.
32334 </para>
32335 <para>
32336 If any expanded string is empty, it is ignored. Otherwise, except as described
32337 below, each string must be a fully qualified file path, optionally preceded by
32338 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
32339 existence of the files or directories. The router is skipped if any paths not
32340 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
32341 </para>
32342 <para>
32343 <indexterm role="concept">
32344 <primary>NFS</primary>
32345 </indexterm>
32346 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
32347 the message is deferred. This can happen when NFS-mounted filesystems are
32348 unavailable.
32349 </para>
32350 <para>
32351 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
32352 options, so you cannot use it to check for the existence of a file in which to
32353 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
32354 full list of the order in which preconditions are evaluated.) However, as
32355 these options are all expanded, you can use the <option>exists</option> expansion condition
32356 to make such tests. The <option>require_files</option> option is intended for checking files
32357 that the router may be going to use internally, or which are needed by a
32358 transport (for example <filename>.procmailrc</filename>).
32359 </para>
32360 <para>
32361 During delivery, the <function>stat()</function> function is run as root, but there is a
32362 facility for some checking of the accessibility of a file by another user.
32363 This is not a proper permissions check, but just a <quote>rough</quote> check that
32364 operates as follows:
32365 </para>
32366 <para>
32367 If an item in a <option>require_files</option> list does not contain any forward slash
32368 characters, it is taken to be the user (and optional group, separated by a
32369 comma) to be checked for subsequent files in the list. If no group is specified
32370 but the user is specified symbolically, the gid associated with the uid is
32371 used. For example:
32372 </para>
32373 <literallayout class="monospaced">
32374 require_files = mail:/some/file
32375 require_files = $local_part:$home/.procmailrc
32376 </literallayout>
32377 <para>
32378 If a user or group name in a <option>require_files</option> list does not exist, the
32379 <option>require_files</option> condition fails.
32380 </para>
32381 <para>
32382 Exim performs the check by scanning along the components of the file path, and
32383 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
32384 directories, and <quote>r</quote> access on the final file. Note that this means that file
32385 access control lists, if the operating system has them, are ignored.
32386 </para>
32387 <para>
32388 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
32389 incoming SMTP message, Exim is not running as root, but under its own uid. This
32390 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
32391 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
32392 user is not permitted to read one of the directories on the file&#x2019;s path.
32393 </para>
32394 <para>
32395 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
32396 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
32397 without root access. In this case, if a check for access by a particular user
32398 is requested, Exim creates a subprocess that runs as that user, and tries the
32399 check again in that process.
32400 </para>
32401 <para>
32402 The default action for handling an unresolved EACCES is to consider it to
32403 be caused by a configuration error, and routing is deferred because the
32404 existence or non-existence of the file cannot be determined. However, in some
32405 circumstances it may be desirable to treat this condition as if the file did
32406 not exist. If the file name (or the exclamation mark that precedes the file
32407 name for non-existence) is preceded by a plus sign, the EACCES error is treated
32408 as if the file did not exist. For example:
32409 </para>
32410 <literallayout class="monospaced">
32411 require_files = +/some/file
32412 </literallayout>
32413 <para>
32414 If the router is not an essential part of verification (for example, it
32415 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
32416 option false so that the router is skipped when verifying.
32417 </para>
32418 <para>
32419 <indexterm role="option">
32420 <primary><option>retry_use_local_part</option></primary>
32421 </indexterm>
32422 </para>
32423 <informaltable frame="all">
32424 <tgroup cols="4" colsep="0" rowsep="0">
32425 <colspec colwidth="8*" align="left"/>
32426 <colspec colwidth="6*" align="center"/>
32427 <colspec colwidth="6*" align="center"/>
32428 <colspec colwidth="6*" align="right"/>
32429 <tbody>
32430 <row>
32431 <entry><option>retry_use_local_part</option></entry>
32432 <entry>Use: <emphasis>routers</emphasis></entry>
32433 <entry>Type: <emphasis>boolean</emphasis></entry>
32434 <entry>Default: <emphasis>see below</emphasis></entry>
32435 </row>
32436 </tbody>
32437 </tgroup>
32438 </informaltable>
32439 <para>
32440 <indexterm role="concept">
32441 <primary>hints database</primary>
32442 <secondary>retry keys</secondary>
32443 </indexterm>
32444 <indexterm role="concept">
32445 <primary>local part</primary>
32446 <secondary>in retry keys</secondary>
32447 </indexterm>
32448 When a delivery suffers a temporary routing failure, a retry record is created
32449 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
32450 domain, the key for the retry record should not involve the local part, but for
32451 other addresses, both the domain and the local part should be included.
32452 Usually, remote routing is of the former kind, and local routing is of the
32453 latter kind.
32454 </para>
32455 <para>
32456 This option controls whether the local part is used to form the key for retry
32457 hints for addresses that suffer temporary errors while being handled by this
32458 router. The default value is true for any router that has <option>check_local_user</option>
32459 set, and false otherwise. Note that this option does not apply to hints keys
32460 for transport delays; they are controlled by a generic transport option of the
32461 same name.
32462 </para>
32463 <para>
32464 The setting of <option>retry_use_local_part</option> applies only to the router on which it
32465 appears. If the router generates child addresses, they are routed
32466 independently; this setting does not become attached to them.
32467 </para>
32468 <para>
32469 <indexterm role="option">
32470 <primary><option>router_home_directory</option></primary>
32471 </indexterm>
32472 </para>
32473 <informaltable frame="all">
32474 <tgroup cols="4" colsep="0" rowsep="0">
32475 <colspec colwidth="8*" align="left"/>
32476 <colspec colwidth="6*" align="center"/>
32477 <colspec colwidth="6*" align="center"/>
32478 <colspec colwidth="6*" align="right"/>
32479 <tbody>
32480 <row>
32481 <entry><option>router_home_directory</option></entry>
32482 <entry>Use: <emphasis>routers</emphasis></entry>
32483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32484 <entry>Default: <emphasis>unset</emphasis></entry>
32485 </row>
32486 </tbody>
32487 </tgroup>
32488 </informaltable>
32489 <para>
32490 <indexterm role="concept">
32491 <primary>router</primary>
32492 <secondary>home directory for</secondary>
32493 </indexterm>
32494 <indexterm role="concept">
32495 <primary>home directory</primary>
32496 <secondary>for router</secondary>
32497 </indexterm>
32498 <indexterm role="variable">
32499 <primary><varname>$home</varname></primary>
32500 </indexterm>
32501 This option sets a home directory for use while the router is running. (Compare
32502 <option>transport_home_directory</option>, which sets a home directory for later
32503 transporting.) In particular, if used on a <command>redirect</command> router, this option
32504 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
32505 forced expansion failure causes the option to be ignored &ndash; other failures
32506 cause the router to defer.
32507 </para>
32508 <para>
32509 Expansion of <option>router_home_directory</option> happens immediately after the
32510 <option>check_local_user</option> test (if configured), before any further expansions take
32511 place.
32512 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32513 are evaluated.)
32514 While the router is running, <option>router_home_directory</option> overrides the value of
32515 <varname>$home</varname> that came from <option>check_local_user</option>.
32516 </para>
32517 <para>
32518 When a router accepts an address and assigns it to a local transport (including
32519 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
32520 delivery), the home directory setting for the transport is taken from the first
32521 of these values that is set:
32522 </para>
32523 <itemizedlist>
32524 <listitem>
32525 <para>
32526 The <option>home_directory</option> option on the transport;
32527 </para>
32528 </listitem>
32529 <listitem>
32530 <para>
32531 The <option>transport_home_directory</option> option on the router;
32532 </para>
32533 </listitem>
32534 <listitem>
32535 <para>
32536 The password data if <option>check_local_user</option> is set on the router;
32537 </para>
32538 </listitem>
32539 <listitem>
32540 <para>
32541 The <option>router_home_directory</option> option on the router.
32542 </para>
32543 </listitem>
32544 </itemizedlist>
32545 <para>
32546 In other words, <option>router_home_directory</option> overrides the password data for the
32547 router, but not for the transport.
32548 </para>
32549 <para>
32550 <indexterm role="option">
32551 <primary><option>self</option></primary>
32552 </indexterm>
32553 </para>
32554 <informaltable frame="all">
32555 <tgroup cols="4" colsep="0" rowsep="0">
32556 <colspec colwidth="8*" align="left"/>
32557 <colspec colwidth="6*" align="center"/>
32558 <colspec colwidth="6*" align="center"/>
32559 <colspec colwidth="6*" align="right"/>
32560 <tbody>
32561 <row>
32562 <entry><option>self</option></entry>
32563 <entry>Use: <emphasis>routers</emphasis></entry>
32564 <entry>Type: <emphasis>string</emphasis></entry>
32565 <entry>Default: <emphasis>freeze</emphasis></entry>
32566 </row>
32567 </tbody>
32568 </tgroup>
32569 </informaltable>
32570 <para>
32571 <indexterm role="concept">
32572 <primary>MX record</primary>
32573 <secondary>pointing to local host</secondary>
32574 </indexterm>
32575 <indexterm role="concept">
32576 <primary>local host</primary>
32577 <secondary>MX pointing to</secondary>
32578 </indexterm>
32579 This option applies to those routers that use a recipient address to find a
32580 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
32581 and <command>manualroute</command> routers.
32582 Certain configurations of the <command>queryprogram</command> router can also specify a list
32583 of remote hosts.
32584 Usually such routers are configured to send the message to a remote host via an
32585 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
32586 host on the list turns out to be the local host.
32587 The way in which Exim checks for the local host is described in section
32588 <xref linkend="SECTreclocipadd"/>.
32589 </para>
32590 <para>
32591 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
32592 example, the router should be configured not to process this domain), or an
32593 error in the DNS (for example, the MX should not point to this host). For this
32594 reason, the default action is to log the incident, defer the address, and
32595 freeze the message. The following alternatives are provided for use in special
32596 cases:
32597 </para>
32598 <variablelist>
32599 <varlistentry>
32600 <term><option>defer</option></term>
32601 <listitem>
32602 <para>
32603 Delivery of the message is tried again later, but the message is not frozen.
32604 </para>
32605 </listitem></varlistentry>
32606 <varlistentry>
32607 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
32608 <listitem>
32609 <para>
32610 The domain is changed to the given domain, and the address is passed back to
32611 be reprocessed by the routers. No rewriting of headers takes place. This
32612 behaviour is essentially a redirection.
32613 </para>
32614 </listitem></varlistentry>
32615 <varlistentry>
32616 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
32617 <listitem>
32618 <para>
32619 The domain is changed to the given domain, and the address is passed back to be
32620 reprocessed by the routers. Any headers that contain the original domain are
32621 rewritten.
32622 </para>
32623 </listitem></varlistentry>
32624 <varlistentry>
32625 <term><option>pass</option></term>
32626 <listitem>
32627 <para>
32628 <indexterm role="option">
32629 <primary><option>more</option></primary>
32630 </indexterm>
32631 <indexterm role="variable">
32632 <primary><varname>$self_hostname</varname></primary>
32633 </indexterm>
32634 The router passes the address to the next router, or to the router named in the
32635 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
32636 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
32637 name of the local host that the router encountered. This can be used to
32638 distinguish between different cases for hosts with multiple names. The
32639 combination
32640 </para>
32641 <literallayout class="monospaced">
32642 self = pass
32643 no_more
32644 </literallayout>
32645 <para>
32646 ensures that only those addresses that routed to the local host are passed on.
32647 Without <option>no_more</option>, addresses that were declined for other reasons would also
32648 be passed to the next router.
32649 </para>
32650 </listitem></varlistentry>
32651 <varlistentry>
32652 <term><option>fail</option></term>
32653 <listitem>
32654 <para>
32655 Delivery fails and an error report is generated.
32656 </para>
32657 </listitem></varlistentry>
32658 <varlistentry>
32659 <term><option>send</option></term>
32660 <listitem>
32661 <para>
32662 <indexterm role="concept">
32663 <primary>local host</primary>
32664 <secondary>sending to</secondary>
32665 </indexterm>
32666 The anomaly is ignored and the address is queued for the transport. This
32667 setting should be used with extreme caution. For an <command>smtp</command> transport, it
32668 makes sense only in cases where the program that is listening on the SMTP port
32669 is not this version of Exim. That is, it must be some other MTA, or Exim with a
32670 different configuration file that handles the domain in another way.
32671 </para>
32672 </listitem></varlistentry>
32673 </variablelist>
32674 <para>
32675 <indexterm role="option">
32676 <primary><option>senders</option></primary>
32677 </indexterm>
32678 </para>
32679 <informaltable frame="all">
32680 <tgroup cols="4" colsep="0" rowsep="0">
32681 <colspec colwidth="8*" align="left"/>
32682 <colspec colwidth="6*" align="center"/>
32683 <colspec colwidth="6*" align="center"/>
32684 <colspec colwidth="6*" align="right"/>
32685 <tbody>
32686 <row>
32687 <entry><option>senders</option></entry>
32688 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32689 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32690 <entry>Default: <emphasis>unset</emphasis></entry>
32691 </row>
32692 </tbody>
32693 </tgroup>
32694 </informaltable>
32695 <para>
32696 <indexterm role="concept">
32697 <primary>router</primary>
32698 <secondary>checking senders</secondary>
32699 </indexterm>
32700 If this option is set, the router is skipped unless the message&#x2019;s sender
32701 address matches something on the list.
32702 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32703 are evaluated.
32704 </para>
32705 <para>
32706 There are issues concerning verification when the running of routers is
32707 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
32708 setting, it sets the sender to the null string. When using the <option>-bt</option> option
32709 to check a configuration file, it is necessary also to use the <option>-f</option> option to
32710 set an appropriate sender. For incoming mail, the sender is unset when
32711 verifying the sender, but is available when verifying any recipients. If the
32712 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
32713 matters.
32714 </para>
32715 <para>
32716 <indexterm role="option">
32717 <primary><option>translate_ip_address</option></primary>
32718 </indexterm>
32719 </para>
32720 <informaltable frame="all">
32721 <tgroup cols="4" colsep="0" rowsep="0">
32722 <colspec colwidth="8*" align="left"/>
32723 <colspec colwidth="6*" align="center"/>
32724 <colspec colwidth="6*" align="center"/>
32725 <colspec colwidth="6*" align="right"/>
32726 <tbody>
32727 <row>
32728 <entry><option>translate_ip_address</option></entry>
32729 <entry>Use: <emphasis>routers</emphasis></entry>
32730 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32731 <entry>Default: <emphasis>unset</emphasis></entry>
32732 </row>
32733 </tbody>
32734 </tgroup>
32735 </informaltable>
32736 <para>
32737 <indexterm role="concept">
32738 <primary>IP address</primary>
32739 <secondary>translating</secondary>
32740 </indexterm>
32741 <indexterm role="concept">
32742 <primary>packet radio</primary>
32743 </indexterm>
32744 <indexterm role="concept">
32745 <primary>router</primary>
32746 <secondary>IP address translation</secondary>
32747 </indexterm>
32748 There exist some rare networking situations (for example, packet radio) where
32749 it is helpful to be able to translate IP addresses generated by normal routing
32750 mechanisms into other IP addresses, thus performing a kind of manual IP
32751 routing. This should be done only if the normal IP routing of the TCP/IP stack
32752 is inadequate or broken. Because this is an extremely uncommon requirement, the
32753 code to support this option is not included in the Exim binary unless
32754 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
32755 </para>
32756 <para>
32757 <indexterm role="variable">
32758 <primary><varname>$host_address</varname></primary>
32759 </indexterm>
32760 The <option>translate_ip_address</option> string is expanded for every IP address generated
32761 by the router, with the generated address set in <varname>$host_address</varname>. If the
32762 expansion is forced to fail, no action is taken.
32763 For any other expansion error, delivery of the message is deferred.
32764 If the result of the expansion is an IP address, that replaces the original
32765 address; otherwise the result is assumed to be a host name &ndash; this is looked
32766 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
32767 produce one or more replacement IP addresses. For example, to subvert all IP
32768 addresses in some specific networks, this could be added to a router:
32769 </para>
32770 <literallayout class="monospaced">
32771 translate_ip_address = \
32772   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
32773     {$value}fail}}
32774 </literallayout>
32775 <para>
32776 The file would contain lines like
32777 </para>
32778 <literallayout class="monospaced">
32779 10.2.3.128/26    some.host
32780 10.8.4.34/26     10.44.8.15
32781 </literallayout>
32782 <para>
32783 You should not make use of this facility unless you really understand what you
32784 are doing.
32785 </para>
32786 <para>
32787 <indexterm role="option">
32788 <primary><option>transport</option></primary>
32789 </indexterm>
32790 </para>
32791 <informaltable frame="all">
32792 <tgroup cols="4" colsep="0" rowsep="0">
32793 <colspec colwidth="8*" align="left"/>
32794 <colspec colwidth="6*" align="center"/>
32795 <colspec colwidth="6*" align="center"/>
32796 <colspec colwidth="6*" align="right"/>
32797 <tbody>
32798 <row>
32799 <entry><option>transport</option></entry>
32800 <entry>Use: <emphasis>routers</emphasis></entry>
32801 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32802 <entry>Default: <emphasis>unset</emphasis></entry>
32803 </row>
32804 </tbody>
32805 </tgroup>
32806 </informaltable>
32807 <para>
32808 This option specifies the transport to be used when a router accepts an address
32809 and sets it up for delivery. A transport is never needed if a router is used
32810 only for verification. The value of the option is expanded at routing time,
32811 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
32812 and result must be the name of one of the configured transports. If it is not,
32813 delivery is deferred.
32814 </para>
32815 <para>
32816 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
32817 have some private options that set up transports for pipe and file deliveries
32818 (see chapter <xref linkend="CHAPredirect"/>).
32819 </para>
32820 <para>
32821 <indexterm role="option">
32822 <primary><option>transport_current_directory</option></primary>
32823 </indexterm>
32824 </para>
32825 <informaltable frame="all">
32826 <tgroup cols="4" colsep="0" rowsep="0">
32827 <colspec colwidth="8*" align="left"/>
32828 <colspec colwidth="6*" align="center"/>
32829 <colspec colwidth="6*" align="center"/>
32830 <colspec colwidth="6*" align="right"/>
32831 <tbody>
32832 <row>
32833 <entry><option>transport_current_directory</option></entry>
32834 <entry>Use: <emphasis>routers</emphasis></entry>
32835 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32836 <entry>Default: <emphasis>unset</emphasis></entry>
32837 </row>
32838 </tbody>
32839 </tgroup>
32840 </informaltable>
32841 <para>
32842 <indexterm role="concept">
32843 <primary>current directory for local transport</primary>
32844 </indexterm>
32845 This option associates a current directory with any address that is routed
32846 to a local transport. This can happen either because a transport is
32847 explicitly configured for the router, or because it generates a delivery to a
32848 file or a pipe. During the delivery process (that is, at transport time), this
32849 option string is expanded and is set as the current directory, unless
32850 overridden by a setting on the transport.
32851 If the expansion fails for any reason, including forced failure, an error is
32852 logged, and delivery is deferred.
32853 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
32854 environment.
32855 </para>
32856 <para>
32857 <indexterm role="option">
32858 <primary><option>transport_home_directory</option></primary>
32859 </indexterm>
32860 </para>
32861 <informaltable frame="all">
32862 <tgroup cols="4" colsep="0" rowsep="0">
32863 <colspec colwidth="8*" align="left"/>
32864 <colspec colwidth="6*" align="center"/>
32865 <colspec colwidth="6*" align="center"/>
32866 <colspec colwidth="6*" align="right"/>
32867 <tbody>
32868 <row>
32869 <entry><option>transport_home_directory</option></entry>
32870 <entry>Use: <emphasis>routers</emphasis></entry>
32871 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32872 <entry>Default: <emphasis>see below</emphasis></entry>
32873 </row>
32874 </tbody>
32875 </tgroup>
32876 </informaltable>
32877 <para>
32878 <indexterm role="concept">
32879 <primary>home directory</primary>
32880 <secondary>for local transport</secondary>
32881 </indexterm>
32882 This option associates a home directory with any address that is routed to a
32883 local transport. This can happen either because a transport is explicitly
32884 configured for the router, or because it generates a delivery to a file or a
32885 pipe. During the delivery process (that is, at transport time), the option
32886 string is expanded and is set as the home directory, unless overridden by a
32887 setting of <option>home_directory</option> on the transport.
32888 If the expansion fails for any reason, including forced failure, an error is
32889 logged, and delivery is deferred.
32890 </para>
32891 <para>
32892 If the transport does not specify a home directory, and
32893 <option>transport_home_directory</option> is not set for the router, the home directory for
32894 the transport is taken from the password data if <option>check_local_user</option> is set for
32895 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
32896 is set; if not, no home directory is set for the transport.
32897 </para>
32898 <para>
32899 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
32900 environment.
32901 </para>
32902 <para>
32903 <indexterm role="option">
32904 <primary><option>unseen</option></primary>
32905 </indexterm>
32906 </para>
32907 <informaltable frame="all">
32908 <tgroup cols="4" colsep="0" rowsep="0">
32909 <colspec colwidth="8*" align="left"/>
32910 <colspec colwidth="6*" align="center"/>
32911 <colspec colwidth="6*" align="center"/>
32912 <colspec colwidth="6*" align="right"/>
32913 <tbody>
32914 <row>
32915 <entry><option>unseen</option></entry>
32916 <entry>Use: <emphasis>routers</emphasis></entry>
32917 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32918 <entry>Default: <emphasis>false</emphasis></entry>
32919 </row>
32920 </tbody>
32921 </tgroup>
32922 </informaltable>
32923 <para>
32924 <indexterm role="concept">
32925 <primary>router</primary>
32926 <secondary>carrying on after success</secondary>
32927 </indexterm>
32928 The result of string expansion for this option must be a valid boolean value,
32929 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32930 result causes an error, and delivery is deferred. If the expansion is forced to
32931 fail, the default value for the option (false) is used. Other failures cause
32932 delivery to be deferred.
32933 </para>
32934 <para>
32935 When this option is set true, routing does not cease if the router accepts the
32936 address. Instead, a copy of the incoming address is passed to the next router,
32937 overriding a false setting of <option>more</option>. There is little point in setting
32938 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
32939 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
32940 sometimes true and sometimes false).
32941 </para>
32942 <para>
32943 <indexterm role="concept">
32944 <primary>copy of message (<option>unseen</option> option)</primary>
32945 </indexterm>
32946 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
32947 qualifier in filter files. It can be used to cause copies of messages to be
32948 delivered to some other destination, while also carrying out a normal delivery.
32949 In effect, the current address is made into a <quote>parent</quote> that has two children
32950 &ndash; one that is delivered as specified by this router, and a clone that goes on
32951 to be routed further. For this reason, <option>unseen</option> may not be combined with the
32952 <option>one_time</option> option in a <command>redirect</command> router.
32953 </para>
32954 <para>
32955 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
32956 this router or by previous routers affect the <quote>unseen</quote> copy of the message
32957 only. The clone that continues to be processed by further routers starts with
32958 no added headers and none specified for removal. For a <option>redirect</option> router, if
32959 a generated address is the same as the incoming address, this can lead to
32960 duplicate addresses with different header modifications. Exim does not do
32961 duplicate deliveries (except, in certain circumstances, to pipes -- see section
32962 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
32963 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
32964 <option>redirect</option> router may be of help.
32965 </para>
32966 <para>
32967 Unlike the handling of header modifications, any data that was set by the
32968 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
32969 subsequent routers.
32970 </para>
32971 <para>
32972 <indexterm role="option">
32973 <primary><option>user</option></primary>
32974 </indexterm>
32975 </para>
32976 <informaltable frame="all">
32977 <tgroup cols="4" colsep="0" rowsep="0">
32978 <colspec colwidth="8*" align="left"/>
32979 <colspec colwidth="6*" align="center"/>
32980 <colspec colwidth="6*" align="center"/>
32981 <colspec colwidth="6*" align="right"/>
32982 <tbody>
32983 <row>
32984 <entry><option>user</option></entry>
32985 <entry>Use: <emphasis>routers</emphasis></entry>
32986 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32987 <entry>Default: <emphasis>see below</emphasis></entry>
32988 </row>
32989 </tbody>
32990 </tgroup>
32991 </informaltable>
32992 <para>
32993 <indexterm role="concept">
32994 <primary>uid (user id)</primary>
32995 <secondary>local delivery</secondary>
32996 </indexterm>
32997 <indexterm role="concept">
32998 <primary>local transports</primary>
32999 <secondary>uid and gid</secondary>
33000 </indexterm>
33001 <indexterm role="concept">
33002 <primary>transport</primary>
33003 <secondary>local</secondary>
33004 </indexterm>
33005 <indexterm role="concept">
33006 <primary>router</primary>
33007 <secondary>user for filter processing</secondary>
33008 </indexterm>
33009 <indexterm role="concept">
33010 <primary>filter</primary>
33011 <secondary>user for processing</secondary>
33012 </indexterm>
33013 When a router queues an address for a transport, and the transport does not
33014 specify a user, the user given here is used when running the delivery process.
33015 The user may be specified numerically or by name. If expansion fails, the
33016 error is logged and delivery is deferred.
33017 This user is also used by the <command>redirect</command> router when running a filter file.
33018 The default is unset, except when <option>check_local_user</option> is set. In this case,
33019 the default is taken from the password information. If the user is specified as
33020 a name, and <option>group</option> is not set, the group associated with the user is used.
33021 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
33022 <xref linkend="CHAPenvironment"/>.
33023 </para>
33024 <para>
33025 <indexterm role="option">
33026 <primary><option>verify</option></primary>
33027 </indexterm>
33028 </para>
33029 <informaltable frame="all">
33030 <tgroup cols="4" colsep="0" rowsep="0">
33031 <colspec colwidth="8*" align="left"/>
33032 <colspec colwidth="6*" align="center"/>
33033 <colspec colwidth="6*" align="center"/>
33034 <colspec colwidth="6*" align="right"/>
33035 <tbody>
33036 <row>
33037 <entry><option>verify</option></entry>
33038 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33039 <entry>Type: <emphasis>boolean</emphasis></entry>
33040 <entry>Default: <emphasis>true</emphasis></entry>
33041 </row>
33042 </tbody>
33043 </tgroup>
33044 </informaltable>
33045 <para>
33046 Setting this option has the effect of setting <option>verify_sender</option> and
33047 <option>verify_recipient</option> to the same value.
33048 </para>
33049 <para>
33050 <indexterm role="option">
33051 <primary><option>verify_only</option></primary>
33052 </indexterm>
33053 </para>
33054 <informaltable frame="all">
33055 <tgroup cols="4" colsep="0" rowsep="0">
33056 <colspec colwidth="8*" align="left"/>
33057 <colspec colwidth="6*" align="center"/>
33058 <colspec colwidth="6*" align="center"/>
33059 <colspec colwidth="6*" align="right"/>
33060 <tbody>
33061 <row>
33062 <entry><option>verify_only</option></entry>
33063 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33064 <entry>Type: <emphasis>boolean</emphasis></entry>
33065 <entry>Default: <emphasis>false</emphasis></entry>
33066 </row>
33067 </tbody>
33068 </tgroup>
33069 </informaltable>
33070 <para>
33071 <indexterm role="concept">
33072 <primary>EXPN</primary>
33073 <secondary>with <option>verify_only</option></secondary>
33074 </indexterm>
33075 <indexterm role="option">
33076 <primary><option>-bv</option></primary>
33077 </indexterm>
33078 <indexterm role="concept">
33079 <primary>router</primary>
33080 <secondary>used only when verifying</secondary>
33081 </indexterm>
33082 If this option is set, the router is used only when verifying an address,
33083 delivering in cutthrough mode or
33084 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
33085 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
33086 restricted to verifying only senders or recipients by means of
33087 <option>verify_sender</option> and <option>verify_recipient</option>.
33088 </para>
33089 <para>
33090 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
33091 SMTP message, Exim is not running as root, but under its own uid. If the router
33092 accesses any files, you need to make sure that they are accessible to the Exim
33093 user or group.
33094 </para>
33095 <para>
33096 <indexterm role="option">
33097 <primary><option>verify_recipient</option></primary>
33098 </indexterm>
33099 </para>
33100 <informaltable frame="all">
33101 <tgroup cols="4" colsep="0" rowsep="0">
33102 <colspec colwidth="8*" align="left"/>
33103 <colspec colwidth="6*" align="center"/>
33104 <colspec colwidth="6*" align="center"/>
33105 <colspec colwidth="6*" align="right"/>
33106 <tbody>
33107 <row>
33108 <entry><option>verify_recipient</option></entry>
33109 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33110 <entry>Type: <emphasis>boolean</emphasis></entry>
33111 <entry>Default: <emphasis>true</emphasis></entry>
33112 </row>
33113 </tbody>
33114 </tgroup>
33115 </informaltable>
33116 <para>
33117 If this option is false, the router is skipped when verifying recipient
33118 addresses,
33119 delivering in cutthrough mode
33120 or testing recipient verification using <option>-bv</option>.
33121 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33122 are evaluated.
33123 </para>
33124 <para>
33125 <indexterm role="option">
33126 <primary><option>verify_sender</option></primary>
33127 </indexterm>
33128 </para>
33129 <informaltable frame="all">
33130 <tgroup cols="4" colsep="0" rowsep="0">
33131 <colspec colwidth="8*" align="left"/>
33132 <colspec colwidth="6*" align="center"/>
33133 <colspec colwidth="6*" align="center"/>
33134 <colspec colwidth="6*" align="right"/>
33135 <tbody>
33136 <row>
33137 <entry><option>verify_sender</option></entry>
33138 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33139 <entry>Type: <emphasis>boolean</emphasis></entry>
33140 <entry>Default: <emphasis>true</emphasis></entry>
33141 </row>
33142 </tbody>
33143 </tgroup>
33144 </informaltable>
33145 <para>
33146 If this option is false, the router is skipped when verifying sender addresses
33147 or testing sender verification using <option>-bvs</option>.
33148 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33149 are evaluated.
33150 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
33151 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
33152 </para>
33153 </chapter>
33154
33155 <chapter id="CHID4">
33156 <title>The accept router</title>
33157 <para>
33158 <indexterm role="concept">
33159 <primary><command>accept</command> router</primary>
33160 </indexterm>
33161 <indexterm role="concept">
33162 <primary>routers</primary>
33163 <secondary><command>accept</command></secondary>
33164 </indexterm>
33165 The <command>accept</command> router has no private options of its own. Unless it is being
33166 used purely for verification (see <option>verify_only</option>) a transport is required to
33167 be defined by the generic <option>transport</option> option. If the preconditions that are
33168 specified by generic options are met, the router accepts the address and queues
33169 it for the given transport. The most common use of this router is for setting
33170 up deliveries to local mailboxes. For example:
33171 </para>
33172 <literallayout class="monospaced">
33173 localusers:
33174   driver = accept
33175   domains = mydomain.example
33176   check_local_user
33177   transport = local_delivery
33178 </literallayout>
33179 <para>
33180 The <option>domains</option> condition in this example checks the domain of the address, and
33181 <option>check_local_user</option> checks that the local part is the login of a local user.
33182 When both preconditions are met, the <command>accept</command> router runs, and queues the
33183 address for the <command>local_delivery</command> transport.
33184 </para>
33185 </chapter>
33186
33187 <chapter id="CHAPdnslookup">
33188 <title>The dnslookup router</title>
33189 <para>
33190 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
33191 <primary><command>dnslookup</command> router</primary>
33192 </indexterm>
33193 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
33194 <primary>routers</primary>
33195 <secondary><command>dnslookup</command></secondary>
33196 </indexterm>
33197 The <command>dnslookup</command> router looks up the hosts that handle mail for the
33198 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
33199 unless <option>verify_only</option> is set.
33200 </para>
33201 <para>
33202 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
33203 SRV records. If none are found, or if SRV support is not configured,
33204 MX records are looked up. If no MX records exist, address records are sought.
33205 However, <option>mx_domains</option> can be set to disable the direct use of address
33206 records.
33207 </para>
33208 <para>
33209 MX records of equal priority are sorted by Exim into a random order. Exim then
33210 looks for address records for the host names obtained from MX or SRV records.
33211 When a host has more than one IP address, they are sorted into a random order,
33212 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
33213 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
33214 generic option, the router declines.
33215 </para>
33216 <para>
33217 Unless they have the highest priority (lowest MX value), MX records that point
33218 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
33219 are discarded, together with any other MX records of equal or lower priority.
33220 </para>
33221 <para>
33222 <indexterm role="concept">
33223 <primary>MX record</primary>
33224 <secondary>pointing to local host</secondary>
33225 </indexterm>
33226 <indexterm role="concept">
33227 <primary>local host</primary>
33228 <secondary>MX pointing to</secondary>
33229 </indexterm>
33230 <indexterm role="option">
33231 <primary><option>self</option></primary>
33232 <secondary>in <command>dnslookup</command> router</secondary>
33233 </indexterm>
33234 If the host pointed to by the highest priority MX record, or looked up as an
33235 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
33236 happens is controlled by the generic <option>self</option> option.
33237 </para>
33238 <section id="SECTprowitdnsloo">
33239 <title>Problems with DNS lookups</title>
33240 <para>
33241 There have been problems with DNS servers when SRV records are looked up.
33242 Some mis-behaving servers return a DNS error or timeout when a non-existent
33243 SRV record is sought. Similar problems have in the past been reported for
33244 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
33245 problem, but it is heavy-handed because it is a global option.
33246 </para>
33247 <para>
33248 For this reason, there are two options, <option>srv_fail_domains</option> and
33249 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
33250 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
33251 an attempt to look up an SRV or MX record causes one of these results, and the
33252 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
33253 such record</quote>. In the case of an SRV lookup, this means that the router
33254 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
33255 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
33256 case routing fails.
33257 </para>
33258 </section>
33259 <section id="SECTdnslookupdecline">
33260 <title>Declining addresses by dnslookup</title>
33261 <para>
33262 <indexterm role="concept">
33263 <primary><command>dnslookup</command> router</primary>
33264 <secondary>declines</secondary>
33265 </indexterm>
33266 There are a few cases where a <command>dnslookup</command> router will decline to accept
33267 an address; if such a router is expected to handle "all remaining non-local
33268 domains", then it is important to set <option>no_more</option>.
33269 </para>
33270 <para>
33271 Reasons for a <command>dnslookup</command> router to decline currently include:
33272 </para>
33273 <itemizedlist>
33274 <listitem>
33275 <para>
33276 The domain does not exist in DNS
33277 </para>
33278 </listitem>
33279 <listitem>
33280 <para>
33281 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
33282 convention (borrowed from SRV) used to indicate that there is no such service
33283 for this domain and to not fall back to trying A/AAAA records.
33284 </para>
33285 </listitem>
33286 <listitem>
33287 <para>
33288 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
33289 </para>
33290 </listitem>
33291 <listitem>
33292 <para>
33293 MX record points to a non-existent host.
33294 </para>
33295 </listitem>
33296 <listitem>
33297 <para>
33298 MX record points to an IP address and the main section option
33299 <option>allow_mx_to_ip</option> is not set.
33300 </para>
33301 </listitem>
33302 <listitem>
33303 <para>
33304 MX records exist and point to valid hosts, but all hosts resolve only to
33305 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
33306 </para>
33307 </listitem>
33308 <listitem>
33309 <para>
33310 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
33311 <option>dns_check_names_pattern</option> for handling one variant of this)
33312 </para>
33313 </listitem>
33314 <listitem>
33315 <para>
33316 <option>check_secondary_mx</option> is set on this router but the local host can
33317 not be found in the MX records (see below)
33318 </para>
33319 </listitem>
33320 </itemizedlist>
33321 </section>
33322 <section id="SECID118">
33323 <title>Private options for dnslookup</title>
33324 <para>
33325 <indexterm role="concept">
33326 <primary>options</primary>
33327 <secondary><command>dnslookup</command> router</secondary>
33328 </indexterm>
33329 The private options for the <command>dnslookup</command> router are as follows:
33330 </para>
33331 <para>
33332 <indexterm role="option">
33333 <primary><option>check_secondary_mx</option></primary>
33334 </indexterm>
33335 </para>
33336 <informaltable frame="all">
33337 <tgroup cols="4" colsep="0" rowsep="0">
33338 <colspec colwidth="8*" align="left"/>
33339 <colspec colwidth="6*" align="center"/>
33340 <colspec colwidth="6*" align="center"/>
33341 <colspec colwidth="6*" align="right"/>
33342 <tbody>
33343 <row>
33344 <entry><option>check_secondary_mx</option></entry>
33345 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33346 <entry>Type: <emphasis>boolean</emphasis></entry>
33347 <entry>Default: <emphasis>false</emphasis></entry>
33348 </row>
33349 </tbody>
33350 </tgroup>
33351 </informaltable>
33352 <para>
33353 <indexterm role="concept">
33354 <primary>MX record</primary>
33355 <secondary>checking for secondary</secondary>
33356 </indexterm>
33357 If this option is set, the router declines unless the local host is found in
33358 (and removed from) the list of hosts obtained by MX lookup. This can be used to
33359 process domains for which the local host is a secondary mail exchanger
33360 differently to other domains. The way in which Exim decides whether a host is
33361 the local host is described in section <xref linkend="SECTreclocipadd"/>.
33362 </para>
33363 <para>
33364 <indexterm role="option">
33365 <primary><option>check_srv</option></primary>
33366 </indexterm>
33367 </para>
33368 <informaltable frame="all">
33369 <tgroup cols="4" colsep="0" rowsep="0">
33370 <colspec colwidth="8*" align="left"/>
33371 <colspec colwidth="6*" align="center"/>
33372 <colspec colwidth="6*" align="center"/>
33373 <colspec colwidth="6*" align="right"/>
33374 <tbody>
33375 <row>
33376 <entry><option>check_srv</option></entry>
33377 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33379 <entry>Default: <emphasis>unset</emphasis></entry>
33380 </row>
33381 </tbody>
33382 </tgroup>
33383 </informaltable>
33384 <para>
33385 <indexterm role="concept">
33386 <primary>SRV record</primary>
33387 <secondary>enabling use of</secondary>
33388 </indexterm>
33389 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
33390 addition to MX and address records. The support is disabled by default. To
33391 enable SRV support, set the <option>check_srv</option> option to the name of the service
33392 required. For example,
33393 </para>
33394 <literallayout class="monospaced">
33395 check_srv = smtp
33396 </literallayout>
33397 <para>
33398 looks for SRV records that refer to the normal smtp service. The option is
33399 expanded, so the service name can vary from message to message or address
33400 to address. This might be helpful if SRV records are being used for a
33401 submission service. If the expansion is forced to fail, the <option>check_srv</option>
33402 option is ignored, and the router proceeds to look for MX records in the
33403 normal way.
33404 </para>
33405 <para>
33406 When the expansion succeeds, the router searches first for SRV records for
33407 the given service (it assumes TCP protocol). A single SRV record with a
33408 host name that consists of just a single dot indicates <quote>no such service for
33409 this domain</quote>; if this is encountered, the router declines. If other kinds of
33410 SRV record are found, they are used to construct a host list for delivery
33411 according to the rules of RFC 2782. MX records are not sought in this case.
33412 </para>
33413 <para>
33414 When no SRV records are found, MX records (and address records) are sought in
33415 the traditional way. In other words, SRV records take precedence over MX
33416 records, just as MX records take precedence over address records. Note that
33417 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
33418 defined it. It is apparently believed that MX records are sufficient for email
33419 and that SRV records should not be used for this purpose. However, SRV records
33420 have an additional <quote>weight</quote> feature which some people might find useful when
33421 trying to split an SMTP load between hosts of different power.
33422 </para>
33423 <para>
33424 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
33425 when there is a DNS lookup error.
33426 </para>
33427 <para>
33428 <indexterm role="option">
33429 <primary><option>dnssec_request_domains</option></primary>
33430 </indexterm>
33431 </para>
33432 <informaltable frame="all">
33433 <tgroup cols="4" colsep="0" rowsep="0">
33434 <colspec colwidth="8*" align="left"/>
33435 <colspec colwidth="6*" align="center"/>
33436 <colspec colwidth="6*" align="center"/>
33437 <colspec colwidth="6*" align="right"/>
33438 <tbody>
33439 <row>
33440 <entry><option>dnssec_request_domains</option></entry>
33441 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33442 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33443 <entry>Default: <emphasis>unset</emphasis></entry>
33444 </row>
33445 </tbody>
33446 </tgroup>
33447 </informaltable>
33448 <para>
33449 <indexterm role="concept">
33450 <primary>MX record</primary>
33451 <secondary>security</secondary>
33452 </indexterm>
33453 <indexterm role="concept">
33454 <primary>DNSSEC</primary>
33455 <secondary>MX lookup</secondary>
33456 </indexterm>
33457 <indexterm role="concept">
33458 <primary>security</primary>
33459 <secondary>MX lookup</secondary>
33460 </indexterm>
33461 <indexterm role="concept">
33462 <primary>DNS</primary>
33463 <secondary>DNSSEC</secondary>
33464 </indexterm>
33465 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33466 the dnssec request bit set.
33467 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33468 </para>
33469 <para>
33470 <indexterm role="option">
33471 <primary><option>dnssec_require_domains</option></primary>
33472 </indexterm>
33473 </para>
33474 <informaltable frame="all">
33475 <tgroup cols="4" colsep="0" rowsep="0">
33476 <colspec colwidth="8*" align="left"/>
33477 <colspec colwidth="6*" align="center"/>
33478 <colspec colwidth="6*" align="center"/>
33479 <colspec colwidth="6*" align="right"/>
33480 <tbody>
33481 <row>
33482 <entry><option>dnssec_require_domains</option></entry>
33483 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33484 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33485 <entry>Default: <emphasis>unset</emphasis></entry>
33486 </row>
33487 </tbody>
33488 </tgroup>
33489 </informaltable>
33490 <para>
33491 <indexterm role="concept">
33492 <primary>MX record</primary>
33493 <secondary>security</secondary>
33494 </indexterm>
33495 <indexterm role="concept">
33496 <primary>DNSSEC</primary>
33497 <secondary>MX lookup</secondary>
33498 </indexterm>
33499 <indexterm role="concept">
33500 <primary>security</primary>
33501 <secondary>MX lookup</secondary>
33502 </indexterm>
33503 <indexterm role="concept">
33504 <primary>DNS</primary>
33505 <secondary>DNSSEC</secondary>
33506 </indexterm>
33507 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33508 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33509 (AD bit) set wil be ignored and logged as a host-lookup failure.
33510 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33511 </para>
33512 <para>
33513 <indexterm role="option">
33514 <primary><option>mx_domains</option></primary>
33515 </indexterm>
33516 </para>
33517 <informaltable frame="all">
33518 <tgroup cols="4" colsep="0" rowsep="0">
33519 <colspec colwidth="8*" align="left"/>
33520 <colspec colwidth="6*" align="center"/>
33521 <colspec colwidth="6*" align="center"/>
33522 <colspec colwidth="6*" align="right"/>
33523 <tbody>
33524 <row>
33525 <entry><option>mx_domains</option></entry>
33526 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33527 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33528 <entry>Default: <emphasis>unset</emphasis></entry>
33529 </row>
33530 </tbody>
33531 </tgroup>
33532 </informaltable>
33533 <para>
33534 <indexterm role="concept">
33535 <primary>MX record</primary>
33536 <secondary>required to exist</secondary>
33537 </indexterm>
33538 <indexterm role="concept">
33539 <primary>SRV record</primary>
33540 <secondary>required to exist</secondary>
33541 </indexterm>
33542 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
33543 record in order to be recognized. (The name of this option could be improved.)
33544 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
33545 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
33546 setting:
33547 </para>
33548 <literallayout class="monospaced">
33549 mx_domains = ! *.discworld.fict.example : *.fict.example
33550 </literallayout>
33551 <para>
33552 This specifies that messages addressed to a domain that matches the list but
33553 has no MX record should be bounced immediately instead of being routed using
33554 the address record.
33555 </para>
33556 <para>
33557 <indexterm role="option">
33558 <primary><option>mx_fail_domains</option></primary>
33559 </indexterm>
33560 </para>
33561 <informaltable frame="all">
33562 <tgroup cols="4" colsep="0" rowsep="0">
33563 <colspec colwidth="8*" align="left"/>
33564 <colspec colwidth="6*" align="center"/>
33565 <colspec colwidth="6*" align="center"/>
33566 <colspec colwidth="6*" align="right"/>
33567 <tbody>
33568 <row>
33569 <entry><option>mx_fail_domains</option></entry>
33570 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33571 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33572 <entry>Default: <emphasis>unset</emphasis></entry>
33573 </row>
33574 </tbody>
33575 </tgroup>
33576 </informaltable>
33577 <para>
33578 If the DNS lookup for MX records for one of the domains in this list causes a
33579 DNS lookup error, Exim behaves as if no MX records were found. See section
33580 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33581 </para>
33582 <para>
33583 <indexterm role="option">
33584 <primary><option>qualify_single</option></primary>
33585 </indexterm>
33586 </para>
33587 <informaltable frame="all">
33588 <tgroup cols="4" colsep="0" rowsep="0">
33589 <colspec colwidth="8*" align="left"/>
33590 <colspec colwidth="6*" align="center"/>
33591 <colspec colwidth="6*" align="center"/>
33592 <colspec colwidth="6*" align="right"/>
33593 <tbody>
33594 <row>
33595 <entry><option>qualify_single</option></entry>
33596 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33597 <entry>Type: <emphasis>boolean</emphasis></entry>
33598 <entry>Default: <emphasis>true</emphasis></entry>
33599 </row>
33600 </tbody>
33601 </tgroup>
33602 </informaltable>
33603 <para>
33604 <indexterm role="concept">
33605 <primary>DNS</primary>
33606 <secondary>resolver options</secondary>
33607 </indexterm>
33608 <indexterm role="concept">
33609 <primary>DNS</primary>
33610 <secondary>qualifying single-component names</secondary>
33611 </indexterm>
33612 When this option is true, the resolver option RES_DEFNAMES is set for DNS
33613 lookups. Typically, but not standardly, this causes the resolver to qualify
33614 single-component names with the default domain. For example, on a machine
33615 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
33616 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
33617 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
33618 <emphasis>resolv.conf</emphasis>.
33619 </para>
33620 <para>
33621 <indexterm role="option">
33622 <primary><option>rewrite_headers</option></primary>
33623 </indexterm>
33624 </para>
33625 <informaltable frame="all">
33626 <tgroup cols="4" colsep="0" rowsep="0">
33627 <colspec colwidth="8*" align="left"/>
33628 <colspec colwidth="6*" align="center"/>
33629 <colspec colwidth="6*" align="center"/>
33630 <colspec colwidth="6*" align="right"/>
33631 <tbody>
33632 <row>
33633 <entry><option>rewrite_headers</option></entry>
33634 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33635 <entry>Type: <emphasis>boolean</emphasis></entry>
33636 <entry>Default: <emphasis>true</emphasis></entry>
33637 </row>
33638 </tbody>
33639 </tgroup>
33640 </informaltable>
33641 <para>
33642 <indexterm role="concept">
33643 <primary>rewriting</primary>
33644 <secondary>header lines</secondary>
33645 </indexterm>
33646 <indexterm role="concept">
33647 <primary>header lines</primary>
33648 <secondary>rewriting</secondary>
33649 </indexterm>
33650 If the domain name in the address that is being processed is not fully
33651 qualified, it may be expanded to its full form by a DNS lookup. For example, if
33652 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
33653 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
33654 occur as a result of setting the <option>widen_domains</option> option. If
33655 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
33656 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
33657 header lines of the message are rewritten with the full domain name.
33658 </para>
33659 <para>
33660 This option should be turned off only when it is known that no message is
33661 ever going to be sent outside an environment where the abbreviation makes
33662 sense.
33663 </para>
33664 <para>
33665 When an MX record is looked up in the DNS and matches a wildcard record, name
33666 servers normally return a record containing the name that has been looked up,
33667 making it impossible to detect whether a wildcard was present or not. However,
33668 some name servers have recently been seen to return the wildcard entry. If the
33669 name returned by a DNS lookup begins with an asterisk, it is not used for
33670 header rewriting.
33671 </para>
33672 <para>
33673 <indexterm role="option">
33674 <primary><option>same_domain_copy_routing</option></primary>
33675 </indexterm>
33676 </para>
33677 <informaltable frame="all">
33678 <tgroup cols="4" colsep="0" rowsep="0">
33679 <colspec colwidth="8*" align="left"/>
33680 <colspec colwidth="6*" align="center"/>
33681 <colspec colwidth="6*" align="center"/>
33682 <colspec colwidth="6*" align="right"/>
33683 <tbody>
33684 <row>
33685 <entry><option>same_domain_copy_routing</option></entry>
33686 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33687 <entry>Type: <emphasis>boolean</emphasis></entry>
33688 <entry>Default: <emphasis>false</emphasis></entry>
33689 </row>
33690 </tbody>
33691 </tgroup>
33692 </informaltable>
33693 <para>
33694 <indexterm role="concept">
33695 <primary>address</primary>
33696 <secondary>copying routing</secondary>
33697 </indexterm>
33698 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
33699 to the same list of hosts. However, this cannot be presumed, because the router
33700 options and preconditions may refer to the local part of the address. By
33701 default, therefore, Exim routes each address in a message independently. DNS
33702 servers run caches, so repeated DNS lookups are not normally expensive, and in
33703 any case, personal messages rarely have more than a few recipients.
33704 </para>
33705 <para>
33706 If you are running mailing lists with large numbers of subscribers at the same
33707 domain, and you are using a <command>dnslookup</command> router which is independent of the
33708 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33709 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
33710 routes an address to a remote transport, any other unrouted addresses in the
33711 message that have the same domain are automatically given the same routing
33712 without processing them independently,
33713 provided the following conditions are met:
33714 </para>
33715 <itemizedlist>
33716 <listitem>
33717 <para>
33718 No router that processed the address specified <option>headers_add</option> or
33719 <option>headers_remove</option>.
33720 </para>
33721 </listitem>
33722 <listitem>
33723 <para>
33724 The router did not change the address in any way, for example, by <quote>widening</quote>
33725 the domain.
33726 </para>
33727 </listitem>
33728 </itemizedlist>
33729 <para>
33730 <indexterm role="option">
33731 <primary><option>search_parents</option></primary>
33732 </indexterm>
33733 </para>
33734 <informaltable frame="all">
33735 <tgroup cols="4" colsep="0" rowsep="0">
33736 <colspec colwidth="8*" align="left"/>
33737 <colspec colwidth="6*" align="center"/>
33738 <colspec colwidth="6*" align="center"/>
33739 <colspec colwidth="6*" align="right"/>
33740 <tbody>
33741 <row>
33742 <entry><option>search_parents</option></entry>
33743 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33744 <entry>Type: <emphasis>boolean</emphasis></entry>
33745 <entry>Default: <emphasis>false</emphasis></entry>
33746 </row>
33747 </tbody>
33748 </tgroup>
33749 </informaltable>
33750 <para>
33751 <indexterm role="concept">
33752 <primary>DNS</primary>
33753 <secondary>resolver options</secondary>
33754 </indexterm>
33755 When this option is true, the resolver option RES_DNSRCH is set for DNS
33756 lookups. This is different from the <option>qualify_single</option> option in that it
33757 applies to domains containing dots. Typically, but not standardly, it causes
33758 the resolver to search for the name in the current domain and in parent
33759 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
33760 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
33761 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
33762 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
33763 </para>
33764 <para>
33765 Setting this option true can cause problems in domains that have a wildcard MX
33766 record, because any domain that does not have its own MX record matches the
33767 local wildcard.
33768 </para>
33769 <para>
33770 <indexterm role="option">
33771 <primary><option>srv_fail_domains</option></primary>
33772 </indexterm>
33773 </para>
33774 <informaltable frame="all">
33775 <tgroup cols="4" colsep="0" rowsep="0">
33776 <colspec colwidth="8*" align="left"/>
33777 <colspec colwidth="6*" align="center"/>
33778 <colspec colwidth="6*" align="center"/>
33779 <colspec colwidth="6*" align="right"/>
33780 <tbody>
33781 <row>
33782 <entry><option>srv_fail_domains</option></entry>
33783 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33784 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33785 <entry>Default: <emphasis>unset</emphasis></entry>
33786 </row>
33787 </tbody>
33788 </tgroup>
33789 </informaltable>
33790 <para>
33791 If the DNS lookup for SRV records for one of the domains in this list causes a
33792 DNS lookup error, Exim behaves as if no SRV records were found. See section
33793 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33794 </para>
33795 <para>
33796 <indexterm role="option">
33797 <primary><option>widen_domains</option></primary>
33798 </indexterm>
33799 </para>
33800 <informaltable frame="all">
33801 <tgroup cols="4" colsep="0" rowsep="0">
33802 <colspec colwidth="8*" align="left"/>
33803 <colspec colwidth="6*" align="center"/>
33804 <colspec colwidth="6*" align="center"/>
33805 <colspec colwidth="6*" align="right"/>
33806 <tbody>
33807 <row>
33808 <entry><option>widen_domains</option></entry>
33809 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33810 <entry>Type: <emphasis>string list</emphasis></entry>
33811 <entry>Default: <emphasis>unset</emphasis></entry>
33812 </row>
33813 </tbody>
33814 </tgroup>
33815 </informaltable>
33816 <para>
33817 <indexterm role="concept">
33818 <primary>domain</primary>
33819 <secondary>partial; widening</secondary>
33820 </indexterm>
33821 If a DNS lookup fails and this option is set, each of its strings in turn is
33822 added onto the end of the domain, and the lookup is tried again. For example,
33823 if
33824 </para>
33825 <literallayout class="monospaced">
33826 widen_domains = fict.example:ref.example
33827 </literallayout>
33828 <para>
33829 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
33830 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
33831 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
33832 and <option>search_parents</option> options can cause some widening to be undertaken inside
33833 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
33834 when verifying, unless <option>rewrite_headers</option> is false (not the default).
33835 </para>
33836 </section>
33837 <section id="SECID119">
33838 <title>Effect of qualify_single and search_parents</title>
33839 <para>
33840 When a domain from an envelope recipient is changed by the resolver as a result
33841 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
33842 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
33843 is set false. Exim then re-routes the address, using the full domain.
33844 </para>
33845 <para>
33846 These two options affect only the DNS lookup that takes place inside the router
33847 for the domain of the address that is being routed. They do not affect lookups
33848 such as that implied by
33849 </para>
33850 <literallayout class="monospaced">
33851 domains = @mx_any
33852 </literallayout>
33853 <para>
33854 that may happen while processing a router precondition before the router is
33855 entered. No widening ever takes place for these lookups.
33856 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
33857 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
33858 </para>
33859 </section>
33860 </chapter>
33861
33862 <chapter id="CHID5">
33863 <title>The ipliteral router</title>
33864 <para>
33865 <indexterm role="concept">
33866 <primary><command>ipliteral</command> router</primary>
33867 </indexterm>
33868 <indexterm role="concept">
33869 <primary>domain literal</primary>
33870 <secondary>routing</secondary>
33871 </indexterm>
33872 <indexterm role="concept">
33873 <primary>routers</primary>
33874 <secondary><command>ipliteral</command></secondary>
33875 </indexterm>
33876 This router has no private options. Unless it is being used purely for
33877 verification (see <option>verify_only</option>) a transport is required to be defined by the
33878 generic <option>transport</option> option. The router accepts the address if its domain part
33879 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
33880 router handles the address
33881 </para>
33882 <literallayout class="monospaced">
33883 root@[192.168.1.1]
33884 </literallayout>
33885 <para>
33886 by setting up delivery to the host with that IP address. IPv4 domain literals
33887 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
33888 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
33889 </para>
33890 <literallayout class="monospaced">
33891 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
33892 </literallayout>
33893 <para>
33894 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
33895 grounds that sooner or later somebody will try it.
33896 </para>
33897 <para>
33898 <indexterm role="option">
33899 <primary><option>self</option></primary>
33900 <secondary>in <command>ipliteral</command> router</secondary>
33901 </indexterm>
33902 If the IP address matches something in <option>ignore_target_hosts</option>, the router
33903 declines. If an IP literal turns out to refer to the local host, the generic
33904 <option>self</option> option determines what happens.
33905 </para>
33906 <para>
33907 The RFCs require support for domain literals; however, their use is
33908 controversial in today&#x2019;s Internet. If you want to use this router, you must
33909 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
33910 Exim will not recognize the domain literal syntax in addresses.
33911 </para>
33912 </chapter>
33913
33914 <chapter id="CHID6">
33915 <title>The iplookup router</title>
33916 <para>
33917 <indexterm role="concept">
33918 <primary><command>iplookup</command> router</primary>
33919 </indexterm>
33920 <indexterm role="concept">
33921 <primary>routers</primary>
33922 <secondary><command>iplookup</command></secondary>
33923 </indexterm>
33924 The <command>iplookup</command> router was written to fulfil a specific requirement in
33925 Cambridge University (which in fact no longer exists). For this reason, it is
33926 not included in the binary of Exim by default. If you want to include it, you
33927 must set
33928 </para>
33929 <literallayout class="monospaced">
33930 ROUTER_IPLOOKUP=yes
33931 </literallayout>
33932 <para>
33933 in your <filename>Local/Makefile</filename> configuration file.
33934 </para>
33935 <para>
33936 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
33937 connection to one or more specific hosts. The host can then return the same or
33938 a different address &ndash; in effect rewriting the recipient address in the
33939 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
33940 this process fails, the address can be passed on to other routers, or delivery
33941 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
33942 must not be specified for it.
33943 </para>
33944 <para>
33945 <indexterm role="concept">
33946 <primary>options</primary>
33947 <secondary><command>iplookup</command> router</secondary>
33948 </indexterm>
33949 <indexterm role="option">
33950 <primary><option>hosts</option></primary>
33951 </indexterm>
33952 </para>
33953 <informaltable frame="all">
33954 <tgroup cols="4" colsep="0" rowsep="0">
33955 <colspec colwidth="8*" align="left"/>
33956 <colspec colwidth="6*" align="center"/>
33957 <colspec colwidth="6*" align="center"/>
33958 <colspec colwidth="6*" align="right"/>
33959 <tbody>
33960 <row>
33961 <entry><option>hosts</option></entry>
33962 <entry>Use: <emphasis>iplookup</emphasis></entry>
33963 <entry>Type: <emphasis>string</emphasis></entry>
33964 <entry>Default: <emphasis>unset</emphasis></entry>
33965 </row>
33966 </tbody>
33967 </tgroup>
33968 </informaltable>
33969 <para>
33970 This option must be supplied. Its value is a colon-separated list of host
33971 names. The hosts are looked up using <function>gethostbyname()</function>
33972 (or <function>getipnodebyname()</function> when available)
33973 and are tried in order until one responds to the query. If none respond, what
33974 happens is controlled by <option>optional</option>.
33975 </para>
33976 <para>
33977 <indexterm role="option">
33978 <primary><option>optional</option></primary>
33979 </indexterm>
33980 </para>
33981 <informaltable frame="all">
33982 <tgroup cols="4" colsep="0" rowsep="0">
33983 <colspec colwidth="8*" align="left"/>
33984 <colspec colwidth="6*" align="center"/>
33985 <colspec colwidth="6*" align="center"/>
33986 <colspec colwidth="6*" align="right"/>
33987 <tbody>
33988 <row>
33989 <entry><option>optional</option></entry>
33990 <entry>Use: <emphasis>iplookup</emphasis></entry>
33991 <entry>Type: <emphasis>boolean</emphasis></entry>
33992 <entry>Default: <emphasis>false</emphasis></entry>
33993 </row>
33994 </tbody>
33995 </tgroup>
33996 </informaltable>
33997 <para>
33998 If <option>optional</option> is true, if no response is obtained from any host, the address
33999 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
34000 delivery to the address is deferred.
34001 </para>
34002 <para>
34003 <indexterm role="option">
34004 <primary><option>port</option></primary>
34005 </indexterm>
34006 </para>
34007 <informaltable frame="all">
34008 <tgroup cols="4" colsep="0" rowsep="0">
34009 <colspec colwidth="8*" align="left"/>
34010 <colspec colwidth="6*" align="center"/>
34011 <colspec colwidth="6*" align="center"/>
34012 <colspec colwidth="6*" align="right"/>
34013 <tbody>
34014 <row>
34015 <entry><option>port</option></entry>
34016 <entry>Use: <emphasis>iplookup</emphasis></entry>
34017 <entry>Type: <emphasis>integer</emphasis></entry>
34018 <entry>Default: <emphasis>0</emphasis></entry>
34019 </row>
34020 </tbody>
34021 </tgroup>
34022 </informaltable>
34023 <para>
34024 <indexterm role="concept">
34025 <primary>port</primary>
34026 <secondary><command>iplookup</command> router</secondary>
34027 </indexterm>
34028 This option must be supplied. It specifies the port number for the TCP or UDP
34029 call.
34030 </para>
34031 <para>
34032 <indexterm role="option">
34033 <primary><option>protocol</option></primary>
34034 </indexterm>
34035 </para>
34036 <informaltable frame="all">
34037 <tgroup cols="4" colsep="0" rowsep="0">
34038 <colspec colwidth="8*" align="left"/>
34039 <colspec colwidth="6*" align="center"/>
34040 <colspec colwidth="6*" align="center"/>
34041 <colspec colwidth="6*" align="right"/>
34042 <tbody>
34043 <row>
34044 <entry><option>protocol</option></entry>
34045 <entry>Use: <emphasis>iplookup</emphasis></entry>
34046 <entry>Type: <emphasis>string</emphasis></entry>
34047 <entry>Default: <emphasis>udp</emphasis></entry>
34048 </row>
34049 </tbody>
34050 </tgroup>
34051 </informaltable>
34052 <para>
34053 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
34054 protocols is to be used.
34055 </para>
34056 <para>
34057 <indexterm role="option">
34058 <primary><option>query</option></primary>
34059 </indexterm>
34060 </para>
34061 <informaltable frame="all">
34062 <tgroup cols="4" colsep="0" rowsep="0">
34063 <colspec colwidth="8*" align="left"/>
34064 <colspec colwidth="6*" align="center"/>
34065 <colspec colwidth="6*" align="center"/>
34066 <colspec colwidth="6*" align="right"/>
34067 <tbody>
34068 <row>
34069 <entry><option>query</option></entry>
34070 <entry>Use: <emphasis>iplookup</emphasis></entry>
34071 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34072 <entry>Default: <emphasis>see below</emphasis></entry>
34073 </row>
34074 </tbody>
34075 </tgroup>
34076 </informaltable>
34077 <para>
34078 This defines the content of the query that is sent to the remote hosts. The
34079 default value is:
34080 </para>
34081 <literallayout class="monospaced">
34082 $local_part@$domain $local_part@$domain
34083 </literallayout>
34084 <para>
34085 The repetition serves as a way of checking that a response is to the correct
34086 query in the default case (see <option>response_pattern</option> below).
34087 </para>
34088 <para>
34089 <indexterm role="option">
34090 <primary><option>reroute</option></primary>
34091 </indexterm>
34092 </para>
34093 <informaltable frame="all">
34094 <tgroup cols="4" colsep="0" rowsep="0">
34095 <colspec colwidth="8*" align="left"/>
34096 <colspec colwidth="6*" align="center"/>
34097 <colspec colwidth="6*" align="center"/>
34098 <colspec colwidth="6*" align="right"/>
34099 <tbody>
34100 <row>
34101 <entry><option>reroute</option></entry>
34102 <entry>Use: <emphasis>iplookup</emphasis></entry>
34103 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34104 <entry>Default: <emphasis>unset</emphasis></entry>
34105 </row>
34106 </tbody>
34107 </tgroup>
34108 </informaltable>
34109 <para>
34110 If this option is not set, the rerouted address is precisely the byte string
34111 returned by the remote host, up to the first white space, if any. If set, the
34112 string is expanded to form the rerouted address. It can include parts matched
34113 in the response by <option>response_pattern</option> by means of numeric variables such as
34114 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
34115 whether or not a pattern is in use. In all cases, the rerouted address must end
34116 up in the form <emphasis>local_part@domain</emphasis>.
34117 </para>
34118 <para>
34119 <indexterm role="option">
34120 <primary><option>response_pattern</option></primary>
34121 </indexterm>
34122 </para>
34123 <informaltable frame="all">
34124 <tgroup cols="4" colsep="0" rowsep="0">
34125 <colspec colwidth="8*" align="left"/>
34126 <colspec colwidth="6*" align="center"/>
34127 <colspec colwidth="6*" align="center"/>
34128 <colspec colwidth="6*" align="right"/>
34129 <tbody>
34130 <row>
34131 <entry><option>response_pattern</option></entry>
34132 <entry>Use: <emphasis>iplookup</emphasis></entry>
34133 <entry>Type: <emphasis>string</emphasis></entry>
34134 <entry>Default: <emphasis>unset</emphasis></entry>
34135 </row>
34136 </tbody>
34137 </tgroup>
34138 </informaltable>
34139 <para>
34140 This option can be set to a regular expression that is applied to the string
34141 returned from the remote host. If the pattern does not match the response, the
34142 router declines. If <option>response_pattern</option> is not set, no checking of the
34143 response is done, unless the query was defaulted, in which case there is a
34144 check that the text returned after the first white space is the original
34145 address. This checks that the answer that has been received is in response to
34146 the correct question. For example, if the response is just a new domain, the
34147 following could be used:
34148 </para>
34149 <literallayout class="monospaced">
34150 response_pattern = ^([^@]+)$
34151 reroute = $local_part@$1
34152 </literallayout>
34153 <para>
34154 <indexterm role="option">
34155 <primary><option>timeout</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>timeout</option></entry>
34167 <entry>Use: <emphasis>iplookup</emphasis></entry>
34168 <entry>Type: <emphasis>time</emphasis></entry>
34169 <entry>Default: <emphasis>5s</emphasis></entry>
34170 </row>
34171 </tbody>
34172 </tgroup>
34173 </informaltable>
34174 <para>
34175 This specifies the amount of time to wait for a response from the remote
34176 machine. The same timeout is used for the <function>connect()</function> function for a TCP
34177 call. It does not apply to UDP.
34178 </para>
34179 </chapter>
34180
34181 <chapter id="CHID7">
34182 <title>The manualroute router</title>
34183 <para>
34184 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
34185 <primary><command>manualroute</command> router</primary>
34186 </indexterm>
34187 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
34188 <primary>routers</primary>
34189 <secondary><command>manualroute</command></secondary>
34190 </indexterm>
34191 <indexterm role="concept">
34192 <primary>domain</primary>
34193 <secondary>manually routing</secondary>
34194 </indexterm>
34195 The <command>manualroute</command> router is so-called because it provides a way of manually
34196 routing an address according to its domain. It is mainly used when you want to
34197 route addresses to remote hosts according to your own rules, bypassing the
34198 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
34199 route to local transports, a facility that may be useful if you want to save
34200 messages for dial-in hosts in local files.
34201 </para>
34202 <para>
34203 The <command>manualroute</command> router compares a list of domain patterns with the domain
34204 it is trying to route. If there is no match, the router declines. Each pattern
34205 has associated with it a list of hosts and some other optional data, which may
34206 include a transport. The combination of a pattern and its data is called a
34207 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
34208 generic <option>transport</option> option must specify a transport, unless the router is
34209 being used purely for verification (see <option>verify_only</option>).
34210 </para>
34211 <para>
34212 <indexterm role="variable">
34213 <primary><varname>$host</varname></primary>
34214 </indexterm>
34215 In the case of verification, matching the domain pattern is sufficient for the
34216 router to accept the address. When actually routing an address for delivery,
34217 an address that matches a domain pattern is queued for the associated
34218 transport. If the transport is not a local one, a host list must be associated
34219 with the pattern; IP addresses are looked up for the hosts, and these are
34220 passed to the transport along with the mail address. For local transports, a
34221 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
34222 text string.
34223 </para>
34224 <para>
34225 The list of routing rules can be provided as an inline string in
34226 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
34227 or database by setting <option>route_data</option>. Only one of these settings may appear in
34228 any one instance of <command>manualroute</command>. The format of routing rules is described
34229 below, following the list of private options.
34230 </para>
34231 <section id="SECTprioptman">
34232 <title>Private options for manualroute</title>
34233 <para>
34234 <indexterm role="concept">
34235 <primary>options</primary>
34236 <secondary><command>manualroute</command> router</secondary>
34237 </indexterm>
34238 The private options for the <command>manualroute</command> router are as follows:
34239 </para>
34240 <para>
34241 <indexterm role="option">
34242 <primary><option>host_all_ignored</option></primary>
34243 </indexterm>
34244 </para>
34245 <informaltable frame="all">
34246 <tgroup cols="4" colsep="0" rowsep="0">
34247 <colspec colwidth="8*" align="left"/>
34248 <colspec colwidth="6*" align="center"/>
34249 <colspec colwidth="6*" align="center"/>
34250 <colspec colwidth="6*" align="right"/>
34251 <tbody>
34252 <row>
34253 <entry><option>host_all_ignored</option></entry>
34254 <entry>Use: <emphasis>manualroute</emphasis></entry>
34255 <entry>Type: <emphasis>string</emphasis></entry>
34256 <entry>Default: <emphasis>defer</emphasis></entry>
34257 </row>
34258 </tbody>
34259 </tgroup>
34260 </informaltable>
34261 <para>
34262 See <option>host_find_failed</option>.
34263 </para>
34264 <para>
34265 <indexterm role="option">
34266 <primary><option>host_find_failed</option></primary>
34267 </indexterm>
34268 </para>
34269 <informaltable frame="all">
34270 <tgroup cols="4" colsep="0" rowsep="0">
34271 <colspec colwidth="8*" align="left"/>
34272 <colspec colwidth="6*" align="center"/>
34273 <colspec colwidth="6*" align="center"/>
34274 <colspec colwidth="6*" align="right"/>
34275 <tbody>
34276 <row>
34277 <entry><option>host_find_failed</option></entry>
34278 <entry>Use: <emphasis>manualroute</emphasis></entry>
34279 <entry>Type: <emphasis>string</emphasis></entry>
34280 <entry>Default: <emphasis>freeze</emphasis></entry>
34281 </row>
34282 </tbody>
34283 </tgroup>
34284 </informaltable>
34285 <para>
34286 This option controls what happens when <command>manualroute</command> tries to find an IP
34287 address for a host, and the host does not exist. The option can be set to one
34288 of the following values:
34289 </para>
34290 <literallayout class="monospaced">
34291 decline
34292 defer
34293 fail
34294 freeze
34295 ignore
34296 pass
34297 </literallayout>
34298 <para>
34299 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
34300 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
34301 forces the address to be passed to the next router (or the router defined by
34302 <option>pass_router</option>),
34303 <indexterm role="option">
34304 <primary><option>more</option></primary>
34305 </indexterm>
34306 overriding <option>no_more</option>, whereas the latter passes the address to the next
34307 router only if <option>more</option> is true.
34308 </para>
34309 <para>
34310 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
34311 cannot be found. If all the hosts in the list are ignored, the behaviour is
34312 controlled by the <option>host_all_ignored</option> option. This takes the same values
34313 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
34314 </para>
34315 <para>
34316 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
34317 state; if a host lookup gets a temporary error, delivery is deferred unless the
34318 generic <option>pass_on_timeout</option> option is set.
34319 </para>
34320 <para>
34321 <indexterm role="option">
34322 <primary><option>hosts_randomize</option></primary>
34323 </indexterm>
34324 </para>
34325 <informaltable frame="all">
34326 <tgroup cols="4" colsep="0" rowsep="0">
34327 <colspec colwidth="8*" align="left"/>
34328 <colspec colwidth="6*" align="center"/>
34329 <colspec colwidth="6*" align="center"/>
34330 <colspec colwidth="6*" align="right"/>
34331 <tbody>
34332 <row>
34333 <entry><option>hosts_randomize</option></entry>
34334 <entry>Use: <emphasis>manualroute</emphasis></entry>
34335 <entry>Type: <emphasis>boolean</emphasis></entry>
34336 <entry>Default: <emphasis>false</emphasis></entry>
34337 </row>
34338 </tbody>
34339 </tgroup>
34340 </informaltable>
34341 <para>
34342 <indexterm role="concept">
34343 <primary>randomized host list</primary>
34344 </indexterm>
34345 <indexterm role="concept">
34346 <primary>host</primary>
34347 <secondary>list of; randomized</secondary>
34348 </indexterm>
34349 If this option is set, the order of the items in a host list in a routing rule
34350 is randomized each time the list is used, unless an option in the routing rule
34351 overrides (see below). Randomizing the order of a host list can be used to do
34352 crude load sharing. However, if more than one mail address is routed by the
34353 same router to the same host list, the host lists are considered to be the same
34354 (even though they may be randomized into different orders) for the purpose of
34355 deciding whether to batch the deliveries into a single SMTP transaction.
34356 </para>
34357 <para>
34358 When <option>hosts_randomize</option> is true, a host list may be split
34359 into groups whose order is separately randomized. This makes it possible to
34360 set up MX-like behaviour. The boundaries between groups are indicated by an
34361 item that is just <literal>+</literal> in the host list. For example:
34362 </para>
34363 <literallayout class="monospaced">
34364 route_list = * host1:host2:host3:+:host4:host5
34365 </literallayout>
34366 <para>
34367 The order of the first three hosts and the order of the last two hosts is
34368 randomized for each use, but the first three always end up before the last two.
34369 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
34370 randomized host list is passed to an <command>smtp</command> transport that also has
34371 <option>hosts_randomize set</option>, the list is not re-randomized.
34372 </para>
34373 <para>
34374 <indexterm role="option">
34375 <primary><option>route_data</option></primary>
34376 </indexterm>
34377 </para>
34378 <informaltable frame="all">
34379 <tgroup cols="4" colsep="0" rowsep="0">
34380 <colspec colwidth="8*" align="left"/>
34381 <colspec colwidth="6*" align="center"/>
34382 <colspec colwidth="6*" align="center"/>
34383 <colspec colwidth="6*" align="right"/>
34384 <tbody>
34385 <row>
34386 <entry><option>route_data</option></entry>
34387 <entry>Use: <emphasis>manualroute</emphasis></entry>
34388 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34389 <entry>Default: <emphasis>unset</emphasis></entry>
34390 </row>
34391 </tbody>
34392 </tgroup>
34393 </informaltable>
34394 <para>
34395 If this option is set, it must expand to yield the data part of a routing rule.
34396 Typically, the expansion string includes a lookup based on the domain. For
34397 example:
34398 </para>
34399 <literallayout class="monospaced">
34400 route_data = ${lookup{$domain}dbm{/etc/routes}}
34401 </literallayout>
34402 <para>
34403 If the expansion is forced to fail, or the result is an empty string, the
34404 router declines. Other kinds of expansion failure cause delivery to be
34405 deferred.
34406 </para>
34407 <para>
34408 <indexterm role="option">
34409 <primary><option>route_list</option></primary>
34410 </indexterm>
34411 </para>
34412 <informaltable frame="all">
34413 <tgroup cols="4" colsep="0" rowsep="0">
34414 <colspec colwidth="8*" align="left"/>
34415 <colspec colwidth="6*" align="center"/>
34416 <colspec colwidth="6*" align="center"/>
34417 <colspec colwidth="6*" align="right"/>
34418 <tbody>
34419 <row>
34420 <entry><option>route_list</option></entry>
34421 <entry>Use: <emphasis>manualroute</emphasis></entry>
34422 <entry>Type: <emphasis>string list</emphasis></entry>
34423 <entry>Default: <emphasis>unset</emphasis></entry>
34424 </row>
34425 </tbody>
34426 </tgroup>
34427 </informaltable>
34428 <para>
34429 This string is a list of routing rules, in the form defined below. Note that,
34430 unlike most string lists, the items are separated by semicolons. This is so
34431 that they may contain colon-separated host lists.
34432 </para>
34433 <para>
34434 <indexterm role="option">
34435 <primary><option>same_domain_copy_routing</option></primary>
34436 </indexterm>
34437 </para>
34438 <informaltable frame="all">
34439 <tgroup cols="4" colsep="0" rowsep="0">
34440 <colspec colwidth="8*" align="left"/>
34441 <colspec colwidth="6*" align="center"/>
34442 <colspec colwidth="6*" align="center"/>
34443 <colspec colwidth="6*" align="right"/>
34444 <tbody>
34445 <row>
34446 <entry><option>same_domain_copy_routing</option></entry>
34447 <entry>Use: <emphasis>manualroute</emphasis></entry>
34448 <entry>Type: <emphasis>boolean</emphasis></entry>
34449 <entry>Default: <emphasis>false</emphasis></entry>
34450 </row>
34451 </tbody>
34452 </tgroup>
34453 </informaltable>
34454 <para>
34455 <indexterm role="concept">
34456 <primary>address</primary>
34457 <secondary>copying routing</secondary>
34458 </indexterm>
34459 Addresses with the same domain are normally routed by the <command>manualroute</command>
34460 router to the same list of hosts. However, this cannot be presumed, because the
34461 router options and preconditions may refer to the local part of the address. By
34462 default, therefore, Exim routes each address in a message independently. DNS
34463 servers run caches, so repeated DNS lookups are not normally expensive, and in
34464 any case, personal messages rarely have more than a few recipients.
34465 </para>
34466 <para>
34467 If you are running mailing lists with large numbers of subscribers at the same
34468 domain, and you are using a <command>manualroute</command> router which is independent of the
34469 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
34470 lookups for identical domains in one message. In this case, when
34471 <command>manualroute</command> routes an address to a remote transport, any other unrouted
34472 addresses in the message that have the same domain are automatically given the
34473 same routing without processing them independently. However, this is only done
34474 if <option>headers_add</option> and <option>headers_remove</option> are unset.
34475 </para>
34476 </section>
34477 <section id="SECID120">
34478 <title>Routing rules in route_list</title>
34479 <para>
34480 The value of <option>route_list</option> is a string consisting of a sequence of routing
34481 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
34482 entered as two semicolons. Alternatively, the list separator can be changed as
34483 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
34484 Empty rules are ignored. The format of each rule is
34485 </para>
34486 <literallayout>
34487 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
34488 </literallayout>
34489 <para>
34490 The following example contains two rules, each with a simple domain pattern and
34491 no options:
34492 </para>
34493 <literallayout class="monospaced">
34494 route_list = \
34495   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
34496   thes.ref.example  mail-3.ref.example:mail-4.ref.example
34497 </literallayout>
34498 <para>
34499 The three parts of a rule are separated by white space. The pattern and the
34500 list of hosts can be enclosed in quotes if necessary, and if they are, the
34501 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
34502 single domain pattern, which is the only mandatory item in the rule. The
34503 pattern is in the same format as one item in a domain list (see section
34504 <xref linkend="SECTdomainlist"/>),
34505 except that it may not be the name of an interpolated file.
34506 That is, it may be wildcarded, or a regular expression, or a file or database
34507 lookup (with semicolons doubled, because of the use of semicolon as a separator
34508 in a <option>route_list</option>).
34509 </para>
34510 <para>
34511 The rules in <option>route_list</option> are searched in order until one of the patterns
34512 matches the domain that is being routed. The list of hosts and then options are
34513 then used as described below. If there is no match, the router declines. When
34514 <option>route_list</option> is set, <option>route_data</option> must not be set.
34515 </para>
34516 </section>
34517 <section id="SECID121">
34518 <title>Routing rules in route_data</title>
34519 <para>
34520 The use of <option>route_list</option> is convenient when there are only a small number of
34521 routing rules. For larger numbers, it is easier to use a file or database to
34522 hold the routing information, and use the <option>route_data</option> option instead.
34523 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
34524 Most commonly, <option>route_data</option> is set as a string that contains an
34525 expansion lookup. For example, suppose we place two routing rules in a file
34526 like this:
34527 </para>
34528 <literallayout class="monospaced">
34529 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
34530 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
34531 </literallayout>
34532 <para>
34533 This data can be accessed by setting
34534 </para>
34535 <literallayout class="monospaced">
34536 route_data = ${lookup{$domain}lsearch{/the/file/name}}
34537 </literallayout>
34538 <para>
34539 Failure of the lookup results in an empty string, causing the router to
34540 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
34541 requirement is that the result of expanding the string is a list of hosts,
34542 possibly followed by options, separated by white space. The list of hosts must
34543 be enclosed in quotes if it contains white space.
34544 </para>
34545 </section>
34546 <section id="SECID122">
34547 <title>Format of the list of hosts</title>
34548 <para>
34549 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
34550 always separately expanded before use. If the expansion fails, the router
34551 declines. The result of the expansion must be a colon-separated list of names
34552 and/or IP addresses, optionally also including ports. The format of each item
34553 in the list is described in the next section. The list separator can be changed
34554 as described in section <xref linkend="SECTlistconstruct"/>.
34555 </para>
34556 <para>
34557 If the list of hosts was obtained from a <option>route_list</option> item, the following
34558 variables are set during its expansion:
34559 </para>
34560 <itemizedlist>
34561 <listitem>
34562 <para>
34563 <indexterm role="concept">
34564 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
34565 <secondary>in <command>manualroute</command> router</secondary>
34566 </indexterm>
34567 If the domain was matched against a regular expression, the numeric variables
34568 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
34569 </para>
34570 <literallayout class="monospaced">
34571 route_list = ^domain(\d+)   host-$1.text.example
34572 </literallayout>
34573 </listitem>
34574 <listitem>
34575 <para>
34576 <varname>$0</varname> is always set to the entire domain.
34577 </para>
34578 </listitem>
34579 <listitem>
34580 <para>
34581 <varname>$1</varname> is also set when partial matching is done in a file lookup.
34582 </para>
34583 </listitem>
34584 <listitem>
34585 <para>
34586 <indexterm role="variable">
34587 <primary><varname>$value</varname></primary>
34588 </indexterm>
34589 If the pattern that matched the domain was a lookup item, the data that was
34590 looked up is available in the expansion variable <varname>$value</varname>. For example:
34591 </para>
34592 <literallayout class="monospaced">
34593 route_list = lsearch;;/some/file.routes  $value
34594 </literallayout>
34595 </listitem>
34596 </itemizedlist>
34597 <para>
34598 Note the doubling of the semicolon in the pattern that is necessary because
34599 semicolon is the default route list separator.
34600 </para>
34601 </section>
34602 <section id="SECTformatonehostitem">
34603 <title>Format of one host item</title>
34604 <para>
34605 Each item in the list of hosts is either a host name or an IP address,
34606 optionally with an attached port number. When no port is given, an IP address
34607 is not enclosed in brackets. When a port is specified, it overrides the port
34608 specification on the transport. The port is separated from the name or address
34609 by a colon. This leads to some complications:
34610 </para>
34611 <itemizedlist>
34612 <listitem>
34613 <para>
34614 Because colon is the default separator for the list of hosts, either
34615 the colon that specifies a port must be doubled, or the list separator must
34616 be changed. The following two examples have the same effect:
34617 </para>
34618 <literallayout class="monospaced">
34619 route_list = * "host1.tld::1225 : host2.tld::1226"
34620 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
34621 </literallayout>
34622 </listitem>
34623 <listitem>
34624 <para>
34625 When IPv6 addresses are involved, it gets worse, because they contain
34626 colons of their own. To make this case easier, it is permitted to
34627 enclose an IP address (either v4 or v6) in square brackets if a port
34628 number follows. For example:
34629 </para>
34630 <literallayout class="monospaced">
34631 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
34632 </literallayout>
34633 </listitem>
34634 </itemizedlist>
34635 </section>
34636 <section id="SECThostshowused">
34637 <title>How the list of hosts is used</title>
34638 <para>
34639 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
34640 the hosts is tried, in the order specified, when carrying out the SMTP
34641 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
34642 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
34643 transport.
34644 </para>
34645 <para>
34646 Hosts may be listed by name or by IP address. An unadorned name in the list of
34647 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
34648 interpreted as an indirection to a sublist of hosts obtained by looking up MX
34649 records in the DNS. For example:
34650 </para>
34651 <literallayout class="monospaced">
34652 route_list = *  x.y.z:p.q.r/MX:e.f.g
34653 </literallayout>
34654 <para>
34655 If this feature is used with a port specifier, the port must come last. For
34656 example:
34657 </para>
34658 <literallayout class="monospaced">
34659 route_list = *  dom1.tld/mx::1225
34660 </literallayout>
34661 <para>
34662 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
34663 randomized before any lookups are done. Exim then scans the list; for any name
34664 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
34665 be an interface on the local host and the item is not the first in the list,
34666 Exim discards it and any subsequent items. If it is the first item, what
34667 happens is controlled by the
34668 <indexterm role="option">
34669 <primary><option>self</option></primary>
34670 <secondary>in <command>manualroute</command> router</secondary>
34671 </indexterm>
34672 <option>self</option> option of the router.
34673 </para>
34674 <para>
34675 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
34676 hosts obtained by looking up MX records for the name. This is always a DNS
34677 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
34678 below) are not relevant here. The order of these hosts is determined by the
34679 preference values in the MX records, according to the usual rules. Because
34680 randomizing happens before the MX lookup, it does not affect the order that is
34681 defined by MX preferences.
34682 </para>
34683 <para>
34684 If the local host is present in the sublist obtained from MX records, but is
34685 not the most preferred host in that list, it and any equally or less
34686 preferred hosts are removed before the sublist is inserted into the main list.
34687 </para>
34688 <para>
34689 If the local host is the most preferred host in the MX list, what happens
34690 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
34691 is not the first item (that is, there are previous hosts in the main list),
34692 Exim discards this name and any subsequent items in the main list.
34693 </para>
34694 <para>
34695 If the MX item is first in the list of hosts, and the local host is the
34696 most preferred host, what happens is controlled by the <option>self</option> option of the
34697 router.
34698 </para>
34699 <para>
34700 DNS failures when lookup up the MX records are treated in the same way as DNS
34701 failures when looking up IP addresses: <option>pass_on_timeout</option> and
34702 <option>host_find_failed</option> are used when relevant.
34703 </para>
34704 <para>
34705 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
34706 whether obtained from an MX lookup or not.
34707 </para>
34708 </section>
34709 <section id="SECThowoptused">
34710 <title>How the options are used</title>
34711 <para>
34712 The options are a sequence of words; in practice no more than three are ever
34713 present. One of the words can be the name of a transport; this overrides the
34714 <option>transport</option> option on the router for this particular routing rule only. The
34715 other words (if present) control randomization of the list of hosts on a
34716 per-rule basis, and how the IP addresses of the hosts are to be found when
34717 routing to a remote transport. These options are as follows:
34718 </para>
34719 <itemizedlist>
34720 <listitem>
34721 <para>
34722 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
34723 setting of <option>hosts_randomize</option> for this routing rule only.
34724 </para>
34725 </listitem>
34726 <listitem>
34727 <para>
34728 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
34729 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
34730 </para>
34731 </listitem>
34732 <listitem>
34733 <para>
34734 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
34735 find IP addresses. This function may ultimately cause a DNS lookup, but it may
34736 also look in <filename>/etc/hosts</filename> or other sources of information.
34737 </para>
34738 </listitem>
34739 <listitem>
34740 <para>
34741 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
34742 no address records are found. If there is a temporary DNS error (such as a
34743 timeout), delivery is deferred.
34744 </para>
34745 </listitem>
34746 </itemizedlist>
34747 <para>
34748 For example:
34749 </para>
34750 <literallayout class="monospaced">
34751 route_list = domain1  host1:host2:host3  randomize bydns;\
34752              domain2  host4:host5
34753 </literallayout>
34754 <para>
34755 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
34756 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
34757 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
34758 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
34759 call.
34760 </para>
34761 <para>
34762 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
34763 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
34764 instead of TRY_AGAIN. That is why the default action is to try a DNS
34765 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
34766 function called.
34767 </para>
34768 <para>
34769 If no IP address for a host can be found, what happens is controlled by the
34770 <option>host_find_failed</option> option.
34771 </para>
34772 <para>
34773 <indexterm role="variable">
34774 <primary><varname>$host</varname></primary>
34775 </indexterm>
34776 When an address is routed to a local transport, IP addresses are not looked up.
34777 The host list is passed to the transport in the <varname>$host</varname> variable.
34778 </para>
34779 </section>
34780 <section id="SECID123">
34781 <title>Manualroute examples</title>
34782 <para>
34783 In some of the examples that follow, the presence of the <option>remote_smtp</option>
34784 transport, as defined in the default configuration file, is assumed:
34785 </para>
34786 <itemizedlist>
34787 <listitem>
34788 <para>
34789 <indexterm role="concept">
34790 <primary>smart host</primary>
34791 <secondary>example router</secondary>
34792 </indexterm>
34793 The <command>manualroute</command> router can be used to forward all external mail to a
34794 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
34795 named domain list that contains your local domains, for example:
34796 </para>
34797 <literallayout class="monospaced">
34798 domainlist local_domains = my.domain.example
34799 </literallayout>
34800 <para>
34801 You can arrange for all other domains to be routed to a smart host by making
34802 your first router something like this:
34803 </para>
34804 <literallayout class="monospaced">
34805 smart_route:
34806   driver = manualroute
34807   domains = !+local_domains
34808   transport = remote_smtp
34809   route_list = * smarthost.ref.example
34810 </literallayout>
34811 <para>
34812 This causes all non-local addresses to be sent to the single host
34813 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
34814 they are tried in order
34815 (but you can use <option>hosts_randomize</option> to vary the order each time).
34816 Another way of configuring the same thing is this:
34817 </para>
34818 <literallayout class="monospaced">
34819 smart_route:
34820   driver = manualroute
34821   transport = remote_smtp
34822   route_list = !+local_domains  smarthost.ref.example
34823 </literallayout>
34824 <para>
34825 There is no difference in behaviour between these two routers as they stand.
34826 However, they behave differently if <option>no_more</option> is added to them. In the first
34827 example, the router is skipped if the domain does not match the <option>domains</option>
34828 precondition; the following router is always tried. If the router runs, it
34829 always matches the domain and so can never decline. Therefore, <option>no_more</option>
34830 would have no effect. In the second case, the router is never skipped; it
34831 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
34832 <option>no_more</option> would prevent subsequent routers from running.
34833 </para>
34834 </listitem>
34835 <listitem>
34836 <para>
34837 <indexterm role="concept">
34838 <primary>mail hub example</primary>
34839 </indexterm>
34840 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
34841 records in the DNS and delivers it via its own private routing mechanism. Often
34842 the final destinations are behind a firewall, with the mail hub being the one
34843 machine that can connect to machines both inside and outside the firewall. The
34844 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
34845 to the correct hosts. For a small number of domains, the routing can be inline,
34846 using the <option>route_list</option> option, but for a larger number a file or database
34847 lookup is easier to manage.
34848 </para>
34849 <para>
34850 If the domain names are in fact the names of the machines to which the mail is
34851 to be sent by the mail hub, the configuration can be quite simple. For
34852 example:
34853 </para>
34854 <literallayout class="monospaced">
34855 hub_route:
34856   driver = manualroute
34857   transport = remote_smtp
34858   route_list = *.rhodes.tvs.example  $domain
34859 </literallayout>
34860 <para>
34861 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
34862 whose names are the same as the mail domains. A similar approach can be taken
34863 if the host name can be obtained from the domain name by a string manipulation
34864 that the expansion facilities can handle. Otherwise, a lookup based on the
34865 domain can be used to find the host:
34866 </para>
34867 <literallayout class="monospaced">
34868 through_firewall:
34869   driver = manualroute
34870   transport = remote_smtp
34871   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
34872 </literallayout>
34873 <para>
34874 The result of the lookup must be the name or IP address of the host (or
34875 hosts) to which the address is to be routed. If the lookup fails, the route
34876 data is empty, causing the router to decline. The address then passes to the
34877 next router.
34878 </para>
34879 </listitem>
34880 <listitem>
34881 <para>
34882 <indexterm role="concept">
34883 <primary>batched SMTP output example</primary>
34884 </indexterm>
34885 <indexterm role="concept">
34886 <primary>SMTP</primary>
34887 <secondary>batched outgoing; example</secondary>
34888 </indexterm>
34889 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
34890 SMTP format for onward transportation by some other means. This is one way of
34891 storing mail for a dial-up host when it is not connected. The route list entry
34892 can be as simple as a single domain name in a configuration like this:
34893 </para>
34894 <literallayout class="monospaced">
34895 save_in_file:
34896   driver = manualroute
34897   transport = batchsmtp_appendfile
34898   route_list = saved.domain.example
34899 </literallayout>
34900 <para>
34901 though often a pattern is used to pick up more than one domain. If there are
34902 several domains or groups of domains with different transport requirements,
34903 different transports can be listed in the routing information:
34904 </para>
34905 <literallayout class="monospaced">
34906 save_in_file:
34907   driver = manualroute
34908   route_list = \
34909     *.saved.domain1.example  $domain  batch_appendfile; \
34910     *.saved.domain2.example  \
34911       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
34912       batch_pipe
34913 </literallayout>
34914 <para>
34915 <indexterm role="variable">
34916 <primary><varname>$domain</varname></primary>
34917 </indexterm>
34918 <indexterm role="variable">
34919 <primary><varname>$host</varname></primary>
34920 </indexterm>
34921 The first of these just passes the domain in the <varname>$host</varname> variable, which
34922 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
34923 file lookup to find a value to pass, causing the router to decline to handle
34924 the address if the lookup fails.
34925 </para>
34926 </listitem>
34927 <listitem>
34928 <para>
34929 <indexterm role="concept">
34930 <primary>UUCP</primary>
34931 <secondary>example of router for</secondary>
34932 </indexterm>
34933 Routing mail directly to UUCP software is a specific case of the use of
34934 <command>manualroute</command> in a gateway to another mail environment. This is an example of
34935 one way it can be done:
34936 </para>
34937 <literallayout class="monospaced">
34938 # Transport
34939 uucp:
34940   driver = pipe
34941   user = nobody
34942   command = /usr/local/bin/uux -r - \
34943     ${substr_-5:$host}!rmail ${local_part}
34944   return_fail_output = true
34945
34946 # Router
34947 uucphost:
34948   transport = uucp
34949   driver = manualroute
34950   route_data = \
34951     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
34952 </literallayout>
34953 <para>
34954 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
34955 </para>
34956 <literallayout class="monospaced">
34957 darksite.ethereal.example:           darksite.UUCP
34958 </literallayout>
34959 <para>
34960 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
34961 makes clear the distinction between the domain name
34962 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
34963 </para>
34964 </listitem>
34965 </itemizedlist>
34966 <para>
34967 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
34968 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
34969 </para>
34970 </section>
34971 </chapter>
34972
34973 <chapter id="CHAPdriverlast">
34974 <title>The queryprogram router</title>
34975 <para>
34976 <indexterm role="concept" id="IIDquerou1" class="startofrange">
34977 <primary><command>queryprogram</command> router</primary>
34978 </indexterm>
34979 <indexterm role="concept" id="IIDquerou2" class="startofrange">
34980 <primary>routers</primary>
34981 <secondary><command>queryprogram</command></secondary>
34982 </indexterm>
34983 <indexterm role="concept">
34984 <primary>routing</primary>
34985 <secondary>by external program</secondary>
34986 </indexterm>
34987 The <command>queryprogram</command> router routes an address by running an external command
34988 and acting on its output. This is an expensive way to route, and is intended
34989 mainly for use in lightly-loaded systems, or for performing experiments.
34990 However, if it is possible to use the precondition options (<option>domains</option>,
34991 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
34992 be used in special cases, even on a busy host. There are the following private
34993 options:
34994 <indexterm role="concept">
34995 <primary>options</primary>
34996 <secondary><command>queryprogram</command> router</secondary>
34997 </indexterm>
34998 </para>
34999 <para>
35000 <indexterm role="option">
35001 <primary><option>command</option></primary>
35002 </indexterm>
35003 </para>
35004 <informaltable frame="all">
35005 <tgroup cols="4" colsep="0" rowsep="0">
35006 <colspec colwidth="8*" align="left"/>
35007 <colspec colwidth="6*" align="center"/>
35008 <colspec colwidth="6*" align="center"/>
35009 <colspec colwidth="6*" align="right"/>
35010 <tbody>
35011 <row>
35012 <entry><option>command</option></entry>
35013 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35014 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35015 <entry>Default: <emphasis>unset</emphasis></entry>
35016 </row>
35017 </tbody>
35018 </tgroup>
35019 </informaltable>
35020 <para>
35021 This option must be set. It specifies the command that is to be run. The
35022 command is split up into a command name and arguments, and then each is
35023 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
35024 <xref linkend="CHAPpipetransport"/>).
35025 </para>
35026 <para>
35027 <indexterm role="option">
35028 <primary><option>command_group</option></primary>
35029 </indexterm>
35030 </para>
35031 <informaltable frame="all">
35032 <tgroup cols="4" colsep="0" rowsep="0">
35033 <colspec colwidth="8*" align="left"/>
35034 <colspec colwidth="6*" align="center"/>
35035 <colspec colwidth="6*" align="center"/>
35036 <colspec colwidth="6*" align="right"/>
35037 <tbody>
35038 <row>
35039 <entry><option>command_group</option></entry>
35040 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35041 <entry>Type: <emphasis>string</emphasis></entry>
35042 <entry>Default: <emphasis>unset</emphasis></entry>
35043 </row>
35044 </tbody>
35045 </tgroup>
35046 </informaltable>
35047 <para>
35048 <indexterm role="concept">
35049 <primary>gid (group id)</primary>
35050 <secondary>in <command>queryprogram</command> router</secondary>
35051 </indexterm>
35052 This option specifies a gid to be set when running the command while routing an
35053 address for deliver. It must be set if <option>command_user</option> specifies a numerical
35054 uid. If it begins with a digit, it is interpreted as the numerical value of the
35055 gid. Otherwise it is looked up using <function>getgrnam()</function>.
35056 </para>
35057 <para>
35058 <indexterm role="option">
35059 <primary><option>command_user</option></primary>
35060 </indexterm>
35061 </para>
35062 <informaltable frame="all">
35063 <tgroup cols="4" colsep="0" rowsep="0">
35064 <colspec colwidth="8*" align="left"/>
35065 <colspec colwidth="6*" align="center"/>
35066 <colspec colwidth="6*" align="center"/>
35067 <colspec colwidth="6*" align="right"/>
35068 <tbody>
35069 <row>
35070 <entry><option>command_user</option></entry>
35071 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35072 <entry>Type: <emphasis>string</emphasis></entry>
35073 <entry>Default: <emphasis>unset</emphasis></entry>
35074 </row>
35075 </tbody>
35076 </tgroup>
35077 </informaltable>
35078 <para>
35079 <indexterm role="concept">
35080 <primary>uid (user id)</primary>
35081 <secondary>for <command>queryprogram</command></secondary>
35082 </indexterm>
35083 This option must be set. It specifies the uid which is set when running the
35084 command while routing an address for delivery. If the value begins with a digit,
35085 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
35086 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
35087 not set, a value for the gid also.
35088 </para>
35089 <para>
35090 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
35091 root, which it does during a normal delivery in a conventional configuration.
35092 However, when an address is being verified during message reception, Exim is
35093 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
35094 is called from a non-root process, Exim cannot change uid or gid before running
35095 the command. In this circumstance the command runs under the current uid and
35096 gid.
35097 </para>
35098 <para>
35099 <indexterm role="option">
35100 <primary><option>current_directory</option></primary>
35101 </indexterm>
35102 </para>
35103 <informaltable frame="all">
35104 <tgroup cols="4" colsep="0" rowsep="0">
35105 <colspec colwidth="8*" align="left"/>
35106 <colspec colwidth="6*" align="center"/>
35107 <colspec colwidth="6*" align="center"/>
35108 <colspec colwidth="6*" align="right"/>
35109 <tbody>
35110 <row>
35111 <entry><option>current_directory</option></entry>
35112 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35113 <entry>Type: <emphasis>string</emphasis></entry>
35114 <entry>Default: <emphasis>/</emphasis></entry>
35115 </row>
35116 </tbody>
35117 </tgroup>
35118 </informaltable>
35119 <para>
35120 This option specifies an absolute path which is made the current directory
35121 before running the command.
35122 </para>
35123 <para>
35124 <indexterm role="option">
35125 <primary><option>timeout</option></primary>
35126 </indexterm>
35127 </para>
35128 <informaltable frame="all">
35129 <tgroup cols="4" colsep="0" rowsep="0">
35130 <colspec colwidth="8*" align="left"/>
35131 <colspec colwidth="6*" align="center"/>
35132 <colspec colwidth="6*" align="center"/>
35133 <colspec colwidth="6*" align="right"/>
35134 <tbody>
35135 <row>
35136 <entry><option>timeout</option></entry>
35137 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35138 <entry>Type: <emphasis>time</emphasis></entry>
35139 <entry>Default: <emphasis>1h</emphasis></entry>
35140 </row>
35141 </tbody>
35142 </tgroup>
35143 </informaltable>
35144 <para>
35145 If the command does not complete within the timeout period, its process group
35146 is killed and the message is frozen. A value of zero time specifies no
35147 timeout.
35148 </para>
35149 <para>
35150 The standard output of the command is connected to a pipe, which is read when
35151 the command terminates. It should consist of a single line of output,
35152 containing up to five fields, separated by white space. The maximum length of
35153 the line is 1023 characters. Longer lines are silently truncated. The first
35154 field is one of the following words (case-insensitive):
35155 </para>
35156 <itemizedlist>
35157 <listitem>
35158 <para>
35159 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
35160 below).
35161 </para>
35162 </listitem>
35163 <listitem>
35164 <para>
35165 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
35166 <option>no_more</option> is set.
35167 </para>
35168 </listitem>
35169 <listitem>
35170 <para>
35171 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
35172 subsequent text on the line is an error message. If the router is run as part
35173 of address verification during an incoming SMTP message, the message is
35174 included in the SMTP response.
35175 </para>
35176 </listitem>
35177 <listitem>
35178 <para>
35179 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
35180 subsequent text on the line is an error message which is logged. It is not
35181 included in any SMTP response.
35182 </para>
35183 </listitem>
35184 <listitem>
35185 <para>
35186 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
35187 </para>
35188 </listitem>
35189 <listitem>
35190 <para>
35191 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
35192 <option>pass_router</option>), overriding <option>no_more</option>.
35193 </para>
35194 </listitem>
35195 <listitem>
35196 <para>
35197 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
35198 new addresses, which are routed independently, starting with the first router,
35199 or the router specified by <option>redirect_router</option>, if set.
35200 </para>
35201 </listitem>
35202 </itemizedlist>
35203 <para>
35204 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
35205 number of keyed data values, as follows (split into two lines here, to fit on
35206 the page):
35207 </para>
35208 <literallayout class="monospaced">
35209 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
35210 LOOKUP=byname|bydns DATA=&lt;text&gt;
35211 </literallayout>
35212 <para>
35213 The data items can be given in any order, and all are optional. If no transport
35214 is included, the transport specified by the generic <option>transport</option> option is
35215 used. The list of hosts and the lookup type are needed only if the transport is
35216 an <command>smtp</command> transport that does not itself supply a list of hosts.
35217 </para>
35218 <para>
35219 The format of the list of hosts is the same as for the <command>manualroute</command> router.
35220 As well as host names and IP addresses with optional port numbers, as described
35221 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
35222 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
35223 (see section <xref linkend="SECThostshowused"/>).
35224 </para>
35225 <para>
35226 If the lookup type is not specified, Exim behaves as follows when trying to
35227 find an IP address for each host: First, a DNS lookup is done. If this yields
35228 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
35229 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
35230 result of the lookup is the result of that call.
35231 </para>
35232 <para>
35233 <indexterm role="variable">
35234 <primary><varname>$address_data</varname></primary>
35235 </indexterm>
35236 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
35237 variable. For example, this return line
35238 </para>
35239 <literallayout class="monospaced">
35240 accept hosts=x1.y.example:x2.y.example data="rule1"
35241 </literallayout>
35242 <para>
35243 routes the address to the default transport, passing a list of two hosts. When
35244 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
35245 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
35246 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
35247 </para>
35248 </chapter>
35249
35250 <chapter id="CHAPredirect">
35251 <title>The redirect router</title>
35252 <para>
35253 <indexterm role="concept" id="IIDredrou1" class="startofrange">
35254 <primary><command>redirect</command> router</primary>
35255 </indexterm>
35256 <indexterm role="concept" id="IIDredrou2" class="startofrange">
35257 <primary>routers</primary>
35258 <secondary><command>redirect</command></secondary>
35259 </indexterm>
35260 <indexterm role="concept">
35261 <primary>alias file</primary>
35262 <secondary>in a <command>redirect</command> router</secondary>
35263 </indexterm>
35264 <indexterm role="concept">
35265 <primary>address redirection</primary>
35266 <secondary><command>redirect</command> router</secondary>
35267 </indexterm>
35268 The <command>redirect</command> router handles several kinds of address redirection. Its most
35269 common uses are for resolving local part aliases from a central alias file
35270 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
35271 files, but it has many other potential uses. The incoming address can be
35272 redirected in several different ways:
35273 </para>
35274 <itemizedlist>
35275 <listitem>
35276 <para>
35277 It can be replaced by one or more new addresses which are themselves routed
35278 independently.
35279 </para>
35280 </listitem>
35281 <listitem>
35282 <para>
35283 It can be routed to be delivered to a given file or directory.
35284 </para>
35285 </listitem>
35286 <listitem>
35287 <para>
35288 It can be routed to be delivered to a specified pipe command.
35289 </para>
35290 </listitem>
35291 <listitem>
35292 <para>
35293 It can cause an automatic reply to be generated.
35294 </para>
35295 </listitem>
35296 <listitem>
35297 <para>
35298 It can be forced to fail, optionally with a custom error message.
35299 </para>
35300 </listitem>
35301 <listitem>
35302 <para>
35303 It can be temporarily deferred, optionally with a custom message.
35304 </para>
35305 </listitem>
35306 <listitem>
35307 <para>
35308 It can be discarded.
35309 </para>
35310 </listitem>
35311 </itemizedlist>
35312 <para>
35313 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
35314 However, there are some private options which define transports for delivery to
35315 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
35316 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
35317 </para>
35318 <section id="SECID124">
35319 <title>Redirection data</title>
35320 <para>
35321 The router operates by interpreting a text string which it obtains either by
35322 expanding the contents of the <option>data</option> option, or by reading the entire
35323 contents of a file whose name is given in the <option>file</option> option. These two
35324 options are mutually exclusive. The first is commonly used for handling system
35325 aliases, in a configuration like this:
35326 </para>
35327 <literallayout class="monospaced">
35328 system_aliases:
35329   driver = redirect
35330   data = ${lookup{$local_part}lsearch{/etc/aliases}}
35331 </literallayout>
35332 <para>
35333 If the lookup fails, the expanded string in this example is empty. When the
35334 expansion of <option>data</option> results in an empty string, the router declines. A forced
35335 expansion failure also causes the router to decline; other expansion failures
35336 cause delivery to be deferred.
35337 </para>
35338 <para>
35339 A configuration using <option>file</option> is commonly used for handling users&#x2019;
35340 <filename>.forward</filename> files, like this:
35341 </para>
35342 <literallayout class="monospaced">
35343 userforward:
35344   driver = redirect
35345   check_local_user
35346   file = $home/.forward
35347   no_verify
35348 </literallayout>
35349 <para>
35350 If the file does not exist, or causes no action to be taken (for example, it is
35351 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
35352 is not the case when the file contains syntactically valid items that happen to
35353 yield empty addresses, for example, items containing only RFC 2822 address
35354 comments.
35355 </para>
35356 </section>
35357 <section id="SECID125">
35358 <title>Forward files and address verification</title>
35359 <para>
35360 <indexterm role="concept">
35361 <primary>address redirection</primary>
35362 <secondary>while verifying</secondary>
35363 </indexterm>
35364 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
35365 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
35366 </para>
35367 <itemizedlist>
35368 <listitem>
35369 <para>
35370 When Exim is receiving an incoming SMTP message from a remote host, it is
35371 running under the Exim uid, not as root. Exim is unable to change uid to read
35372 the file as the user, and it may not be able to read it as the Exim user. So in
35373 practice the router may not be able to operate.
35374 </para>
35375 </listitem>
35376 <listitem>
35377 <para>
35378 However, even when the router can operate, the existence of a <filename>.forward</filename> file
35379 is unimportant when verifying an address. What should be checked is whether the
35380 local part is a valid user name or not. Cutting out the redirection processing
35381 saves some resources.
35382 </para>
35383 </listitem>
35384 </itemizedlist>
35385 </section>
35386 <section id="SECID126">
35387 <title>Interpreting redirection data</title>
35388 <para>
35389 <indexterm role="concept">
35390 <primary>Sieve filter</primary>
35391 <secondary>specifying in redirection data</secondary>
35392 </indexterm>
35393 <indexterm role="concept">
35394 <primary>filter</primary>
35395 <secondary>specifying in redirection data</secondary>
35396 </indexterm>
35397 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
35398 can be interpreted in two different ways:
35399 </para>
35400 <itemizedlist>
35401 <listitem>
35402 <para>
35403 If the <option>allow_filter</option> option is set true, and the data begins with the text
35404 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
35405 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
35406 respectively. Details of the syntax and semantics of filter files are described
35407 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
35408 document is intended for use by end users.
35409 </para>
35410 </listitem>
35411 <listitem>
35412 <para>
35413 Otherwise, the data must be a comma-separated list of redirection items, as
35414 described in the next section.
35415 </para>
35416 </listitem>
35417 </itemizedlist>
35418 <para>
35419 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
35420 in a non-filter redirection list must always be an absolute path. A filter may
35421 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
35422 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
35423 for the <command>appendfile</command> transport.
35424 </para>
35425 </section>
35426 <section id="SECTitenonfilred">
35427 <title>Items in a non-filter redirection list</title>
35428 <para>
35429 <indexterm role="concept">
35430 <primary>address redirection</primary>
35431 <secondary>non-filter list items</secondary>
35432 </indexterm>
35433 When the redirection data is not an Exim or Sieve filter, for example, if it
35434 comes from a conventional alias or forward file, it consists of a list of
35435 addresses, file names, pipe commands, or certain special items (see section
35436 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
35437 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
35438 depending on their default values. The items in the list are separated by
35439 commas or newlines.
35440 If a comma is required in an item, the entire item must be enclosed in double
35441 quotes.
35442 </para>
35443 <para>
35444 Lines starting with a # character are comments, and are ignored, and # may
35445 also appear following a comma, in which case everything between the # and the
35446 next newline character is ignored.
35447 </para>
35448 <para>
35449 If an item is entirely enclosed in double quotes, these are removed. Otherwise
35450 double quotes are retained because some forms of mail address require their use
35451 (but never to enclose the entire address). In the following description,
35452 <quote>item</quote> refers to what remains after any surrounding double quotes have been
35453 removed.
35454 </para>
35455 <para>
35456 <indexterm role="variable">
35457 <primary><varname>$local_part</varname></primary>
35458 </indexterm>
35459 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
35460 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
35461 of the <option>quote_local_part</option> expansion operator, in case the local part contains
35462 special characters. For example, to redirect all mail for the domain
35463 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
35464 setting:
35465 </para>
35466 <literallayout class="monospaced">
35467 data = ${quote_local_part:$local_part}@newdomain.example
35468 </literallayout>
35469 </section>
35470 <section id="SECTredlocmai">
35471 <title>Redirecting to a local mailbox</title>
35472 <para>
35473 <indexterm role="concept">
35474 <primary>routing</primary>
35475 <secondary>loops in</secondary>
35476 </indexterm>
35477 <indexterm role="concept">
35478 <primary>loop</primary>
35479 <secondary>while routing, avoidance of</secondary>
35480 </indexterm>
35481 <indexterm role="concept">
35482 <primary>address redirection</primary>
35483 <secondary>to local mailbox</secondary>
35484 </indexterm>
35485 A redirection item may safely be the same as the address currently under
35486 consideration. This does not cause a routing loop, because a router is
35487 automatically skipped if any ancestor of the address that is being processed
35488 is the same as the current address and was processed by the current router.
35489 Such an address is therefore passed to the following routers, so it is handled
35490 as if there were no redirection. When making this loop-avoidance test, the
35491 complete local part, including any prefix or suffix, is used.
35492 </para>
35493 <para>
35494 <indexterm role="concept">
35495 <primary>address redirection</primary>
35496 <secondary>local part without domain</secondary>
35497 </indexterm>
35498 Specifying the same local part without a domain is a common usage in personal
35499 filter files when the user wants to have messages delivered to the local
35500 mailbox and also forwarded elsewhere. For example, the user whose login is
35501 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
35502 </para>
35503 <literallayout class="monospaced">
35504 cleo, cleopatra@egypt.example
35505 </literallayout>
35506 <para>
35507 <indexterm role="concept">
35508 <primary>backslash in alias file</primary>
35509 </indexterm>
35510 <indexterm role="concept">
35511 <primary>alias file</primary>
35512 <secondary>backslash in</secondary>
35513 </indexterm>
35514 For compatibility with other MTAs, such unqualified local parts may be
35515 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
35516 it does make a difference if more than one domain is being handled
35517 synonymously.
35518 </para>
35519 <para>
35520 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
35521 2822 address that does not include a domain, the item is qualified using the
35522 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
35523 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
35524 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
35525 </para>
35526 <para>
35527 Care must be taken if there are alias names for local users.
35528 Consider an MTA handling a single local domain where the system alias file
35529 contains:
35530 </para>
35531 <literallayout class="monospaced">
35532 Sam.Reman: spqr
35533 </literallayout>
35534 <para>
35535 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
35536 messages in the local mailbox, and also forward copies elsewhere. He creates
35537 this forward file:
35538 </para>
35539 <literallayout class="monospaced">
35540 Sam.Reman, spqr@reme.elsewhere.example
35541 </literallayout>
35542 <para>
35543 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
35544 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
35545 second time round, because it has previously routed it,
35546 and the following routers presumably cannot handle the alias. The forward file
35547 should really contain
35548 </para>
35549 <literallayout class="monospaced">
35550 spqr, spqr@reme.elsewhere.example
35551 </literallayout>
35552 <para>
35553 but because this is such a common error, the <option>check_ancestor</option> option (see
35554 below) exists to provide a way to get round it. This is normally set on a
35555 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
35556 </para>
35557 </section>
35558 <section id="SECTspecitredli">
35559 <title>Special items in redirection lists</title>
35560 <para>
35561 In addition to addresses, the following types of item may appear in redirection
35562 lists (that is, in non-filter redirection data):
35563 </para>
35564 <itemizedlist>
35565 <listitem>
35566 <para>
35567 <indexterm role="concept">
35568 <primary>pipe</primary>
35569 <secondary>in redirection list</secondary>
35570 </indexterm>
35571 <indexterm role="concept">
35572 <primary>address redirection</primary>
35573 <secondary>to pipe</secondary>
35574 </indexterm>
35575 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
35576 as a valid RFC 2822 address that includes a domain. A transport for running the
35577 command must be specified by the <option>pipe_transport</option> option.
35578 Normally, either the router or the transport specifies a user and a group under
35579 which to run the delivery. The default is to use the Exim user and group.
35580 </para>
35581 <para>
35582 Single or double quotes can be used for enclosing the individual arguments of
35583 the pipe command; no interpretation of escapes is done for single quotes. If
35584 the command contains a comma character, it is necessary to put the whole item
35585 in double quotes, for example:
35586 </para>
35587 <literallayout class="monospaced">
35588 "|/some/command ready,steady,go"
35589 </literallayout>
35590 <para>
35591 since items in redirection lists are terminated by commas. Do not, however,
35592 quote just the command. An item such as
35593 </para>
35594 <literallayout class="monospaced">
35595 |"/some/command ready,steady,go"
35596 </literallayout>
35597 <para>
35598 is interpreted as a pipe with a rather strange command name, and no arguments.
35599 </para>
35600 <para>
35601 Note that the above example assumes that the text comes from a lookup source
35602 of some sort, so that the quotes are part of the data.  If composing a
35603 redirect router with a <option>data</option> option directly specifying this command, the
35604 quotes will be used by the configuration parser to define the extent of one
35605 string, but will not be passed down into the redirect router itself.  There
35606 are two main approaches to get around this: escape quotes to be part of the
35607 data itself, or avoid using this mechanism and instead create a custom
35608 transport with the <option>command</option> option set and reference that transport from
35609 an <option>accept</option> router.
35610 </para>
35611 </listitem>
35612 <listitem>
35613 <para>
35614 <indexterm role="concept">
35615 <primary>file</primary>
35616 <secondary>in redirection list</secondary>
35617 </indexterm>
35618 <indexterm role="concept">
35619 <primary>address redirection</primary>
35620 <secondary>to file</secondary>
35621 </indexterm>
35622 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
35623 parse as a valid RFC 2822 address that includes a domain. For example,
35624 </para>
35625 <literallayout class="monospaced">
35626 /home/world/minbari
35627 </literallayout>
35628 <para>
35629 is treated as a file name, but
35630 </para>
35631 <literallayout class="monospaced">
35632 /s=molari/o=babylon/@x400gate.way
35633 </literallayout>
35634 <para>
35635 is treated as an address. For a file name, a transport must be specified using
35636 the <option>file_transport</option> option. However, if the generated path name ends with a
35637 forward slash character, it is interpreted as a directory name rather than a
35638 file name, and <option>directory_transport</option> is used instead.
35639 </para>
35640 <para>
35641 Normally, either the router or the transport specifies a user and a group under
35642 which to run the delivery. The default is to use the Exim user and group.
35643 </para>
35644 <para>
35645 <indexterm role="concept">
35646 <primary><filename>/dev/null</filename></primary>
35647 </indexterm>
35648 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
35649 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
35650 instead of a transport name. In this case the user and group are not used.
35651 </para>
35652 </listitem>
35653 <listitem>
35654 <para>
35655 <indexterm role="concept">
35656 <primary>included address list</primary>
35657 </indexterm>
35658 <indexterm role="concept">
35659 <primary>address redirection</primary>
35660 <secondary>included external list</secondary>
35661 </indexterm>
35662 If an item is of the form
35663 </para>
35664 <literallayout class="monospaced">
35665 :include:&lt;path name&gt;
35666 </literallayout>
35667 <para>
35668 a list of further items is taken from the given file and included at that
35669 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
35670 out-of-line addition to the list. The items in the included list are separated
35671 by commas or newlines and are not subject to expansion. If this is the first
35672 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
35673 the alias name. This example is incorrect:
35674 </para>
35675 <literallayout class="monospaced">
35676 list1    :include:/opt/lists/list1
35677 </literallayout>
35678 <para>
35679 It must be given as
35680 </para>
35681 <literallayout class="monospaced">
35682 list1:   :include:/opt/lists/list1
35683 </literallayout>
35684 </listitem>
35685 <listitem>
35686 <para>
35687 <indexterm role="concept">
35688 <primary>address redirection</primary>
35689 <secondary>to black hole</secondary>
35690 </indexterm>
35691 Sometimes you want to throw away mail to a particular local part. Making the
35692 <option>data</option> option expand to an empty string does not work, because that causes
35693 the router to decline. Instead, the alias item
35694 <indexterm role="concept">
35695 <primary>black hole</primary>
35696 </indexterm>
35697 <indexterm role="concept">
35698 <primary>abandoning mail</primary>
35699 </indexterm>
35700 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
35701 done, and no error message is generated. This has the same effect as specifing
35702 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
35703 </para>
35704 <para>
35705 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
35706 delivery is done for the original local part, even if other redirection items
35707 are present. If you are generating a multi-item list (for example, by reading a
35708 database) and need the ability to provide a no-op item, you must use
35709 <filename>/dev/null</filename>.
35710 </para>
35711 </listitem>
35712 <listitem>
35713 <para>
35714 <indexterm role="concept">
35715 <primary>delivery</primary>
35716 <secondary>forcing failure</secondary>
35717 </indexterm>
35718 <indexterm role="concept">
35719 <primary>delivery</primary>
35720 <secondary>forcing deferral</secondary>
35721 </indexterm>
35722 <indexterm role="concept">
35723 <primary>failing delivery</primary>
35724 <secondary>forcing</secondary>
35725 </indexterm>
35726 <indexterm role="concept">
35727 <primary>deferred delivery, forcing</primary>
35728 </indexterm>
35729 <indexterm role="concept">
35730 <primary>customizing</primary>
35731 <secondary>failure message</secondary>
35732 </indexterm>
35733 An attempt to deliver a particular address can be deferred or forced to fail by
35734 redirection items of the form
35735 </para>
35736 <literallayout class="monospaced">
35737 :defer:
35738 :fail:
35739 </literallayout>
35740 <para>
35741 respectively. When a redirection list contains such an item, it applies
35742 to the entire redirection; any other items in the list are ignored. Any
35743 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
35744 associated with the failure. For example, an alias file might contain:
35745 </para>
35746 <literallayout class="monospaced">
35747 X.Employee:  :fail: Gone away, no forwarding address
35748 </literallayout>
35749 <para>
35750 In the case of an address that is being verified from an ACL or as the subject
35751 of a
35752 <indexterm role="concept">
35753 <primary>VRFY</primary>
35754 <secondary>error text, display of</secondary>
35755 </indexterm>
35756 VRFY command, the text is included in the SMTP error response by
35757 default.
35758 <indexterm role="concept">
35759 <primary>EXPN</primary>
35760 <secondary>error text, display of</secondary>
35761 </indexterm>
35762 The text is not included in the response to an EXPN command. In non-SMTP cases
35763 the text is included in the error message that Exim generates.
35764 </para>
35765 <para>
35766 <indexterm role="concept">
35767 <primary>SMTP</primary>
35768 <secondary>error codes</secondary>
35769 </indexterm>
35770 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
35771 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
35772 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
35773 followed by a space, and the very first digit is the same as the default error
35774 code, the code from the message is used instead. If the very first digit is
35775 incorrect, a panic error is logged, and the default code is used. You can
35776 suppress the use of the supplied code in a redirect router by setting the
35777 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
35778 ignored.
35779 </para>
35780 <para>
35781 <indexterm role="variable">
35782 <primary><varname>$acl_verify_message</varname></primary>
35783 </indexterm>
35784 In an ACL, an explicitly provided message overrides the default, but the
35785 default message is available in the variable <varname>$acl_verify_message</varname> and can
35786 therefore be included in a custom message if this is desired.
35787 </para>
35788 <para>
35789 Normally the error text is the rest of the redirection list &ndash; a comma does
35790 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
35791 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
35792 as part of the continuation process, but they may exist in other kinds of
35793 lookup and in <emphasis>:include:</emphasis> files.
35794 </para>
35795 <para>
35796 During routing for message delivery (as opposed to verification), a redirection
35797 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
35798 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
35799 subsequent delivery attempt can happen at a later time. If an address is
35800 deferred for too long, it will ultimately fail, because the normal retry
35801 rules still apply.
35802 </para>
35803 </listitem>
35804 <listitem>
35805 <para>
35806 <indexterm role="concept">
35807 <primary>alias file</primary>
35808 <secondary>exception to default</secondary>
35809 </indexterm>
35810 Sometimes it is useful to use a single-key search type with a default (see
35811 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
35812 for exceptions to the default. These can be handled by aliasing them to
35813 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
35814 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
35815 results in an empty redirection list has the same effect.
35816 </para>
35817 </listitem>
35818 </itemizedlist>
35819 </section>
35820 <section id="SECTdupaddr">
35821 <title>Duplicate addresses</title>
35822 <para>
35823 <indexterm role="concept">
35824 <primary>duplicate addresses</primary>
35825 </indexterm>
35826 <indexterm role="concept">
35827 <primary>address duplicate, discarding</primary>
35828 </indexterm>
35829 <indexterm role="concept">
35830 <primary>pipe</primary>
35831 <secondary>duplicated</secondary>
35832 </indexterm>
35833 Exim removes duplicate addresses from the list to which it is delivering, so as
35834 to deliver just one copy to each address. This does not apply to deliveries
35835 routed to pipes by different immediate parent addresses, but an indirect
35836 aliasing scheme of the type
35837 </para>
35838 <literallayout class="monospaced">
35839 pipe:       |/some/command $local_part
35840 localpart1: pipe
35841 localpart2: pipe
35842 </literallayout>
35843 <para>
35844 does not work with a message that is addressed to both local parts, because
35845 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
35846 discarded as being the same as a previously handled address. However, a scheme
35847 such as
35848 </para>
35849 <literallayout class="monospaced">
35850 localpart1: |/some/command $local_part
35851 localpart2: |/some/command $local_part
35852 </literallayout>
35853 <para>
35854 does result in two different pipe deliveries, because the immediate parents of
35855 the pipes are distinct.
35856 </para>
35857 </section>
35858 <section id="SECID128">
35859 <title>Repeated redirection expansion</title>
35860 <para>
35861 <indexterm role="concept">
35862 <primary>repeated redirection expansion</primary>
35863 </indexterm>
35864 <indexterm role="concept">
35865 <primary>address redirection</primary>
35866 <secondary>repeated for each delivery attempt</secondary>
35867 </indexterm>
35868 When a message cannot be delivered to all of its recipients immediately,
35869 leading to two or more delivery attempts, redirection expansion is carried out
35870 afresh each time for those addresses whose children were not all previously
35871 delivered. If redirection is being used as a mailing list, this can lead to new
35872 members of the list receiving copies of old messages. The <option>one_time</option> option
35873 can be used to avoid this.
35874 </para>
35875 </section>
35876 <section id="SECID129">
35877 <title>Errors in redirection lists</title>
35878 <para>
35879 <indexterm role="concept">
35880 <primary>address redirection</primary>
35881 <secondary>errors</secondary>
35882 </indexterm>
35883 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
35884 error is skipped, and an entry is written to the main log. This may be useful
35885 for mailing lists that are automatically managed. Otherwise, if an error is
35886 detected while generating the list of new addresses, the original address is
35887 deferred. See also <option>syntax_errors_to</option>.
35888 </para>
35889 </section>
35890 <section id="SECID130">
35891 <title>Private options for the redirect router</title>
35892 <para>
35893 <indexterm role="concept">
35894 <primary>options</primary>
35895 <secondary><command>redirect</command> router</secondary>
35896 </indexterm>
35897 The private options for the <command>redirect</command> router are as follows:
35898 </para>
35899 <para>
35900 <indexterm role="option">
35901 <primary><option>allow_defer</option></primary>
35902 </indexterm>
35903 </para>
35904 <informaltable frame="all">
35905 <tgroup cols="4" colsep="0" rowsep="0">
35906 <colspec colwidth="8*" align="left"/>
35907 <colspec colwidth="6*" align="center"/>
35908 <colspec colwidth="6*" align="center"/>
35909 <colspec colwidth="6*" align="right"/>
35910 <tbody>
35911 <row>
35912 <entry><option>allow_defer</option></entry>
35913 <entry>Use: <emphasis>redirect</emphasis></entry>
35914 <entry>Type: <emphasis>boolean</emphasis></entry>
35915 <entry>Default: <emphasis>false</emphasis></entry>
35916 </row>
35917 </tbody>
35918 </tgroup>
35919 </informaltable>
35920 <para>
35921 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
35922 data, or the <option>defer</option> command in an Exim filter file.
35923 </para>
35924 <para>
35925 <indexterm role="option">
35926 <primary><option>allow_fail</option></primary>
35927 </indexterm>
35928 </para>
35929 <informaltable frame="all">
35930 <tgroup cols="4" colsep="0" rowsep="0">
35931 <colspec colwidth="8*" align="left"/>
35932 <colspec colwidth="6*" align="center"/>
35933 <colspec colwidth="6*" align="center"/>
35934 <colspec colwidth="6*" align="right"/>
35935 <tbody>
35936 <row>
35937 <entry><option>allow_fail</option></entry>
35938 <entry>Use: <emphasis>redirect</emphasis></entry>
35939 <entry>Type: <emphasis>boolean</emphasis></entry>
35940 <entry>Default: <emphasis>false</emphasis></entry>
35941 </row>
35942 </tbody>
35943 </tgroup>
35944 </informaltable>
35945 <para>
35946 <indexterm role="concept">
35947 <primary>failing delivery</primary>
35948 <secondary>from filter</secondary>
35949 </indexterm>
35950 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
35951 and the <option>fail</option> command may be used in an Exim filter file.
35952 </para>
35953 <para>
35954 <indexterm role="option">
35955 <primary><option>allow_filter</option></primary>
35956 </indexterm>
35957 </para>
35958 <informaltable frame="all">
35959 <tgroup cols="4" colsep="0" rowsep="0">
35960 <colspec colwidth="8*" align="left"/>
35961 <colspec colwidth="6*" align="center"/>
35962 <colspec colwidth="6*" align="center"/>
35963 <colspec colwidth="6*" align="right"/>
35964 <tbody>
35965 <row>
35966 <entry><option>allow_filter</option></entry>
35967 <entry>Use: <emphasis>redirect</emphasis></entry>
35968 <entry>Type: <emphasis>boolean</emphasis></entry>
35969 <entry>Default: <emphasis>false</emphasis></entry>
35970 </row>
35971 </tbody>
35972 </tgroup>
35973 </informaltable>
35974 <para>
35975 <indexterm role="concept">
35976 <primary>filter</primary>
35977 <secondary>enabling use of</secondary>
35978 </indexterm>
35979 <indexterm role="concept">
35980 <primary>Sieve filter</primary>
35981 <secondary>enabling use of</secondary>
35982 </indexterm>
35983 Setting this option allows Exim to interpret redirection data that starts with
35984 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
35985 are some features of Exim filter files that some administrators may wish to
35986 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
35987 </para>
35988 <para>
35989 It is also possible to lock out Exim filters or Sieve filters while allowing
35990 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
35991 </para>
35992 <para>
35993 The filter is run using the uid and gid set by the generic <option>user</option> and
35994 <option>group</option> options. These take their defaults from the password data if
35995 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
35996 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
35997 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
35998 </para>
35999 <para>
36000 <indexterm role="option">
36001 <primary><option>allow_freeze</option></primary>
36002 </indexterm>
36003 </para>
36004 <informaltable frame="all">
36005 <tgroup cols="4" colsep="0" rowsep="0">
36006 <colspec colwidth="8*" align="left"/>
36007 <colspec colwidth="6*" align="center"/>
36008 <colspec colwidth="6*" align="center"/>
36009 <colspec colwidth="6*" align="right"/>
36010 <tbody>
36011 <row>
36012 <entry><option>allow_freeze</option></entry>
36013 <entry>Use: <emphasis>redirect</emphasis></entry>
36014 <entry>Type: <emphasis>boolean</emphasis></entry>
36015 <entry>Default: <emphasis>false</emphasis></entry>
36016 </row>
36017 </tbody>
36018 </tgroup>
36019 </informaltable>
36020 <para>
36021 <indexterm role="concept">
36022 <primary>freezing messages</primary>
36023 <secondary>allowing in filter</secondary>
36024 </indexterm>
36025 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
36026 This command is more normally encountered in system filters, and is disabled by
36027 default for redirection filters because it isn&#x2019;t something you usually want to
36028 let ordinary users do.
36029 </para>
36030 <para>
36031 <indexterm role="option">
36032 <primary><option>check_ancestor</option></primary>
36033 </indexterm>
36034 </para>
36035 <informaltable frame="all">
36036 <tgroup cols="4" colsep="0" rowsep="0">
36037 <colspec colwidth="8*" align="left"/>
36038 <colspec colwidth="6*" align="center"/>
36039 <colspec colwidth="6*" align="center"/>
36040 <colspec colwidth="6*" align="right"/>
36041 <tbody>
36042 <row>
36043 <entry><option>check_ancestor</option></entry>
36044 <entry>Use: <emphasis>redirect</emphasis></entry>
36045 <entry>Type: <emphasis>boolean</emphasis></entry>
36046 <entry>Default: <emphasis>false</emphasis></entry>
36047 </row>
36048 </tbody>
36049 </tgroup>
36050 </informaltable>
36051 <para>
36052 This option is concerned with handling generated addresses that are the same
36053 as some address in the list of redirection ancestors of the current address.
36054 Although it is turned off by default in the code, it is set in the default
36055 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
36056 for this use of the <command>redirect</command> router.
36057 </para>
36058 <para>
36059 When <option>check_ancestor</option> is set, if a generated address (including the domain)
36060 is the same as any ancestor of the current address, it is replaced by a copy of
36061 the current address. This helps in the case where local part A is aliased to B,
36062 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
36063 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
36064 <filename>&nbsp;jb/.forward</filename> contains:
36065 </para>
36066 <literallayout class="monospaced">
36067 \Joe.Bloggs, &lt;other item(s)&gt;
36068 </literallayout>
36069 <para>
36070 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
36071 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
36072 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
36073 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
36074 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
36075 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
36076 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
36077 original address. See also the <option>repeat_use</option> option below.
36078 </para>
36079 <para>
36080 <indexterm role="option">
36081 <primary><option>check_group</option></primary>
36082 </indexterm>
36083 </para>
36084 <informaltable frame="all">
36085 <tgroup cols="4" colsep="0" rowsep="0">
36086 <colspec colwidth="8*" align="left"/>
36087 <colspec colwidth="6*" align="center"/>
36088 <colspec colwidth="6*" align="center"/>
36089 <colspec colwidth="6*" align="right"/>
36090 <tbody>
36091 <row>
36092 <entry><option>check_group</option></entry>
36093 <entry>Use: <emphasis>redirect</emphasis></entry>
36094 <entry>Type: <emphasis>boolean</emphasis></entry>
36095 <entry>Default: <emphasis>see below</emphasis></entry>
36096 </row>
36097 </tbody>
36098 </tgroup>
36099 </informaltable>
36100 <para>
36101 When the <option>file</option> option is used, the group owner of the file is checked only
36102 when this option is set. The permitted groups are those listed in the
36103 <option>owngroups</option> option, together with the user&#x2019;s default group if
36104 <option>check_local_user</option> is set. If the file has the wrong group, routing is
36105 deferred. The default setting for this option is true if <option>check_local_user</option>
36106 is set and the <option>modemask</option> option permits the group write bit, or if the
36107 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
36108 </para>
36109 <para>
36110 <indexterm role="option">
36111 <primary><option>check_owner</option></primary>
36112 </indexterm>
36113 </para>
36114 <informaltable frame="all">
36115 <tgroup cols="4" colsep="0" rowsep="0">
36116 <colspec colwidth="8*" align="left"/>
36117 <colspec colwidth="6*" align="center"/>
36118 <colspec colwidth="6*" align="center"/>
36119 <colspec colwidth="6*" align="right"/>
36120 <tbody>
36121 <row>
36122 <entry><option>check_owner</option></entry>
36123 <entry>Use: <emphasis>redirect</emphasis></entry>
36124 <entry>Type: <emphasis>boolean</emphasis></entry>
36125 <entry>Default: <emphasis>see below</emphasis></entry>
36126 </row>
36127 </tbody>
36128 </tgroup>
36129 </informaltable>
36130 <para>
36131 When the <option>file</option> option is used, the owner of the file is checked only when
36132 this option is set. If <option>check_local_user</option> is set, the local user is
36133 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
36134 option. The default value for this option is true if <option>check_local_user</option> or
36135 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
36136 </para>
36137 <para>
36138 <indexterm role="option">
36139 <primary><option>data</option></primary>
36140 </indexterm>
36141 </para>
36142 <informaltable frame="all">
36143 <tgroup cols="4" colsep="0" rowsep="0">
36144 <colspec colwidth="8*" align="left"/>
36145 <colspec colwidth="6*" align="center"/>
36146 <colspec colwidth="6*" align="center"/>
36147 <colspec colwidth="6*" align="right"/>
36148 <tbody>
36149 <row>
36150 <entry><option>data</option></entry>
36151 <entry>Use: <emphasis>redirect</emphasis></entry>
36152 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36153 <entry>Default: <emphasis>unset</emphasis></entry>
36154 </row>
36155 </tbody>
36156 </tgroup>
36157 </informaltable>
36158 <para>
36159 This option is mutually exclusive with <option>file</option>. One or other of them must be
36160 set, but not both. The contents of <option>data</option> are expanded, and then used as the
36161 list of forwarding items, or as a set of filtering instructions. If the
36162 expansion is forced to fail, or the result is an empty string or a string that
36163 has no effect (consists entirely of comments), the router declines.
36164 </para>
36165 <para>
36166 When filtering instructions are used, the string must begin with <quote>#Exim
36167 filter</quote>, and all comments in the string, including this initial one, must be
36168 terminated with newline characters. For example:
36169 </para>
36170 <literallayout class="monospaced">
36171 data = #Exim filter\n\
36172        if $h_to: contains Exim then save $home/mail/exim endif
36173 </literallayout>
36174 <para>
36175 If you are reading the data from a database where newlines cannot be included,
36176 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
36177 choice into a newline.
36178 </para>
36179 <para>
36180 <indexterm role="option">
36181 <primary><option>directory_transport</option></primary>
36182 </indexterm>
36183 </para>
36184 <informaltable frame="all">
36185 <tgroup cols="4" colsep="0" rowsep="0">
36186 <colspec colwidth="8*" align="left"/>
36187 <colspec colwidth="6*" align="center"/>
36188 <colspec colwidth="6*" align="center"/>
36189 <colspec colwidth="6*" align="right"/>
36190 <tbody>
36191 <row>
36192 <entry><option>directory_transport</option></entry>
36193 <entry>Use: <emphasis>redirect</emphasis></entry>
36194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36195 <entry>Default: <emphasis>unset</emphasis></entry>
36196 </row>
36197 </tbody>
36198 </tgroup>
36199 </informaltable>
36200 <para>
36201 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
36202 ending with a slash is specified as a new <quote>address</quote>. The transport used is
36203 specified by this option, which, after expansion, must be the name of a
36204 configured transport. This should normally be an <command>appendfile</command> transport.
36205 </para>
36206 <para>
36207 <indexterm role="option">
36208 <primary><option>file</option></primary>
36209 </indexterm>
36210 </para>
36211 <informaltable frame="all">
36212 <tgroup cols="4" colsep="0" rowsep="0">
36213 <colspec colwidth="8*" align="left"/>
36214 <colspec colwidth="6*" align="center"/>
36215 <colspec colwidth="6*" align="center"/>
36216 <colspec colwidth="6*" align="right"/>
36217 <tbody>
36218 <row>
36219 <entry><option>file</option></entry>
36220 <entry>Use: <emphasis>redirect</emphasis></entry>
36221 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36222 <entry>Default: <emphasis>unset</emphasis></entry>
36223 </row>
36224 </tbody>
36225 </tgroup>
36226 </informaltable>
36227 <para>
36228 This option specifies the name of a file that contains the redirection data. It
36229 is mutually exclusive with the <option>data</option> option. The string is expanded before
36230 use; if the expansion is forced to fail, the router declines. Other expansion
36231 failures cause delivery to be deferred. The result of a successful expansion
36232 must be an absolute path. The entire file is read and used as the redirection
36233 data. If the data is an empty string or a string that has no effect (consists
36234 entirely of comments), the router declines.
36235 </para>
36236 <para>
36237 <indexterm role="concept">
36238 <primary>NFS</primary>
36239 <secondary>checking for file existence</secondary>
36240 </indexterm>
36241 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
36242 runs a check on the containing directory,
36243 unless <option>ignore_enotdir</option> is true (see below).
36244 If the directory does not appear to exist, delivery is deferred. This can
36245 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
36246 is a mount problem. If the containing directory does exist, but the file does
36247 not, the router declines.
36248 </para>
36249 <para>
36250 <indexterm role="option">
36251 <primary><option>file_transport</option></primary>
36252 </indexterm>
36253 </para>
36254 <informaltable frame="all">
36255 <tgroup cols="4" colsep="0" rowsep="0">
36256 <colspec colwidth="8*" align="left"/>
36257 <colspec colwidth="6*" align="center"/>
36258 <colspec colwidth="6*" align="center"/>
36259 <colspec colwidth="6*" align="right"/>
36260 <tbody>
36261 <row>
36262 <entry><option>file_transport</option></entry>
36263 <entry>Use: <emphasis>redirect</emphasis></entry>
36264 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36265 <entry>Default: <emphasis>unset</emphasis></entry>
36266 </row>
36267 </tbody>
36268 </tgroup>
36269 </informaltable>
36270 <para>
36271 <indexterm role="variable">
36272 <primary><varname>$address_file</varname></primary>
36273 </indexterm>
36274 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
36275 ending in a slash is specified as a new <quote>address</quote>. The transport used is
36276 specified by this option, which, after expansion, must be the name of a
36277 configured transport. This should normally be an <command>appendfile</command> transport. When
36278 it is running, the file name is in <varname>$address_file</varname>.
36279 </para>
36280 <para>
36281 <indexterm role="option">
36282 <primary><option>filter_prepend_home</option></primary>
36283 </indexterm>
36284 </para>
36285 <informaltable frame="all">
36286 <tgroup cols="4" colsep="0" rowsep="0">
36287 <colspec colwidth="8*" align="left"/>
36288 <colspec colwidth="6*" align="center"/>
36289 <colspec colwidth="6*" align="center"/>
36290 <colspec colwidth="6*" align="right"/>
36291 <tbody>
36292 <row>
36293 <entry><option>filter_prepend_home</option></entry>
36294 <entry>Use: <emphasis>redirect</emphasis></entry>
36295 <entry>Type: <emphasis>boolean</emphasis></entry>
36296 <entry>Default: <emphasis>true</emphasis></entry>
36297 </row>
36298 </tbody>
36299 </tgroup>
36300 </informaltable>
36301 <para>
36302 When this option is true, if a <command>save</command> command in an Exim filter specifies a
36303 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
36304 relative path. If this option is set false, this action does not happen. The
36305 relative path is then passed to the transport unmodified.
36306 </para>
36307 <para>
36308 <indexterm role="option">
36309 <primary><option>forbid_blackhole</option></primary>
36310 </indexterm>
36311 </para>
36312 <informaltable frame="all">
36313 <tgroup cols="4" colsep="0" rowsep="0">
36314 <colspec colwidth="8*" align="left"/>
36315 <colspec colwidth="6*" align="center"/>
36316 <colspec colwidth="6*" align="center"/>
36317 <colspec colwidth="6*" align="right"/>
36318 <tbody>
36319 <row>
36320 <entry><option>forbid_blackhole</option></entry>
36321 <entry>Use: <emphasis>redirect</emphasis></entry>
36322 <entry>Type: <emphasis>boolean</emphasis></entry>
36323 <entry>Default: <emphasis>false</emphasis></entry>
36324 </row>
36325 </tbody>
36326 </tgroup>
36327 </informaltable>
36328 <para>
36329 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
36330 redirection list.
36331 </para>
36332 <para>
36333 <indexterm role="option">
36334 <primary><option>forbid_exim_filter</option></primary>
36335 </indexterm>
36336 </para>
36337 <informaltable frame="all">
36338 <tgroup cols="4" colsep="0" rowsep="0">
36339 <colspec colwidth="8*" align="left"/>
36340 <colspec colwidth="6*" align="center"/>
36341 <colspec colwidth="6*" align="center"/>
36342 <colspec colwidth="6*" align="right"/>
36343 <tbody>
36344 <row>
36345 <entry><option>forbid_exim_filter</option></entry>
36346 <entry>Use: <emphasis>redirect</emphasis></entry>
36347 <entry>Type: <emphasis>boolean</emphasis></entry>
36348 <entry>Default: <emphasis>false</emphasis></entry>
36349 </row>
36350 </tbody>
36351 </tgroup>
36352 </informaltable>
36353 <para>
36354 If this option is set true, only Sieve filters are permitted when
36355 <option>allow_filter</option> is true.
36356 </para>
36357 <para>
36358 <indexterm role="option">
36359 <primary><option>forbid_file</option></primary>
36360 </indexterm>
36361 </para>
36362 <informaltable frame="all">
36363 <tgroup cols="4" colsep="0" rowsep="0">
36364 <colspec colwidth="8*" align="left"/>
36365 <colspec colwidth="6*" align="center"/>
36366 <colspec colwidth="6*" align="center"/>
36367 <colspec colwidth="6*" align="right"/>
36368 <tbody>
36369 <row>
36370 <entry><option>forbid_file</option></entry>
36371 <entry>Use: <emphasis>redirect</emphasis></entry>
36372 <entry>Type: <emphasis>boolean</emphasis></entry>
36373 <entry>Default: <emphasis>false</emphasis></entry>
36374 </row>
36375 </tbody>
36376 </tgroup>
36377 </informaltable>
36378 <para>
36379 <indexterm role="concept">
36380 <primary>delivery</primary>
36381 <secondary>to file; forbidding</secondary>
36382 </indexterm>
36383 <indexterm role="concept">
36384 <primary>Sieve filter</primary>
36385 <secondary>forbidding delivery to a file</secondary>
36386 </indexterm>
36387 <indexterm role="concept">
36388 <primary>Sieve filter</primary>
36389 <secondary><quote>keep</quote> facility; disabling</secondary>
36390 </indexterm>
36391 If this option is true, this router may not generate a new address that
36392 specifies delivery to a local file or directory, either from a filter or from a
36393 conventional forward file. This option is forced to be true if <option>one_time</option> is
36394 set. It applies to Sieve filters as well as to Exim filters, but if true, it
36395 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
36396 </para>
36397 <para>
36398 <indexterm role="option">
36399 <primary><option>forbid_filter_dlfunc</option></primary>
36400 </indexterm>
36401 </para>
36402 <informaltable frame="all">
36403 <tgroup cols="4" colsep="0" rowsep="0">
36404 <colspec colwidth="8*" align="left"/>
36405 <colspec colwidth="6*" align="center"/>
36406 <colspec colwidth="6*" align="center"/>
36407 <colspec colwidth="6*" align="right"/>
36408 <tbody>
36409 <row>
36410 <entry><option>forbid_filter_dlfunc</option></entry>
36411 <entry>Use: <emphasis>redirect</emphasis></entry>
36412 <entry>Type: <emphasis>boolean</emphasis></entry>
36413 <entry>Default: <emphasis>false</emphasis></entry>
36414 </row>
36415 </tbody>
36416 </tgroup>
36417 </informaltable>
36418 <para>
36419 <indexterm role="concept">
36420 <primary>filter</primary>
36421 <secondary>locking out certain features</secondary>
36422 </indexterm>
36423 If this option is true, string expansions in Exim filters are not allowed to
36424 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
36425 functions.
36426 </para>
36427 <para>
36428 <indexterm role="option">
36429 <primary><option>forbid_filter_existstest</option></primary>
36430 </indexterm>
36431 </para>
36432 <informaltable frame="all">
36433 <tgroup cols="4" colsep="0" rowsep="0">
36434 <colspec colwidth="8*" align="left"/>
36435 <colspec colwidth="6*" align="center"/>
36436 <colspec colwidth="6*" align="center"/>
36437 <colspec colwidth="6*" align="right"/>
36438 <tbody>
36439 <row>
36440 <entry><option>forbid_filter_existstest</option></entry>
36441 <entry>Use: <emphasis>redirect</emphasis></entry>
36442 <entry>Type: <emphasis>boolean</emphasis></entry>
36443 <entry>Default: <emphasis>false</emphasis></entry>
36444 </row>
36445 </tbody>
36446 </tgroup>
36447 </informaltable>
36448 <para>
36449 <indexterm role="concept">
36450 <primary>expansion</primary>
36451 <secondary>statting a file</secondary>
36452 </indexterm>
36453 If this option is true, string expansions in Exim filters are not allowed to
36454 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
36455 </para>
36456 <para>
36457 <indexterm role="option">
36458 <primary><option>forbid_filter_logwrite</option></primary>
36459 </indexterm>
36460 </para>
36461 <informaltable frame="all">
36462 <tgroup cols="4" colsep="0" rowsep="0">
36463 <colspec colwidth="8*" align="left"/>
36464 <colspec colwidth="6*" align="center"/>
36465 <colspec colwidth="6*" align="center"/>
36466 <colspec colwidth="6*" align="right"/>
36467 <tbody>
36468 <row>
36469 <entry><option>forbid_filter_logwrite</option></entry>
36470 <entry>Use: <emphasis>redirect</emphasis></entry>
36471 <entry>Type: <emphasis>boolean</emphasis></entry>
36472 <entry>Default: <emphasis>false</emphasis></entry>
36473 </row>
36474 </tbody>
36475 </tgroup>
36476 </informaltable>
36477 <para>
36478 If this option is true, use of the logging facility in Exim filters is not
36479 permitted. Logging is in any case available only if the filter is being run
36480 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
36481 <filename>.forward</filename> files).
36482 </para>
36483 <para>
36484 <indexterm role="option">
36485 <primary><option>forbid_filter_lookup</option></primary>
36486 </indexterm>
36487 </para>
36488 <informaltable frame="all">
36489 <tgroup cols="4" colsep="0" rowsep="0">
36490 <colspec colwidth="8*" align="left"/>
36491 <colspec colwidth="6*" align="center"/>
36492 <colspec colwidth="6*" align="center"/>
36493 <colspec colwidth="6*" align="right"/>
36494 <tbody>
36495 <row>
36496 <entry><option>forbid_filter_lookup</option></entry>
36497 <entry>Use: <emphasis>redirect</emphasis></entry>
36498 <entry>Type: <emphasis>boolean</emphasis></entry>
36499 <entry>Default: <emphasis>false</emphasis></entry>
36500 </row>
36501 </tbody>
36502 </tgroup>
36503 </informaltable>
36504 <para>
36505 If this option is true, string expansions in Exim filter files are not allowed
36506 to make use of <option>lookup</option> items.
36507 </para>
36508 <para>
36509 <indexterm role="option">
36510 <primary><option>forbid_filter_perl</option></primary>
36511 </indexterm>
36512 </para>
36513 <informaltable frame="all">
36514 <tgroup cols="4" colsep="0" rowsep="0">
36515 <colspec colwidth="8*" align="left"/>
36516 <colspec colwidth="6*" align="center"/>
36517 <colspec colwidth="6*" align="center"/>
36518 <colspec colwidth="6*" align="right"/>
36519 <tbody>
36520 <row>
36521 <entry><option>forbid_filter_perl</option></entry>
36522 <entry>Use: <emphasis>redirect</emphasis></entry>
36523 <entry>Type: <emphasis>boolean</emphasis></entry>
36524 <entry>Default: <emphasis>false</emphasis></entry>
36525 </row>
36526 </tbody>
36527 </tgroup>
36528 </informaltable>
36529 <para>
36530 This option has an effect only if Exim is built with embedded Perl support. If
36531 it is true, string expansions in Exim filter files are not allowed to make use
36532 of the embedded Perl support.
36533 </para>
36534 <para>
36535 <indexterm role="option">
36536 <primary><option>forbid_filter_readfile</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_filter_readfile</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 If this option is true, string expansions in Exim filter files are not allowed
36557 to make use of <option>readfile</option> items.
36558 </para>
36559 <para>
36560 <indexterm role="option">
36561 <primary><option>forbid_filter_readsocket</option></primary>
36562 </indexterm>
36563 </para>
36564 <informaltable frame="all">
36565 <tgroup cols="4" colsep="0" rowsep="0">
36566 <colspec colwidth="8*" align="left"/>
36567 <colspec colwidth="6*" align="center"/>
36568 <colspec colwidth="6*" align="center"/>
36569 <colspec colwidth="6*" align="right"/>
36570 <tbody>
36571 <row>
36572 <entry><option>forbid_filter_readsocket</option></entry>
36573 <entry>Use: <emphasis>redirect</emphasis></entry>
36574 <entry>Type: <emphasis>boolean</emphasis></entry>
36575 <entry>Default: <emphasis>false</emphasis></entry>
36576 </row>
36577 </tbody>
36578 </tgroup>
36579 </informaltable>
36580 <para>
36581 If this option is true, string expansions in Exim filter files are not allowed
36582 to make use of <option>readsocket</option> items.
36583 </para>
36584 <para>
36585 <indexterm role="option">
36586 <primary><option>forbid_filter_reply</option></primary>
36587 </indexterm>
36588 </para>
36589 <informaltable frame="all">
36590 <tgroup cols="4" colsep="0" rowsep="0">
36591 <colspec colwidth="8*" align="left"/>
36592 <colspec colwidth="6*" align="center"/>
36593 <colspec colwidth="6*" align="center"/>
36594 <colspec colwidth="6*" align="right"/>
36595 <tbody>
36596 <row>
36597 <entry><option>forbid_filter_reply</option></entry>
36598 <entry>Use: <emphasis>redirect</emphasis></entry>
36599 <entry>Type: <emphasis>boolean</emphasis></entry>
36600 <entry>Default: <emphasis>false</emphasis></entry>
36601 </row>
36602 </tbody>
36603 </tgroup>
36604 </informaltable>
36605 <para>
36606 If this option is true, this router may not generate an automatic reply
36607 message. Automatic replies can be generated only from Exim or Sieve filter
36608 files, not from traditional forward files. This option is forced to be true if
36609 <option>one_time</option> is set.
36610 </para>
36611 <para>
36612 <indexterm role="option">
36613 <primary><option>forbid_filter_run</option></primary>
36614 </indexterm>
36615 </para>
36616 <informaltable frame="all">
36617 <tgroup cols="4" colsep="0" rowsep="0">
36618 <colspec colwidth="8*" align="left"/>
36619 <colspec colwidth="6*" align="center"/>
36620 <colspec colwidth="6*" align="center"/>
36621 <colspec colwidth="6*" align="right"/>
36622 <tbody>
36623 <row>
36624 <entry><option>forbid_filter_run</option></entry>
36625 <entry>Use: <emphasis>redirect</emphasis></entry>
36626 <entry>Type: <emphasis>boolean</emphasis></entry>
36627 <entry>Default: <emphasis>false</emphasis></entry>
36628 </row>
36629 </tbody>
36630 </tgroup>
36631 </informaltable>
36632 <para>
36633 If this option is true, string expansions in Exim filter files are not allowed
36634 to make use of <option>run</option> items.
36635 </para>
36636 <para>
36637 <indexterm role="option">
36638 <primary><option>forbid_include</option></primary>
36639 </indexterm>
36640 </para>
36641 <informaltable frame="all">
36642 <tgroup cols="4" colsep="0" rowsep="0">
36643 <colspec colwidth="8*" align="left"/>
36644 <colspec colwidth="6*" align="center"/>
36645 <colspec colwidth="6*" align="center"/>
36646 <colspec colwidth="6*" align="right"/>
36647 <tbody>
36648 <row>
36649 <entry><option>forbid_include</option></entry>
36650 <entry>Use: <emphasis>redirect</emphasis></entry>
36651 <entry>Type: <emphasis>boolean</emphasis></entry>
36652 <entry>Default: <emphasis>false</emphasis></entry>
36653 </row>
36654 </tbody>
36655 </tgroup>
36656 </informaltable>
36657 <para>
36658 If this option is true, items of the form
36659 </para>
36660 <literallayout class="monospaced">
36661 :include:&lt;path name&gt;
36662 </literallayout>
36663 <para>
36664 are not permitted in non-filter redirection lists.
36665 </para>
36666 <para>
36667 <indexterm role="option">
36668 <primary><option>forbid_pipe</option></primary>
36669 </indexterm>
36670 </para>
36671 <informaltable frame="all">
36672 <tgroup cols="4" colsep="0" rowsep="0">
36673 <colspec colwidth="8*" align="left"/>
36674 <colspec colwidth="6*" align="center"/>
36675 <colspec colwidth="6*" align="center"/>
36676 <colspec colwidth="6*" align="right"/>
36677 <tbody>
36678 <row>
36679 <entry><option>forbid_pipe</option></entry>
36680 <entry>Use: <emphasis>redirect</emphasis></entry>
36681 <entry>Type: <emphasis>boolean</emphasis></entry>
36682 <entry>Default: <emphasis>false</emphasis></entry>
36683 </row>
36684 </tbody>
36685 </tgroup>
36686 </informaltable>
36687 <para>
36688 <indexterm role="concept">
36689 <primary>delivery</primary>
36690 <secondary>to pipe; forbidding</secondary>
36691 </indexterm>
36692 If this option is true, this router may not generate a new address which
36693 specifies delivery to a pipe, either from an Exim filter or from a conventional
36694 forward file. This option is forced to be true if <option>one_time</option> is set.
36695 </para>
36696 <para>
36697 <indexterm role="option">
36698 <primary><option>forbid_sieve_filter</option></primary>
36699 </indexterm>
36700 </para>
36701 <informaltable frame="all">
36702 <tgroup cols="4" colsep="0" rowsep="0">
36703 <colspec colwidth="8*" align="left"/>
36704 <colspec colwidth="6*" align="center"/>
36705 <colspec colwidth="6*" align="center"/>
36706 <colspec colwidth="6*" align="right"/>
36707 <tbody>
36708 <row>
36709 <entry><option>forbid_sieve_filter</option></entry>
36710 <entry>Use: <emphasis>redirect</emphasis></entry>
36711 <entry>Type: <emphasis>boolean</emphasis></entry>
36712 <entry>Default: <emphasis>false</emphasis></entry>
36713 </row>
36714 </tbody>
36715 </tgroup>
36716 </informaltable>
36717 <para>
36718 If this option is set true, only Exim filters are permitted when
36719 <option>allow_filter</option> is true.
36720 </para>
36721 <para>
36722 <indexterm role="concept">
36723 <primary>SMTP</primary>
36724 <secondary>error codes</secondary>
36725 </indexterm>
36726 <indexterm role="option">
36727 <primary><option>forbid_smtp_code</option></primary>
36728 </indexterm>
36729 </para>
36730 <informaltable frame="all">
36731 <tgroup cols="4" colsep="0" rowsep="0">
36732 <colspec colwidth="8*" align="left"/>
36733 <colspec colwidth="6*" align="center"/>
36734 <colspec colwidth="6*" align="center"/>
36735 <colspec colwidth="6*" align="right"/>
36736 <tbody>
36737 <row>
36738 <entry><option>forbid_smtp_code</option></entry>
36739 <entry>Use: <emphasis>redirect</emphasis></entry>
36740 <entry>Type: <emphasis>boolean</emphasis></entry>
36741 <entry>Default: <emphasis>false</emphasis></entry>
36742 </row>
36743 </tbody>
36744 </tgroup>
36745 </informaltable>
36746 <para>
36747 If this option is set true, any SMTP error codes that are present at the start
36748 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
36749 the default codes (451 and 550, respectively) are always used.
36750 </para>
36751 <para>
36752 <indexterm role="option">
36753 <primary><option>hide_child_in_errmsg</option></primary>
36754 </indexterm>
36755 </para>
36756 <informaltable frame="all">
36757 <tgroup cols="4" colsep="0" rowsep="0">
36758 <colspec colwidth="8*" align="left"/>
36759 <colspec colwidth="6*" align="center"/>
36760 <colspec colwidth="6*" align="center"/>
36761 <colspec colwidth="6*" align="right"/>
36762 <tbody>
36763 <row>
36764 <entry><option>hide_child_in_errmsg</option></entry>
36765 <entry>Use: <emphasis>redirect</emphasis></entry>
36766 <entry>Type: <emphasis>boolean</emphasis></entry>
36767 <entry>Default: <emphasis>false</emphasis></entry>
36768 </row>
36769 </tbody>
36770 </tgroup>
36771 </informaltable>
36772 <para>
36773 <indexterm role="concept">
36774 <primary>bounce message</primary>
36775 <secondary>redirection details; suppressing</secondary>
36776 </indexterm>
36777 If this option is true, it prevents Exim from quoting a child address if it
36778 generates a bounce or delay message for it. Instead it says <quote>an address
36779 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
36780 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
36781 bounce may well quote the generated address.
36782 </para>
36783 <para>
36784 <indexterm role="option">
36785 <primary><option>ignore_eacces</option></primary>
36786 </indexterm>
36787 </para>
36788 <informaltable frame="all">
36789 <tgroup cols="4" colsep="0" rowsep="0">
36790 <colspec colwidth="8*" align="left"/>
36791 <colspec colwidth="6*" align="center"/>
36792 <colspec colwidth="6*" align="center"/>
36793 <colspec colwidth="6*" align="right"/>
36794 <tbody>
36795 <row>
36796 <entry><option>ignore_eacces</option></entry>
36797 <entry>Use: <emphasis>redirect</emphasis></entry>
36798 <entry>Type: <emphasis>boolean</emphasis></entry>
36799 <entry>Default: <emphasis>false</emphasis></entry>
36800 </row>
36801 </tbody>
36802 </tgroup>
36803 </informaltable>
36804 <para>
36805 <indexterm role="concept">
36806 <primary>EACCES</primary>
36807 </indexterm>
36808 If this option is set and an attempt to open a redirection file yields the
36809 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
36810 file did not exist.
36811 </para>
36812 <para>
36813 <indexterm role="option">
36814 <primary><option>ignore_enotdir</option></primary>
36815 </indexterm>
36816 </para>
36817 <informaltable frame="all">
36818 <tgroup cols="4" colsep="0" rowsep="0">
36819 <colspec colwidth="8*" align="left"/>
36820 <colspec colwidth="6*" align="center"/>
36821 <colspec colwidth="6*" align="center"/>
36822 <colspec colwidth="6*" align="right"/>
36823 <tbody>
36824 <row>
36825 <entry><option>ignore_enotdir</option></entry>
36826 <entry>Use: <emphasis>redirect</emphasis></entry>
36827 <entry>Type: <emphasis>boolean</emphasis></entry>
36828 <entry>Default: <emphasis>false</emphasis></entry>
36829 </row>
36830 </tbody>
36831 </tgroup>
36832 </informaltable>
36833 <para>
36834 <indexterm role="concept">
36835 <primary>ENOTDIR</primary>
36836 </indexterm>
36837 If this option is set and an attempt to open a redirection file yields the
36838 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
36839 router behaves as if the file did not exist.
36840 </para>
36841 <para>
36842 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
36843 router that has the <option>file</option> option set discovers that the file does not exist
36844 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
36845 against unmounted NFS directories. If the parent can not be statted, delivery
36846 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
36847 is set, because that option tells Exim to ignore <quote>something on the path is not
36848 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
36849 that some operating systems give ENOENT where others give ENOTDIR.
36850 </para>
36851 <para>
36852 <indexterm role="option">
36853 <primary><option>include_directory</option></primary>
36854 </indexterm>
36855 </para>
36856 <informaltable frame="all">
36857 <tgroup cols="4" colsep="0" rowsep="0">
36858 <colspec colwidth="8*" align="left"/>
36859 <colspec colwidth="6*" align="center"/>
36860 <colspec colwidth="6*" align="center"/>
36861 <colspec colwidth="6*" align="right"/>
36862 <tbody>
36863 <row>
36864 <entry><option>include_directory</option></entry>
36865 <entry>Use: <emphasis>redirect</emphasis></entry>
36866 <entry>Type: <emphasis>string</emphasis></entry>
36867 <entry>Default: <emphasis>unset</emphasis></entry>
36868 </row>
36869 </tbody>
36870 </tgroup>
36871 </informaltable>
36872 <para>
36873 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
36874 redirection list must start with this directory.
36875 </para>
36876 <para>
36877 <indexterm role="option">
36878 <primary><option>modemask</option></primary>
36879 </indexterm>
36880 </para>
36881 <informaltable frame="all">
36882 <tgroup cols="4" colsep="0" rowsep="0">
36883 <colspec colwidth="8*" align="left"/>
36884 <colspec colwidth="6*" align="center"/>
36885 <colspec colwidth="6*" align="center"/>
36886 <colspec colwidth="6*" align="right"/>
36887 <tbody>
36888 <row>
36889 <entry><option>modemask</option></entry>
36890 <entry>Use: <emphasis>redirect</emphasis></entry>
36891 <entry>Type: <emphasis>octal integer</emphasis></entry>
36892 <entry>Default: <emphasis>022</emphasis></entry>
36893 </row>
36894 </tbody>
36895 </tgroup>
36896 </informaltable>
36897 <para>
36898 This specifies mode bits which must not be set for a file specified by the
36899 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
36900 </para>
36901 <para>
36902 <indexterm role="option">
36903 <primary><option>one_time</option></primary>
36904 </indexterm>
36905 </para>
36906 <informaltable frame="all">
36907 <tgroup cols="4" colsep="0" rowsep="0">
36908 <colspec colwidth="8*" align="left"/>
36909 <colspec colwidth="6*" align="center"/>
36910 <colspec colwidth="6*" align="center"/>
36911 <colspec colwidth="6*" align="right"/>
36912 <tbody>
36913 <row>
36914 <entry><option>one_time</option></entry>
36915 <entry>Use: <emphasis>redirect</emphasis></entry>
36916 <entry>Type: <emphasis>boolean</emphasis></entry>
36917 <entry>Default: <emphasis>false</emphasis></entry>
36918 </row>
36919 </tbody>
36920 </tgroup>
36921 </informaltable>
36922 <para>
36923 <indexterm role="concept">
36924 <primary>one-time aliasing/forwarding expansion</primary>
36925 </indexterm>
36926 <indexterm role="concept">
36927 <primary>alias file</primary>
36928 <secondary>one-time expansion</secondary>
36929 </indexterm>
36930 <indexterm role="concept">
36931 <primary>forward file</primary>
36932 <secondary>one-time expansion</secondary>
36933 </indexterm>
36934 <indexterm role="concept">
36935 <primary>mailing lists</primary>
36936 <secondary>one-time expansion</secondary>
36937 </indexterm>
36938 <indexterm role="concept">
36939 <primary>address redirection</primary>
36940 <secondary>one-time expansion</secondary>
36941 </indexterm>
36942 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
36943 files each time it tries to deliver a message causes a problem when one or more
36944 of the generated addresses fails be delivered at the first attempt. The problem
36945 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
36946 but of what happens when the redirection list changes during the time that the
36947 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
36948 lists, where new subscribers might receive copies of messages that were posted
36949 before they subscribed.
36950 </para>
36951 <para>
36952 If <option>one_time</option> is set and any addresses generated by the router fail to
36953 deliver at the first attempt, the failing addresses are added to the message as
36954 <quote>top level</quote> addresses, and the parent address that generated them is marked
36955 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
36956 attempt.
36957 </para>
36958 <para>
36959 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
36960 router would be lost if delivery did not succeed at the first attempt. For this
36961 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
36962 permitted when <option>one_time</option> is set.
36963 </para>
36964 <para>
36965 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
36966 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
36967 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
36968 </para>
36969 <para>
36970 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
36971 <option>one_time</option>.
36972 </para>
36973 <para>
36974 The original top-level address is remembered with each of the generated
36975 addresses, and is output in any log messages. However, any intermediate parent
36976 addresses are not recorded. This makes a difference to the log only if
36977 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
36978 typically be used for mailing lists, where there is normally just one level of
36979 expansion.
36980 </para>
36981 <para>
36982 <indexterm role="option">
36983 <primary><option>owners</option></primary>
36984 </indexterm>
36985 </para>
36986 <informaltable frame="all">
36987 <tgroup cols="4" colsep="0" rowsep="0">
36988 <colspec colwidth="8*" align="left"/>
36989 <colspec colwidth="6*" align="center"/>
36990 <colspec colwidth="6*" align="center"/>
36991 <colspec colwidth="6*" align="right"/>
36992 <tbody>
36993 <row>
36994 <entry><option>owners</option></entry>
36995 <entry>Use: <emphasis>redirect</emphasis></entry>
36996 <entry>Type: <emphasis>string list</emphasis></entry>
36997 <entry>Default: <emphasis>unset</emphasis></entry>
36998 </row>
36999 </tbody>
37000 </tgroup>
37001 </informaltable>
37002 <para>
37003 <indexterm role="concept">
37004 <primary>ownership</primary>
37005 <secondary>alias file</secondary>
37006 </indexterm>
37007 <indexterm role="concept">
37008 <primary>ownership</primary>
37009 <secondary>forward file</secondary>
37010 </indexterm>
37011 <indexterm role="concept">
37012 <primary>alias file</primary>
37013 <secondary>ownership</secondary>
37014 </indexterm>
37015 <indexterm role="concept">
37016 <primary>forward file</primary>
37017 <secondary>ownership</secondary>
37018 </indexterm>
37019 This specifies a list of permitted owners for the file specified by <option>file</option>.
37020 This list is in addition to the local user when <option>check_local_user</option> is set.
37021 See <option>check_owner</option> above.
37022 </para>
37023 <para>
37024 <indexterm role="option">
37025 <primary><option>owngroups</option></primary>
37026 </indexterm>
37027 </para>
37028 <informaltable frame="all">
37029 <tgroup cols="4" colsep="0" rowsep="0">
37030 <colspec colwidth="8*" align="left"/>
37031 <colspec colwidth="6*" align="center"/>
37032 <colspec colwidth="6*" align="center"/>
37033 <colspec colwidth="6*" align="right"/>
37034 <tbody>
37035 <row>
37036 <entry><option>owngroups</option></entry>
37037 <entry>Use: <emphasis>redirect</emphasis></entry>
37038 <entry>Type: <emphasis>string list</emphasis></entry>
37039 <entry>Default: <emphasis>unset</emphasis></entry>
37040 </row>
37041 </tbody>
37042 </tgroup>
37043 </informaltable>
37044 <para>
37045 This specifies a list of permitted groups for the file specified by <option>file</option>.
37046 The list is in addition to the local user&#x2019;s primary group when
37047 <option>check_local_user</option> is set. See <option>check_group</option> above.
37048 </para>
37049 <para>
37050 <indexterm role="option">
37051 <primary><option>pipe_transport</option></primary>
37052 </indexterm>
37053 </para>
37054 <informaltable frame="all">
37055 <tgroup cols="4" colsep="0" rowsep="0">
37056 <colspec colwidth="8*" align="left"/>
37057 <colspec colwidth="6*" align="center"/>
37058 <colspec colwidth="6*" align="center"/>
37059 <colspec colwidth="6*" align="right"/>
37060 <tbody>
37061 <row>
37062 <entry><option>pipe_transport</option></entry>
37063 <entry>Use: <emphasis>redirect</emphasis></entry>
37064 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37065 <entry>Default: <emphasis>unset</emphasis></entry>
37066 </row>
37067 </tbody>
37068 </tgroup>
37069 </informaltable>
37070 <para>
37071 <indexterm role="variable">
37072 <primary><varname>$address_pipe</varname></primary>
37073 </indexterm>
37074 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
37075 starting with a vertical bar character is specified as a new <quote>address</quote>. The
37076 transport used is specified by this option, which, after expansion, must be the
37077 name of a configured transport. This should normally be a <command>pipe</command> transport.
37078 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
37079 </para>
37080 <para>
37081 <indexterm role="option">
37082 <primary><option>qualify_domain</option></primary>
37083 </indexterm>
37084 </para>
37085 <informaltable frame="all">
37086 <tgroup cols="4" colsep="0" rowsep="0">
37087 <colspec colwidth="8*" align="left"/>
37088 <colspec colwidth="6*" align="center"/>
37089 <colspec colwidth="6*" align="center"/>
37090 <colspec colwidth="6*" align="right"/>
37091 <tbody>
37092 <row>
37093 <entry><option>qualify_domain</option></entry>
37094 <entry>Use: <emphasis>redirect</emphasis></entry>
37095 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37096 <entry>Default: <emphasis>unset</emphasis></entry>
37097 </row>
37098 </tbody>
37099 </tgroup>
37100 </informaltable>
37101 <para>
37102 <indexterm role="variable">
37103 <primary><varname>$qualify_recipient</varname></primary>
37104 </indexterm>
37105 If this option is set, and an unqualified address (one without a domain) is
37106 generated, and that address would normally be qualified by the global setting
37107 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
37108 expanding this string. If the expansion fails, the router declines. If you want
37109 to revert to the default, you can have the expansion generate
37110 <varname>$qualify_recipient</varname>.
37111 </para>
37112 <para>
37113 This option applies to all unqualified addresses generated by Exim filters,
37114 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
37115 not preceded by a backslash. Sieve filters cannot generate unqualified
37116 addresses.
37117 </para>
37118 <para>
37119 <indexterm role="option">
37120 <primary><option>qualify_preserve_domain</option></primary>
37121 </indexterm>
37122 </para>
37123 <informaltable frame="all">
37124 <tgroup cols="4" colsep="0" rowsep="0">
37125 <colspec colwidth="8*" align="left"/>
37126 <colspec colwidth="6*" align="center"/>
37127 <colspec colwidth="6*" align="center"/>
37128 <colspec colwidth="6*" align="right"/>
37129 <tbody>
37130 <row>
37131 <entry><option>qualify_preserve_domain</option></entry>
37132 <entry>Use: <emphasis>redirect</emphasis></entry>
37133 <entry>Type: <emphasis>boolean</emphasis></entry>
37134 <entry>Default: <emphasis>false</emphasis></entry>
37135 </row>
37136 </tbody>
37137 </tgroup>
37138 </informaltable>
37139 <para>
37140 <indexterm role="concept">
37141 <primary>domain</primary>
37142 <secondary>in redirection; preserving</secondary>
37143 </indexterm>
37144 <indexterm role="concept">
37145 <primary>preserving domain in redirection</primary>
37146 </indexterm>
37147 <indexterm role="concept">
37148 <primary>address redirection</primary>
37149 <secondary>domain; preserving</secondary>
37150 </indexterm>
37151 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
37152 set (a configuration error occurs if it is). If an unqualified address (one
37153 without a domain) is generated, it is qualified with the domain of the parent
37154 address (the immediately preceding ancestor) instead of the global
37155 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
37156 this applies whether or not the address is preceded by a backslash.
37157 </para>
37158 <para>
37159 <indexterm role="option">
37160 <primary><option>repeat_use</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>repeat_use</option></entry>
37172 <entry>Use: <emphasis>redirect</emphasis></entry>
37173 <entry>Type: <emphasis>boolean</emphasis></entry>
37174 <entry>Default: <emphasis>true</emphasis></entry>
37175 </row>
37176 </tbody>
37177 </tgroup>
37178 </informaltable>
37179 <para>
37180 If this option is set false, the router is skipped for a child address that has
37181 any ancestor that was routed by this router. This test happens before any of
37182 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
37183 only when the ancestor is the same as the current address. See also
37184 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
37185 </para>
37186 <para>
37187 <indexterm role="option">
37188 <primary><option>reply_transport</option></primary>
37189 </indexterm>
37190 </para>
37191 <informaltable frame="all">
37192 <tgroup cols="4" colsep="0" rowsep="0">
37193 <colspec colwidth="8*" align="left"/>
37194 <colspec colwidth="6*" align="center"/>
37195 <colspec colwidth="6*" align="center"/>
37196 <colspec colwidth="6*" align="right"/>
37197 <tbody>
37198 <row>
37199 <entry><option>reply_transport</option></entry>
37200 <entry>Use: <emphasis>redirect</emphasis></entry>
37201 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37202 <entry>Default: <emphasis>unset</emphasis></entry>
37203 </row>
37204 </tbody>
37205 </tgroup>
37206 </informaltable>
37207 <para>
37208 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
37209 <option>vacation</option> command is used in a filter file. The transport used is specified
37210 by this option, which, after expansion, must be the name of a configured
37211 transport. This should normally be an <command>autoreply</command> transport. Other transports
37212 are unlikely to do anything sensible or useful.
37213 </para>
37214 <para>
37215 <indexterm role="option">
37216 <primary><option>rewrite</option></primary>
37217 </indexterm>
37218 </para>
37219 <informaltable frame="all">
37220 <tgroup cols="4" colsep="0" rowsep="0">
37221 <colspec colwidth="8*" align="left"/>
37222 <colspec colwidth="6*" align="center"/>
37223 <colspec colwidth="6*" align="center"/>
37224 <colspec colwidth="6*" align="right"/>
37225 <tbody>
37226 <row>
37227 <entry><option>rewrite</option></entry>
37228 <entry>Use: <emphasis>redirect</emphasis></entry>
37229 <entry>Type: <emphasis>boolean</emphasis></entry>
37230 <entry>Default: <emphasis>true</emphasis></entry>
37231 </row>
37232 </tbody>
37233 </tgroup>
37234 </informaltable>
37235 <para>
37236 <indexterm role="concept">
37237 <primary>address redirection</primary>
37238 <secondary>disabling rewriting</secondary>
37239 </indexterm>
37240 If this option is set false, addresses generated by the router are not
37241 subject to address rewriting. Otherwise, they are treated like new addresses
37242 and are rewritten according to the global rewriting rules.
37243 </para>
37244 <para>
37245 <indexterm role="option">
37246 <primary><option>sieve_subaddress</option></primary>
37247 </indexterm>
37248 </para>
37249 <informaltable frame="all">
37250 <tgroup cols="4" colsep="0" rowsep="0">
37251 <colspec colwidth="8*" align="left"/>
37252 <colspec colwidth="6*" align="center"/>
37253 <colspec colwidth="6*" align="center"/>
37254 <colspec colwidth="6*" align="right"/>
37255 <tbody>
37256 <row>
37257 <entry><option>sieve_subaddress</option></entry>
37258 <entry>Use: <emphasis>redirect</emphasis></entry>
37259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37260 <entry>Default: <emphasis>unset</emphasis></entry>
37261 </row>
37262 </tbody>
37263 </tgroup>
37264 </informaltable>
37265 <para>
37266 The value of this option is passed to a Sieve filter to specify the
37267 :subaddress part of an address.
37268 </para>
37269 <para>
37270 <indexterm role="option">
37271 <primary><option>sieve_useraddress</option></primary>
37272 </indexterm>
37273 </para>
37274 <informaltable frame="all">
37275 <tgroup cols="4" colsep="0" rowsep="0">
37276 <colspec colwidth="8*" align="left"/>
37277 <colspec colwidth="6*" align="center"/>
37278 <colspec colwidth="6*" align="center"/>
37279 <colspec colwidth="6*" align="right"/>
37280 <tbody>
37281 <row>
37282 <entry><option>sieve_useraddress</option></entry>
37283 <entry>Use: <emphasis>redirect</emphasis></entry>
37284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37285 <entry>Default: <emphasis>unset</emphasis></entry>
37286 </row>
37287 </tbody>
37288 </tgroup>
37289 </informaltable>
37290 <para>
37291 The value of this option is passed to a Sieve filter to specify the :user part
37292 of an address. However, if it is unset, the entire original local part
37293 (including any prefix or suffix) is used for :user.
37294 </para>
37295 <para>
37296 <indexterm role="option">
37297 <primary><option>sieve_vacation_directory</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>sieve_vacation_directory</option></entry>
37309 <entry>Use: <emphasis>redirect</emphasis></entry>
37310 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37311 <entry>Default: <emphasis>unset</emphasis></entry>
37312 </row>
37313 </tbody>
37314 </tgroup>
37315 </informaltable>
37316 <para>
37317 <indexterm role="concept">
37318 <primary>Sieve filter</primary>
37319 <secondary>vacation directory</secondary>
37320 </indexterm>
37321 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
37322 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
37323 (do not put anything else in that directory), and ensure that the
37324 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
37325 needs their own directory; Exim will create it if necessary.
37326 </para>
37327 <para>
37328 <indexterm role="option">
37329 <primary><option>skip_syntax_errors</option></primary>
37330 </indexterm>
37331 </para>
37332 <informaltable frame="all">
37333 <tgroup cols="4" colsep="0" rowsep="0">
37334 <colspec colwidth="8*" align="left"/>
37335 <colspec colwidth="6*" align="center"/>
37336 <colspec colwidth="6*" align="center"/>
37337 <colspec colwidth="6*" align="right"/>
37338 <tbody>
37339 <row>
37340 <entry><option>skip_syntax_errors</option></entry>
37341 <entry>Use: <emphasis>redirect</emphasis></entry>
37342 <entry>Type: <emphasis>boolean</emphasis></entry>
37343 <entry>Default: <emphasis>false</emphasis></entry>
37344 </row>
37345 </tbody>
37346 </tgroup>
37347 </informaltable>
37348 <para>
37349 <indexterm role="concept">
37350 <primary>forward file</primary>
37351 <secondary>broken</secondary>
37352 </indexterm>
37353 <indexterm role="concept">
37354 <primary>address redirection</primary>
37355 <secondary>broken files</secondary>
37356 </indexterm>
37357 <indexterm role="concept">
37358 <primary>alias file</primary>
37359 <secondary>broken</secondary>
37360 </indexterm>
37361 <indexterm role="concept">
37362 <primary>broken alias or forward files</primary>
37363 </indexterm>
37364 <indexterm role="concept">
37365 <primary>ignoring faulty addresses</primary>
37366 </indexterm>
37367 <indexterm role="concept">
37368 <primary>skipping faulty addresses</primary>
37369 </indexterm>
37370 <indexterm role="concept">
37371 <primary>error</primary>
37372 <secondary>skipping bad syntax</secondary>
37373 </indexterm>
37374 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
37375 non-filter redirection data are skipped, and each failing address is logged. If
37376 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
37377 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
37378 are expanded and placed at the head of the error message generated by
37379 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
37380 be the same address as the generic <option>errors_to</option> option. The
37381 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
37382 </para>
37383 <para>
37384 If all the addresses in a redirection list are skipped because of syntax
37385 errors, the router declines to handle the original address, and it is passed to
37386 the following routers.
37387 </para>
37388 <para>
37389 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
37390 error in the filter causes filtering to be abandoned without any action being
37391 taken. The incident is logged, and the router declines to handle the address,
37392 so it is passed to the following routers.
37393 </para>
37394 <para>
37395 <indexterm role="concept">
37396 <primary>Sieve filter</primary>
37397 <secondary>syntax errors in</secondary>
37398 </indexterm>
37399 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
37400 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
37401 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
37402 </para>
37403 <para>
37404 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
37405 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
37406 option, used with an address that does not get redirected, can be used to
37407 notify users of these errors, by means of a router like this:
37408 </para>
37409 <literallayout class="monospaced">
37410 userforward:
37411   driver = redirect
37412   allow_filter
37413   check_local_user
37414   file = $home/.forward
37415   file_transport = address_file
37416   pipe_transport = address_pipe
37417   reply_transport = address_reply
37418   no_verify
37419   skip_syntax_errors
37420   syntax_errors_to = real-$local_part@$domain
37421   syntax_errors_text = \
37422    This is an automatically generated message. An error has\n\
37423    been found in your .forward file. Details of the error are\n\
37424    reported below. While this error persists, you will receive\n\
37425    a copy of this message for every message that is addressed\n\
37426    to you. If your .forward file is a filter file, or if it is\n\
37427    a non-filter file containing no valid forwarding addresses,\n\
37428    a copy of each incoming message will be put in your normal\n\
37429    mailbox. If a non-filter file contains at least one valid\n\
37430    forwarding address, forwarding to the valid addresses will\n\
37431    happen, and those will be the only deliveries that occur.
37432 </literallayout>
37433 <para>
37434 You also need a router to ensure that local addresses that are prefixed by
37435 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
37436 put this immediately before the <command>userforward</command> router:
37437 </para>
37438 <literallayout class="monospaced">
37439 real_localuser:
37440   driver = accept
37441   check_local_user
37442   local_part_prefix = real-
37443   transport = local_delivery
37444 </literallayout>
37445 <para>
37446 For security, it would probably be a good idea to restrict the use of this
37447 router to locally-generated messages, using a condition such as this:
37448 </para>
37449 <literallayout class="monospaced">
37450   condition = ${if match {$sender_host_address}\
37451                          {\N^(|127\.0\.0\.1)$\N}}
37452 </literallayout>
37453 <para>
37454 <indexterm role="option">
37455 <primary><option>syntax_errors_text</option></primary>
37456 </indexterm>
37457 </para>
37458 <informaltable frame="all">
37459 <tgroup cols="4" colsep="0" rowsep="0">
37460 <colspec colwidth="8*" align="left"/>
37461 <colspec colwidth="6*" align="center"/>
37462 <colspec colwidth="6*" align="center"/>
37463 <colspec colwidth="6*" align="right"/>
37464 <tbody>
37465 <row>
37466 <entry><option>syntax_errors_text</option></entry>
37467 <entry>Use: <emphasis>redirect</emphasis></entry>
37468 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37469 <entry>Default: <emphasis>unset</emphasis></entry>
37470 </row>
37471 </tbody>
37472 </tgroup>
37473 </informaltable>
37474 <para>
37475 See <option>skip_syntax_errors</option> above.
37476 </para>
37477 <para>
37478 <indexterm role="option">
37479 <primary><option>syntax_errors_to</option></primary>
37480 </indexterm>
37481 </para>
37482 <informaltable frame="all">
37483 <tgroup cols="4" colsep="0" rowsep="0">
37484 <colspec colwidth="8*" align="left"/>
37485 <colspec colwidth="6*" align="center"/>
37486 <colspec colwidth="6*" align="center"/>
37487 <colspec colwidth="6*" align="right"/>
37488 <tbody>
37489 <row>
37490 <entry><option>syntax_errors_to</option></entry>
37491 <entry>Use: <emphasis>redirect</emphasis></entry>
37492 <entry>Type: <emphasis>string</emphasis></entry>
37493 <entry>Default: <emphasis>unset</emphasis></entry>
37494 </row>
37495 </tbody>
37496 </tgroup>
37497 </informaltable>
37498 <para>
37499 See <option>skip_syntax_errors</option> above.
37500 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
37501 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
37502 </para>
37503 </section>
37504 </chapter>
37505
37506 <chapter id="CHAPenvironment">
37507 <title>Environment for running local transports</title>
37508 <titleabbrev>Environment for local transports</titleabbrev>
37509 <para>
37510 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
37511 <primary>local transports</primary>
37512 <secondary>environment for</secondary>
37513 </indexterm>
37514 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
37515 <primary>environment for local transports</primary>
37516 </indexterm>
37517 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
37518 <primary>transport</primary>
37519 <secondary>local; environment for</secondary>
37520 </indexterm>
37521 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
37522 transport can be thought of as similar to a pipe.) Exim always runs transports
37523 in subprocesses, under specified uids and gids. Typical deliveries to local
37524 mailboxes run under the uid and gid of the local user.
37525 </para>
37526 <para>
37527 Exim also sets a specific current directory while running the transport; for
37528 some transports a home directory setting is also relevant. The <command>pipe</command>
37529 transport is the only one that sets up environment variables; see section
37530 <xref linkend="SECTpipeenv"/> for details.
37531 </para>
37532 <para>
37533 The values used for the uid, gid, and the directories may come from several
37534 different places. In many cases, the router that handles the address associates
37535 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
37536 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
37537 configuration, and these override anything that comes from the router.
37538 </para>
37539 <section id="SECID131">
37540 <title>Concurrent deliveries</title>
37541 <para>
37542 <indexterm role="concept">
37543 <primary>concurrent deliveries</primary>
37544 </indexterm>
37545 <indexterm role="concept">
37546 <primary>simultaneous deliveries</primary>
37547 </indexterm>
37548 If two different messages for the same local recipient arrive more or less
37549 simultaneously, the two delivery processes are likely to run concurrently. When
37550 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
37551 rules to stop concurrent processes from writing to the same file at the same
37552 time.
37553 </para>
37554 <para>
37555 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
37556 locking that is needed. Here is a silly example:
37557 </para>
37558 <literallayout class="monospaced">
37559 my_transport:
37560   driver = pipe
37561   command = /bin/sh -c 'cat &gt;&gt;/some/file'
37562 </literallayout>
37563 <para>
37564 This is supposed to write the message at the end of the file. However, if two
37565 messages arrive at the same time, the file will be scrambled. You can use the
37566 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
37567 file using the same algorithm that Exim itself uses.
37568 </para>
37569 </section>
37570 <section id="SECTenvuidgid">
37571 <title>Uids and gids</title>
37572 <para>
37573 <indexterm role="concept">
37574 <primary>local transports</primary>
37575 <secondary>uid and gid</secondary>
37576 </indexterm>
37577 <indexterm role="concept">
37578 <primary>transport</primary>
37579 <secondary>local; uid and gid</secondary>
37580 </indexterm>
37581 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
37582 overrides any group that the router set in the address, even if <option>user</option> is not
37583 set for the transport. This makes it possible, for example, to run local mail
37584 delivery under the uid of the recipient (set by the router), but in a special
37585 group (set by the transport). For example:
37586 </para>
37587 <literallayout class="monospaced">
37588 # Routers ...
37589 # User/group are set by check_local_user in this router
37590 local_users:
37591   driver = accept
37592   check_local_user
37593   transport = group_delivery
37594
37595 # Transports ...
37596 # This transport overrides the group
37597 group_delivery:
37598   driver = appendfile
37599   file = /var/spool/mail/$local_part
37600   group = mail
37601 </literallayout>
37602 <para>
37603 If <option>user</option> is set for a transport, its value overrides what is set in the
37604 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
37605 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
37606 set.
37607 </para>
37608 <para>
37609 <indexterm role="option">
37610 <primary><option>initgroups</option></primary>
37611 </indexterm>
37612 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
37613 function is called for the groups associated with that uid if the
37614 <option>initgroups</option> option is set for the transport. When the uid is not specified
37615 by the transport, but is associated with the address by a router, the option
37616 for calling <function>initgroups()</function> is taken from the router configuration.
37617 </para>
37618 <para>
37619 <indexterm role="concept">
37620 <primary><command>pipe</command> transport</primary>
37621 <secondary>uid for</secondary>
37622 </indexterm>
37623 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
37624 is set and <option>user</option> is not set, the uid of the process that called Exim to
37625 receive the message is used, and if <option>group</option> is not set, the corresponding
37626 original gid is also used.
37627 </para>
37628 <para>
37629 This is the detailed preference order for obtaining a gid; the first of the
37630 following that is set is used:
37631 </para>
37632 <itemizedlist>
37633 <listitem>
37634 <para>
37635 A <option>group</option> setting of the transport;
37636 </para>
37637 </listitem>
37638 <listitem>
37639 <para>
37640 A <option>group</option> setting of the router;
37641 </para>
37642 </listitem>
37643 <listitem>
37644 <para>
37645 A gid associated with a user setting of the router, either as a result of
37646 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
37647 </para>
37648 </listitem>
37649 <listitem>
37650 <para>
37651 The group associated with a non-numeric <option>user</option> setting of the transport;
37652 </para>
37653 </listitem>
37654 <listitem>
37655 <para>
37656 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
37657 the uid is the creator&#x2019;s uid;
37658 </para>
37659 </listitem>
37660 <listitem>
37661 <para>
37662 The Exim gid if the Exim uid is being used as a default.
37663 </para>
37664 </listitem>
37665 </itemizedlist>
37666 <para>
37667 If, for example, the user is specified numerically on the router and there are
37668 no group settings, no gid is available. In this situation, an error occurs.
37669 This is different for the uid, for which there always is an ultimate default.
37670 The first of the following that is set is used:
37671 </para>
37672 <itemizedlist>
37673 <listitem>
37674 <para>
37675 A <option>user</option> setting of the transport;
37676 </para>
37677 </listitem>
37678 <listitem>
37679 <para>
37680 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
37681 </para>
37682 </listitem>
37683 <listitem>
37684 <para>
37685 A <option>user</option> setting of the router;
37686 </para>
37687 </listitem>
37688 <listitem>
37689 <para>
37690 A <option>check_local_user</option> setting of the router;
37691 </para>
37692 </listitem>
37693 <listitem>
37694 <para>
37695 The Exim uid.
37696 </para>
37697 </listitem>
37698 </itemizedlist>
37699 <para>
37700 Of course, an error will still occur if the uid that is chosen is on the
37701 <option>never_users</option> list.
37702 </para>
37703 </section>
37704 <section id="SECID132">
37705 <title>Current and home directories</title>
37706 <para>
37707 <indexterm role="concept">
37708 <primary>current directory for local transport</primary>
37709 </indexterm>
37710 <indexterm role="concept">
37711 <primary>home directory</primary>
37712 <secondary>for local transport</secondary>
37713 </indexterm>
37714 <indexterm role="concept">
37715 <primary>transport</primary>
37716 <secondary>local; home directory for</secondary>
37717 </indexterm>
37718 <indexterm role="concept">
37719 <primary>transport</primary>
37720 <secondary>local; current directory for</secondary>
37721 </indexterm>
37722 Routers may set current and home directories for local transports by means of
37723 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
37724 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
37725 are set, they override the router&#x2019;s values. In detail, the home directory
37726 for a local transport is taken from the first of these values that is set:
37727 </para>
37728 <itemizedlist>
37729 <listitem>
37730 <para>
37731 The <option>home_directory</option> option on the transport;
37732 </para>
37733 </listitem>
37734 <listitem>
37735 <para>
37736 The <option>transport_home_directory</option> option on the router;
37737 </para>
37738 </listitem>
37739 <listitem>
37740 <para>
37741 The password data if <option>check_local_user</option> is set on the router;
37742 </para>
37743 </listitem>
37744 <listitem>
37745 <para>
37746 The <option>router_home_directory</option> option on the router.
37747 </para>
37748 </listitem>
37749 </itemizedlist>
37750 <para>
37751 The current directory is taken from the first of these values that is set:
37752 </para>
37753 <itemizedlist>
37754 <listitem>
37755 <para>
37756 The <option>current_directory</option> option on the transport;
37757 </para>
37758 </listitem>
37759 <listitem>
37760 <para>
37761 The <option>transport_current_directory</option> option on the router.
37762 </para>
37763 </listitem>
37764 </itemizedlist>
37765 <para>
37766 If neither the router nor the transport sets a current directory, Exim uses the
37767 value of the home directory, if it is set. Otherwise it sets the current
37768 directory to <filename>/</filename> before running a local transport.
37769 </para>
37770 </section>
37771 <section id="SECID133">
37772 <title>Expansion variables derived from the address</title>
37773 <para>
37774 <indexterm role="variable">
37775 <primary><varname>$domain</varname></primary>
37776 </indexterm>
37777 <indexterm role="variable">
37778 <primary><varname>$local_part</varname></primary>
37779 </indexterm>
37780 <indexterm role="variable">
37781 <primary><varname>$original_domain</varname></primary>
37782 </indexterm>
37783 Normally a local delivery is handling a single address, and in that case the
37784 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
37785 deliveries. However, in some circumstances more than one address may be handled
37786 at once (for example, while writing batch SMTP for onward transmission by some
37787 other means). In this case, the variables associated with the local part are
37788 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
37789 and <varname>$original_domain</varname> is never set.
37790 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
37791 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
37792 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
37793 </para>
37794 </section>
37795 </chapter>
37796
37797 <chapter id="CHAPtransportgeneric">
37798 <title>Generic options for transports</title>
37799 <para>
37800 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
37801 <primary>generic options</primary>
37802 <secondary>transport</secondary>
37803 </indexterm>
37804 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
37805 <primary>options</primary>
37806 <secondary>generic; for transports</secondary>
37807 </indexterm>
37808 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
37809 <primary>transport</primary>
37810 <secondary>generic options for</secondary>
37811 </indexterm>
37812 The following generic options apply to all transports:
37813 </para>
37814 <para>
37815 <indexterm role="option">
37816 <primary><option>body_only</option></primary>
37817 </indexterm>
37818 </para>
37819 <informaltable frame="all">
37820 <tgroup cols="4" colsep="0" rowsep="0">
37821 <colspec colwidth="8*" align="left"/>
37822 <colspec colwidth="6*" align="center"/>
37823 <colspec colwidth="6*" align="center"/>
37824 <colspec colwidth="6*" align="right"/>
37825 <tbody>
37826 <row>
37827 <entry><option>body_only</option></entry>
37828 <entry>Use: <emphasis>transports</emphasis></entry>
37829 <entry>Type: <emphasis>boolean</emphasis></entry>
37830 <entry>Default: <emphasis>false</emphasis></entry>
37831 </row>
37832 </tbody>
37833 </tgroup>
37834 </informaltable>
37835 <para>
37836 <indexterm role="concept">
37837 <primary>transport</primary>
37838 <secondary>body only</secondary>
37839 </indexterm>
37840 <indexterm role="concept">
37841 <primary>message</primary>
37842 <secondary>transporting body only</secondary>
37843 </indexterm>
37844 <indexterm role="concept">
37845 <primary>body of message</primary>
37846 <secondary>transporting</secondary>
37847 </indexterm>
37848 If this option is set, the message&#x2019;s headers are not transported. It is
37849 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
37850 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
37851 <option>message_suffix</option> should be checked, because this option does not
37852 automatically suppress them.
37853 </para>
37854 <para>
37855 <indexterm role="option">
37856 <primary><option>current_directory</option></primary>
37857 </indexterm>
37858 </para>
37859 <informaltable frame="all">
37860 <tgroup cols="4" colsep="0" rowsep="0">
37861 <colspec colwidth="8*" align="left"/>
37862 <colspec colwidth="6*" align="center"/>
37863 <colspec colwidth="6*" align="center"/>
37864 <colspec colwidth="6*" align="right"/>
37865 <tbody>
37866 <row>
37867 <entry><option>current_directory</option></entry>
37868 <entry>Use: <emphasis>transports</emphasis></entry>
37869 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37870 <entry>Default: <emphasis>unset</emphasis></entry>
37871 </row>
37872 </tbody>
37873 </tgroup>
37874 </informaltable>
37875 <para>
37876 <indexterm role="concept">
37877 <primary>transport</primary>
37878 <secondary>current directory for</secondary>
37879 </indexterm>
37880 This specifies the current directory that is to be set while running the
37881 transport, overriding any value that may have been set by the router.
37882 If the expansion fails for any reason, including forced failure, an error is
37883 logged, and delivery is deferred.
37884 </para>
37885 <para>
37886 <indexterm role="option">
37887 <primary><option>disable_logging</option></primary>
37888 </indexterm>
37889 </para>
37890 <informaltable frame="all">
37891 <tgroup cols="4" colsep="0" rowsep="0">
37892 <colspec colwidth="8*" align="left"/>
37893 <colspec colwidth="6*" align="center"/>
37894 <colspec colwidth="6*" align="center"/>
37895 <colspec colwidth="6*" align="right"/>
37896 <tbody>
37897 <row>
37898 <entry><option>disable_logging</option></entry>
37899 <entry>Use: <emphasis>transports</emphasis></entry>
37900 <entry>Type: <emphasis>boolean</emphasis></entry>
37901 <entry>Default: <emphasis>false</emphasis></entry>
37902 </row>
37903 </tbody>
37904 </tgroup>
37905 </informaltable>
37906 <para>
37907 If this option is set true, nothing is logged for any
37908 deliveries by the transport or for any
37909 transport errors. You should not set this option unless you really, really know
37910 what you are doing.
37911 </para>
37912 <para>
37913 <indexterm role="option">
37914 <primary><option>debug_print</option></primary>
37915 </indexterm>
37916 </para>
37917 <informaltable frame="all">
37918 <tgroup cols="4" colsep="0" rowsep="0">
37919 <colspec colwidth="8*" align="left"/>
37920 <colspec colwidth="6*" align="center"/>
37921 <colspec colwidth="6*" align="center"/>
37922 <colspec colwidth="6*" align="right"/>
37923 <tbody>
37924 <row>
37925 <entry><option>debug_print</option></entry>
37926 <entry>Use: <emphasis>transports</emphasis></entry>
37927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37928 <entry>Default: <emphasis>unset</emphasis></entry>
37929 </row>
37930 </tbody>
37931 </tgroup>
37932 </informaltable>
37933 <para>
37934 <indexterm role="concept">
37935 <primary>testing</primary>
37936 <secondary>variables in drivers</secondary>
37937 </indexterm>
37938 If this option is set and debugging is enabled (see the <option>-d</option> command line
37939 option), the string is expanded and included in the debugging output when the
37940 transport is run.
37941 If expansion of the string fails, the error message is written to the debugging
37942 output, and Exim carries on processing.
37943 This facility is provided to help with checking out the values of variables and
37944 so on when debugging driver configurations. For example, if a <option>headers_add</option>
37945 option is not working properly, <option>debug_print</option> could be used to output the
37946 variables it references. A newline is added to the text if it does not end with
37947 one.
37948 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
37949 transport and the router that called it.
37950 </para>
37951 <para>
37952 <indexterm role="option">
37953 <primary><option>delivery_date_add</option></primary>
37954 </indexterm>
37955 </para>
37956 <informaltable frame="all">
37957 <tgroup cols="4" colsep="0" rowsep="0">
37958 <colspec colwidth="8*" align="left"/>
37959 <colspec colwidth="6*" align="center"/>
37960 <colspec colwidth="6*" align="center"/>
37961 <colspec colwidth="6*" align="right"/>
37962 <tbody>
37963 <row>
37964 <entry><option>delivery_date_add</option></entry>
37965 <entry>Use: <emphasis>transports</emphasis></entry>
37966 <entry>Type: <emphasis>boolean</emphasis></entry>
37967 <entry>Default: <emphasis>false</emphasis></entry>
37968 </row>
37969 </tbody>
37970 </tgroup>
37971 </informaltable>
37972 <para>
37973 <indexterm role="concept">
37974 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
37975 </indexterm>
37976 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
37977 This gives the actual time the delivery was made. As this is not a standard
37978 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
37979 requests its removal from incoming messages, so that delivered messages can
37980 safely be resent to other recipients.
37981 </para>
37982 <para>
37983 <indexterm role="option">
37984 <primary><option>driver</option></primary>
37985 </indexterm>
37986 </para>
37987 <informaltable frame="all">
37988 <tgroup cols="4" colsep="0" rowsep="0">
37989 <colspec colwidth="8*" align="left"/>
37990 <colspec colwidth="6*" align="center"/>
37991 <colspec colwidth="6*" align="center"/>
37992 <colspec colwidth="6*" align="right"/>
37993 <tbody>
37994 <row>
37995 <entry><option>driver</option></entry>
37996 <entry>Use: <emphasis>transports</emphasis></entry>
37997 <entry>Type: <emphasis>string</emphasis></entry>
37998 <entry>Default: <emphasis>unset</emphasis></entry>
37999 </row>
38000 </tbody>
38001 </tgroup>
38002 </informaltable>
38003 <para>
38004 This specifies which of the available transport drivers is to be used.
38005 There is no default, and this option must be set for every transport.
38006 </para>
38007 <para>
38008 <indexterm role="option">
38009 <primary><option>envelope_to_add</option></primary>
38010 </indexterm>
38011 </para>
38012 <informaltable frame="all">
38013 <tgroup cols="4" colsep="0" rowsep="0">
38014 <colspec colwidth="8*" align="left"/>
38015 <colspec colwidth="6*" align="center"/>
38016 <colspec colwidth="6*" align="center"/>
38017 <colspec colwidth="6*" align="right"/>
38018 <tbody>
38019 <row>
38020 <entry><option>envelope_to_add</option></entry>
38021 <entry>Use: <emphasis>transports</emphasis></entry>
38022 <entry>Type: <emphasis>boolean</emphasis></entry>
38023 <entry>Default: <emphasis>false</emphasis></entry>
38024 </row>
38025 </tbody>
38026 </tgroup>
38027 </informaltable>
38028 <para>
38029 <indexterm role="concept">
38030 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38031 </indexterm>
38032 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
38033 This gives the original address(es) in the incoming envelope that caused this
38034 delivery to happen. More than one address may be present if the transport is
38035 configured to handle several addresses at once, or if more than one original
38036 address was redirected to the same final address. As this is not a standard
38037 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
38038 its removal from incoming messages, so that delivered messages can safely be
38039 resent to other recipients.
38040 </para>
38041 <para>
38042 <indexterm role="option">
38043 <primary><option>group</option></primary>
38044 </indexterm>
38045 </para>
38046 <informaltable frame="all">
38047 <tgroup cols="4" colsep="0" rowsep="0">
38048 <colspec colwidth="8*" align="left"/>
38049 <colspec colwidth="6*" align="center"/>
38050 <colspec colwidth="6*" align="center"/>
38051 <colspec colwidth="6*" align="right"/>
38052 <tbody>
38053 <row>
38054 <entry><option>group</option></entry>
38055 <entry>Use: <emphasis>transports</emphasis></entry>
38056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38057 <entry>Default: <emphasis>Exim group</emphasis></entry>
38058 </row>
38059 </tbody>
38060 </tgroup>
38061 </informaltable>
38062 <para>
38063 <indexterm role="concept">
38064 <primary>transport</primary>
38065 <secondary>group; specifying</secondary>
38066 </indexterm>
38067 This option specifies a gid for running the transport process, overriding any
38068 value that the router supplies, and also overriding any value associated with
38069 <option>user</option> (see below).
38070 </para>
38071 <para>
38072 <indexterm role="option">
38073 <primary><option>headers_add</option></primary>
38074 </indexterm>
38075 </para>
38076 <informaltable frame="all">
38077 <tgroup cols="4" colsep="0" rowsep="0">
38078 <colspec colwidth="8*" align="left"/>
38079 <colspec colwidth="6*" align="center"/>
38080 <colspec colwidth="6*" align="center"/>
38081 <colspec colwidth="6*" align="right"/>
38082 <tbody>
38083 <row>
38084 <entry><option>headers_add</option></entry>
38085 <entry>Use: <emphasis>transports</emphasis></entry>
38086 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38087 <entry>Default: <emphasis>unset</emphasis></entry>
38088 </row>
38089 </tbody>
38090 </tgroup>
38091 </informaltable>
38092 <para>
38093 <indexterm role="concept">
38094 <primary>header lines</primary>
38095 <secondary>adding in transport</secondary>
38096 </indexterm>
38097 <indexterm role="concept">
38098 <primary>transport</primary>
38099 <secondary>header lines; adding</secondary>
38100 </indexterm>
38101 This option specifies a list of text headers, newline-separated,
38102 which are (separately) expanded and added to the header
38103 portion of a message as it is transported, as described in section
38104 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
38105 routers. If the result of the expansion is an empty string, or if the expansion
38106 is forced to fail, no action is taken. Other expansion failures are treated as
38107 errors and cause the delivery to be deferred.
38108 </para>
38109 <para>
38110 Unlike most options, <option>headers_add</option> can be specified multiple times
38111 for a transport; all listed headers are added.
38112 </para>
38113 <para>
38114 <indexterm role="option">
38115 <primary><option>headers_only</option></primary>
38116 </indexterm>
38117 </para>
38118 <informaltable frame="all">
38119 <tgroup cols="4" colsep="0" rowsep="0">
38120 <colspec colwidth="8*" align="left"/>
38121 <colspec colwidth="6*" align="center"/>
38122 <colspec colwidth="6*" align="center"/>
38123 <colspec colwidth="6*" align="right"/>
38124 <tbody>
38125 <row>
38126 <entry><option>headers_only</option></entry>
38127 <entry>Use: <emphasis>transports</emphasis></entry>
38128 <entry>Type: <emphasis>boolean</emphasis></entry>
38129 <entry>Default: <emphasis>false</emphasis></entry>
38130 </row>
38131 </tbody>
38132 </tgroup>
38133 </informaltable>
38134 <para>
38135 <indexterm role="concept">
38136 <primary>transport</primary>
38137 <secondary>header lines only</secondary>
38138 </indexterm>
38139 <indexterm role="concept">
38140 <primary>message</primary>
38141 <secondary>transporting headers only</secondary>
38142 </indexterm>
38143 <indexterm role="concept">
38144 <primary>header lines</primary>
38145 <secondary>transporting</secondary>
38146 </indexterm>
38147 If this option is set, the message&#x2019;s body is not transported. It is mutually
38148 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
38149 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
38150 checked, since this option does not automatically suppress them.
38151 </para>
38152 <para>
38153 <indexterm role="option">
38154 <primary><option>headers_remove</option></primary>
38155 </indexterm>
38156 </para>
38157 <informaltable frame="all">
38158 <tgroup cols="4" colsep="0" rowsep="0">
38159 <colspec colwidth="8*" align="left"/>
38160 <colspec colwidth="6*" align="center"/>
38161 <colspec colwidth="6*" align="center"/>
38162 <colspec colwidth="6*" align="right"/>
38163 <tbody>
38164 <row>
38165 <entry><option>headers_remove</option></entry>
38166 <entry>Use: <emphasis>transports</emphasis></entry>
38167 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38168 <entry>Default: <emphasis>unset</emphasis></entry>
38169 </row>
38170 </tbody>
38171 </tgroup>
38172 </informaltable>
38173 <para>
38174 <indexterm role="concept">
38175 <primary>header lines</primary>
38176 <secondary>removing</secondary>
38177 </indexterm>
38178 <indexterm role="concept">
38179 <primary>transport</primary>
38180 <secondary>header lines; removing</secondary>
38181 </indexterm>
38182 This option specifies a list of header names, colon-separated;
38183 these headers are omitted from the message as it is transported, as described
38184 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
38185 routers.
38186 Each list item is separately expanded.
38187 If the result of the expansion is an empty string, or if the expansion
38188 is forced to fail, no action is taken. Other expansion failures are treated as
38189 errors and cause the delivery to be deferred.
38190 </para>
38191 <para>
38192 Unlike most options, <option>headers_remove</option> can be specified multiple times
38193 for a router; all listed headers are removed.
38194 </para>
38195 <para>
38196 <indexterm role="option">
38197 <primary><option>headers_rewrite</option></primary>
38198 </indexterm>
38199 </para>
38200 <informaltable frame="all">
38201 <tgroup cols="4" colsep="0" rowsep="0">
38202 <colspec colwidth="8*" align="left"/>
38203 <colspec colwidth="6*" align="center"/>
38204 <colspec colwidth="6*" align="center"/>
38205 <colspec colwidth="6*" align="right"/>
38206 <tbody>
38207 <row>
38208 <entry><option>headers_rewrite</option></entry>
38209 <entry>Use: <emphasis>transports</emphasis></entry>
38210 <entry>Type: <emphasis>string</emphasis></entry>
38211 <entry>Default: <emphasis>unset</emphasis></entry>
38212 </row>
38213 </tbody>
38214 </tgroup>
38215 </informaltable>
38216 <para>
38217 <indexterm role="concept">
38218 <primary>transport</primary>
38219 <secondary>header lines; rewriting</secondary>
38220 </indexterm>
38221 <indexterm role="concept">
38222 <primary>rewriting</primary>
38223 <secondary>at transport time</secondary>
38224 </indexterm>
38225 This option allows addresses in header lines to be rewritten at transport time,
38226 that is, as the message is being copied to its destination. The contents of the
38227 option are a colon-separated list of rewriting rules. Each rule is in exactly
38228 the same form as one of the general rewriting rules that are applied when a
38229 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
38230 example,
38231 </para>
38232 <literallayout class="monospaced">
38233 headers_rewrite = a@b c@d f : \
38234                   x@y w@z
38235 </literallayout>
38236 <para>
38237 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
38238 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
38239 header lines just before they are written out at transport time, so they affect
38240 only those copies of the message that pass through the transport. However, only
38241 the message&#x2019;s original header lines, and any that were added by a system
38242 filter, are rewritten. If a router or transport adds header lines, they are not
38243 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
38244 envelope. You can change the return path using <option>return_path</option>, but you cannot
38245 change envelope recipients at this time.
38246 </para>
38247 <para>
38248 <indexterm role="option">
38249 <primary><option>home_directory</option></primary>
38250 </indexterm>
38251 </para>
38252 <informaltable frame="all">
38253 <tgroup cols="4" colsep="0" rowsep="0">
38254 <colspec colwidth="8*" align="left"/>
38255 <colspec colwidth="6*" align="center"/>
38256 <colspec colwidth="6*" align="center"/>
38257 <colspec colwidth="6*" align="right"/>
38258 <tbody>
38259 <row>
38260 <entry><option>home_directory</option></entry>
38261 <entry>Use: <emphasis>transports</emphasis></entry>
38262 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38263 <entry>Default: <emphasis>unset</emphasis></entry>
38264 </row>
38265 </tbody>
38266 </tgroup>
38267 </informaltable>
38268 <para>
38269 <indexterm role="concept">
38270 <primary>transport</primary>
38271 <secondary>home directory for</secondary>
38272 </indexterm>
38273 <indexterm role="variable">
38274 <primary><varname>$home</varname></primary>
38275 </indexterm>
38276 This option specifies a home directory setting for a local transport,
38277 overriding any value that may be set by the router. The home directory is
38278 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
38279 used as the current directory if no current directory is set by the
38280 <option>current_directory</option> option on the transport or the
38281 <option>transport_current_directory</option> option on the router. If the expansion fails
38282 for any reason, including forced failure, an error is logged, and delivery is
38283 deferred.
38284 </para>
38285 <para>
38286 <indexterm role="option">
38287 <primary><option>initgroups</option></primary>
38288 </indexterm>
38289 </para>
38290 <informaltable frame="all">
38291 <tgroup cols="4" colsep="0" rowsep="0">
38292 <colspec colwidth="8*" align="left"/>
38293 <colspec colwidth="6*" align="center"/>
38294 <colspec colwidth="6*" align="center"/>
38295 <colspec colwidth="6*" align="right"/>
38296 <tbody>
38297 <row>
38298 <entry><option>initgroups</option></entry>
38299 <entry>Use: <emphasis>transports</emphasis></entry>
38300 <entry>Type: <emphasis>boolean</emphasis></entry>
38301 <entry>Default: <emphasis>false</emphasis></entry>
38302 </row>
38303 </tbody>
38304 </tgroup>
38305 </informaltable>
38306 <para>
38307 <indexterm role="concept">
38308 <primary>additional groups</primary>
38309 </indexterm>
38310 <indexterm role="concept">
38311 <primary>groups</primary>
38312 <secondary>additional</secondary>
38313 </indexterm>
38314 <indexterm role="concept">
38315 <primary>transport</primary>
38316 <secondary>group; additional</secondary>
38317 </indexterm>
38318 If this option is true and the uid for the delivery process is provided by the
38319 transport, the <function>initgroups()</function> function is called when running the transport
38320 to ensure that any additional groups associated with the uid are set up.
38321 </para>
38322 <para>
38323 <indexterm role="option">
38324 <primary><option>message_size_limit</option></primary>
38325 </indexterm>
38326 </para>
38327 <informaltable frame="all">
38328 <tgroup cols="4" colsep="0" rowsep="0">
38329 <colspec colwidth="8*" align="left"/>
38330 <colspec colwidth="6*" align="center"/>
38331 <colspec colwidth="6*" align="center"/>
38332 <colspec colwidth="6*" align="right"/>
38333 <tbody>
38334 <row>
38335 <entry><option>message_size_limit</option></entry>
38336 <entry>Use: <emphasis>transports</emphasis></entry>
38337 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38338 <entry>Default: <emphasis>0</emphasis></entry>
38339 </row>
38340 </tbody>
38341 </tgroup>
38342 </informaltable>
38343 <para>
38344 <indexterm role="concept">
38345 <primary>limit</primary>
38346 <secondary>message size per transport</secondary>
38347 </indexterm>
38348 <indexterm role="concept">
38349 <primary>size</primary>
38350 <secondary>of message, limit</secondary>
38351 </indexterm>
38352 <indexterm role="concept">
38353 <primary>transport</primary>
38354 <secondary>message size; limiting</secondary>
38355 </indexterm>
38356 This option controls the size of messages passed through the transport. It is
38357 expanded before use; the result of the expansion must be a sequence of decimal
38358 digits, optionally followed by K or M. If the expansion fails for any reason,
38359 including forced failure, or if the result is not of the required form,
38360 delivery is deferred. If the value is greater than zero and the size of a
38361 message exceeds this limit, the address is failed. If there is any chance that
38362 the resulting bounce message could be routed to the same transport, you should
38363 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
38364 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
38365 delivered.
38366 </para>
38367 <para>
38368 <indexterm role="option">
38369 <primary><option>rcpt_include_affixes</option></primary>
38370 </indexterm>
38371 </para>
38372 <informaltable frame="all">
38373 <tgroup cols="4" colsep="0" rowsep="0">
38374 <colspec colwidth="8*" align="left"/>
38375 <colspec colwidth="6*" align="center"/>
38376 <colspec colwidth="6*" align="center"/>
38377 <colspec colwidth="6*" align="right"/>
38378 <tbody>
38379 <row>
38380 <entry><option>rcpt_include_affixes</option></entry>
38381 <entry>Use: <emphasis>transports</emphasis></entry>
38382 <entry>Type: <emphasis>boolean</emphasis></entry>
38383 <entry>Default: <emphasis>false</emphasis></entry>
38384 </row>
38385 </tbody>
38386 </tgroup>
38387 </informaltable>
38388 <para>
38389 <indexterm role="concept">
38390 <primary>prefix</primary>
38391 <secondary>for local part, including in envelope</secondary>
38392 </indexterm>
38393 <indexterm role="concept">
38394 <primary>suffix for local part</primary>
38395 <secondary>including in envelope</secondary>
38396 </indexterm>
38397 <indexterm role="concept">
38398 <primary>local part</primary>
38399 <secondary>prefix</secondary>
38400 </indexterm>
38401 <indexterm role="concept">
38402 <primary>local part</primary>
38403 <secondary>suffix</secondary>
38404 </indexterm>
38405 When this option is false (the default), and an address that has had any
38406 affixes (prefixes or suffixes) removed from the local part is delivered by any
38407 form of SMTP or LMTP, the affixes are not included. For example, if a router
38408 that contains
38409 </para>
38410 <literallayout class="monospaced">
38411 local_part_prefix = *-
38412 </literallayout>
38413 <para>
38414 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
38415 is delivered with
38416 </para>
38417 <literallayout class="monospaced">
38418 RCPT TO:&lt;xyz@some.domain&gt;
38419 </literallayout>
38420 <para>
38421 This is also the case when an ACL-time callout is being used to verify a
38422 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
38423 whole local part is included in the RCPT command. This option applies to BSMTP
38424 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
38425 <command>lmtp</command> and <command>smtp</command> transports.
38426 </para>
38427 <para>
38428 <indexterm role="option">
38429 <primary><option>retry_use_local_part</option></primary>
38430 </indexterm>
38431 </para>
38432 <informaltable frame="all">
38433 <tgroup cols="4" colsep="0" rowsep="0">
38434 <colspec colwidth="8*" align="left"/>
38435 <colspec colwidth="6*" align="center"/>
38436 <colspec colwidth="6*" align="center"/>
38437 <colspec colwidth="6*" align="right"/>
38438 <tbody>
38439 <row>
38440 <entry><option>retry_use_local_part</option></entry>
38441 <entry>Use: <emphasis>transports</emphasis></entry>
38442 <entry>Type: <emphasis>boolean</emphasis></entry>
38443 <entry>Default: <emphasis>see below</emphasis></entry>
38444 </row>
38445 </tbody>
38446 </tgroup>
38447 </informaltable>
38448 <para>
38449 <indexterm role="concept">
38450 <primary>hints database</primary>
38451 <secondary>retry keys</secondary>
38452 </indexterm>
38453 When a delivery suffers a temporary failure, a retry record is created
38454 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
38455 is based on the name and/or IP address of the failing remote host. For local
38456 deliveries, the key is normally the entire address, including both the local
38457 part and the domain. This is suitable for most common cases of local delivery
38458 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
38459 deliveries to that mailbox, not to the whole domain.
38460 </para>
38461 <para>
38462 However, in some special cases you may want to treat a temporary local delivery
38463 as a failure associated with the domain, and not with a particular local part.
38464 (For example, if you are storing all mail for some domain in files.) You can do
38465 this by setting <option>retry_use_local_part</option> false.
38466 </para>
38467 <para>
38468 For all the local transports, its default value is true. For remote transports,
38469 the default value is false for tidiness, but changing the value has no effect
38470 on a remote transport in the current implementation.
38471 </para>
38472 <para>
38473 <indexterm role="option">
38474 <primary><option>return_path</option></primary>
38475 </indexterm>
38476 </para>
38477 <informaltable frame="all">
38478 <tgroup cols="4" colsep="0" rowsep="0">
38479 <colspec colwidth="8*" align="left"/>
38480 <colspec colwidth="6*" align="center"/>
38481 <colspec colwidth="6*" align="center"/>
38482 <colspec colwidth="6*" align="right"/>
38483 <tbody>
38484 <row>
38485 <entry><option>return_path</option></entry>
38486 <entry>Use: <emphasis>transports</emphasis></entry>
38487 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38488 <entry>Default: <emphasis>unset</emphasis></entry>
38489 </row>
38490 </tbody>
38491 </tgroup>
38492 </informaltable>
38493 <para>
38494 <indexterm role="concept">
38495 <primary>envelope sender</primary>
38496 </indexterm>
38497 <indexterm role="concept">
38498 <primary>transport</primary>
38499 <secondary>return path; changing</secondary>
38500 </indexterm>
38501 <indexterm role="concept">
38502 <primary>return path</primary>
38503 <secondary>changing in transport</secondary>
38504 </indexterm>
38505 If this option is set, the string is expanded at transport time and replaces
38506 the existing return path (envelope sender) value in the copy of the message
38507 that is being delivered. An empty return path is permitted. This feature is
38508 designed for remote deliveries, where the value of this option is used in the
38509 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
38510 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
38511 header line, if one is added to the message (see the next option).
38512 </para>
38513 <para>
38514 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
38515 <option>return_path_on_delivery</option> to the log selector.
38516 </para>
38517 <para>
38518 <indexterm role="variable">
38519 <primary><varname>$return_path</varname></primary>
38520 </indexterm>
38521 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
38522 either the message&#x2019;s envelope sender, or an address set by the
38523 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
38524 replacement occurs; if it fails for another reason, delivery is deferred. This
38525 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
38526 section <xref linkend="SECTverp"/>.
38527 </para>
38528 <para>
38529 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
38530 remote server rejects a message at SMTP time, the bounce message is not sent to
38531 the value of this option. It is sent to the previously set errors address.
38532 This defaults to the incoming sender address, but can be changed by setting
38533 <option>errors_to</option> in a router.
38534 </para>
38535 <para>
38536 <indexterm role="option">
38537 <primary><option>return_path_add</option></primary>
38538 </indexterm>
38539 </para>
38540 <informaltable frame="all">
38541 <tgroup cols="4" colsep="0" rowsep="0">
38542 <colspec colwidth="8*" align="left"/>
38543 <colspec colwidth="6*" align="center"/>
38544 <colspec colwidth="6*" align="center"/>
38545 <colspec colwidth="6*" align="right"/>
38546 <tbody>
38547 <row>
38548 <entry><option>return_path_add</option></entry>
38549 <entry>Use: <emphasis>transports</emphasis></entry>
38550 <entry>Type: <emphasis>boolean</emphasis></entry>
38551 <entry>Default: <emphasis>false</emphasis></entry>
38552 </row>
38553 </tbody>
38554 </tgroup>
38555 </informaltable>
38556 <para>
38557 <indexterm role="concept">
38558 <primary><emphasis>Return-path:</emphasis> header line</primary>
38559 </indexterm>
38560 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
38561 Although the return path is normally available in the prefix line of BSD
38562 mailboxes, this is commonly not displayed by MUAs, and so the user does not
38563 have easy access to it.
38564 </para>
38565 <para>
38566 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
38567 the delivery SMTP server makes the final delivery</quote>. This implies that this
38568 header should not be present in incoming messages. Exim has a configuration
38569 option, <option>return_path_remove</option>, which requests removal of this header from
38570 incoming messages, so that delivered messages can safely be resent to other
38571 recipients.
38572 </para>
38573 <para>
38574 <indexterm role="option">
38575 <primary><option>shadow_condition</option></primary>
38576 </indexterm>
38577 </para>
38578 <informaltable frame="all">
38579 <tgroup cols="4" colsep="0" rowsep="0">
38580 <colspec colwidth="8*" align="left"/>
38581 <colspec colwidth="6*" align="center"/>
38582 <colspec colwidth="6*" align="center"/>
38583 <colspec colwidth="6*" align="right"/>
38584 <tbody>
38585 <row>
38586 <entry><option>shadow_condition</option></entry>
38587 <entry>Use: <emphasis>transports</emphasis></entry>
38588 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38589 <entry>Default: <emphasis>unset</emphasis></entry>
38590 </row>
38591 </tbody>
38592 </tgroup>
38593 </informaltable>
38594 <para>
38595 See <option>shadow_transport</option> below.
38596 </para>
38597 <para>
38598 <indexterm role="option">
38599 <primary><option>shadow_transport</option></primary>
38600 </indexterm>
38601 </para>
38602 <informaltable frame="all">
38603 <tgroup cols="4" colsep="0" rowsep="0">
38604 <colspec colwidth="8*" align="left"/>
38605 <colspec colwidth="6*" align="center"/>
38606 <colspec colwidth="6*" align="center"/>
38607 <colspec colwidth="6*" align="right"/>
38608 <tbody>
38609 <row>
38610 <entry><option>shadow_transport</option></entry>
38611 <entry>Use: <emphasis>transports</emphasis></entry>
38612 <entry>Type: <emphasis>string</emphasis></entry>
38613 <entry>Default: <emphasis>unset</emphasis></entry>
38614 </row>
38615 </tbody>
38616 </tgroup>
38617 </informaltable>
38618 <para>
38619 <indexterm role="concept">
38620 <primary>shadow transport</primary>
38621 </indexterm>
38622 <indexterm role="concept">
38623 <primary>transport</primary>
38624 <secondary>shadow</secondary>
38625 </indexterm>
38626 A local transport may set the <option>shadow_transport</option> option to the name of
38627 another local transport. Shadow remote transports are not supported.
38628 </para>
38629 <para>
38630 Whenever a delivery to the main transport succeeds, and either
38631 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
38632 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
38633 passed to the shadow transport, with the same delivery address or addresses. If
38634 expansion fails, no action is taken except that non-forced expansion failures
38635 cause a log line to be written.
38636 </para>
38637 <para>
38638 The result of the shadow transport is discarded and does not affect the
38639 subsequent processing of the message. Only a single level of shadowing is
38640 provided; the <option>shadow_transport</option> option is ignored on any transport when it
38641 is running as a shadow. Options concerned with output from pipes are also
38642 ignored. The log line for the successful delivery has an item added on the end,
38643 of the form
38644 </para>
38645 <literallayout class="monospaced">
38646 ST=&lt;shadow transport name&gt;
38647 </literallayout>
38648 <para>
38649 If the shadow transport did not succeed, the error message is put in
38650 parentheses afterwards. Shadow transports can be used for a number of different
38651 purposes, including keeping more detailed log information than Exim normally
38652 provides, and implementing automatic acknowledgment policies based on message
38653 headers that some sites insist on.
38654 </para>
38655 <para>
38656 <indexterm role="option">
38657 <primary><option>transport_filter</option></primary>
38658 </indexterm>
38659 </para>
38660 <informaltable frame="all">
38661 <tgroup cols="4" colsep="0" rowsep="0">
38662 <colspec colwidth="8*" align="left"/>
38663 <colspec colwidth="6*" align="center"/>
38664 <colspec colwidth="6*" align="center"/>
38665 <colspec colwidth="6*" align="right"/>
38666 <tbody>
38667 <row>
38668 <entry><option>transport_filter</option></entry>
38669 <entry>Use: <emphasis>transports</emphasis></entry>
38670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38671 <entry>Default: <emphasis>unset</emphasis></entry>
38672 </row>
38673 </tbody>
38674 </tgroup>
38675 </informaltable>
38676 <para>
38677 <indexterm role="concept">
38678 <primary>transport</primary>
38679 <secondary>filter</secondary>
38680 </indexterm>
38681 <indexterm role="concept">
38682 <primary>filter</primary>
38683 <secondary>transport filter</secondary>
38684 </indexterm>
38685 This option sets up a filtering (in the Unix shell sense) process for messages
38686 at transport time. It should not be confused with mail filtering as set up by
38687 individual users or via a system filter.
38688 </para>
38689 <para>
38690 When the message is about to be written out, the command specified by
38691 <option>transport_filter</option> is started up in a separate, parallel process, and
38692 the entire message, including the header lines, is passed to it on its standard
38693 input (this in fact is done from a third process, to avoid deadlock). The
38694 command must be specified as an absolute path.
38695 </para>
38696 <para>
38697 The lines of the message that are written to the transport filter are
38698 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
38699 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
38700 lines beginning with a dot, and also before any processing implied by the
38701 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
38702 <command>pipe</command> transports.
38703 </para>
38704 <para>
38705 The standard error for the filter process is set to the same destination as its
38706 standard output; this is read and written to the message&#x2019;s ultimate
38707 destination. The process that writes the message to the filter, the
38708 filter itself, and the original process that reads the result and delivers it
38709 are all run in parallel, like a shell pipeline.
38710 </para>
38711 <para>
38712 The filter can perform any transformations it likes, but of course should take
38713 care not to break RFC 2822 syntax. Exim does not check the result, except to
38714 test for a final newline when SMTP is in use. All messages transmitted over
38715 SMTP must end with a newline, so Exim supplies one if it is missing.
38716 </para>
38717 <para>
38718 <indexterm role="concept">
38719 <primary>content scanning</primary>
38720 <secondary>per user</secondary>
38721 </indexterm>
38722 A transport filter can be used to provide content-scanning on a per-user basis
38723 at delivery time if the only required effect of the scan is to modify the
38724 message. For example, a content scan could insert a new header line containing
38725 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
38726 not possible to discard a message at this stage.
38727 </para>
38728 <para>
38729 <indexterm role="concept">
38730 <primary>SMTP</primary>
38731 <secondary>SIZE</secondary>
38732 </indexterm>
38733 A problem might arise if the filter increases the size of a message that is
38734 being sent down an SMTP connection. If the receiving SMTP server has indicated
38735 support for the SIZE parameter, Exim will have sent the size of the message
38736 at the start of the SMTP session. If what is actually sent is substantially
38737 more, the server might reject the message. This can be worked round by setting
38738 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
38739 additions to the message, or to disable the use of SIZE altogether.
38740 </para>
38741 <para>
38742 <indexterm role="variable">
38743 <primary><varname>$pipe_addresses</varname></primary>
38744 </indexterm>
38745 The value of the <option>transport_filter</option> option is the command string for starting
38746 the filter, which is run directly from Exim, not under a shell. The string is
38747 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
38748 Exim breaks it up into arguments and then expands each argument separately (see
38749 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
38750 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
38751 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
38752 an ideal name for this feature here, but as it was already implemented for the
38753 <command>pipe</command> transport, it seemed sensible not to change it.)
38754 </para>
38755 <para>
38756 <indexterm role="variable">
38757 <primary><varname>$host</varname></primary>
38758 </indexterm>
38759 <indexterm role="variable">
38760 <primary><varname>$host_address</varname></primary>
38761 </indexterm>
38762 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
38763 transport is a remote one. They contain the name and IP address of the host to
38764 which the message is being sent. For example:
38765 </para>
38766 <literallayout class="monospaced">
38767 transport_filter = /some/directory/transport-filter.pl \
38768   $host $host_address $sender_address $pipe_addresses
38769 </literallayout>
38770 <para>
38771 Two problems arise if you want to use more complicated expansion items to
38772 generate transport filter commands, both of which due to the fact that the
38773 command is split up <emphasis>before</emphasis> expansion.
38774 </para>
38775 <itemizedlist>
38776 <listitem>
38777 <para>
38778 If an expansion item contains white space, you must quote it, so that it is all
38779 part of the same command item. If the entire option setting is one such
38780 expansion item, you have to take care what kind of quoting you use. For
38781 example:
38782 </para>
38783 <literallayout class="monospaced">
38784 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
38785 </literallayout>
38786 <para>
38787 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
38788 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
38789 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
38790 the single quotes were missing, the line would be split into two items,
38791 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
38792 Exim tried to expand the first one.
38793 </para>
38794 </listitem>
38795 <listitem>
38796 <para>
38797 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
38798 expansion cannot generate multiple arguments, or a command name followed by
38799 arguments. Consider this example:
38800 </para>
38801 <literallayout class="monospaced">
38802 transport_filter = ${lookup{$host}lsearch{/a/file}\
38803                     {$value}{/bin/cat}}
38804 </literallayout>
38805 <para>
38806 The result of the lookup is interpreted as the name of the command, even
38807 if it contains white space. The simplest way round this is to use a shell:
38808 </para>
38809 <literallayout class="monospaced">
38810 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
38811                                {$value}{/bin/cat}}
38812 </literallayout>
38813 </listitem>
38814 </itemizedlist>
38815 <para>
38816 The filter process is run under the same uid and gid as the normal delivery.
38817 For remote deliveries this is the Exim uid/gid by default. The command should
38818 normally yield a zero return code. Transport filters are not supposed to fail.
38819 A non-zero code is taken to mean that the transport filter encountered some
38820 serious problem. Delivery of the message is deferred; the message remains on
38821 the queue and is tried again later. It is not possible to cause a message to be
38822 bounced from a transport filter.
38823 </para>
38824 <para>
38825 If a transport filter is set on an autoreply transport, the original message is
38826 passed through the filter as it is being copied into the newly generated
38827 message, which happens if the <option>return_message</option> option is set.
38828 </para>
38829 <para>
38830 <indexterm role="option">
38831 <primary><option>transport_filter_timeout</option></primary>
38832 </indexterm>
38833 </para>
38834 <informaltable frame="all">
38835 <tgroup cols="4" colsep="0" rowsep="0">
38836 <colspec colwidth="8*" align="left"/>
38837 <colspec colwidth="6*" align="center"/>
38838 <colspec colwidth="6*" align="center"/>
38839 <colspec colwidth="6*" align="right"/>
38840 <tbody>
38841 <row>
38842 <entry><option>transport_filter_timeout</option></entry>
38843 <entry>Use: <emphasis>transports</emphasis></entry>
38844 <entry>Type: <emphasis>time</emphasis></entry>
38845 <entry>Default: <emphasis>5m</emphasis></entry>
38846 </row>
38847 </tbody>
38848 </tgroup>
38849 </informaltable>
38850 <para>
38851 <indexterm role="concept">
38852 <primary>transport</primary>
38853 <secondary>filter, timeout</secondary>
38854 </indexterm>
38855 When Exim is reading the output of a transport filter, it applies a timeout
38856 that can be set by this option. Exceeding the timeout is normally treated as a
38857 temporary delivery failure. However, if a transport filter is used with a
38858 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
38859 way as a timeout in the pipe command itself. By default, a timeout is a hard
38860 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
38861 becomes a temporary error.
38862 </para>
38863 <para>
38864 <indexterm role="option">
38865 <primary><option>user</option></primary>
38866 </indexterm>
38867 </para>
38868 <informaltable frame="all">
38869 <tgroup cols="4" colsep="0" rowsep="0">
38870 <colspec colwidth="8*" align="left"/>
38871 <colspec colwidth="6*" align="center"/>
38872 <colspec colwidth="6*" align="center"/>
38873 <colspec colwidth="6*" align="right"/>
38874 <tbody>
38875 <row>
38876 <entry><option>user</option></entry>
38877 <entry>Use: <emphasis>transports</emphasis></entry>
38878 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38879 <entry>Default: <emphasis>Exim user</emphasis></entry>
38880 </row>
38881 </tbody>
38882 </tgroup>
38883 </informaltable>
38884 <para>
38885 <indexterm role="concept">
38886 <primary>uid (user id)</primary>
38887 <secondary>local delivery</secondary>
38888 </indexterm>
38889 <indexterm role="concept">
38890 <primary>transport</primary>
38891 <secondary>user, specifying</secondary>
38892 </indexterm>
38893 This option specifies the user under whose uid the delivery process is to be
38894 run, overriding any uid that may have been set by the router. If the user is
38895 given as a name, the uid is looked up from the password data, and the
38896 associated group is taken as the value of the gid to be used if the <option>group</option>
38897 option is not set.
38898 </para>
38899 <para>
38900 For deliveries that use local transports, a user and group are normally
38901 specified explicitly or implicitly (for example, as a result of
38902 <option>check_local_user</option>) by the router or transport.
38903 </para>
38904 <para>
38905 <indexterm role="concept">
38906 <primary>hints database</primary>
38907 <secondary>access by remote transport</secondary>
38908 </indexterm>
38909 For remote transports, you should leave this option unset unless you really are
38910 sure you know what you are doing. When a remote transport is running, it needs
38911 to be able to access Exim&#x2019;s hints databases, because each host may have its own
38912 retry data.
38913 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
38914 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
38915 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
38916 </para>
38917 </chapter>
38918
38919 <chapter id="CHAPbatching">
38920 <title>Address batching in local transports</title>
38921 <titleabbrev>Address batching</titleabbrev>
38922 <para>
38923 <indexterm role="concept">
38924 <primary>transport</primary>
38925 <secondary>local; address batching in</secondary>
38926 </indexterm>
38927 The only remote transport (<command>smtp</command>) is normally configured to handle more than
38928 one address at a time, so that when several addresses are routed to the same
38929 remote host, just one copy of the message is sent. Local transports, however,
38930 normally handle one address at a time. That is, a separate instance of the
38931 transport is run for each address that is routed to the transport. A separate
38932 copy of the message is delivered each time.
38933 </para>
38934 <para>
38935 <indexterm role="concept">
38936 <primary>batched local delivery</primary>
38937 </indexterm>
38938 <indexterm role="option">
38939 <primary><option>batch_max</option></primary>
38940 </indexterm>
38941 <indexterm role="option">
38942 <primary><option>batch_id</option></primary>
38943 </indexterm>
38944 In special cases, it may be desirable to handle several addresses at once in a
38945 local transport, for example:
38946 </para>
38947 <itemizedlist>
38948 <listitem>
38949 <para>
38950 In an <command>appendfile</command> transport, when storing messages in files for later
38951 delivery by some other means, a single copy of the message with multiple
38952 recipients saves space.
38953 </para>
38954 </listitem>
38955 <listitem>
38956 <para>
38957 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
38958 a single copy saves time, and is the normal way LMTP is expected to work.
38959 </para>
38960 </listitem>
38961 <listitem>
38962 <para>
38963 In a <command>pipe</command> transport, when passing the message
38964 to a scanner program or
38965 to some other delivery mechanism such as UUCP, multiple recipients may be
38966 acceptable.
38967 </para>
38968 </listitem>
38969 </itemizedlist>
38970 <para>
38971 These three local transports all have the same options for controlling multiple
38972 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
38973 repeating the information for each transport, these options are described here.
38974 </para>
38975 <para>
38976 The <option>batch_max</option> option specifies the maximum number of addresses that can be
38977 delivered together in a single run of the transport. Its default value is one
38978 (no batching). When more than one address is routed to a transport that has a
38979 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
38980 (that is, in a single run of the transport with multiple recipients), subject
38981 to certain conditions:
38982 </para>
38983 <itemizedlist>
38984 <listitem>
38985 <para>
38986 <indexterm role="variable">
38987 <primary><varname>$local_part</varname></primary>
38988 </indexterm>
38989 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
38990 batching is possible.
38991 </para>
38992 </listitem>
38993 <listitem>
38994 <para>
38995 <indexterm role="variable">
38996 <primary><varname>$domain</varname></primary>
38997 </indexterm>
38998 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
38999 addresses with the same domain are batched.
39000 </para>
39001 </listitem>
39002 <listitem>
39003 <para>
39004 <indexterm role="concept">
39005 <primary>customizing</primary>
39006 <secondary>batching condition</secondary>
39007 </indexterm>
39008 If <option>batch_id</option> is set, it is expanded for each address, and only those
39009 addresses with the same expanded value are batched. This allows you to specify
39010 customized batching conditions. Failure of the expansion for any reason,
39011 including forced failure, disables batching, but it does not stop the delivery
39012 from taking place.
39013 </para>
39014 </listitem>
39015 <listitem>
39016 <para>
39017 Batched addresses must also have the same errors address (where to send
39018 delivery errors), the same header additions and removals, the same user and
39019 group for the transport, and if a host list is present, the first host must
39020 be the same.
39021 </para>
39022 </listitem>
39023 </itemizedlist>
39024 <para>
39025 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
39026 both when the file or pipe command is specified in the transport, and when it
39027 is specified by a <command>redirect</command> router, but all the batched addresses must of
39028 course be routed to the same file or pipe command. These two transports have an
39029 option called <option>use_bsmtp</option>, which causes them to deliver the message in
39030 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
39031 <option>check_string</option> and <option>escape_string</option> options are forced to the values
39032 </para>
39033 <literallayout class="monospaced">
39034 check_string = "."
39035 escape_string = ".."
39036 </literallayout>
39037 <para>
39038 when batched SMTP is in use. A full description of the batch SMTP mechanism is
39039 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
39040 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
39041 </para>
39042 <para>
39043 <indexterm role="concept">
39044 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39045 </indexterm>
39046 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
39047 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
39048 that are being processed together. If you are using a batching <command>appendfile</command>
39049 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
39050 addresses is to set the <option>envelope_to_add</option> option.
39051 </para>
39052 <para>
39053 <indexterm role="concept">
39054 <primary><command>pipe</command> transport</primary>
39055 <secondary>with multiple addresses</secondary>
39056 </indexterm>
39057 <indexterm role="variable">
39058 <primary><varname>$pipe_addresses</varname></primary>
39059 </indexterm>
39060 If you are using a <command>pipe</command> transport without BSMTP, and setting the
39061 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
39062 the command. This is not a true variable; it is a bit of magic that causes each
39063 of the recipient addresses to be inserted into the command as a separate
39064 argument. This provides a way of accessing all the addresses that are being
39065 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
39066 are specified by a <command>redirect</command> router.
39067 </para>
39068 </chapter>
39069
39070 <chapter id="CHAPappendfile">
39071 <title>The appendfile transport</title>
39072 <para>
39073 <indexterm role="concept" id="IIDapptra1" class="startofrange">
39074 <primary><command>appendfile</command> transport</primary>
39075 </indexterm>
39076 <indexterm role="concept" id="IIDapptra2" class="startofrange">
39077 <primary>transports</primary>
39078 <secondary><command>appendfile</command></secondary>
39079 </indexterm>
39080 <indexterm role="concept">
39081 <primary>directory creation</primary>
39082 </indexterm>
39083 <indexterm role="concept">
39084 <primary>creating directories</primary>
39085 </indexterm>
39086 The <command>appendfile</command> transport delivers a message by appending it to an existing
39087 file, or by creating an entirely new file in a specified directory. Single
39088 files to which messages are appended can be in the traditional Unix mailbox
39089 format, or optionally in the MBX format supported by the Pine MUA and
39090 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
39091 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
39092 to give added protection against failures that happen part-way through the
39093 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
39094 supported. For all file formats, Exim attempts to create as many levels of
39095 directory as necessary, provided that <option>create_directory</option> is set.
39096 </para>
39097 <para>
39098 The code for the optional formats is not included in the Exim binary by
39099 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
39100 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
39101 included.
39102 </para>
39103 <para>
39104 <indexterm role="concept">
39105 <primary>quota</primary>
39106 <secondary>system</secondary>
39107 </indexterm>
39108 Exim recognizes system quota errors, and generates an appropriate message. Exim
39109 also supports its own quota control within the transport, for use when the
39110 system facility is unavailable or cannot be used for some reason.
39111 </para>
39112 <para>
39113 If there is an error while appending to a file (for example, quota exceeded or
39114 partition filled), Exim attempts to reset the file&#x2019;s length and last
39115 modification time back to what they were before. If there is an error while
39116 creating an entirely new file, the new file is removed.
39117 </para>
39118 <para>
39119 Before appending to a file, a number of security checks are made, and the
39120 file is locked. A detailed description is given below, after the list of
39121 private options.
39122 </para>
39123 <para>
39124 The <command>appendfile</command> transport is most commonly used for local deliveries to
39125 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
39126 putting messages into files for remote delivery by some means other than Exim.
39127 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
39128 option).
39129 </para>
39130 <section id="SECTfildiropt">
39131 <title>The file and directory options</title>
39132 <para>
39133 The <option>file</option> option specifies a single file, to which the message is appended;
39134 the <option>directory</option> option specifies a directory, in which a new file containing
39135 the message is created. Only one of these two options can be set, and for
39136 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
39137 </para>
39138 <para>
39139 <indexterm role="variable">
39140 <primary><varname>$address_file</varname></primary>
39141 </indexterm>
39142 <indexterm role="variable">
39143 <primary><varname>$local_part</varname></primary>
39144 </indexterm>
39145 However, <command>appendfile</command> is also used for delivering messages to files or
39146 directories whose names (or parts of names) are obtained from alias,
39147 forwarding, or filtering operations (for example, a <option>save</option> command in a
39148 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
39149 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
39150 name (or partial name) of the file or directory generated by the redirection
39151 operation. There are two cases:
39152 </para>
39153 <itemizedlist>
39154 <listitem>
39155 <para>
39156 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
39157 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
39158 common case when users with local accounts use filtering to sort mail into
39159 different folders. See for example, the <command>address_file</command> transport in the
39160 default configuration. If the path ends with a slash, it is assumed to be the
39161 name of a directory. A delivery to a directory can also be forced by setting
39162 <option>maildir_format</option> or <option>mailstore_format</option>.
39163 </para>
39164 </listitem>
39165 <listitem>
39166 <para>
39167 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
39168 used to determine the file or directory name for the delivery. Normally, the
39169 contents of <varname>$address_file</varname> are used in some way in the string expansion.
39170 </para>
39171 </listitem>
39172 </itemizedlist>
39173 <para>
39174 <indexterm role="concept">
39175 <primary>Sieve filter</primary>
39176 <secondary>configuring <command>appendfile</command></secondary>
39177 </indexterm>
39178 <indexterm role="concept">
39179 <primary>Sieve filter</primary>
39180 <secondary>relative mailbox path handling</secondary>
39181 </indexterm>
39182 As an example of the second case, consider an environment where users do not
39183 have home directories. They may be permitted to use Exim filter commands of the
39184 form:
39185 </para>
39186 <literallayout class="monospaced">
39187 save folder23
39188 </literallayout>
39189 <para>
39190 or Sieve filter commands of the form:
39191 </para>
39192 <literallayout class="monospaced">
39193 require "fileinto";
39194 fileinto "folder23";
39195 </literallayout>
39196 <para>
39197 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
39198 must transform the relative path into an appropriate absolute file name. In the
39199 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
39200 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
39201 way of handling this requirement:
39202 </para>
39203 <literallayout class="monospaced">
39204 file = ${if eq{$address_file}{inbox} \
39205             {/var/mail/$local_part} \
39206             {${if eq{${substr_0_1:$address_file}}{/} \
39207                   {$address_file} \
39208                   {$home/mail/$address_file} \
39209             }} \
39210        }
39211 </literallayout>
39212 <para>
39213 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
39214 location, absolute paths are used without change, and other folders are in the
39215 <filename>mail</filename> directory within the home directory.
39216 </para>
39217 <para>
39218 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
39219 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
39220 the router. In particular, this is the case if <option>check_local_user</option> is set. If
39221 you want to prevent this happening at routing time, you can set
39222 <option>router_home_directory</option> empty. This forces the router to pass the relative
39223 path to the transport.
39224 </para>
39225 <para>
39226 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
39227 the <option>file</option> or <option>directory</option> option is still used if it is set.
39228 </para>
39229 </section>
39230 <section id="SECID134">
39231 <title>Private options for appendfile</title>
39232 <para>
39233 <indexterm role="concept">
39234 <primary>options</primary>
39235 <secondary><command>appendfile</command> transport</secondary>
39236 </indexterm>
39237 </para>
39238 <para>
39239 <indexterm role="option">
39240 <primary><option>allow_fifo</option></primary>
39241 </indexterm>
39242 </para>
39243 <informaltable frame="all">
39244 <tgroup cols="4" colsep="0" rowsep="0">
39245 <colspec colwidth="8*" align="left"/>
39246 <colspec colwidth="6*" align="center"/>
39247 <colspec colwidth="6*" align="center"/>
39248 <colspec colwidth="6*" align="right"/>
39249 <tbody>
39250 <row>
39251 <entry><option>allow_fifo</option></entry>
39252 <entry>Use: <emphasis>appendfile</emphasis></entry>
39253 <entry>Type: <emphasis>boolean</emphasis></entry>
39254 <entry>Default: <emphasis>false</emphasis></entry>
39255 </row>
39256 </tbody>
39257 </tgroup>
39258 </informaltable>
39259 <para>
39260 <indexterm role="concept">
39261 <primary>fifo (named pipe)</primary>
39262 </indexterm>
39263 <indexterm role="concept">
39264 <primary>named pipe (fifo)</primary>
39265 </indexterm>
39266 <indexterm role="concept">
39267 <primary>pipe</primary>
39268 <secondary>named (fifo)</secondary>
39269 </indexterm>
39270 Setting this option permits delivery to named pipes (FIFOs) as well as to
39271 regular files. If no process is reading the named pipe at delivery time, the
39272 delivery is deferred.
39273 </para>
39274 <para>
39275 <indexterm role="option">
39276 <primary><option>allow_symlink</option></primary>
39277 </indexterm>
39278 </para>
39279 <informaltable frame="all">
39280 <tgroup cols="4" colsep="0" rowsep="0">
39281 <colspec colwidth="8*" align="left"/>
39282 <colspec colwidth="6*" align="center"/>
39283 <colspec colwidth="6*" align="center"/>
39284 <colspec colwidth="6*" align="right"/>
39285 <tbody>
39286 <row>
39287 <entry><option>allow_symlink</option></entry>
39288 <entry>Use: <emphasis>appendfile</emphasis></entry>
39289 <entry>Type: <emphasis>boolean</emphasis></entry>
39290 <entry>Default: <emphasis>false</emphasis></entry>
39291 </row>
39292 </tbody>
39293 </tgroup>
39294 </informaltable>
39295 <para>
39296 <indexterm role="concept">
39297 <primary>symbolic link</primary>
39298 <secondary>to mailbox</secondary>
39299 </indexterm>
39300 <indexterm role="concept">
39301 <primary>mailbox</primary>
39302 <secondary>symbolic link</secondary>
39303 </indexterm>
39304 By default, <command>appendfile</command> will not deliver if the path name for the file is
39305 that of a symbolic link. Setting this option relaxes that constraint, but there
39306 are security issues involved in the use of symbolic links. Be sure you know
39307 what you are doing if you set this. Details of exactly what this option affects
39308 are included in the discussion which follows this list of options.
39309 </para>
39310 <para>
39311 <indexterm role="option">
39312 <primary><option>batch_id</option></primary>
39313 </indexterm>
39314 </para>
39315 <informaltable frame="all">
39316 <tgroup cols="4" colsep="0" rowsep="0">
39317 <colspec colwidth="8*" align="left"/>
39318 <colspec colwidth="6*" align="center"/>
39319 <colspec colwidth="6*" align="center"/>
39320 <colspec colwidth="6*" align="right"/>
39321 <tbody>
39322 <row>
39323 <entry><option>batch_id</option></entry>
39324 <entry>Use: <emphasis>appendfile</emphasis></entry>
39325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39326 <entry>Default: <emphasis>unset</emphasis></entry>
39327 </row>
39328 </tbody>
39329 </tgroup>
39330 </informaltable>
39331 <para>
39332 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39333 However, batching is automatically disabled for <command>appendfile</command> deliveries that
39334 happen as a result of forwarding or aliasing or other redirection directly to a
39335 file.
39336 </para>
39337 <para>
39338 <indexterm role="option">
39339 <primary><option>batch_max</option></primary>
39340 </indexterm>
39341 </para>
39342 <informaltable frame="all">
39343 <tgroup cols="4" colsep="0" rowsep="0">
39344 <colspec colwidth="8*" align="left"/>
39345 <colspec colwidth="6*" align="center"/>
39346 <colspec colwidth="6*" align="center"/>
39347 <colspec colwidth="6*" align="right"/>
39348 <tbody>
39349 <row>
39350 <entry><option>batch_max</option></entry>
39351 <entry>Use: <emphasis>appendfile</emphasis></entry>
39352 <entry>Type: <emphasis>integer</emphasis></entry>
39353 <entry>Default: <emphasis>1</emphasis></entry>
39354 </row>
39355 </tbody>
39356 </tgroup>
39357 </informaltable>
39358 <para>
39359 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39360 </para>
39361 <para>
39362 <indexterm role="option">
39363 <primary><option>check_group</option></primary>
39364 </indexterm>
39365 </para>
39366 <informaltable frame="all">
39367 <tgroup cols="4" colsep="0" rowsep="0">
39368 <colspec colwidth="8*" align="left"/>
39369 <colspec colwidth="6*" align="center"/>
39370 <colspec colwidth="6*" align="center"/>
39371 <colspec colwidth="6*" align="right"/>
39372 <tbody>
39373 <row>
39374 <entry><option>check_group</option></entry>
39375 <entry>Use: <emphasis>appendfile</emphasis></entry>
39376 <entry>Type: <emphasis>boolean</emphasis></entry>
39377 <entry>Default: <emphasis>false</emphasis></entry>
39378 </row>
39379 </tbody>
39380 </tgroup>
39381 </informaltable>
39382 <para>
39383 When this option is set, the group owner of the file defined by the <option>file</option>
39384 option is checked to see that it is the same as the group under which the
39385 delivery process is running. The default setting is false because the default
39386 file mode is 0600, which means that the group is irrelevant.
39387 </para>
39388 <para>
39389 <indexterm role="option">
39390 <primary><option>check_owner</option></primary>
39391 </indexterm>
39392 </para>
39393 <informaltable frame="all">
39394 <tgroup cols="4" colsep="0" rowsep="0">
39395 <colspec colwidth="8*" align="left"/>
39396 <colspec colwidth="6*" align="center"/>
39397 <colspec colwidth="6*" align="center"/>
39398 <colspec colwidth="6*" align="right"/>
39399 <tbody>
39400 <row>
39401 <entry><option>check_owner</option></entry>
39402 <entry>Use: <emphasis>appendfile</emphasis></entry>
39403 <entry>Type: <emphasis>boolean</emphasis></entry>
39404 <entry>Default: <emphasis>true</emphasis></entry>
39405 </row>
39406 </tbody>
39407 </tgroup>
39408 </informaltable>
39409 <para>
39410 When this option is set, the owner of the file defined by the <option>file</option> option
39411 is checked to ensure that it is the same as the user under which the delivery
39412 process is running.
39413 </para>
39414 <para>
39415 <indexterm role="option">
39416 <primary><option>check_string</option></primary>
39417 </indexterm>
39418 </para>
39419 <informaltable frame="all">
39420 <tgroup cols="4" colsep="0" rowsep="0">
39421 <colspec colwidth="8*" align="left"/>
39422 <colspec colwidth="6*" align="center"/>
39423 <colspec colwidth="6*" align="center"/>
39424 <colspec colwidth="6*" align="right"/>
39425 <tbody>
39426 <row>
39427 <entry><option>check_string</option></entry>
39428 <entry>Use: <emphasis>appendfile</emphasis></entry>
39429 <entry>Type: <emphasis>string</emphasis></entry>
39430 <entry>Default: <emphasis>see below</emphasis></entry>
39431 </row>
39432 </tbody>
39433 </tgroup>
39434 </informaltable>
39435 <para>
39436 <indexterm role="concept">
39437 <primary><quote>From</quote> line</primary>
39438 </indexterm>
39439 As <command>appendfile</command> writes the message, the start of each line is tested for
39440 matching <option>check_string</option>, and if it does, the initial matching characters are
39441 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
39442 a literal string, not a regular expression, and the case of any letters it
39443 contains is significant.
39444 </para>
39445 <para>
39446 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
39447 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
39448 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
39449 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
39450 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
39451 </para>
39452 <para>
39453 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
39454 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
39455 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
39456 if another format is used. For example, to deliver to mailboxes in MMDF format:
39457 <indexterm role="concept">
39458 <primary>MMDF format mailbox</primary>
39459 </indexterm>
39460 <indexterm role="concept">
39461 <primary>mailbox</primary>
39462 <secondary>MMDF format</secondary>
39463 </indexterm>
39464 </para>
39465 <literallayout class="monospaced">
39466 check_string = "\1\1\1\1\n"
39467 escape_string = "\1\1\1\1 \n"
39468 message_prefix = "\1\1\1\1\n"
39469 message_suffix = "\1\1\1\1\n"
39470 </literallayout>
39471 <para>
39472 <indexterm role="option">
39473 <primary><option>create_directory</option></primary>
39474 </indexterm>
39475 </para>
39476 <informaltable frame="all">
39477 <tgroup cols="4" colsep="0" rowsep="0">
39478 <colspec colwidth="8*" align="left"/>
39479 <colspec colwidth="6*" align="center"/>
39480 <colspec colwidth="6*" align="center"/>
39481 <colspec colwidth="6*" align="right"/>
39482 <tbody>
39483 <row>
39484 <entry><option>create_directory</option></entry>
39485 <entry>Use: <emphasis>appendfile</emphasis></entry>
39486 <entry>Type: <emphasis>boolean</emphasis></entry>
39487 <entry>Default: <emphasis>true</emphasis></entry>
39488 </row>
39489 </tbody>
39490 </tgroup>
39491 </informaltable>
39492 <para>
39493 <indexterm role="concept">
39494 <primary>directory creation</primary>
39495 </indexterm>
39496 When this option is true, Exim attempts to create any missing superior
39497 directories for the file that it is about to write. A created directory&#x2019;s mode
39498 is given by the <option>directory_mode</option> option.
39499 </para>
39500 <para>
39501 The group ownership of a newly created directory is highly dependent on the
39502 operating system (and possibly the file system) that is being used. For
39503 example, in Solaris, if the parent directory has the setgid bit set, its group
39504 is propagated to the child; if not, the currently set group is used. However,
39505 in FreeBSD, the parent&#x2019;s group is always used.
39506 </para>
39507 <para>
39508 <indexterm role="option">
39509 <primary><option>create_file</option></primary>
39510 </indexterm>
39511 </para>
39512 <informaltable frame="all">
39513 <tgroup cols="4" colsep="0" rowsep="0">
39514 <colspec colwidth="8*" align="left"/>
39515 <colspec colwidth="6*" align="center"/>
39516 <colspec colwidth="6*" align="center"/>
39517 <colspec colwidth="6*" align="right"/>
39518 <tbody>
39519 <row>
39520 <entry><option>create_file</option></entry>
39521 <entry>Use: <emphasis>appendfile</emphasis></entry>
39522 <entry>Type: <emphasis>string</emphasis></entry>
39523 <entry>Default: <emphasis>anywhere</emphasis></entry>
39524 </row>
39525 </tbody>
39526 </tgroup>
39527 </informaltable>
39528 <para>
39529 This option constrains the location of files and directories that are created
39530 by this transport. It applies to files defined by the <option>file</option> option and
39531 directories defined by the <option>directory</option> option. In the case of maildir
39532 delivery, it applies to the top level directory, not the maildir directories
39533 beneath.
39534 </para>
39535 <para>
39536 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
39537 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
39538 set for the transport. This option is not useful when an explicit file name is
39539 given for normal mailbox deliveries. It is intended for the case when file
39540 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
39541 by an <command>appendfile</command> transport called <option>address_file</option>. See also
39542 <option>file_must_exist</option>.
39543 </para>
39544 <para>
39545 <indexterm role="option">
39546 <primary><option>directory</option></primary>
39547 </indexterm>
39548 </para>
39549 <informaltable frame="all">
39550 <tgroup cols="4" colsep="0" rowsep="0">
39551 <colspec colwidth="8*" align="left"/>
39552 <colspec colwidth="6*" align="center"/>
39553 <colspec colwidth="6*" align="center"/>
39554 <colspec colwidth="6*" align="right"/>
39555 <tbody>
39556 <row>
39557 <entry><option>directory</option></entry>
39558 <entry>Use: <emphasis>appendfile</emphasis></entry>
39559 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39560 <entry>Default: <emphasis>unset</emphasis></entry>
39561 </row>
39562 </tbody>
39563 </tgroup>
39564 </informaltable>
39565 <para>
39566 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
39567 or <option>directory</option> must be set, unless the delivery is the direct result of a
39568 redirection (see section <xref linkend="SECTfildiropt"/>).
39569 </para>
39570 <para>
39571 When <option>directory</option> is set, the string is expanded, and the message is delivered
39572 into a new file or files in or below the given directory, instead of being
39573 appended to a single mailbox file. A number of different formats are provided
39574 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
39575 <xref linkend="SECTopdir"/> for further details of this form of delivery.
39576 </para>
39577 <para>
39578 <indexterm role="option">
39579 <primary><option>directory_file</option></primary>
39580 </indexterm>
39581 </para>
39582 <informaltable frame="all">
39583 <tgroup cols="4" colsep="0" rowsep="0">
39584 <colspec colwidth="8*" align="left"/>
39585 <colspec colwidth="6*" align="center"/>
39586 <colspec colwidth="6*" align="center"/>
39587 <colspec colwidth="6*" align="right"/>
39588 <tbody>
39589 <row>
39590 <entry><option>directory_file</option></entry>
39591 <entry>Use: <emphasis>appendfile</emphasis></entry>
39592 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39593 <entry>Default: <emphasis>see below</emphasis></entry>
39594 </row>
39595 </tbody>
39596 </tgroup>
39597 </informaltable>
39598 <para>
39599 <indexterm role="concept">
39600 <primary>base62</primary>
39601 </indexterm>
39602 <indexterm role="variable">
39603 <primary><varname>$inode</varname></primary>
39604 </indexterm>
39605 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
39606 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
39607 whose name is obtained by expanding this string. The default value is:
39608 </para>
39609 <literallayout class="monospaced">
39610 q${base62:$tod_epoch}-$inode
39611 </literallayout>
39612 <para>
39613 This generates a unique name from the current time, in base 62 form, and the
39614 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
39615 option.
39616 </para>
39617 <para>
39618 <indexterm role="option">
39619 <primary><option>directory_mode</option></primary>
39620 </indexterm>
39621 </para>
39622 <informaltable frame="all">
39623 <tgroup cols="4" colsep="0" rowsep="0">
39624 <colspec colwidth="8*" align="left"/>
39625 <colspec colwidth="6*" align="center"/>
39626 <colspec colwidth="6*" align="center"/>
39627 <colspec colwidth="6*" align="right"/>
39628 <tbody>
39629 <row>
39630 <entry><option>directory_mode</option></entry>
39631 <entry>Use: <emphasis>appendfile</emphasis></entry>
39632 <entry>Type: <emphasis>octal integer</emphasis></entry>
39633 <entry>Default: <emphasis>0700</emphasis></entry>
39634 </row>
39635 </tbody>
39636 </tgroup>
39637 </informaltable>
39638 <para>
39639 If <command>appendfile</command> creates any directories as a result of the
39640 <option>create_directory</option> option, their mode is specified by this option.
39641 </para>
39642 <para>
39643 <indexterm role="option">
39644 <primary><option>escape_string</option></primary>
39645 </indexterm>
39646 </para>
39647 <informaltable frame="all">
39648 <tgroup cols="4" colsep="0" rowsep="0">
39649 <colspec colwidth="8*" align="left"/>
39650 <colspec colwidth="6*" align="center"/>
39651 <colspec colwidth="6*" align="center"/>
39652 <colspec colwidth="6*" align="right"/>
39653 <tbody>
39654 <row>
39655 <entry><option>escape_string</option></entry>
39656 <entry>Use: <emphasis>appendfile</emphasis></entry>
39657 <entry>Type: <emphasis>string</emphasis></entry>
39658 <entry>Default: <emphasis>see description</emphasis></entry>
39659 </row>
39660 </tbody>
39661 </tgroup>
39662 </informaltable>
39663 <para>
39664 See <option>check_string</option> above.
39665 </para>
39666 <para>
39667 <indexterm role="option">
39668 <primary><option>file</option></primary>
39669 </indexterm>
39670 </para>
39671 <informaltable frame="all">
39672 <tgroup cols="4" colsep="0" rowsep="0">
39673 <colspec colwidth="8*" align="left"/>
39674 <colspec colwidth="6*" align="center"/>
39675 <colspec colwidth="6*" align="center"/>
39676 <colspec colwidth="6*" align="right"/>
39677 <tbody>
39678 <row>
39679 <entry><option>file</option></entry>
39680 <entry>Use: <emphasis>appendfile</emphasis></entry>
39681 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39682 <entry>Default: <emphasis>unset</emphasis></entry>
39683 </row>
39684 </tbody>
39685 </tgroup>
39686 </informaltable>
39687 <para>
39688 This option is mutually exclusive with the <option>directory</option> option, but one of
39689 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
39690 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
39691 specifies a single file, to which the message is appended. One or more of
39692 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
39693 <option>file</option>.
39694 </para>
39695 <para>
39696 <indexterm role="concept">
39697 <primary>NFS</primary>
39698 <secondary>lock file</secondary>
39699 </indexterm>
39700 <indexterm role="concept">
39701 <primary>locking files</primary>
39702 </indexterm>
39703 <indexterm role="concept">
39704 <primary>lock files</primary>
39705 </indexterm>
39706 If you are using more than one host to deliver over NFS into the same
39707 mailboxes, you should always use lock files.
39708 </para>
39709 <para>
39710 The string value is expanded for each delivery, and must yield an absolute
39711 path. The most common settings of this option are variations on one of these
39712 examples:
39713 </para>
39714 <literallayout class="monospaced">
39715 file = /var/spool/mail/$local_part
39716 file = /home/$local_part/inbox
39717 file = $home/inbox
39718 </literallayout>
39719 <para>
39720 <indexterm role="concept">
39721 <primary><quote>sticky</quote> bit</primary>
39722 </indexterm>
39723 In the first example, all deliveries are done into the same directory. If Exim
39724 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
39725 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
39726 deliveries to be possible, or alternatively the <option>group</option> option can be used to
39727 run the delivery under a group id which has write access to the directory.
39728 </para>
39729 <para>
39730 <indexterm role="option">
39731 <primary><option>file_format</option></primary>
39732 </indexterm>
39733 </para>
39734 <informaltable frame="all">
39735 <tgroup cols="4" colsep="0" rowsep="0">
39736 <colspec colwidth="8*" align="left"/>
39737 <colspec colwidth="6*" align="center"/>
39738 <colspec colwidth="6*" align="center"/>
39739 <colspec colwidth="6*" align="right"/>
39740 <tbody>
39741 <row>
39742 <entry><option>file_format</option></entry>
39743 <entry>Use: <emphasis>appendfile</emphasis></entry>
39744 <entry>Type: <emphasis>string</emphasis></entry>
39745 <entry>Default: <emphasis>unset</emphasis></entry>
39746 </row>
39747 </tbody>
39748 </tgroup>
39749 </informaltable>
39750 <para>
39751 <indexterm role="concept">
39752 <primary>file</primary>
39753 <secondary>mailbox; checking existing format</secondary>
39754 </indexterm>
39755 This option requests the transport to check the format of an existing file
39756 before adding to it. The check consists of matching a specific string at the
39757 start of the file. The value of the option consists of an even number of
39758 colon-separated strings. The first of each pair is the test string, and the
39759 second is the name of a transport. If the transport associated with a matched
39760 string is not the current transport, control is passed over to the other
39761 transport. For example, suppose the standard <command>local_delivery</command> transport has
39762 this added to it:
39763 </para>
39764 <literallayout class="monospaced">
39765 file_format = "From       : local_delivery :\
39766                \1\1\1\1\n : local_mmdf_delivery"
39767 </literallayout>
39768 <para>
39769 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
39770 a mailbox begins with four binary ones followed by a newline, control is passed
39771 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
39772 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
39773 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
39774 match any string, or if the transport named for a given string is not defined,
39775 delivery is deferred.
39776 </para>
39777 <para>
39778 <indexterm role="option">
39779 <primary><option>file_must_exist</option></primary>
39780 </indexterm>
39781 </para>
39782 <informaltable frame="all">
39783 <tgroup cols="4" colsep="0" rowsep="0">
39784 <colspec colwidth="8*" align="left"/>
39785 <colspec colwidth="6*" align="center"/>
39786 <colspec colwidth="6*" align="center"/>
39787 <colspec colwidth="6*" align="right"/>
39788 <tbody>
39789 <row>
39790 <entry><option>file_must_exist</option></entry>
39791 <entry>Use: <emphasis>appendfile</emphasis></entry>
39792 <entry>Type: <emphasis>boolean</emphasis></entry>
39793 <entry>Default: <emphasis>false</emphasis></entry>
39794 </row>
39795 </tbody>
39796 </tgroup>
39797 </informaltable>
39798 <para>
39799 If this option is true, the file specified by the <option>file</option> option must exist.
39800 A temporary error occurs if it does not, causing delivery to be deferred.
39801 If this option is false, the file is created if it does not exist.
39802 </para>
39803 <para>
39804 <indexterm role="option">
39805 <primary><option>lock_fcntl_timeout</option></primary>
39806 </indexterm>
39807 </para>
39808 <informaltable frame="all">
39809 <tgroup cols="4" colsep="0" rowsep="0">
39810 <colspec colwidth="8*" align="left"/>
39811 <colspec colwidth="6*" align="center"/>
39812 <colspec colwidth="6*" align="center"/>
39813 <colspec colwidth="6*" align="right"/>
39814 <tbody>
39815 <row>
39816 <entry><option>lock_fcntl_timeout</option></entry>
39817 <entry>Use: <emphasis>appendfile</emphasis></entry>
39818 <entry>Type: <emphasis>time</emphasis></entry>
39819 <entry>Default: <emphasis>0s</emphasis></entry>
39820 </row>
39821 </tbody>
39822 </tgroup>
39823 </informaltable>
39824 <para>
39825 <indexterm role="concept">
39826 <primary>timeout</primary>
39827 <secondary>mailbox locking</secondary>
39828 </indexterm>
39829 <indexterm role="concept">
39830 <primary>mailbox</primary>
39831 <secondary>locking, blocking and non-blocking</secondary>
39832 </indexterm>
39833 <indexterm role="concept">
39834 <primary>locking files</primary>
39835 </indexterm>
39836 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
39837 when locking an open mailbox file. If the call fails, the delivery process
39838 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
39839 Non-blocking calls are used so that the file is not kept open during the wait
39840 for the lock; the reason for this is to make it as safe as possible for
39841 deliveries over NFS in the case when processes might be accessing an NFS
39842 mailbox without using a lock file. This should not be done, but
39843 misunderstandings and hence misconfigurations are not unknown.
39844 </para>
39845 <para>
39846 On a busy system, however, the performance of a non-blocking lock approach is
39847 not as good as using a blocking lock with a timeout. In this case, the waiting
39848 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
39849 and can proceed as soon as the previous lock holder releases it.
39850 </para>
39851 <para>
39852 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
39853 timeout, are used. There may still be some retrying: the maximum number of
39854 retries is
39855 </para>
39856 <literallayout class="monospaced">
39857 (lock_retries * lock_interval) / lock_fcntl_timeout
39858 </literallayout>
39859 <para>
39860 rounded up to the next whole number. In other words, the total time during
39861 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
39862 <option>lock_fcntl_timeout</option> is set very large.
39863 </para>
39864 <para>
39865 You should consider setting this option if you are getting a lot of delayed
39866 local deliveries because of errors of the form
39867 </para>
39868 <literallayout class="monospaced">
39869 failed to lock mailbox /some/file (fcntl)
39870 </literallayout>
39871 <para>
39872 <indexterm role="option">
39873 <primary><option>lock_flock_timeout</option></primary>
39874 </indexterm>
39875 </para>
39876 <informaltable frame="all">
39877 <tgroup cols="4" colsep="0" rowsep="0">
39878 <colspec colwidth="8*" align="left"/>
39879 <colspec colwidth="6*" align="center"/>
39880 <colspec colwidth="6*" align="center"/>
39881 <colspec colwidth="6*" align="right"/>
39882 <tbody>
39883 <row>
39884 <entry><option>lock_flock_timeout</option></entry>
39885 <entry>Use: <emphasis>appendfile</emphasis></entry>
39886 <entry>Type: <emphasis>time</emphasis></entry>
39887 <entry>Default: <emphasis>0s</emphasis></entry>
39888 </row>
39889 </tbody>
39890 </tgroup>
39891 </informaltable>
39892 <para>
39893 This timeout applies to file locking when using <function>flock()</function> (see
39894 <option>use_flock</option>); the timeout operates in a similar manner to
39895 <option>lock_fcntl_timeout</option>.
39896 </para>
39897 <para>
39898 <indexterm role="option">
39899 <primary><option>lock_interval</option></primary>
39900 </indexterm>
39901 </para>
39902 <informaltable frame="all">
39903 <tgroup cols="4" colsep="0" rowsep="0">
39904 <colspec colwidth="8*" align="left"/>
39905 <colspec colwidth="6*" align="center"/>
39906 <colspec colwidth="6*" align="center"/>
39907 <colspec colwidth="6*" align="right"/>
39908 <tbody>
39909 <row>
39910 <entry><option>lock_interval</option></entry>
39911 <entry>Use: <emphasis>appendfile</emphasis></entry>
39912 <entry>Type: <emphasis>time</emphasis></entry>
39913 <entry>Default: <emphasis>3s</emphasis></entry>
39914 </row>
39915 </tbody>
39916 </tgroup>
39917 </informaltable>
39918 <para>
39919 This specifies the time to wait between attempts to lock the file. See below
39920 for details of locking.
39921 </para>
39922 <para>
39923 <indexterm role="option">
39924 <primary><option>lock_retries</option></primary>
39925 </indexterm>
39926 </para>
39927 <informaltable frame="all">
39928 <tgroup cols="4" colsep="0" rowsep="0">
39929 <colspec colwidth="8*" align="left"/>
39930 <colspec colwidth="6*" align="center"/>
39931 <colspec colwidth="6*" align="center"/>
39932 <colspec colwidth="6*" align="right"/>
39933 <tbody>
39934 <row>
39935 <entry><option>lock_retries</option></entry>
39936 <entry>Use: <emphasis>appendfile</emphasis></entry>
39937 <entry>Type: <emphasis>integer</emphasis></entry>
39938 <entry>Default: <emphasis>10</emphasis></entry>
39939 </row>
39940 </tbody>
39941 </tgroup>
39942 </informaltable>
39943 <para>
39944 This specifies the maximum number of attempts to lock the file. A value of zero
39945 is treated as 1. See below for details of locking.
39946 </para>
39947 <para>
39948 <indexterm role="option">
39949 <primary><option>lockfile_mode</option></primary>
39950 </indexterm>
39951 </para>
39952 <informaltable frame="all">
39953 <tgroup cols="4" colsep="0" rowsep="0">
39954 <colspec colwidth="8*" align="left"/>
39955 <colspec colwidth="6*" align="center"/>
39956 <colspec colwidth="6*" align="center"/>
39957 <colspec colwidth="6*" align="right"/>
39958 <tbody>
39959 <row>
39960 <entry><option>lockfile_mode</option></entry>
39961 <entry>Use: <emphasis>appendfile</emphasis></entry>
39962 <entry>Type: <emphasis>octal integer</emphasis></entry>
39963 <entry>Default: <emphasis>0600</emphasis></entry>
39964 </row>
39965 </tbody>
39966 </tgroup>
39967 </informaltable>
39968 <para>
39969 This specifies the mode of the created lock file, when a lock file is being
39970 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
39971 </para>
39972 <para>
39973 <indexterm role="option">
39974 <primary><option>lockfile_timeout</option></primary>
39975 </indexterm>
39976 </para>
39977 <informaltable frame="all">
39978 <tgroup cols="4" colsep="0" rowsep="0">
39979 <colspec colwidth="8*" align="left"/>
39980 <colspec colwidth="6*" align="center"/>
39981 <colspec colwidth="6*" align="center"/>
39982 <colspec colwidth="6*" align="right"/>
39983 <tbody>
39984 <row>
39985 <entry><option>lockfile_timeout</option></entry>
39986 <entry>Use: <emphasis>appendfile</emphasis></entry>
39987 <entry>Type: <emphasis>time</emphasis></entry>
39988 <entry>Default: <emphasis>30m</emphasis></entry>
39989 </row>
39990 </tbody>
39991 </tgroup>
39992 </informaltable>
39993 <para>
39994 <indexterm role="concept">
39995 <primary>timeout</primary>
39996 <secondary>mailbox locking</secondary>
39997 </indexterm>
39998 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
39999 exists and is older than this value, it is assumed to have been left behind by
40000 accident, and Exim attempts to remove it.
40001 </para>
40002 <para>
40003 <indexterm role="option">
40004 <primary><option>mailbox_filecount</option></primary>
40005 </indexterm>
40006 </para>
40007 <informaltable frame="all">
40008 <tgroup cols="4" colsep="0" rowsep="0">
40009 <colspec colwidth="8*" align="left"/>
40010 <colspec colwidth="6*" align="center"/>
40011 <colspec colwidth="6*" align="center"/>
40012 <colspec colwidth="6*" align="right"/>
40013 <tbody>
40014 <row>
40015 <entry><option>mailbox_filecount</option></entry>
40016 <entry>Use: <emphasis>appendfile</emphasis></entry>
40017 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40018 <entry>Default: <emphasis>unset</emphasis></entry>
40019 </row>
40020 </tbody>
40021 </tgroup>
40022 </informaltable>
40023 <para>
40024 <indexterm role="concept">
40025 <primary>mailbox</primary>
40026 <secondary>specifying size of</secondary>
40027 </indexterm>
40028 <indexterm role="concept">
40029 <primary>size</primary>
40030 <secondary>of mailbox</secondary>
40031 </indexterm>
40032 If this option is set, it is expanded, and the result is taken as the current
40033 number of files in the mailbox. It must be a decimal number, optionally
40034 followed by K or M. This provides a way of obtaining this information from an
40035 external source that maintains the data.
40036 </para>
40037 <para>
40038 <indexterm role="option">
40039 <primary><option>mailbox_size</option></primary>
40040 </indexterm>
40041 </para>
40042 <informaltable frame="all">
40043 <tgroup cols="4" colsep="0" rowsep="0">
40044 <colspec colwidth="8*" align="left"/>
40045 <colspec colwidth="6*" align="center"/>
40046 <colspec colwidth="6*" align="center"/>
40047 <colspec colwidth="6*" align="right"/>
40048 <tbody>
40049 <row>
40050 <entry><option>mailbox_size</option></entry>
40051 <entry>Use: <emphasis>appendfile</emphasis></entry>
40052 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40053 <entry>Default: <emphasis>unset</emphasis></entry>
40054 </row>
40055 </tbody>
40056 </tgroup>
40057 </informaltable>
40058 <para>
40059 <indexterm role="concept">
40060 <primary>mailbox</primary>
40061 <secondary>specifying size of</secondary>
40062 </indexterm>
40063 <indexterm role="concept">
40064 <primary>size</primary>
40065 <secondary>of mailbox</secondary>
40066 </indexterm>
40067 If this option is set, it is expanded, and the result is taken as the current
40068 size the mailbox. It must be a decimal number, optionally followed by K or M.
40069 This provides a way of obtaining this information from an external source that
40070 maintains the data. This is likely to be helpful for maildir deliveries where
40071 it is computationally expensive to compute the size of a mailbox.
40072 </para>
40073 <para>
40074 <indexterm role="option">
40075 <primary><option>maildir_format</option></primary>
40076 </indexterm>
40077 </para>
40078 <informaltable frame="all">
40079 <tgroup cols="4" colsep="0" rowsep="0">
40080 <colspec colwidth="8*" align="left"/>
40081 <colspec colwidth="6*" align="center"/>
40082 <colspec colwidth="6*" align="center"/>
40083 <colspec colwidth="6*" align="right"/>
40084 <tbody>
40085 <row>
40086 <entry><option>maildir_format</option></entry>
40087 <entry>Use: <emphasis>appendfile</emphasis></entry>
40088 <entry>Type: <emphasis>boolean</emphasis></entry>
40089 <entry>Default: <emphasis>false</emphasis></entry>
40090 </row>
40091 </tbody>
40092 </tgroup>
40093 </informaltable>
40094 <para>
40095 <indexterm role="concept">
40096 <primary>maildir format</primary>
40097 <secondary>specifying</secondary>
40098 </indexterm>
40099 If this option is set with the <option>directory</option> option, the delivery is into a new
40100 file, in the <quote>maildir</quote> format that is used by other mail software. When the
40101 transport is activated directly from a <command>redirect</command> router (for example, the
40102 <command>address_file</command> transport in the default configuration), setting
40103 <option>maildir_format</option> causes the path received from the router to be treated as a
40104 directory, whether or not it ends with <literal>/</literal>. This option is available only if
40105 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
40106 <xref linkend="SECTmaildirdelivery"/> below for further details.
40107 </para>
40108 <para>
40109 <indexterm role="option">
40110 <primary><option>maildir_quota_directory_regex</option></primary>
40111 </indexterm>
40112 </para>
40113 <informaltable frame="all">
40114 <tgroup cols="4" colsep="0" rowsep="0">
40115 <colspec colwidth="8*" align="left"/>
40116 <colspec colwidth="6*" align="center"/>
40117 <colspec colwidth="6*" align="center"/>
40118 <colspec colwidth="6*" align="right"/>
40119 <tbody>
40120 <row>
40121 <entry><option>maildir_quota_directory_regex</option></entry>
40122 <entry>Use: <emphasis>appendfile</emphasis></entry>
40123 <entry>Type: <emphasis>string</emphasis></entry>
40124 <entry>Default: <emphasis>See below</emphasis></entry>
40125 </row>
40126 </tbody>
40127 </tgroup>
40128 </informaltable>
40129 <para>
40130 <indexterm role="concept">
40131 <primary>maildir format</primary>
40132 <secondary>quota; directories included in</secondary>
40133 </indexterm>
40134 <indexterm role="concept">
40135 <primary>quota</primary>
40136 <secondary>maildir; directories included in</secondary>
40137 </indexterm>
40138 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
40139 a regular expression for specifying directories, relative to the quota
40140 directory (see <option>quota_directory</option>), that should be included in the quota
40141 calculation. The default value is:
40142 </para>
40143 <literallayout class="monospaced">
40144 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
40145 </literallayout>
40146 <para>
40147 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
40148 (directories whose names begin with a dot). If you want to exclude the
40149 <filename>Trash</filename>
40150 folder from the count (as some sites do), you need to change this setting to
40151 </para>
40152 <literallayout class="monospaced">
40153 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
40154 </literallayout>
40155 <para>
40156 This uses a negative lookahead in the regular expression to exclude the
40157 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
40158 calculations, quota processing is bypassed for any messages that are delivered
40159 directly into that directory.
40160 </para>
40161 <para>
40162 <indexterm role="option">
40163 <primary><option>maildir_retries</option></primary>
40164 </indexterm>
40165 </para>
40166 <informaltable frame="all">
40167 <tgroup cols="4" colsep="0" rowsep="0">
40168 <colspec colwidth="8*" align="left"/>
40169 <colspec colwidth="6*" align="center"/>
40170 <colspec colwidth="6*" align="center"/>
40171 <colspec colwidth="6*" align="right"/>
40172 <tbody>
40173 <row>
40174 <entry><option>maildir_retries</option></entry>
40175 <entry>Use: <emphasis>appendfile</emphasis></entry>
40176 <entry>Type: <emphasis>integer</emphasis></entry>
40177 <entry>Default: <emphasis>10</emphasis></entry>
40178 </row>
40179 </tbody>
40180 </tgroup>
40181 </informaltable>
40182 <para>
40183 This option specifies the number of times to retry when writing a file in
40184 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
40185 </para>
40186 <para>
40187 <indexterm role="option">
40188 <primary><option>maildir_tag</option></primary>
40189 </indexterm>
40190 </para>
40191 <informaltable frame="all">
40192 <tgroup cols="4" colsep="0" rowsep="0">
40193 <colspec colwidth="8*" align="left"/>
40194 <colspec colwidth="6*" align="center"/>
40195 <colspec colwidth="6*" align="center"/>
40196 <colspec colwidth="6*" align="right"/>
40197 <tbody>
40198 <row>
40199 <entry><option>maildir_tag</option></entry>
40200 <entry>Use: <emphasis>appendfile</emphasis></entry>
40201 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40202 <entry>Default: <emphasis>unset</emphasis></entry>
40203 </row>
40204 </tbody>
40205 </tgroup>
40206 </informaltable>
40207 <para>
40208 This option applies only to deliveries in maildir format, and is described in
40209 section <xref linkend="SECTmaildirdelivery"/> below.
40210 </para>
40211 <para>
40212 <indexterm role="option">
40213 <primary><option>maildir_use_size_file</option></primary>
40214 </indexterm>
40215 </para>
40216 <informaltable frame="all">
40217 <tgroup cols="4" colsep="0" rowsep="0">
40218 <colspec colwidth="8*" align="left"/>
40219 <colspec colwidth="6*" align="center"/>
40220 <colspec colwidth="6*" align="center"/>
40221 <colspec colwidth="6*" align="right"/>
40222 <tbody>
40223 <row>
40224 <entry><option>maildir_use_size_file</option></entry>
40225 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
40226 <entry>Type: <emphasis>boolean</emphasis></entry>
40227 <entry>Default: <emphasis>false</emphasis></entry>
40228 </row>
40229 </tbody>
40230 </tgroup>
40231 </informaltable>
40232 <para>
40233 <indexterm role="concept">
40234 <primary>maildir format</primary>
40235 <secondary><filename>maildirsize</filename> file</secondary>
40236 </indexterm>
40237 The result of string expansion for this option must be a valid boolean value.
40238 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
40239 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
40240 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
40241 value is zero. See <option>maildir_quota_directory_regex</option> above and section
40242 <xref linkend="SECTmaildirdelivery"/> below for further details.
40243 </para>
40244 <para>
40245 <indexterm role="option">
40246 <primary><option>maildirfolder_create_regex</option></primary>
40247 </indexterm>
40248 </para>
40249 <informaltable frame="all">
40250 <tgroup cols="4" colsep="0" rowsep="0">
40251 <colspec colwidth="8*" align="left"/>
40252 <colspec colwidth="6*" align="center"/>
40253 <colspec colwidth="6*" align="center"/>
40254 <colspec colwidth="6*" align="right"/>
40255 <tbody>
40256 <row>
40257 <entry><option>maildirfolder_create_regex</option></entry>
40258 <entry>Use: <emphasis>appendfile</emphasis></entry>
40259 <entry>Type: <emphasis>string</emphasis></entry>
40260 <entry>Default: <emphasis>unset</emphasis></entry>
40261 </row>
40262 </tbody>
40263 </tgroup>
40264 </informaltable>
40265 <para>
40266 <indexterm role="concept">
40267 <primary>maildir format</primary>
40268 <secondary><filename>maildirfolder</filename> file</secondary>
40269 </indexterm>
40270 <indexterm role="concept">
40271 <primary><filename>maildirfolder</filename>, creating</primary>
40272 </indexterm>
40273 The value of this option is a regular expression. If it is unset, it has no
40274 effect. Otherwise, before a maildir delivery takes place, the pattern is
40275 matched against the name of the maildir directory, that is, the directory
40276 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
40277 delivery. If there is a match, Exim checks for the existence of a file called
40278 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
40279 See section <xref linkend="SECTmaildirdelivery"/> for more details.
40280 </para>
40281 <para>
40282 <indexterm role="option">
40283 <primary><option>mailstore_format</option></primary>
40284 </indexterm>
40285 </para>
40286 <informaltable frame="all">
40287 <tgroup cols="4" colsep="0" rowsep="0">
40288 <colspec colwidth="8*" align="left"/>
40289 <colspec colwidth="6*" align="center"/>
40290 <colspec colwidth="6*" align="center"/>
40291 <colspec colwidth="6*" align="right"/>
40292 <tbody>
40293 <row>
40294 <entry><option>mailstore_format</option></entry>
40295 <entry>Use: <emphasis>appendfile</emphasis></entry>
40296 <entry>Type: <emphasis>boolean</emphasis></entry>
40297 <entry>Default: <emphasis>false</emphasis></entry>
40298 </row>
40299 </tbody>
40300 </tgroup>
40301 </informaltable>
40302 <para>
40303 <indexterm role="concept">
40304 <primary>mailstore format</primary>
40305 <secondary>specifying</secondary>
40306 </indexterm>
40307 If this option is set with the <option>directory</option> option, the delivery is into two
40308 new files in  <quote>mailstore</quote> format. The option is available only if
40309 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
40310 below for further details.
40311 </para>
40312 <para>
40313 <indexterm role="option">
40314 <primary><option>mailstore_prefix</option></primary>
40315 </indexterm>
40316 </para>
40317 <informaltable frame="all">
40318 <tgroup cols="4" colsep="0" rowsep="0">
40319 <colspec colwidth="8*" align="left"/>
40320 <colspec colwidth="6*" align="center"/>
40321 <colspec colwidth="6*" align="center"/>
40322 <colspec colwidth="6*" align="right"/>
40323 <tbody>
40324 <row>
40325 <entry><option>mailstore_prefix</option></entry>
40326 <entry>Use: <emphasis>appendfile</emphasis></entry>
40327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40328 <entry>Default: <emphasis>unset</emphasis></entry>
40329 </row>
40330 </tbody>
40331 </tgroup>
40332 </informaltable>
40333 <para>
40334 This option applies only to deliveries in mailstore format, and is described in
40335 section <xref linkend="SECTopdir"/> below.
40336 </para>
40337 <para>
40338 <indexterm role="option">
40339 <primary><option>mailstore_suffix</option></primary>
40340 </indexterm>
40341 </para>
40342 <informaltable frame="all">
40343 <tgroup cols="4" colsep="0" rowsep="0">
40344 <colspec colwidth="8*" align="left"/>
40345 <colspec colwidth="6*" align="center"/>
40346 <colspec colwidth="6*" align="center"/>
40347 <colspec colwidth="6*" align="right"/>
40348 <tbody>
40349 <row>
40350 <entry><option>mailstore_suffix</option></entry>
40351 <entry>Use: <emphasis>appendfile</emphasis></entry>
40352 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40353 <entry>Default: <emphasis>unset</emphasis></entry>
40354 </row>
40355 </tbody>
40356 </tgroup>
40357 </informaltable>
40358 <para>
40359 This option applies only to deliveries in mailstore format, and is described in
40360 section <xref linkend="SECTopdir"/> below.
40361 </para>
40362 <para>
40363 <indexterm role="option">
40364 <primary><option>mbx_format</option></primary>
40365 </indexterm>
40366 </para>
40367 <informaltable frame="all">
40368 <tgroup cols="4" colsep="0" rowsep="0">
40369 <colspec colwidth="8*" align="left"/>
40370 <colspec colwidth="6*" align="center"/>
40371 <colspec colwidth="6*" align="center"/>
40372 <colspec colwidth="6*" align="right"/>
40373 <tbody>
40374 <row>
40375 <entry><option>mbx_format</option></entry>
40376 <entry>Use: <emphasis>appendfile</emphasis></entry>
40377 <entry>Type: <emphasis>boolean</emphasis></entry>
40378 <entry>Default: <emphasis>false</emphasis></entry>
40379 </row>
40380 </tbody>
40381 </tgroup>
40382 </informaltable>
40383 <para>
40384 <indexterm role="concept">
40385 <primary>locking files</primary>
40386 </indexterm>
40387 <indexterm role="concept">
40388 <primary>file</primary>
40389 <secondary>locking</secondary>
40390 </indexterm>
40391 <indexterm role="concept">
40392 <primary>file</primary>
40393 <secondary>MBX format</secondary>
40394 </indexterm>
40395 <indexterm role="concept">
40396 <primary>MBX format, specifying</primary>
40397 </indexterm>
40398 This option is available only if Exim has been compiled with SUPPORT_MBX
40399 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
40400 the message is appended to the mailbox file in MBX format instead of
40401 traditional Unix format. This format is supported by Pine4 and its associated
40402 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
40403 </para>
40404 <para>
40405 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
40406 automatically changed by the use of <option>mbx_format</option>. They should normally be set
40407 empty when using MBX format, so this option almost always appears in this
40408 combination:
40409 </para>
40410 <literallayout class="monospaced">
40411 mbx_format = true
40412 message_prefix =
40413 message_suffix =
40414 </literallayout>
40415 <para>
40416 If none of the locking options are mentioned in the configuration,
40417 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
40418 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
40419 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
40420 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
40421 should not be used if any program that does not use this form of locking is
40422 going to access the mailbox, nor should it be used if the mailbox file is NFS
40423 mounted, because it works only when the mailbox is accessed from a single host.
40424 </para>
40425 <para>
40426 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
40427 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
40428 (this means for the whole of a Pine or IMAP session), Exim will not be able to
40429 append messages to it.
40430 </para>
40431 <para>
40432 <indexterm role="option">
40433 <primary><option>message_prefix</option></primary>
40434 </indexterm>
40435 </para>
40436 <informaltable frame="all">
40437 <tgroup cols="4" colsep="0" rowsep="0">
40438 <colspec colwidth="8*" align="left"/>
40439 <colspec colwidth="6*" align="center"/>
40440 <colspec colwidth="6*" align="center"/>
40441 <colspec colwidth="6*" align="right"/>
40442 <tbody>
40443 <row>
40444 <entry><option>message_prefix</option></entry>
40445 <entry>Use: <emphasis>appendfile</emphasis></entry>
40446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40447 <entry>Default: <emphasis>see below</emphasis></entry>
40448 </row>
40449 </tbody>
40450 </tgroup>
40451 </informaltable>
40452 <para>
40453 <indexterm role="concept">
40454 <primary><quote>From</quote> line</primary>
40455 </indexterm>
40456 The string specified here is expanded and output at the start of every message.
40457 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40458 in which case it is:
40459 </para>
40460 <literallayout class="monospaced">
40461 message_prefix = "From ${if def:return_path{$return_path}\
40462   {MAILER-DAEMON}} $tod_bsdinbox\n"
40463 </literallayout>
40464 <para>
40465 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40466 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40467 </para>
40468 <para>
40469 <indexterm role="option">
40470 <primary><option>message_suffix</option></primary>
40471 </indexterm>
40472 </para>
40473 <informaltable frame="all">
40474 <tgroup cols="4" colsep="0" rowsep="0">
40475 <colspec colwidth="8*" align="left"/>
40476 <colspec colwidth="6*" align="center"/>
40477 <colspec colwidth="6*" align="center"/>
40478 <colspec colwidth="6*" align="right"/>
40479 <tbody>
40480 <row>
40481 <entry><option>message_suffix</option></entry>
40482 <entry>Use: <emphasis>appendfile</emphasis></entry>
40483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40484 <entry>Default: <emphasis>see below</emphasis></entry>
40485 </row>
40486 </tbody>
40487 </tgroup>
40488 </informaltable>
40489 <para>
40490 The string specified here is expanded and output at the end of every message.
40491 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40492 in which case it is a single newline character. The suffix can be suppressed by
40493 setting
40494 </para>
40495 <literallayout class="monospaced">
40496 message_suffix =
40497 </literallayout>
40498 <para>
40499 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40500 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40501 </para>
40502 <para>
40503 <indexterm role="option">
40504 <primary><option>mode</option></primary>
40505 </indexterm>
40506 </para>
40507 <informaltable frame="all">
40508 <tgroup cols="4" colsep="0" rowsep="0">
40509 <colspec colwidth="8*" align="left"/>
40510 <colspec colwidth="6*" align="center"/>
40511 <colspec colwidth="6*" align="center"/>
40512 <colspec colwidth="6*" align="right"/>
40513 <tbody>
40514 <row>
40515 <entry><option>mode</option></entry>
40516 <entry>Use: <emphasis>appendfile</emphasis></entry>
40517 <entry>Type: <emphasis>octal integer</emphasis></entry>
40518 <entry>Default: <emphasis>0600</emphasis></entry>
40519 </row>
40520 </tbody>
40521 </tgroup>
40522 </informaltable>
40523 <para>
40524 If the output file is created, it is given this mode. If it already exists and
40525 has wider permissions, they are reduced to this mode. If it has narrower
40526 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
40527 if the delivery is the result of a <option>save</option> command in a filter file specifying
40528 a particular mode, the mode of the output file is always forced to take that
40529 value, and this option is ignored.
40530 </para>
40531 <para>
40532 <indexterm role="option">
40533 <primary><option>mode_fail_narrower</option></primary>
40534 </indexterm>
40535 </para>
40536 <informaltable frame="all">
40537 <tgroup cols="4" colsep="0" rowsep="0">
40538 <colspec colwidth="8*" align="left"/>
40539 <colspec colwidth="6*" align="center"/>
40540 <colspec colwidth="6*" align="center"/>
40541 <colspec colwidth="6*" align="right"/>
40542 <tbody>
40543 <row>
40544 <entry><option>mode_fail_narrower</option></entry>
40545 <entry>Use: <emphasis>appendfile</emphasis></entry>
40546 <entry>Type: <emphasis>boolean</emphasis></entry>
40547 <entry>Default: <emphasis>true</emphasis></entry>
40548 </row>
40549 </tbody>
40550 </tgroup>
40551 </informaltable>
40552 <para>
40553 This option applies in the case when an existing mailbox file has a narrower
40554 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
40555 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
40556 continues with the delivery attempt, using the existing mode of the file.
40557 </para>
40558 <para>
40559 <indexterm role="option">
40560 <primary><option>notify_comsat</option></primary>
40561 </indexterm>
40562 </para>
40563 <informaltable frame="all">
40564 <tgroup cols="4" colsep="0" rowsep="0">
40565 <colspec colwidth="8*" align="left"/>
40566 <colspec colwidth="6*" align="center"/>
40567 <colspec colwidth="6*" align="center"/>
40568 <colspec colwidth="6*" align="right"/>
40569 <tbody>
40570 <row>
40571 <entry><option>notify_comsat</option></entry>
40572 <entry>Use: <emphasis>appendfile</emphasis></entry>
40573 <entry>Type: <emphasis>boolean</emphasis></entry>
40574 <entry>Default: <emphasis>false</emphasis></entry>
40575 </row>
40576 </tbody>
40577 </tgroup>
40578 </informaltable>
40579 <para>
40580 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
40581 successful delivery to a user mailbox. This is the daemon that notifies logged
40582 on users about incoming mail.
40583 </para>
40584 <para>
40585 <indexterm role="option">
40586 <primary><option>quota</option></primary>
40587 </indexterm>
40588 </para>
40589 <informaltable frame="all">
40590 <tgroup cols="4" colsep="0" rowsep="0">
40591 <colspec colwidth="8*" align="left"/>
40592 <colspec colwidth="6*" align="center"/>
40593 <colspec colwidth="6*" align="center"/>
40594 <colspec colwidth="6*" align="right"/>
40595 <tbody>
40596 <row>
40597 <entry><option>quota</option></entry>
40598 <entry>Use: <emphasis>appendfile</emphasis></entry>
40599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40600 <entry>Default: <emphasis>unset</emphasis></entry>
40601 </row>
40602 </tbody>
40603 </tgroup>
40604 </informaltable>
40605 <para>
40606 <indexterm role="concept">
40607 <primary>quota</primary>
40608 <secondary>imposed by Exim</secondary>
40609 </indexterm>
40610 This option imposes a limit on the size of the file to which Exim is appending,
40611 or to the total space used in the directory tree when the <option>directory</option> option
40612 is set. In the latter case, computation of the space used is expensive, because
40613 all the files in the directory (and any sub-directories) have to be
40614 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
40615 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
40616 have no shell access to their mailboxes).
40617 </para>
40618 <para>
40619 As there is no interlock against two simultaneous deliveries into a
40620 multi-file mailbox, it is possible for the quota to be overrun in this case.
40621 For single-file mailboxes, of course, an interlock is a necessity.
40622 </para>
40623 <para>
40624 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
40625 may be a lot less than the actual amount of disk space allocated to the file.
40626 If the sizes of a number of files are being added up, the rounding effect can
40627 become quite noticeable, especially on systems that have large block sizes.
40628 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
40629 the obvious value which users understand most easily.
40630 </para>
40631 <para>
40632 The value of the option is expanded, and must then be a numerical value
40633 (decimal point allowed), optionally followed by one of the letters K, M, or G,
40634 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
40635 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
40636 be handled.
40637 </para>
40638 <para>
40639 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
40640 </para>
40641 <para>
40642 The expansion happens while Exim is running as root, before it changes uid for
40643 the delivery. This means that files that are inaccessible to the end user can
40644 be used to hold quota values that are looked up in the expansion. When delivery
40645 fails because this quota is exceeded, the handling of the error is as for
40646 system quota failures.
40647 </para>
40648 <para>
40649 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
40650 mailbox to the specified maximum size, though the value is not accurate to the
40651 last byte, owing to separator lines and additional headers that may get added
40652 during message delivery. When a mailbox is nearly full, large messages may get
40653 refused even though small ones are accepted, because the size of the current
40654 message is added to the quota when the check is made. This behaviour can be
40655 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
40656 for exceeding the quota does not include the current message. Thus, deliveries
40657 continue until the quota has been exceeded; thereafter, no further messages are
40658 delivered. See also <option>quota_warn_threshold</option>.
40659 </para>
40660 <para>
40661 <indexterm role="option">
40662 <primary><option>quota_directory</option></primary>
40663 </indexterm>
40664 </para>
40665 <informaltable frame="all">
40666 <tgroup cols="4" colsep="0" rowsep="0">
40667 <colspec colwidth="8*" align="left"/>
40668 <colspec colwidth="6*" align="center"/>
40669 <colspec colwidth="6*" align="center"/>
40670 <colspec colwidth="6*" align="right"/>
40671 <tbody>
40672 <row>
40673 <entry><option>quota_directory</option></entry>
40674 <entry>Use: <emphasis>appendfile</emphasis></entry>
40675 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40676 <entry>Default: <emphasis>unset</emphasis></entry>
40677 </row>
40678 </tbody>
40679 </tgroup>
40680 </informaltable>
40681 <para>
40682 This option defines the directory to check for quota purposes when delivering
40683 into individual files. The default is the delivery directory, or, if a file
40684 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
40685 delivery directory.
40686 </para>
40687 <para>
40688 <indexterm role="option">
40689 <primary><option>quota_filecount</option></primary>
40690 </indexterm>
40691 </para>
40692 <informaltable frame="all">
40693 <tgroup cols="4" colsep="0" rowsep="0">
40694 <colspec colwidth="8*" align="left"/>
40695 <colspec colwidth="6*" align="center"/>
40696 <colspec colwidth="6*" align="center"/>
40697 <colspec colwidth="6*" align="right"/>
40698 <tbody>
40699 <row>
40700 <entry><option>quota_filecount</option></entry>
40701 <entry>Use: <emphasis>appendfile</emphasis></entry>
40702 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40703 <entry>Default: <emphasis>0</emphasis></entry>
40704 </row>
40705 </tbody>
40706 </tgroup>
40707 </informaltable>
40708 <para>
40709 This option applies when the <option>directory</option> option is set. It limits the total
40710 number of files in the directory (compare the inode limit in system quotas). It
40711 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
40712 failure causes delivery to be deferred. A value of zero is interpreted as
40713 <quote>no quota</quote>.
40714 </para>
40715 <para>
40716 <indexterm role="option">
40717 <primary><option>quota_is_inclusive</option></primary>
40718 </indexterm>
40719 </para>
40720 <informaltable frame="all">
40721 <tgroup cols="4" colsep="0" rowsep="0">
40722 <colspec colwidth="8*" align="left"/>
40723 <colspec colwidth="6*" align="center"/>
40724 <colspec colwidth="6*" align="center"/>
40725 <colspec colwidth="6*" align="right"/>
40726 <tbody>
40727 <row>
40728 <entry><option>quota_is_inclusive</option></entry>
40729 <entry>Use: <emphasis>appendfile</emphasis></entry>
40730 <entry>Type: <emphasis>boolean</emphasis></entry>
40731 <entry>Default: <emphasis>true</emphasis></entry>
40732 </row>
40733 </tbody>
40734 </tgroup>
40735 </informaltable>
40736 <para>
40737 See <option>quota</option> above.
40738 </para>
40739 <para>
40740 <indexterm role="option">
40741 <primary><option>quota_size_regex</option></primary>
40742 </indexterm>
40743 </para>
40744 <informaltable frame="all">
40745 <tgroup cols="4" colsep="0" rowsep="0">
40746 <colspec colwidth="8*" align="left"/>
40747 <colspec colwidth="6*" align="center"/>
40748 <colspec colwidth="6*" align="center"/>
40749 <colspec colwidth="6*" align="right"/>
40750 <tbody>
40751 <row>
40752 <entry><option>quota_size_regex</option></entry>
40753 <entry>Use: <emphasis>appendfile</emphasis></entry>
40754 <entry>Type: <emphasis>string</emphasis></entry>
40755 <entry>Default: <emphasis>unset</emphasis></entry>
40756 </row>
40757 </tbody>
40758 </tgroup>
40759 </informaltable>
40760 <para>
40761 This option applies when one of the delivery modes that writes a separate file
40762 for each message is being used. When Exim wants to find the size of one of
40763 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
40764 If this is set to a regular expression that matches the file name, and it
40765 captures one string, that string is interpreted as a representation of the
40766 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
40767 </para>
40768 <para>
40769 This feature is useful only when users have no shell access to their mailboxes
40770 &ndash; otherwise they could defeat the quota simply by renaming the files. This
40771 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
40772 the file length to the file name. For example:
40773 </para>
40774 <literallayout class="monospaced">
40775 maildir_tag = ,S=$message_size
40776 quota_size_regex = ,S=(\d+)
40777 </literallayout>
40778 <para>
40779 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
40780 number of lines in the message.
40781 </para>
40782 <para>
40783 The regular expression should not assume that the length is at the end of the
40784 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
40785 sometimes add other information onto the ends of message file names.
40786 </para>
40787 <para>
40788 Section <xref linkend="SECID136"/> contains further information.
40789 </para>
40790 <para>
40791 <indexterm role="option">
40792 <primary><option>quota_warn_message</option></primary>
40793 </indexterm>
40794 </para>
40795 <informaltable frame="all">
40796 <tgroup cols="4" colsep="0" rowsep="0">
40797 <colspec colwidth="8*" align="left"/>
40798 <colspec colwidth="6*" align="center"/>
40799 <colspec colwidth="6*" align="center"/>
40800 <colspec colwidth="6*" align="right"/>
40801 <tbody>
40802 <row>
40803 <entry><option>quota_warn_message</option></entry>
40804 <entry>Use: <emphasis>appendfile</emphasis></entry>
40805 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40806 <entry>Default: <emphasis>see below</emphasis></entry>
40807 </row>
40808 </tbody>
40809 </tgroup>
40810 </informaltable>
40811 <para>
40812 See below for the use of this option. If it is not set when
40813 <option>quota_warn_threshold</option> is set, it defaults to
40814 </para>
40815 <literallayout class="monospaced">
40816 quota_warn_message = "\
40817   To: $local_part@$domain\n\
40818   Subject: Your mailbox\n\n\
40819   This message is automatically created \
40820   by mail delivery software.\n\n\
40821   The size of your mailbox has exceeded \
40822   a warning threshold that is\n\
40823   set by the system administrator.\n"
40824 </literallayout>
40825 <para>
40826 <indexterm role="option">
40827 <primary><option>quota_warn_threshold</option></primary>
40828 </indexterm>
40829 </para>
40830 <informaltable frame="all">
40831 <tgroup cols="4" colsep="0" rowsep="0">
40832 <colspec colwidth="8*" align="left"/>
40833 <colspec colwidth="6*" align="center"/>
40834 <colspec colwidth="6*" align="center"/>
40835 <colspec colwidth="6*" align="right"/>
40836 <tbody>
40837 <row>
40838 <entry><option>quota_warn_threshold</option></entry>
40839 <entry>Use: <emphasis>appendfile</emphasis></entry>
40840 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40841 <entry>Default: <emphasis>0</emphasis></entry>
40842 </row>
40843 </tbody>
40844 </tgroup>
40845 </informaltable>
40846 <para>
40847 <indexterm role="concept">
40848 <primary>quota</primary>
40849 <secondary>warning threshold</secondary>
40850 </indexterm>
40851 <indexterm role="concept">
40852 <primary>mailbox</primary>
40853 <secondary>size warning</secondary>
40854 </indexterm>
40855 <indexterm role="concept">
40856 <primary>size</primary>
40857 <secondary>of mailbox</secondary>
40858 </indexterm>
40859 This option is expanded in the same way as <option>quota</option> (see above). If the
40860 resulting value is greater than zero, and delivery of the message causes the
40861 size of the file or total space in the directory tree to cross the given
40862 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
40863 may be specified as a percentage of it by following the value with a percent
40864 sign. For example:
40865 </para>
40866 <literallayout class="monospaced">
40867 quota = 10M
40868 quota_warn_threshold = 75%
40869 </literallayout>
40870 <para>
40871 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
40872 percent sign is ignored.
40873 </para>
40874 <para>
40875 The warning message itself is specified by the <option>quota_warn_message</option> option,
40876 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
40877 warning message. These do not necessarily have to include the recipient(s) of
40878 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
40879 can include any other header lines that you want. If you do not include a
40880 <emphasis>From:</emphasis> line, the default is:
40881 </para>
40882 <literallayout class="monospaced">
40883 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
40884 </literallayout>
40885 <para>
40886 <indexterm role="option">
40887 <primary><option>errors_reply_to</option></primary>
40888 </indexterm>
40889 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
40890 option.
40891 </para>
40892 <para>
40893 The <option>quota</option> option does not have to be set in order to use this option; they
40894 are independent of one another except when the threshold is specified as a
40895 percentage.
40896 </para>
40897 <para>
40898 <indexterm role="option">
40899 <primary><option>use_bsmtp</option></primary>
40900 </indexterm>
40901 </para>
40902 <informaltable frame="all">
40903 <tgroup cols="4" colsep="0" rowsep="0">
40904 <colspec colwidth="8*" align="left"/>
40905 <colspec colwidth="6*" align="center"/>
40906 <colspec colwidth="6*" align="center"/>
40907 <colspec colwidth="6*" align="right"/>
40908 <tbody>
40909 <row>
40910 <entry><option>use_bsmtp</option></entry>
40911 <entry>Use: <emphasis>appendfile</emphasis></entry>
40912 <entry>Type: <emphasis>boolean</emphasis></entry>
40913 <entry>Default: <emphasis>false</emphasis></entry>
40914 </row>
40915 </tbody>
40916 </tgroup>
40917 </informaltable>
40918 <para>
40919 <indexterm role="concept">
40920 <primary>envelope sender</primary>
40921 </indexterm>
40922 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
40923 format, with the envelope sender and recipient(s) included as SMTP commands. If
40924 you want to include a leading HELO command with such messages, you can do
40925 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
40926 for details of batch SMTP.
40927 </para>
40928 <para>
40929 <indexterm role="option">
40930 <primary><option>use_crlf</option></primary>
40931 </indexterm>
40932 </para>
40933 <informaltable frame="all">
40934 <tgroup cols="4" colsep="0" rowsep="0">
40935 <colspec colwidth="8*" align="left"/>
40936 <colspec colwidth="6*" align="center"/>
40937 <colspec colwidth="6*" align="center"/>
40938 <colspec colwidth="6*" align="right"/>
40939 <tbody>
40940 <row>
40941 <entry><option>use_crlf</option></entry>
40942 <entry>Use: <emphasis>appendfile</emphasis></entry>
40943 <entry>Type: <emphasis>boolean</emphasis></entry>
40944 <entry>Default: <emphasis>false</emphasis></entry>
40945 </row>
40946 </tbody>
40947 </tgroup>
40948 </informaltable>
40949 <para>
40950 <indexterm role="concept">
40951 <primary>carriage return</primary>
40952 </indexterm>
40953 <indexterm role="concept">
40954 <primary>linefeed</primary>
40955 </indexterm>
40956 This option causes lines to be terminated with the two-character CRLF sequence
40957 (carriage return, linefeed) instead of just a linefeed character. In the case
40958 of batched SMTP, the byte sequence written to the file is then an exact image
40959 of what would be sent down a real SMTP connection.
40960 </para>
40961 <para>
40962 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
40963 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
40964 in Berkeley-style mailboxes) are written verbatim, so must contain their own
40965 carriage return characters if these are needed. In cases where these options
40966 have non-empty defaults, the values end with a single linefeed, so they must be
40967 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
40968 </para>
40969 <para>
40970 <indexterm role="option">
40971 <primary><option>use_fcntl_lock</option></primary>
40972 </indexterm>
40973 </para>
40974 <informaltable frame="all">
40975 <tgroup cols="4" colsep="0" rowsep="0">
40976 <colspec colwidth="8*" align="left"/>
40977 <colspec colwidth="6*" align="center"/>
40978 <colspec colwidth="6*" align="center"/>
40979 <colspec colwidth="6*" align="right"/>
40980 <tbody>
40981 <row>
40982 <entry><option>use_fcntl_lock</option></entry>
40983 <entry>Use: <emphasis>appendfile</emphasis></entry>
40984 <entry>Type: <emphasis>boolean</emphasis></entry>
40985 <entry>Default: <emphasis>see below</emphasis></entry>
40986 </row>
40987 </tbody>
40988 </tgroup>
40989 </informaltable>
40990 <para>
40991 This option controls the use of the <function>fcntl()</function> function to lock a file for
40992 exclusive use when a message is being appended. It is set by default unless
40993 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
40994 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
40995 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
40996 </para>
40997 <para>
40998 <indexterm role="option">
40999 <primary><option>use_flock_lock</option></primary>
41000 </indexterm>
41001 </para>
41002 <informaltable frame="all">
41003 <tgroup cols="4" colsep="0" rowsep="0">
41004 <colspec colwidth="8*" align="left"/>
41005 <colspec colwidth="6*" align="center"/>
41006 <colspec colwidth="6*" align="center"/>
41007 <colspec colwidth="6*" align="right"/>
41008 <tbody>
41009 <row>
41010 <entry><option>use_flock_lock</option></entry>
41011 <entry>Use: <emphasis>appendfile</emphasis></entry>
41012 <entry>Type: <emphasis>boolean</emphasis></entry>
41013 <entry>Default: <emphasis>false</emphasis></entry>
41014 </row>
41015 </tbody>
41016 </tgroup>
41017 </informaltable>
41018 <para>
41019 This option is provided to support the use of <function>flock()</function> for file locking, for
41020 the few situations where it is needed. Most modern operating systems support
41021 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
41022 each other. Exim uses <function>fcntl()</function> locking by default.
41023 </para>
41024 <para>
41025 This option is required only if you are using an operating system where
41026 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
41027 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
41028 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
41029 </para>
41030 <para>
41031 <indexterm role="concept">
41032 <primary>Solaris</primary>
41033 <secondary><function>flock()</function> support</secondary>
41034 </indexterm>
41035 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
41036 have it (and some, I think, provide a not quite right version built on top of
41037 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
41038 the ability to use it, and any attempt to do so will cause a configuration
41039 error.
41040 </para>
41041 <para>
41042 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
41043 is just being mapped onto <function>fcntl()</function> by the OS).
41044 </para>
41045 <para>
41046 <indexterm role="option">
41047 <primary><option>use_lockfile</option></primary>
41048 </indexterm>
41049 </para>
41050 <informaltable frame="all">
41051 <tgroup cols="4" colsep="0" rowsep="0">
41052 <colspec colwidth="8*" align="left"/>
41053 <colspec colwidth="6*" align="center"/>
41054 <colspec colwidth="6*" align="center"/>
41055 <colspec colwidth="6*" align="right"/>
41056 <tbody>
41057 <row>
41058 <entry><option>use_lockfile</option></entry>
41059 <entry>Use: <emphasis>appendfile</emphasis></entry>
41060 <entry>Type: <emphasis>boolean</emphasis></entry>
41061 <entry>Default: <emphasis>see below</emphasis></entry>
41062 </row>
41063 </tbody>
41064 </tgroup>
41065 </informaltable>
41066 <para>
41067 If this option is turned off, Exim does not attempt to create a lock file when
41068 appending to a mailbox file. In this situation, the only locking is by
41069 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
41070 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
41071 <function>fcntl()</function> rather than a lock file, and even then only when you are not
41072 delivering over NFS from more than one host.
41073 </para>
41074 <para>
41075 <indexterm role="concept">
41076 <primary>NFS</primary>
41077 <secondary>lock file</secondary>
41078 </indexterm>
41079 In order to append to an NFS file safely from more than one host, it is
41080 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
41081 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
41082 file corruption.
41083 </para>
41084 <para>
41085 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
41086 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
41087 except when <option>mbx_format</option> is set.
41088 </para>
41089 <para>
41090 <indexterm role="option">
41091 <primary><option>use_mbx_lock</option></primary>
41092 </indexterm>
41093 </para>
41094 <informaltable frame="all">
41095 <tgroup cols="4" colsep="0" rowsep="0">
41096 <colspec colwidth="8*" align="left"/>
41097 <colspec colwidth="6*" align="center"/>
41098 <colspec colwidth="6*" align="center"/>
41099 <colspec colwidth="6*" align="right"/>
41100 <tbody>
41101 <row>
41102 <entry><option>use_mbx_lock</option></entry>
41103 <entry>Use: <emphasis>appendfile</emphasis></entry>
41104 <entry>Type: <emphasis>boolean</emphasis></entry>
41105 <entry>Default: <emphasis>see below</emphasis></entry>
41106 </row>
41107 </tbody>
41108 </tgroup>
41109 </informaltable>
41110 <para>
41111 This option is available only if Exim has been compiled with SUPPORT_MBX
41112 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
41113 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
41114 of the locking options are mentioned in the configuration. The locking rules
41115 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
41116 the IMAP4 and POP daemons that come with it (see the discussion below). The
41117 rules allow for shared access to the mailbox. However, this kind of locking
41118 does not work when the mailbox is NFS mounted.
41119 </para>
41120 <para>
41121 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
41122 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
41123 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
41124 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
41125 </para>
41126 </section>
41127 <section id="SECTopappend">
41128 <title>Operational details for appending</title>
41129 <para>
41130 <indexterm role="concept">
41131 <primary>appending to a file</primary>
41132 </indexterm>
41133 <indexterm role="concept">
41134 <primary>file</primary>
41135 <secondary>appending</secondary>
41136 </indexterm>
41137 Before appending to a file, the following preparations are made:
41138 </para>
41139 <itemizedlist>
41140 <listitem>
41141 <para>
41142 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
41143 return is given.
41144 </para>
41145 </listitem>
41146 <listitem>
41147 <para>
41148 <indexterm role="concept">
41149 <primary>directory creation</primary>
41150 </indexterm>
41151 If any directories on the file&#x2019;s path are missing, Exim creates them if the
41152 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
41153 <option>directory_mode</option> option.
41154 </para>
41155 </listitem>
41156 <listitem>
41157 <para>
41158 If <option>file_format</option> is set, the format of an existing file is checked. If this
41159 indicates that a different transport should be used, control is passed to that
41160 transport.
41161 </para>
41162 </listitem>
41163 <listitem>
41164 <para>
41165 <indexterm role="concept">
41166 <primary>file</primary>
41167 <secondary>locking</secondary>
41168 </indexterm>
41169 <indexterm role="concept">
41170 <primary>locking files</primary>
41171 </indexterm>
41172 <indexterm role="concept">
41173 <primary>NFS</primary>
41174 <secondary>lock file</secondary>
41175 </indexterm>
41176 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
41177 reliably over NFS, as follows:
41178 </para>
41179 <orderedlist numeration="arabic">
41180 <listitem>
41181 <para>
41182 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
41183 current time, primary host name, and process id added, by opening for writing
41184 as a new file. If this fails with an access error, delivery is deferred.
41185 </para>
41186 </listitem>
41187 <listitem>
41188 <para>
41189 Close the hitching post file, and hard link it to the lock file name.
41190 </para>
41191 </listitem>
41192 <listitem>
41193 <para>
41194 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
41195 Unlink the hitching post name.
41196 </para>
41197 </listitem>
41198 <listitem>
41199 <para>
41200 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
41201 then unlink hitching post name. If the number of links is exactly two, creation
41202 of the lock file succeeded but something (for example, an NFS server crash and
41203 restart) caused this fact not to be communicated to the <function>link()</function> call.
41204 </para>
41205 </listitem>
41206 <listitem>
41207 <para>
41208 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
41209 up to <option>lock_retries</option> times. However, since any program that writes to a
41210 mailbox should complete its task very quickly, it is reasonable to time out old
41211 lock files that are normally the result of user agent and system crashes. If an
41212 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
41213 it before trying again.
41214 </para>
41215 </listitem>
41216 </orderedlist>
41217 </listitem>
41218 <listitem>
41219 <para>
41220 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
41221 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
41222 than non-existence, delivery is deferred.
41223 </para>
41224 </listitem>
41225 <listitem>
41226 <para>
41227 <indexterm role="concept">
41228 <primary>symbolic link</primary>
41229 <secondary>to mailbox</secondary>
41230 </indexterm>
41231 <indexterm role="concept">
41232 <primary>mailbox</primary>
41233 <secondary>symbolic link</secondary>
41234 </indexterm>
41235 If the file does exist and is a symbolic link, delivery is deferred, unless the
41236 <option>allow_symlink</option> option is set, in which case the ownership of the link is
41237 checked, and then <function>stat()</function> is called to find out about the real file, which
41238 is then subjected to the checks below. The check on the top-level link
41239 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
41240 directory, though allowing symbolic links in this case is definitely not a good
41241 idea. If there is a chain of symbolic links, the intermediate ones are not
41242 checked.
41243 </para>
41244 </listitem>
41245 <listitem>
41246 <para>
41247 If the file already exists but is not a regular file, or if the file&#x2019;s owner
41248 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
41249 different from the user and group under which the delivery is running,
41250 delivery is deferred.
41251 </para>
41252 </listitem>
41253 <listitem>
41254 <para>
41255 If the file&#x2019;s permissions are more generous than specified, they are reduced.
41256 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
41257 is set false, in which case the delivery is tried using the existing
41258 permissions.
41259 </para>
41260 </listitem>
41261 <listitem>
41262 <para>
41263 The file&#x2019;s inode number is saved, and the file is then opened for appending.
41264 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
41265 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
41266 </para>
41267 </listitem>
41268 <listitem>
41269 <para>
41270 If the file is opened successfully, check that the inode number hasn&#x2019;t
41271 changed, that it is still a regular file, and that the owner and permissions
41272 have not changed. If anything is wrong, defer delivery and freeze the message.
41273 </para>
41274 </listitem>
41275 <listitem>
41276 <para>
41277 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
41278 option is set. Otherwise, check that the file is being created in a permitted
41279 directory if the <option>create_file</option> option is set (deferring on failure), and then
41280 open for writing as a new file, with the O_EXCL and O_CREAT options,
41281 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
41282 set). In this case, which can happen if the link points to a non-existent file,
41283 the file is opened for writing using O_CREAT but not O_EXCL, because
41284 that prevents link following.
41285 </para>
41286 </listitem>
41287 <listitem>
41288 <para>
41289 <indexterm role="concept">
41290 <primary>loop</primary>
41291 <secondary>while file testing</secondary>
41292 </indexterm>
41293 If opening fails because the file exists, obey the tests given above for
41294 existing files. However, to avoid looping in a situation where the file is
41295 being continuously created and destroyed, the exists/not-exists loop is broken
41296 after 10 repetitions, and the message is then frozen.
41297 </para>
41298 </listitem>
41299 <listitem>
41300 <para>
41301 If opening fails with any other error, defer delivery.
41302 </para>
41303 </listitem>
41304 <listitem>
41305 <para>
41306 <indexterm role="concept">
41307 <primary>file</primary>
41308 <secondary>locking</secondary>
41309 </indexterm>
41310 <indexterm role="concept">
41311 <primary>locking files</primary>
41312 </indexterm>
41313 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
41314 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
41315 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
41316 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
41317 file, and an exclusive lock on the file whose name is
41318 </para>
41319 <literallayout class="monospaced">
41320 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
41321 </literallayout>
41322 <para>
41323 using the device and inode numbers of the open mailbox file, in accordance with
41324 the MBX locking rules. This file is created with a mode that is specified by
41325 the <option>lockfile_mode</option> option.
41326 </para>
41327 <para>
41328 If Exim fails to lock the file, there are two possible courses of action,
41329 depending on the value of the locking timeout. This is obtained from
41330 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
41331 </para>
41332 <para>
41333 If the timeout value is zero, the file is closed, Exim waits for
41334 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
41335 to lock it again. This happens up to <option>lock_retries</option> times, after which the
41336 delivery is deferred.
41337 </para>
41338 <para>
41339 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
41340 <function>flock()</function> are used (with the given timeout), so there has already been some
41341 waiting involved by the time locking fails. Nevertheless, Exim does not give up
41342 immediately. It retries up to
41343 </para>
41344 <literallayout class="monospaced">
41345 (lock_retries * lock_interval) / &lt;timeout&gt;
41346 </literallayout>
41347 <para>
41348 times (rounded up).
41349 </para>
41350 </listitem>
41351 </itemizedlist>
41352 <para>
41353 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
41354 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
41355 </para>
41356 </section>
41357 <section id="SECTopdir">
41358 <title>Operational details for delivery to a new file</title>
41359 <para>
41360 <indexterm role="concept">
41361 <primary>delivery</primary>
41362 <secondary>to single file</secondary>
41363 </indexterm>
41364 <indexterm role="concept">
41365 <primary><quote>From</quote> line</primary>
41366 </indexterm>
41367 When the <option>directory</option> option is set instead of <option>file</option>, each message is
41368 delivered into a newly-created file or set of files. When <command>appendfile</command> is
41369 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
41370 <option>directory</option> is normally set, because the path for delivery is supplied by the
41371 router. (See for example, the <command>address_file</command> transport in the default
41372 configuration.) In this case, delivery is to a new file if either the path name
41373 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
41374 </para>
41375 <para>
41376 No locking is required while writing the message to a new file, so the various
41377 locking options of the transport are ignored. The <quote>From</quote> line that by default
41378 separates messages in a single file is not normally needed, nor is the escaping
41379 of message lines that start with <quote>From</quote>, and there is no need to ensure a
41380 newline at the end of each message. Consequently, the default values for
41381 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
41382 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
41383 </para>
41384 <para>
41385 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
41386 the files in the delivery directory by default. However, you can specify a
41387 different directory by setting <option>quota_directory</option>. Also, for maildir
41388 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
41389 </para>
41390 <para>
41391 <indexterm role="concept">
41392 <primary>maildir format</primary>
41393 </indexterm>
41394 <indexterm role="concept">
41395 <primary>mailstore format</primary>
41396 </indexterm>
41397 There are three different ways in which delivery to individual files can be
41398 done, controlled by the settings of the <option>maildir_format</option> and
41399 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
41400 formats is not included in the binary unless SUPPORT_MAILDIR or
41401 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
41402 </para>
41403 <para>
41404 <indexterm role="concept">
41405 <primary>directory creation</primary>
41406 </indexterm>
41407 In all three cases an attempt is made to create the directory and any necessary
41408 sub-directories if they do not exist, provided that the <option>create_directory</option>
41409 option is set (the default). The location of a created directory can be
41410 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
41411 the <option>directory_mode</option> option. If creation fails, or if the
41412 <option>create_directory</option> option is not set when creation is required, delivery is
41413 deferred.
41414 </para>
41415 </section>
41416 <section id="SECTmaildirdelivery">
41417 <title>Maildir delivery</title>
41418 <para>
41419 <indexterm role="concept">
41420 <primary>maildir format</primary>
41421 <secondary>description of</secondary>
41422 </indexterm>
41423 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
41424 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
41425 directory that is defined by the <option>directory</option> option (the <quote>delivery
41426 directory</quote>). If the delivery is successful, the file is renamed into the
41427 <filename>new</filename> subdirectory.
41428 </para>
41429 <para>
41430 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
41431 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
41432 Exim checks that the time-of-day clock has moved on by at least one microsecond
41433 before terminating the delivery process. This guarantees uniqueness for the
41434 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
41435 opening it. If any response other than ENOENT (does not exist) is given,
41436 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
41437 </para>
41438 <para>
41439 Before Exim carries out a maildir delivery, it ensures that subdirectories
41440 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
41441 do not exist, Exim tries to create them and any superior directories in their
41442 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
41443 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
41444 contains matches the delivery directory, Exim also ensures that a file called
41445 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
41446 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
41447 </para>
41448 <para>
41449 These features make it possible to use Exim to create all the necessary files
41450 and directories in a maildir mailbox, including subdirectories for maildir++
41451 folders. Consider this example:
41452 </para>
41453 <literallayout class="monospaced">
41454 maildir_format = true
41455 directory = /var/mail/$local_part\
41456            ${if eq{$local_part_suffix}{}{}\
41457            {/.${substr_1:$local_part_suffix}}}
41458 maildirfolder_create_regex = /\.[^/]+$
41459 </literallayout>
41460 <para>
41461 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
41462 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
41463 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
41464 not match this name, so Exim will not look for or create the file
41465 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
41466 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
41467 </para>
41468 <para>
41469 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
41470 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
41471 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
41472 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
41473 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
41474 </para>
41475 <para>
41476 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
41477 not inadvertently match the toplevel maildir directory, because a
41478 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
41479 </para>
41480 <para>
41481 <indexterm role="concept">
41482 <primary>quota</primary>
41483 <secondary>in maildir delivery</secondary>
41484 </indexterm>
41485 <indexterm role="concept">
41486 <primary>maildir++</primary>
41487 </indexterm>
41488 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
41489 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
41490 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
41491 Exim assumes the directory is a maildir++ folder directory, which is one level
41492 down from the user&#x2019;s top level mailbox directory. This causes it to start at
41493 the parent directory instead of the current directory when calculating the
41494 amount of space used.
41495 </para>
41496 <para>
41497 One problem with delivering into a multi-file mailbox is that it is
41498 computationally expensive to compute the size of the mailbox for quota
41499 checking. Various approaches have been taken to reduce the amount of work
41500 needed. The next two sections describe two of them. A third alternative is to
41501 use some external process for maintaining the size data, and use the expansion
41502 of the <option>mailbox_size</option> option as a way of importing it into Exim.
41503 </para>
41504 </section>
41505 <section id="SECID135">
41506 <title>Using tags to record message sizes</title>
41507 <para>
41508 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
41509 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
41510 tag is added to its name. However, if adding the tag takes the length of the
41511 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
41512 the tag is dropped and the maildir file is created with no tag.
41513 </para>
41514 <para>
41515 <indexterm role="variable">
41516 <primary><varname>$message_size</varname></primary>
41517 </indexterm>
41518 Tags can be used to encode the size of files in their names; see
41519 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
41520 happens after the message has been written. The value of the <varname>$message_size</varname>
41521 variable is set to the number of bytes actually written. If the expansion is
41522 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
41523 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
41524 Non-printing characters in the string are ignored; if the resulting string is
41525 empty, it is ignored. If it starts with an alphanumeric character, a leading
41526 colon is inserted; this default has not proven to be the path that popular
41527 maildir implementations have chosen (but changing it in Exim would break
41528 backwards compatibility).
41529 </para>
41530 <para>
41531 For one common implementation, you might set:
41532 </para>
41533 <literallayout class="monospaced">
41534 maildir_tag = ,S=${message_size}
41535 </literallayout>
41536 <para>
41537 but you should check the documentation of the other software to be sure.
41538 </para>
41539 <para>
41540 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
41541 as this allows Exim to extract the size from your tag, instead of having to
41542 <function>stat()</function> each message file.
41543 </para>
41544 </section>
41545 <section id="SECID136">
41546 <title>Using a maildirsize file</title>
41547 <para>
41548 <indexterm role="concept">
41549 <primary>quota</primary>
41550 <secondary>in maildir delivery</secondary>
41551 </indexterm>
41552 <indexterm role="concept">
41553 <primary>maildir format</primary>
41554 <secondary><filename>maildirsize</filename> file</secondary>
41555 </indexterm>
41556 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
41557 storing quota and message size information in a file called <filename>maildirsize</filename>
41558 within the toplevel maildir directory. If this file does not exist, Exim
41559 creates it, setting the quota from the <option>quota</option> option of the transport. If
41560 the maildir directory itself does not exist, it is created before any attempt
41561 to write a <filename>maildirsize</filename> file.
41562 </para>
41563 <para>
41564 The <filename>maildirsize</filename> file is used to hold information about the sizes of
41565 messages in the maildir, thus speeding up quota calculations. The quota value
41566 in the file is just a cache; if the quota is changed in the transport, the new
41567 value overrides the cached value when the next message is delivered. The cache
41568 is maintained for the benefit of other programs that access the maildir and
41569 need to know the quota.
41570 </para>
41571 <para>
41572 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
41573 file is maintained (with a zero quota setting), but no quota is imposed.
41574 </para>
41575 <para>
41576 A regular expression is available for controlling which directories in the
41577 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
41578 See the description of the <option>maildir_quota_directory_regex</option> option above for
41579 details.
41580 </para>
41581 </section>
41582 <section id="SECID137">
41583 <title>Mailstore delivery</title>
41584 <para>
41585 <indexterm role="concept">
41586 <primary>mailstore format</primary>
41587 <secondary>description of</secondary>
41588 </indexterm>
41589 If the <option>mailstore_format</option> option is true, each message is written as two
41590 files in the given directory. A unique base name is constructed from the
41591 message id and the current delivery process, and the files that are written use
41592 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
41593 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
41594 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
41595 </para>
41596 <para>
41597 During delivery, the envelope is first written to a file with the suffix
41598 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
41599 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
41600 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
41601 file before accessing either of them. An alternative approach is to wait for
41602 the absence of a <filename>.tmp</filename> file.
41603 </para>
41604 <para>
41605 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
41606 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
41607 the sender address on one line, then all the recipient addresses, one per line.
41608 There can be more than one recipient only if the <option>batch_max</option> option is set
41609 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
41610 appended to the file, followed by a newline if it does not end with one.
41611 </para>
41612 <para>
41613 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
41614 failure, it is ignored. Other expansion errors are treated as serious
41615 configuration errors, and delivery is deferred. The variable
41616 <varname>$mailstore_basename</varname> is available for use during these expansions.
41617 </para>
41618 </section>
41619 <section id="SECID138">
41620 <title>Non-special new file delivery</title>
41621 <para>
41622 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
41623 file is created directly in the named directory. For example, when delivering
41624 messages into files in batched SMTP format for later delivery to some host (see
41625 section <xref linkend="SECTbatchSMTP"/>), a setting such as
41626 </para>
41627 <literallayout class="monospaced">
41628 directory = /var/bsmtp/$host
41629 </literallayout>
41630 <para>
41631 might be used. A message is written to a file with a temporary name, which is
41632 then renamed when the delivery is complete. The final name is obtained by
41633 expanding the contents of the <option>directory_file</option> option.
41634 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
41635 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
41636 </para>
41637 </section>
41638 </chapter>
41639
41640 <chapter id="CHID8">
41641 <title>The autoreply transport</title>
41642 <para>
41643 <indexterm role="concept" id="IIDauttra1" class="startofrange">
41644 <primary>transports</primary>
41645 <secondary><command>autoreply</command></secondary>
41646 </indexterm>
41647 <indexterm role="concept" id="IIDauttra2" class="startofrange">
41648 <primary><command>autoreply</command> transport</primary>
41649 </indexterm>
41650 The <command>autoreply</command> transport is not a true transport in that it does not cause
41651 the message to be transmitted. Instead, it generates a new mail message as an
41652 automatic reply to the incoming message. <emphasis>References:</emphasis> and
41653 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
41654 to the rules in RFCs 2822 and 3834, respectively.
41655 </para>
41656 <para>
41657 If the router that passes the message to this transport does not have the
41658 <option>unseen</option> option set, the original message (for the current recipient) is not
41659 delivered anywhere. However, when the <option>unseen</option> option is set on the router
41660 that passes the message to this transport, routing of the address continues, so
41661 another router can set up a normal message delivery.
41662 </para>
41663 <para>
41664 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
41665 <quote>vacation</quote> message being the standard example. However, it can also be run
41666 directly from a router like any other transport. To reduce the possibility of
41667 message cascades, messages created by the <command>autoreply</command> transport always have
41668 empty envelope sender addresses, like bounce messages.
41669 </para>
41670 <para>
41671 The parameters of the message to be sent can be specified in the configuration
41672 by options described below. However, these are used only when the address
41673 passed to the transport does not contain its own reply information. When the
41674 transport is run as a consequence of a
41675 <option>mail</option>
41676 or <option>vacation</option> command in a filter file, the parameters of the message are
41677 supplied by the filter, and passed with the address. The transport&#x2019;s options
41678 that define the message are then ignored (so they are not usually set in this
41679 case). The message is specified entirely by the filter or by the transport; it
41680 is never built from a mixture of options. However, the <option>file_optional</option>,
41681 <option>mode</option>, and <option>return_message</option> options apply in all cases.
41682 </para>
41683 <para>
41684 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
41685 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
41686 gid of the user, and with appropriate current and home directories (see chapter
41687 <xref linkend="CHAPenvironment"/>).
41688 </para>
41689 <para>
41690 There is a subtle difference between routing a message to a <command>pipe</command> transport
41691 that generates some text to be returned to the sender, and routing it to an
41692 <command>autoreply</command> transport. This difference is noticeable only if more than one
41693 address from the same message is so handled. In the case of a pipe, the
41694 separate outputs from the different addresses are gathered up and returned to
41695 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
41696 message is generated for each address that is passed to it.
41697 </para>
41698 <para>
41699 Non-printing characters are not permitted in the header lines generated for the
41700 message that <command>autoreply</command> creates, with the exception of newlines that are
41701 immediately followed by white space. If any non-printing characters are found,
41702 the transport defers.
41703 Whether characters with the top bit set count as printing characters or not is
41704 controlled by the <option>print_topbitchars</option> global option.
41705 </para>
41706 <para>
41707 If any of the generic options for manipulating headers (for example,
41708 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
41709 of the original message that is included in the generated message when
41710 <option>return_message</option> is set. They do not apply to the generated message itself.
41711 </para>
41712 <para>
41713 <indexterm role="variable">
41714 <primary><varname>$sender_address</varname></primary>
41715 </indexterm>
41716 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
41717 the message, indicating that there were no recipients, it does not treat this
41718 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
41719 is empty (because the incoming message is a bounce message) do not cause
41720 problems. They are just discarded.
41721 </para>
41722 <section id="SECID139">
41723 <title>Private options for autoreply</title>
41724 <para>
41725 <indexterm role="concept">
41726 <primary>options</primary>
41727 <secondary><command>autoreply</command> transport</secondary>
41728 </indexterm>
41729 </para>
41730 <para>
41731 <indexterm role="option">
41732 <primary><option>bcc</option></primary>
41733 </indexterm>
41734 </para>
41735 <informaltable frame="all">
41736 <tgroup cols="4" colsep="0" rowsep="0">
41737 <colspec colwidth="8*" align="left"/>
41738 <colspec colwidth="6*" align="center"/>
41739 <colspec colwidth="6*" align="center"/>
41740 <colspec colwidth="6*" align="right"/>
41741 <tbody>
41742 <row>
41743 <entry><option>bcc</option></entry>
41744 <entry>Use: <emphasis>autoreply</emphasis></entry>
41745 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41746 <entry>Default: <emphasis>unset</emphasis></entry>
41747 </row>
41748 </tbody>
41749 </tgroup>
41750 </informaltable>
41751 <para>
41752 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
41753 message when the message is specified by the transport.
41754 </para>
41755 <para>
41756 <indexterm role="option">
41757 <primary><option>cc</option></primary>
41758 </indexterm>
41759 </para>
41760 <informaltable frame="all">
41761 <tgroup cols="4" colsep="0" rowsep="0">
41762 <colspec colwidth="8*" align="left"/>
41763 <colspec colwidth="6*" align="center"/>
41764 <colspec colwidth="6*" align="center"/>
41765 <colspec colwidth="6*" align="right"/>
41766 <tbody>
41767 <row>
41768 <entry><option>cc</option></entry>
41769 <entry>Use: <emphasis>autoreply</emphasis></entry>
41770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41771 <entry>Default: <emphasis>unset</emphasis></entry>
41772 </row>
41773 </tbody>
41774 </tgroup>
41775 </informaltable>
41776 <para>
41777 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
41778 when the message is specified by the transport.
41779 </para>
41780 <para>
41781 <indexterm role="option">
41782 <primary><option>file</option></primary>
41783 </indexterm>
41784 </para>
41785 <informaltable frame="all">
41786 <tgroup cols="4" colsep="0" rowsep="0">
41787 <colspec colwidth="8*" align="left"/>
41788 <colspec colwidth="6*" align="center"/>
41789 <colspec colwidth="6*" align="center"/>
41790 <colspec colwidth="6*" align="right"/>
41791 <tbody>
41792 <row>
41793 <entry><option>file</option></entry>
41794 <entry>Use: <emphasis>autoreply</emphasis></entry>
41795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41796 <entry>Default: <emphasis>unset</emphasis></entry>
41797 </row>
41798 </tbody>
41799 </tgroup>
41800 </informaltable>
41801 <para>
41802 The contents of the file are sent as the body of the message when the message
41803 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
41804 string comes first.
41805 </para>
41806 <para>
41807 <indexterm role="option">
41808 <primary><option>file_expand</option></primary>
41809 </indexterm>
41810 </para>
41811 <informaltable frame="all">
41812 <tgroup cols="4" colsep="0" rowsep="0">
41813 <colspec colwidth="8*" align="left"/>
41814 <colspec colwidth="6*" align="center"/>
41815 <colspec colwidth="6*" align="center"/>
41816 <colspec colwidth="6*" align="right"/>
41817 <tbody>
41818 <row>
41819 <entry><option>file_expand</option></entry>
41820 <entry>Use: <emphasis>autoreply</emphasis></entry>
41821 <entry>Type: <emphasis>boolean</emphasis></entry>
41822 <entry>Default: <emphasis>false</emphasis></entry>
41823 </row>
41824 </tbody>
41825 </tgroup>
41826 </informaltable>
41827 <para>
41828 If this is set, the contents of the file named by the <option>file</option> option are
41829 subjected to string expansion as they are added to the message.
41830 </para>
41831 <para>
41832 <indexterm role="option">
41833 <primary><option>file_optional</option></primary>
41834 </indexterm>
41835 </para>
41836 <informaltable frame="all">
41837 <tgroup cols="4" colsep="0" rowsep="0">
41838 <colspec colwidth="8*" align="left"/>
41839 <colspec colwidth="6*" align="center"/>
41840 <colspec colwidth="6*" align="center"/>
41841 <colspec colwidth="6*" align="right"/>
41842 <tbody>
41843 <row>
41844 <entry><option>file_optional</option></entry>
41845 <entry>Use: <emphasis>autoreply</emphasis></entry>
41846 <entry>Type: <emphasis>boolean</emphasis></entry>
41847 <entry>Default: <emphasis>false</emphasis></entry>
41848 </row>
41849 </tbody>
41850 </tgroup>
41851 </informaltable>
41852 <para>
41853 If this option is true, no error is generated if the file named by the <option>file</option>
41854 option or passed with the address does not exist or cannot be read.
41855 </para>
41856 <para>
41857 <indexterm role="option">
41858 <primary><option>from</option></primary>
41859 </indexterm>
41860 </para>
41861 <informaltable frame="all">
41862 <tgroup cols="4" colsep="0" rowsep="0">
41863 <colspec colwidth="8*" align="left"/>
41864 <colspec colwidth="6*" align="center"/>
41865 <colspec colwidth="6*" align="center"/>
41866 <colspec colwidth="6*" align="right"/>
41867 <tbody>
41868 <row>
41869 <entry><option>from</option></entry>
41870 <entry>Use: <emphasis>autoreply</emphasis></entry>
41871 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41872 <entry>Default: <emphasis>unset</emphasis></entry>
41873 </row>
41874 </tbody>
41875 </tgroup>
41876 </informaltable>
41877 <para>
41878 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
41879 specified by the transport.
41880 </para>
41881 <para>
41882 <indexterm role="option">
41883 <primary><option>headers</option></primary>
41884 </indexterm>
41885 </para>
41886 <informaltable frame="all">
41887 <tgroup cols="4" colsep="0" rowsep="0">
41888 <colspec colwidth="8*" align="left"/>
41889 <colspec colwidth="6*" align="center"/>
41890 <colspec colwidth="6*" align="center"/>
41891 <colspec colwidth="6*" align="right"/>
41892 <tbody>
41893 <row>
41894 <entry><option>headers</option></entry>
41895 <entry>Use: <emphasis>autoreply</emphasis></entry>
41896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41897 <entry>Default: <emphasis>unset</emphasis></entry>
41898 </row>
41899 </tbody>
41900 </tgroup>
41901 </informaltable>
41902 <para>
41903 This specifies additional RFC 2822 headers that are to be added to the message
41904 when the message is specified by the transport. Several can be given by using
41905 <quote>\n</quote> to separate them. There is no check on the format.
41906 </para>
41907 <para>
41908 <indexterm role="option">
41909 <primary><option>log</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>log</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 option names a file in which a record of every message sent is logged when
41930 the message is specified by the transport.
41931 </para>
41932 <para>
41933 <indexterm role="option">
41934 <primary><option>mode</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>mode</option></entry>
41946 <entry>Use: <emphasis>autoreply</emphasis></entry>
41947 <entry>Type: <emphasis>octal integer</emphasis></entry>
41948 <entry>Default: <emphasis>0600</emphasis></entry>
41949 </row>
41950 </tbody>
41951 </tgroup>
41952 </informaltable>
41953 <para>
41954 If either the log file or the <quote>once</quote> file has to be created, this mode is
41955 used.
41956 </para>
41957 <para>
41958 <indexterm role="option">
41959 <primary><option>never_mail</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>never_mail</option></entry>
41971 <entry>Use: <emphasis>autoreply</emphasis></entry>
41972 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
41973 <entry>Default: <emphasis>unset</emphasis></entry>
41974 </row>
41975 </tbody>
41976 </tgroup>
41977 </informaltable>
41978 <para>
41979 If any run of the transport creates a message with a recipient that matches any
41980 item in the list, that recipient is quietly discarded. If all recipients are
41981 discarded, no message is created. This applies both when the recipients are
41982 generated by a filter and when they are specified in the transport.
41983 </para>
41984 <para>
41985 <indexterm role="option">
41986 <primary><option>once</option></primary>
41987 </indexterm>
41988 </para>
41989 <informaltable frame="all">
41990 <tgroup cols="4" colsep="0" rowsep="0">
41991 <colspec colwidth="8*" align="left"/>
41992 <colspec colwidth="6*" align="center"/>
41993 <colspec colwidth="6*" align="center"/>
41994 <colspec colwidth="6*" align="right"/>
41995 <tbody>
41996 <row>
41997 <entry><option>once</option></entry>
41998 <entry>Use: <emphasis>autoreply</emphasis></entry>
41999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42000 <entry>Default: <emphasis>unset</emphasis></entry>
42001 </row>
42002 </tbody>
42003 </tgroup>
42004 </informaltable>
42005 <para>
42006 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
42007 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
42008 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
42009 </para>
42010 <para>
42011 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
42012 By default, if <option>once</option> is set to a non-empty file name, the message
42013 is not sent if a potential recipient is already listed in the database.
42014 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
42015 message is sent if that much time has elapsed since a message was last sent to
42016 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
42017 prevents a message from being sent a second time &ndash; in this case, zero means
42018 infinity.
42019 </para>
42020 <para>
42021 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
42022 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
42023 greater than zero, it changes the way Exim implements the <option>once</option> option.
42024 Instead of using a DBM file to record every recipient it sends to, it uses a
42025 regular file, whose size will never get larger than the given value.
42026 </para>
42027 <para>
42028 In the file, Exim keeps a linear list of recipient addresses and the times at
42029 which they were sent messages. If the file is full when a new address needs to
42030 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
42031 means that a given recipient may receive multiple messages, but at
42032 unpredictable intervals that depend on the rate of turnover of addresses in the
42033 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
42034 </para>
42035 <para>
42036 <indexterm role="option">
42037 <primary><option>once_file_size</option></primary>
42038 </indexterm>
42039 </para>
42040 <informaltable frame="all">
42041 <tgroup cols="4" colsep="0" rowsep="0">
42042 <colspec colwidth="8*" align="left"/>
42043 <colspec colwidth="6*" align="center"/>
42044 <colspec colwidth="6*" align="center"/>
42045 <colspec colwidth="6*" align="right"/>
42046 <tbody>
42047 <row>
42048 <entry><option>once_file_size</option></entry>
42049 <entry>Use: <emphasis>autoreply</emphasis></entry>
42050 <entry>Type: <emphasis>integer</emphasis></entry>
42051 <entry>Default: <emphasis>0</emphasis></entry>
42052 </row>
42053 </tbody>
42054 </tgroup>
42055 </informaltable>
42056 <para>
42057 See <option>once</option> above.
42058 </para>
42059 <para>
42060 <indexterm role="option">
42061 <primary><option>once_repeat</option></primary>
42062 </indexterm>
42063 </para>
42064 <informaltable frame="all">
42065 <tgroup cols="4" colsep="0" rowsep="0">
42066 <colspec colwidth="8*" align="left"/>
42067 <colspec colwidth="6*" align="center"/>
42068 <colspec colwidth="6*" align="center"/>
42069 <colspec colwidth="6*" align="right"/>
42070 <tbody>
42071 <row>
42072 <entry><option>once_repeat</option></entry>
42073 <entry>Use: <emphasis>autoreply</emphasis></entry>
42074 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
42075 <entry>Default: <emphasis>0s</emphasis></entry>
42076 </row>
42077 </tbody>
42078 </tgroup>
42079 </informaltable>
42080 <para>
42081 See <option>once</option> above.
42082 After expansion, the value of this option must be a valid time value.
42083 </para>
42084 <para>
42085 <indexterm role="option">
42086 <primary><option>reply_to</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>reply_to</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 specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
42107 specified by the transport.
42108 </para>
42109 <para>
42110 <indexterm role="option">
42111 <primary><option>return_message</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>return_message</option></entry>
42123 <entry>Use: <emphasis>autoreply</emphasis></entry>
42124 <entry>Type: <emphasis>boolean</emphasis></entry>
42125 <entry>Default: <emphasis>false</emphasis></entry>
42126 </row>
42127 </tbody>
42128 </tgroup>
42129 </informaltable>
42130 <para>
42131 If this is set, a copy of the original message is returned with the new
42132 message, subject to the maximum size set in the <option>return_size_limit</option> global
42133 configuration option.
42134 </para>
42135 <para>
42136 <indexterm role="option">
42137 <primary><option>subject</option></primary>
42138 </indexterm>
42139 </para>
42140 <informaltable frame="all">
42141 <tgroup cols="4" colsep="0" rowsep="0">
42142 <colspec colwidth="8*" align="left"/>
42143 <colspec colwidth="6*" align="center"/>
42144 <colspec colwidth="6*" align="center"/>
42145 <colspec colwidth="6*" align="right"/>
42146 <tbody>
42147 <row>
42148 <entry><option>subject</option></entry>
42149 <entry>Use: <emphasis>autoreply</emphasis></entry>
42150 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42151 <entry>Default: <emphasis>unset</emphasis></entry>
42152 </row>
42153 </tbody>
42154 </tgroup>
42155 </informaltable>
42156 <para>
42157 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
42158 specified by the transport. It is tempting to quote the original subject in
42159 automatic responses. For example:
42160 </para>
42161 <literallayout class="monospaced">
42162 subject = Re: $h_subject:
42163 </literallayout>
42164 <para>
42165 There is a danger in doing this, however. It may allow a third party to
42166 subscribe your users to an opt-in mailing list, provided that the list accepts
42167 bounce messages as subscription confirmations. Well-managed lists require a
42168 non-bounce message to confirm a subscription, so the danger is relatively
42169 small.
42170 </para>
42171 <para>
42172 <indexterm role="option">
42173 <primary><option>text</option></primary>
42174 </indexterm>
42175 </para>
42176 <informaltable frame="all">
42177 <tgroup cols="4" colsep="0" rowsep="0">
42178 <colspec colwidth="8*" align="left"/>
42179 <colspec colwidth="6*" align="center"/>
42180 <colspec colwidth="6*" align="center"/>
42181 <colspec colwidth="6*" align="right"/>
42182 <tbody>
42183 <row>
42184 <entry><option>text</option></entry>
42185 <entry>Use: <emphasis>autoreply</emphasis></entry>
42186 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42187 <entry>Default: <emphasis>unset</emphasis></entry>
42188 </row>
42189 </tbody>
42190 </tgroup>
42191 </informaltable>
42192 <para>
42193 This specifies a single string to be used as the body of the message when the
42194 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
42195 the text comes first.
42196 </para>
42197 <para>
42198 <indexterm role="option">
42199 <primary><option>to</option></primary>
42200 </indexterm>
42201 </para>
42202 <informaltable frame="all">
42203 <tgroup cols="4" colsep="0" rowsep="0">
42204 <colspec colwidth="8*" align="left"/>
42205 <colspec colwidth="6*" align="center"/>
42206 <colspec colwidth="6*" align="center"/>
42207 <colspec colwidth="6*" align="right"/>
42208 <tbody>
42209 <row>
42210 <entry><option>to</option></entry>
42211 <entry>Use: <emphasis>autoreply</emphasis></entry>
42212 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42213 <entry>Default: <emphasis>unset</emphasis></entry>
42214 </row>
42215 </tbody>
42216 </tgroup>
42217 </informaltable>
42218 <para>
42219 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
42220 when the message is specified by the transport.
42221 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
42222 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
42223 </para>
42224 </section>
42225 </chapter>
42226
42227 <chapter id="CHAPLMTP">
42228 <title>The lmtp transport</title>
42229 <para>
42230 <indexterm role="concept">
42231 <primary>transports</primary>
42232 <secondary><command>lmtp</command></secondary>
42233 </indexterm>
42234 <indexterm role="concept">
42235 <primary><command>lmtp</command> transport</primary>
42236 </indexterm>
42237 <indexterm role="concept">
42238 <primary>LMTP</primary>
42239 <secondary>over a pipe</secondary>
42240 </indexterm>
42241 <indexterm role="concept">
42242 <primary>LMTP</primary>
42243 <secondary>over a socket</secondary>
42244 </indexterm>
42245 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
42246 specified command
42247 or by interacting with a Unix domain socket.
42248 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
42249 transports. Exim also has support for using LMTP over TCP/IP; this is
42250 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
42251 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
42252 has it commented out. You need to ensure that
42253 </para>
42254 <literallayout class="monospaced">
42255 TRANSPORT_LMTP=yes
42256 </literallayout>
42257 <para>
42258 <indexterm role="concept">
42259 <primary>options</primary>
42260 <secondary><command>lmtp</command> transport</secondary>
42261 </indexterm>
42262 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
42263 included in the Exim binary. The private options of the <command>lmtp</command> transport are
42264 as follows:
42265 </para>
42266 <para>
42267 <indexterm role="option">
42268 <primary><option>batch_id</option></primary>
42269 </indexterm>
42270 </para>
42271 <informaltable frame="all">
42272 <tgroup cols="4" colsep="0" rowsep="0">
42273 <colspec colwidth="8*" align="left"/>
42274 <colspec colwidth="6*" align="center"/>
42275 <colspec colwidth="6*" align="center"/>
42276 <colspec colwidth="6*" align="right"/>
42277 <tbody>
42278 <row>
42279 <entry><option>batch_id</option></entry>
42280 <entry>Use: <emphasis>lmtp</emphasis></entry>
42281 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42282 <entry>Default: <emphasis>unset</emphasis></entry>
42283 </row>
42284 </tbody>
42285 </tgroup>
42286 </informaltable>
42287 <para>
42288 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42289 </para>
42290 <para>
42291 <indexterm role="option">
42292 <primary><option>batch_max</option></primary>
42293 </indexterm>
42294 </para>
42295 <informaltable frame="all">
42296 <tgroup cols="4" colsep="0" rowsep="0">
42297 <colspec colwidth="8*" align="left"/>
42298 <colspec colwidth="6*" align="center"/>
42299 <colspec colwidth="6*" align="center"/>
42300 <colspec colwidth="6*" align="right"/>
42301 <tbody>
42302 <row>
42303 <entry><option>batch_max</option></entry>
42304 <entry>Use: <emphasis>lmtp</emphasis></entry>
42305 <entry>Type: <emphasis>integer</emphasis></entry>
42306 <entry>Default: <emphasis>1</emphasis></entry>
42307 </row>
42308 </tbody>
42309 </tgroup>
42310 </informaltable>
42311 <para>
42312 This limits the number of addresses that can be handled in a single delivery.
42313 Most LMTP servers can handle several addresses at once, so it is normally a
42314 good idea to increase this value. See the description of local delivery
42315 batching in chapter <xref linkend="CHAPbatching"/>.
42316 </para>
42317 <para>
42318 <indexterm role="option">
42319 <primary><option>command</option></primary>
42320 </indexterm>
42321 </para>
42322 <informaltable frame="all">
42323 <tgroup cols="4" colsep="0" rowsep="0">
42324 <colspec colwidth="8*" align="left"/>
42325 <colspec colwidth="6*" align="center"/>
42326 <colspec colwidth="6*" align="center"/>
42327 <colspec colwidth="6*" align="right"/>
42328 <tbody>
42329 <row>
42330 <entry><option>command</option></entry>
42331 <entry>Use: <emphasis>lmtp</emphasis></entry>
42332 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42333 <entry>Default: <emphasis>unset</emphasis></entry>
42334 </row>
42335 </tbody>
42336 </tgroup>
42337 </informaltable>
42338 <para>
42339 This option must be set if <option>socket</option> is not set. The string is a command which
42340 is run in a separate process. It is split up into a command name and list of
42341 arguments, each of which is separately expanded (so expansion cannot change the
42342 number of arguments). The command is run directly, not via a shell. The message
42343 is passed to the new process using the standard input and output to operate the
42344 LMTP protocol.
42345 </para>
42346 <para>
42347 <indexterm role="option">
42348 <primary><option>ignore_quota</option></primary>
42349 </indexterm>
42350 </para>
42351 <informaltable frame="all">
42352 <tgroup cols="4" colsep="0" rowsep="0">
42353 <colspec colwidth="8*" align="left"/>
42354 <colspec colwidth="6*" align="center"/>
42355 <colspec colwidth="6*" align="center"/>
42356 <colspec colwidth="6*" align="right"/>
42357 <tbody>
42358 <row>
42359 <entry><option>ignore_quota</option></entry>
42360 <entry>Use: <emphasis>lmtp</emphasis></entry>
42361 <entry>Type: <emphasis>boolean</emphasis></entry>
42362 <entry>Default: <emphasis>false</emphasis></entry>
42363 </row>
42364 </tbody>
42365 </tgroup>
42366 </informaltable>
42367 <para>
42368 <indexterm role="concept">
42369 <primary>LMTP</primary>
42370 <secondary>ignoring quota errors</secondary>
42371 </indexterm>
42372 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
42373 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
42374 in its response to the LHLO command.
42375 </para>
42376 <para>
42377 <indexterm role="option">
42378 <primary><option>socket</option></primary>
42379 </indexterm>
42380 </para>
42381 <informaltable frame="all">
42382 <tgroup cols="4" colsep="0" rowsep="0">
42383 <colspec colwidth="8*" align="left"/>
42384 <colspec colwidth="6*" align="center"/>
42385 <colspec colwidth="6*" align="center"/>
42386 <colspec colwidth="6*" align="right"/>
42387 <tbody>
42388 <row>
42389 <entry><option>socket</option></entry>
42390 <entry>Use: <emphasis>lmtp</emphasis></entry>
42391 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42392 <entry>Default: <emphasis>unset</emphasis></entry>
42393 </row>
42394 </tbody>
42395 </tgroup>
42396 </informaltable>
42397 <para>
42398 This option must be set if <option>command</option> is not set. The result of expansion must
42399 be the name of a Unix domain socket. The transport connects to the socket and
42400 delivers the message to it using the LMTP protocol.
42401 </para>
42402 <para>
42403 <indexterm role="option">
42404 <primary><option>timeout</option></primary>
42405 </indexterm>
42406 </para>
42407 <informaltable frame="all">
42408 <tgroup cols="4" colsep="0" rowsep="0">
42409 <colspec colwidth="8*" align="left"/>
42410 <colspec colwidth="6*" align="center"/>
42411 <colspec colwidth="6*" align="center"/>
42412 <colspec colwidth="6*" align="right"/>
42413 <tbody>
42414 <row>
42415 <entry><option>timeout</option></entry>
42416 <entry>Use: <emphasis>lmtp</emphasis></entry>
42417 <entry>Type: <emphasis>time</emphasis></entry>
42418 <entry>Default: <emphasis>5m</emphasis></entry>
42419 </row>
42420 </tbody>
42421 </tgroup>
42422 </informaltable>
42423 <para>
42424 The transport is aborted if the created process or Unix domain socket does not
42425 respond to LMTP commands or message input within this timeout. Delivery
42426 is deferred, and will be tried again later. Here is an example of a typical
42427 LMTP transport:
42428 </para>
42429 <literallayout class="monospaced">
42430 lmtp:
42431   driver = lmtp
42432   command = /some/local/lmtp/delivery/program
42433   batch_max = 20
42434   user = exim
42435 </literallayout>
42436 <para>
42437 This delivers up to 20 addresses at a time, in a mixture of domains if
42438 necessary, running as the user <emphasis>exim</emphasis>.
42439 </para>
42440 </chapter>
42441
42442 <chapter id="CHAPpipetransport">
42443 <title>The pipe transport</title>
42444 <para>
42445 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
42446 <primary>transports</primary>
42447 <secondary><command>pipe</command></secondary>
42448 </indexterm>
42449 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
42450 <primary><command>pipe</command> transport</primary>
42451 </indexterm>
42452 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
42453 running in another process. One example is the use of <command>pipe</command> as a
42454 pseudo-remote transport for passing messages to some other delivery mechanism
42455 (such as UUCP). Another is the use by individual users to automatically process
42456 their incoming messages. The <command>pipe</command> transport can be used in one of the
42457 following ways:
42458 </para>
42459 <itemizedlist>
42460 <listitem>
42461 <para>
42462 <indexterm role="variable">
42463 <primary><varname>$local_part</varname></primary>
42464 </indexterm>
42465 A router routes one address to a transport in the normal way, and the
42466 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
42467 contains the local part of the address (as usual), and the command that is run
42468 is specified by the <option>command</option> option on the transport.
42469 </para>
42470 </listitem>
42471 <listitem>
42472 <para>
42473 <indexterm role="variable">
42474 <primary><varname>$pipe_addresses</varname></primary>
42475 </indexterm>
42476 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
42477 transport can handle more than one address in a single run. In this case, when
42478 more than one address is routed to the transport, <varname>$local_part</varname> is not set
42479 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
42480 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
42481 that are routed to the transport.
42482 </para>
42483 </listitem>
42484 <listitem>
42485 <para>
42486 <indexterm role="variable">
42487 <primary><varname>$address_pipe</varname></primary>
42488 </indexterm>
42489 A router redirects an address directly to a pipe command (for example, from an
42490 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
42491 pipe command, and the <option>command</option> option on the transport is ignored unless
42492 <option>force_command</option> is set. If only one address is being transported
42493 (<option>batch_max</option> is not greater than one, or only one address was redirected to
42494 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
42495 </para>
42496 </listitem>
42497 </itemizedlist>
42498 <para>
42499 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
42500 deliver messages over pipes using the LMTP interactive protocol. This is
42501 implemented by the <command>lmtp</command> transport.
42502 </para>
42503 <para>
42504 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
42505 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
42506 other cases, the uid and gid have to be specified explicitly, either on the
42507 transport or on the router that handles the address. Current and <quote>home</quote>
42508 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
42509 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
42510 for a discussion of local delivery batching.
42511 </para>
42512 <section id="SECID140">
42513 <title>Concurrent delivery</title>
42514 <para>
42515 If two messages arrive at almost the same time, and both are routed to a pipe
42516 delivery, the two pipe transports may be run concurrently. You must ensure that
42517 any pipe commands you set up are robust against this happening. If the commands
42518 write to a file, the <option>exim_lock</option> utility might be of use.
42519 </para>
42520 </section>
42521 <section id="SECID141">
42522 <title>Returned status and data</title>
42523 <para>
42524 <indexterm role="concept">
42525 <primary><command>pipe</command> transport</primary>
42526 <secondary>returned data</secondary>
42527 </indexterm>
42528 If the command exits with a non-zero return code, the delivery is deemed to
42529 have failed, unless either the <option>ignore_status</option> option is set (in which case
42530 the return code is treated as zero), or the return code is one of those listed
42531 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
42532 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
42533 logged, but are not included in the bounce message, which merely contains
42534 <quote>local delivery failed</quote>.
42535 </para>
42536 <para>
42537 If the command exits on a signal and the <option>freeze_signal</option> option is set then
42538 the message will be frozen in the queue. If that option is not set, a bounce
42539 will be sent as normal.
42540 </para>
42541 <para>
42542 If the return code is greater than 128 and the command being run is a shell
42543 script, it normally means that the script was terminated by a signal whose
42544 value is the return code minus 128. The <option>freeze_signal</option> option does not
42545 apply in this case.
42546 </para>
42547 <para>
42548 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
42549 return code is set to 127. This is the value that a shell returns if it is
42550 asked to run a non-existent command. The wording for the log line suggests that
42551 a non-existent command may be the problem.
42552 </para>
42553 <para>
42554 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
42555 set and the command produces any output on its standard output or standard
42556 error streams, the command is considered to have failed, even if it gave a zero
42557 return code or if <option>ignore_status</option> is set. The output from the command is
42558 included as part of the bounce message. The <option>return_fail_output</option> option is
42559 similar, except that output is returned only when the command exits with a
42560 failure return code, that is, a value other than zero or a code that matches
42561 <option>temp_errors</option>.
42562 </para>
42563 </section>
42564 <section id="SECThowcommandrun">
42565 <title>How the command is run</title>
42566 <para>
42567 <indexterm role="concept">
42568 <primary><command>pipe</command> transport</primary>
42569 <secondary>path for command</secondary>
42570 </indexterm>
42571 The command line is (by default) broken down into a command name and arguments
42572 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
42573 <option>restrict_to_path</option> options can be used to restrict the commands that may be
42574 run.
42575 </para>
42576 <para>
42577 <indexterm role="concept">
42578 <primary>quoting</primary>
42579 <secondary>in pipe command</secondary>
42580 </indexterm>
42581 Unquoted arguments are delimited by white space. If an argument appears in
42582 double quotes, backslash is interpreted as an escape character in the usual
42583 way. If an argument appears in single quotes, no escaping is done.
42584 </para>
42585 <para>
42586 String expansion is applied to the command line except when it comes from a
42587 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
42588 expansion is applied to each argument in turn rather than to the whole line.
42589 For this reason, any string expansion item that contains white space must be
42590 quoted so as to be contained within a single argument. A setting such as
42591 </para>
42592 <literallayout class="monospaced">
42593 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
42594 </literallayout>
42595 <para>
42596 will not work, because the expansion item gets split between several
42597 arguments. You have to write
42598 </para>
42599 <literallayout class="monospaced">
42600 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
42601 </literallayout>
42602 <para>
42603 to ensure that it is all in one argument. The expansion is done in this way,
42604 argument by argument, so that the number of arguments cannot be changed as a
42605 result of expansion, and quotes or backslashes in inserted variables do not
42606 interact with external quoting. However, this leads to problems if you want to
42607 generate multiple arguments (or the command name plus arguments) from a single
42608 expansion. In this situation, the simplest solution is to use a shell. For
42609 example:
42610 </para>
42611 <literallayout class="monospaced">
42612 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
42613 </literallayout>
42614 <para>
42615 <indexterm role="concept">
42616 <primary>transport</primary>
42617 <secondary>filter</secondary>
42618 </indexterm>
42619 <indexterm role="concept">
42620 <primary>filter</primary>
42621 <secondary>transport filter</secondary>
42622 </indexterm>
42623 <indexterm role="variable">
42624 <primary><varname>$pipe_addresses</varname></primary>
42625 </indexterm>
42626 Special handling takes place when an argument consists of precisely the text
42627 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
42628 place this string is recognized is when it appears as an argument for a pipe or
42629 transport filter command. It causes each address that is being handled to be
42630 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
42631 avoids any problems with spaces or shell metacharacters, and is of use when a
42632 <command>pipe</command> transport is handling groups of addresses in a batch.
42633 </para>
42634 <para>
42635 If <option>force_command</option> is enabled on the transport, Special handling takes place
42636 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
42637 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
42638 argument is inserted in the argument list at that point
42639 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
42640 the only item in the argument; in fact, if it were then <option>force_command</option>
42641 should behave as a no-op.  Rather, it should be used to adjust the command
42642 run while preserving the argument vector separation.
42643 </para>
42644 <para>
42645 After splitting up into arguments and expansion, the resulting command is run
42646 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
42647 message that is being delivered is supplied on the standard input, and the
42648 standard output and standard error are both connected to a single pipe that is
42649 read by Exim. The <option>max_output</option> option controls how much output the command
42650 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
42651 control what is done with it.
42652 </para>
42653 <para>
42654 Not running the command under a shell (by default) lessens the security risks
42655 in cases when a command from a user&#x2019;s filter file is built out of data that was
42656 taken from an incoming message. If a shell is required, it can of course be
42657 explicitly specified as the command to be run. However, there are circumstances
42658 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
42659 under a shell and cannot easily be modified. To allow for these cases, there is
42660 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
42661 works. Instead of breaking up the command line as just described, it expands it
42662 as a single string and passes the result to <filename>/bin/sh</filename>. The
42663 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
42664 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
42665 </para>
42666 </section>
42667 <section id="SECTpipeenv">
42668 <title>Environment variables</title>
42669 <para>
42670 <indexterm role="concept">
42671 <primary><command>pipe</command> transport</primary>
42672 <secondary>environment for command</secondary>
42673 </indexterm>
42674 <indexterm role="concept">
42675 <primary>environment for pipe transport</primary>
42676 </indexterm>
42677 The environment variables listed below are set up when the command is invoked.
42678 This list is a compromise for maximum compatibility with other MTAs. Note that
42679 the <option>environment</option> option can be used to add additional variables to this
42680 environment.
42681 </para>
42682 <literallayout>
42683 <literal>DOMAIN            </literal>   the domain of the address
42684 <literal>HOME              </literal>   the home directory, if set
42685 <literal>HOST              </literal>   the host name when called from a router (see below)
42686 <literal>LOCAL_PART        </literal>   see below
42687 <literal>LOCAL_PART_PREFIX </literal>   see below
42688 <literal>LOCAL_PART_SUFFIX </literal>   see below
42689 <literal>LOGNAME           </literal>   see below
42690 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
42691 <literal>PATH              </literal>   as specified by the <option>path</option> option below
42692 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
42693 <literal>RECIPIENT         </literal>   the complete recipient address
42694 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
42695 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
42696 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
42697 <literal>USER              </literal>   see below
42698 </literallayout>
42699 <para>
42700 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
42701 router, LOCAL_PART is set to the local part of the address. When it is
42702 called as a result of a forward or alias expansion, LOCAL_PART is set to
42703 the local part of the address that was expanded. In both cases, any affixes are
42704 removed from the local part, and made available in LOCAL_PART_PREFIX and
42705 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
42706 same value as LOCAL_PART for compatibility with other MTAs.
42707 </para>
42708 <para>
42709 <indexterm role="concept">
42710 <primary>HOST</primary>
42711 </indexterm>
42712 HOST is set only when a <command>pipe</command> transport is called from a router that
42713 associates hosts with an address, typically when using <command>pipe</command> as a
42714 pseudo-remote transport. HOST is set to the first host name specified by
42715 the router.
42716 </para>
42717 <para>
42718 <indexterm role="concept">
42719 <primary>HOME</primary>
42720 </indexterm>
42721 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
42722 for the HOME environment variable. Otherwise, a home directory may be set
42723 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
42724 user&#x2019;s home directory if <option>check_local_user</option> is set.
42725 </para>
42726 </section>
42727 <section id="SECID142">
42728 <title>Private options for pipe</title>
42729 <para>
42730 <indexterm role="concept">
42731 <primary>options</primary>
42732 <secondary><command>pipe</command> transport</secondary>
42733 </indexterm>
42734 </para>
42735 <para>
42736 <indexterm role="option">
42737 <primary><option>allow_commands</option></primary>
42738 </indexterm>
42739 </para>
42740 <informaltable frame="all">
42741 <tgroup cols="4" colsep="0" rowsep="0">
42742 <colspec colwidth="8*" align="left"/>
42743 <colspec colwidth="6*" align="center"/>
42744 <colspec colwidth="6*" align="center"/>
42745 <colspec colwidth="6*" align="right"/>
42746 <tbody>
42747 <row>
42748 <entry><option>allow_commands</option></entry>
42749 <entry>Use: <emphasis>pipe</emphasis></entry>
42750 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42751 <entry>Default: <emphasis>unset</emphasis></entry>
42752 </row>
42753 </tbody>
42754 </tgroup>
42755 </informaltable>
42756 <para>
42757 <indexterm role="concept">
42758 <primary><command>pipe</command> transport</primary>
42759 <secondary>permitted commands</secondary>
42760 </indexterm>
42761 The string is expanded, and is then interpreted as a colon-separated list of
42762 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
42763 permitted are those in the <option>allow_commands</option> list. They need not be absolute
42764 paths; the <option>path</option> option is still used for relative paths. If
42765 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
42766 in the <option>allow_commands</option> list, or a name without any slashes that is found on
42767 the path. In other words, if neither <option>allow_commands</option> nor
42768 <option>restrict_to_path</option> is set, there is no restriction on the command, but
42769 otherwise only commands that are permitted by one or the other are allowed. For
42770 example, if
42771 </para>
42772 <literallayout class="monospaced">
42773 allow_commands = /usr/bin/vacation
42774 </literallayout>
42775 <para>
42776 and <option>restrict_to_path</option> is not set, the only permitted command is
42777 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
42778 <option>use_shell</option> is set.
42779 </para>
42780 <para>
42781 <indexterm role="option">
42782 <primary><option>batch_id</option></primary>
42783 </indexterm>
42784 </para>
42785 <informaltable frame="all">
42786 <tgroup cols="4" colsep="0" rowsep="0">
42787 <colspec colwidth="8*" align="left"/>
42788 <colspec colwidth="6*" align="center"/>
42789 <colspec colwidth="6*" align="center"/>
42790 <colspec colwidth="6*" align="right"/>
42791 <tbody>
42792 <row>
42793 <entry><option>batch_id</option></entry>
42794 <entry>Use: <emphasis>pipe</emphasis></entry>
42795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42796 <entry>Default: <emphasis>unset</emphasis></entry>
42797 </row>
42798 </tbody>
42799 </tgroup>
42800 </informaltable>
42801 <para>
42802 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42803 </para>
42804 <para>
42805 <indexterm role="option">
42806 <primary><option>batch_max</option></primary>
42807 </indexterm>
42808 </para>
42809 <informaltable frame="all">
42810 <tgroup cols="4" colsep="0" rowsep="0">
42811 <colspec colwidth="8*" align="left"/>
42812 <colspec colwidth="6*" align="center"/>
42813 <colspec colwidth="6*" align="center"/>
42814 <colspec colwidth="6*" align="right"/>
42815 <tbody>
42816 <row>
42817 <entry><option>batch_max</option></entry>
42818 <entry>Use: <emphasis>pipe</emphasis></entry>
42819 <entry>Type: <emphasis>integer</emphasis></entry>
42820 <entry>Default: <emphasis>1</emphasis></entry>
42821 </row>
42822 </tbody>
42823 </tgroup>
42824 </informaltable>
42825 <para>
42826 This limits the number of addresses that can be handled in a single delivery.
42827 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42828 </para>
42829 <para>
42830 <indexterm role="option">
42831 <primary><option>check_string</option></primary>
42832 </indexterm>
42833 </para>
42834 <informaltable frame="all">
42835 <tgroup cols="4" colsep="0" rowsep="0">
42836 <colspec colwidth="8*" align="left"/>
42837 <colspec colwidth="6*" align="center"/>
42838 <colspec colwidth="6*" align="center"/>
42839 <colspec colwidth="6*" align="right"/>
42840 <tbody>
42841 <row>
42842 <entry><option>check_string</option></entry>
42843 <entry>Use: <emphasis>pipe</emphasis></entry>
42844 <entry>Type: <emphasis>string</emphasis></entry>
42845 <entry>Default: <emphasis>unset</emphasis></entry>
42846 </row>
42847 </tbody>
42848 </tgroup>
42849 </informaltable>
42850 <para>
42851 As <command>pipe</command> writes the message, the start of each line is tested for matching
42852 <option>check_string</option>, and if it does, the initial matching characters are replaced
42853 by the contents of <option>escape_string</option>, provided both are set. The value of
42854 <option>check_string</option> is a literal string, not a regular expression, and the case of
42855 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
42856 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
42857 the SMTP escaping protocol. Any settings made in the configuration file are
42858 ignored.
42859 </para>
42860 <para>
42861 <indexterm role="option">
42862 <primary><option>command</option></primary>
42863 </indexterm>
42864 </para>
42865 <informaltable frame="all">
42866 <tgroup cols="4" colsep="0" rowsep="0">
42867 <colspec colwidth="8*" align="left"/>
42868 <colspec colwidth="6*" align="center"/>
42869 <colspec colwidth="6*" align="center"/>
42870 <colspec colwidth="6*" align="right"/>
42871 <tbody>
42872 <row>
42873 <entry><option>command</option></entry>
42874 <entry>Use: <emphasis>pipe</emphasis></entry>
42875 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42876 <entry>Default: <emphasis>unset</emphasis></entry>
42877 </row>
42878 </tbody>
42879 </tgroup>
42880 </informaltable>
42881 <para>
42882 This option need not be set when <command>pipe</command> is being used to deliver to pipes
42883 obtained directly from address redirections. In other cases, the option must be
42884 set, to provide a command to be run. It need not yield an absolute path (see
42885 the <option>path</option> option below). The command is split up into separate arguments by
42886 Exim, and each argument is separately expanded, as described in section
42887 <xref linkend="SECThowcommandrun"/> above.
42888 </para>
42889 <para>
42890 <indexterm role="option">
42891 <primary><option>environment</option></primary>
42892 </indexterm>
42893 </para>
42894 <informaltable frame="all">
42895 <tgroup cols="4" colsep="0" rowsep="0">
42896 <colspec colwidth="8*" align="left"/>
42897 <colspec colwidth="6*" align="center"/>
42898 <colspec colwidth="6*" align="center"/>
42899 <colspec colwidth="6*" align="right"/>
42900 <tbody>
42901 <row>
42902 <entry><option>environment</option></entry>
42903 <entry>Use: <emphasis>pipe</emphasis></entry>
42904 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42905 <entry>Default: <emphasis>unset</emphasis></entry>
42906 </row>
42907 </tbody>
42908 </tgroup>
42909 </informaltable>
42910 <para>
42911 <indexterm role="concept">
42912 <primary><command>pipe</command> transport</primary>
42913 <secondary>environment for command</secondary>
42914 </indexterm>
42915 <indexterm role="concept">
42916 <primary>environment for <command>pipe</command> transport</primary>
42917 </indexterm>
42918 This option is used to add additional variables to the environment in which the
42919 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
42920 a string which is expanded, and then interpreted as a colon-separated list of
42921 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
42922 </para>
42923 <para>
42924 <indexterm role="option">
42925 <primary><option>escape_string</option></primary>
42926 </indexterm>
42927 </para>
42928 <informaltable frame="all">
42929 <tgroup cols="4" colsep="0" rowsep="0">
42930 <colspec colwidth="8*" align="left"/>
42931 <colspec colwidth="6*" align="center"/>
42932 <colspec colwidth="6*" align="center"/>
42933 <colspec colwidth="6*" align="right"/>
42934 <tbody>
42935 <row>
42936 <entry><option>escape_string</option></entry>
42937 <entry>Use: <emphasis>pipe</emphasis></entry>
42938 <entry>Type: <emphasis>string</emphasis></entry>
42939 <entry>Default: <emphasis>unset</emphasis></entry>
42940 </row>
42941 </tbody>
42942 </tgroup>
42943 </informaltable>
42944 <para>
42945 See <option>check_string</option> above.
42946 </para>
42947 <para>
42948 <indexterm role="option">
42949 <primary><option>freeze_exec_fail</option></primary>
42950 </indexterm>
42951 </para>
42952 <informaltable frame="all">
42953 <tgroup cols="4" colsep="0" rowsep="0">
42954 <colspec colwidth="8*" align="left"/>
42955 <colspec colwidth="6*" align="center"/>
42956 <colspec colwidth="6*" align="center"/>
42957 <colspec colwidth="6*" align="right"/>
42958 <tbody>
42959 <row>
42960 <entry><option>freeze_exec_fail</option></entry>
42961 <entry>Use: <emphasis>pipe</emphasis></entry>
42962 <entry>Type: <emphasis>boolean</emphasis></entry>
42963 <entry>Default: <emphasis>false</emphasis></entry>
42964 </row>
42965 </tbody>
42966 </tgroup>
42967 </informaltable>
42968 <para>
42969 <indexterm role="concept">
42970 <primary>exec failure</primary>
42971 </indexterm>
42972 <indexterm role="concept">
42973 <primary>failure of exec</primary>
42974 </indexterm>
42975 <indexterm role="concept">
42976 <primary><command>pipe</command> transport</primary>
42977 <secondary>failure of exec</secondary>
42978 </indexterm>
42979 Failure to exec the command in a pipe transport is by default treated like
42980 any other failure while running the command. However, if <option>freeze_exec_fail</option>
42981 is set, failure to exec is treated specially, and causes the message to be
42982 frozen, whatever the setting of <option>ignore_status</option>.
42983 </para>
42984 <para>
42985 <indexterm role="option">
42986 <primary><option>freeze_signal</option></primary>
42987 </indexterm>
42988 </para>
42989 <informaltable frame="all">
42990 <tgroup cols="4" colsep="0" rowsep="0">
42991 <colspec colwidth="8*" align="left"/>
42992 <colspec colwidth="6*" align="center"/>
42993 <colspec colwidth="6*" align="center"/>
42994 <colspec colwidth="6*" align="right"/>
42995 <tbody>
42996 <row>
42997 <entry><option>freeze_signal</option></entry>
42998 <entry>Use: <emphasis>pipe</emphasis></entry>
42999 <entry>Type: <emphasis>boolean</emphasis></entry>
43000 <entry>Default: <emphasis>false</emphasis></entry>
43001 </row>
43002 </tbody>
43003 </tgroup>
43004 </informaltable>
43005 <para>
43006 <indexterm role="concept">
43007 <primary>signal exit</primary>
43008 </indexterm>
43009 <indexterm role="concept">
43010 <primary><command>pipe</command> transport</primary>
43011 <secondary>,</secondary>
43012 </indexterm>
43013 Normally if the process run by a command in a pipe transport exits on a signal,
43014 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
43015 frozen in Exim&#x2019;s queue instead.
43016 </para>
43017 <para>
43018 <indexterm role="option">
43019 <primary><option>force_command</option></primary>
43020 </indexterm>
43021 </para>
43022 <informaltable frame="all">
43023 <tgroup cols="4" colsep="0" rowsep="0">
43024 <colspec colwidth="8*" align="left"/>
43025 <colspec colwidth="6*" align="center"/>
43026 <colspec colwidth="6*" align="center"/>
43027 <colspec colwidth="6*" align="right"/>
43028 <tbody>
43029 <row>
43030 <entry><option>force_command</option></entry>
43031 <entry>Use: <emphasis>pipe</emphasis></entry>
43032 <entry>Type: <emphasis>boolean</emphasis></entry>
43033 <entry>Default: <emphasis>false</emphasis></entry>
43034 </row>
43035 </tbody>
43036 </tgroup>
43037 </informaltable>
43038 <para>
43039 <indexterm role="concept">
43040 <primary>force command</primary>
43041 </indexterm>
43042 <indexterm role="concept">
43043 <primary><command>pipe</command> transport</primary>
43044 <secondary>,</secondary>
43045 </indexterm>
43046 Normally when a router redirects an address directly to a pipe command
43047 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
43048 is set, the <option>command</option> option will used. This is especially
43049 useful for forcing a wrapper or additional argument to be added to the
43050 command. For example:
43051 </para>
43052 <literallayout class="monospaced">
43053 command = /usr/bin/remote_exec myhost -- $address_pipe
43054 force_command
43055 </literallayout>
43056 <para>
43057 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
43058 <option>force_command</option> is set, expanding out to the original argument vector as
43059 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
43060 </para>
43061 <para>
43062 <indexterm role="option">
43063 <primary><option>ignore_status</option></primary>
43064 </indexterm>
43065 </para>
43066 <informaltable frame="all">
43067 <tgroup cols="4" colsep="0" rowsep="0">
43068 <colspec colwidth="8*" align="left"/>
43069 <colspec colwidth="6*" align="center"/>
43070 <colspec colwidth="6*" align="center"/>
43071 <colspec colwidth="6*" align="right"/>
43072 <tbody>
43073 <row>
43074 <entry><option>ignore_status</option></entry>
43075 <entry>Use: <emphasis>pipe</emphasis></entry>
43076 <entry>Type: <emphasis>boolean</emphasis></entry>
43077 <entry>Default: <emphasis>false</emphasis></entry>
43078 </row>
43079 </tbody>
43080 </tgroup>
43081 </informaltable>
43082 <para>
43083 If this option is true, the status returned by the subprocess that is set up to
43084 run the command is ignored, and Exim behaves as if zero had been returned.
43085 Otherwise, a non-zero status or termination by signal causes an error return
43086 from the transport unless the status value is one of those listed in
43087 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
43088 </para>
43089 <para>
43090 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
43091 See the <option>timeout_defer</option> option for how timeouts are handled.
43092 </para>
43093 <para>
43094 <indexterm role="option">
43095 <primary><option>log_defer_output</option></primary>
43096 </indexterm>
43097 </para>
43098 <informaltable frame="all">
43099 <tgroup cols="4" colsep="0" rowsep="0">
43100 <colspec colwidth="8*" align="left"/>
43101 <colspec colwidth="6*" align="center"/>
43102 <colspec colwidth="6*" align="center"/>
43103 <colspec colwidth="6*" align="right"/>
43104 <tbody>
43105 <row>
43106 <entry><option>log_defer_output</option></entry>
43107 <entry>Use: <emphasis>pipe</emphasis></entry>
43108 <entry>Type: <emphasis>boolean</emphasis></entry>
43109 <entry>Default: <emphasis>false</emphasis></entry>
43110 </row>
43111 </tbody>
43112 </tgroup>
43113 </informaltable>
43114 <para>
43115 <indexterm role="concept">
43116 <primary><command>pipe</command> transport</primary>
43117 <secondary>logging output</secondary>
43118 </indexterm>
43119 If this option is set, and the status returned by the command is
43120 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
43121 and any output was produced, the first line of it is written to the main log.
43122 </para>
43123 <para>
43124 <indexterm role="option">
43125 <primary><option>log_fail_output</option></primary>
43126 </indexterm>
43127 </para>
43128 <informaltable frame="all">
43129 <tgroup cols="4" colsep="0" rowsep="0">
43130 <colspec colwidth="8*" align="left"/>
43131 <colspec colwidth="6*" align="center"/>
43132 <colspec colwidth="6*" align="center"/>
43133 <colspec colwidth="6*" align="right"/>
43134 <tbody>
43135 <row>
43136 <entry><option>log_fail_output</option></entry>
43137 <entry>Use: <emphasis>pipe</emphasis></entry>
43138 <entry>Type: <emphasis>boolean</emphasis></entry>
43139 <entry>Default: <emphasis>false</emphasis></entry>
43140 </row>
43141 </tbody>
43142 </tgroup>
43143 </informaltable>
43144 <para>
43145 If this option is set, and the command returns any output, and also ends with a
43146 return code that is neither zero nor one of the return codes listed in
43147 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
43148 written to the main log. This option and <option>log_output</option> are mutually exclusive.
43149 Only one of them may be set.
43150 </para>
43151 <para>
43152 <indexterm role="option">
43153 <primary><option>log_output</option></primary>
43154 </indexterm>
43155 </para>
43156 <informaltable frame="all">
43157 <tgroup cols="4" colsep="0" rowsep="0">
43158 <colspec colwidth="8*" align="left"/>
43159 <colspec colwidth="6*" align="center"/>
43160 <colspec colwidth="6*" align="center"/>
43161 <colspec colwidth="6*" align="right"/>
43162 <tbody>
43163 <row>
43164 <entry><option>log_output</option></entry>
43165 <entry>Use: <emphasis>pipe</emphasis></entry>
43166 <entry>Type: <emphasis>boolean</emphasis></entry>
43167 <entry>Default: <emphasis>false</emphasis></entry>
43168 </row>
43169 </tbody>
43170 </tgroup>
43171 </informaltable>
43172 <para>
43173 If this option is set and the command returns any output, the first line of
43174 output is written to the main log, whatever the return code. This option and
43175 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
43176 </para>
43177 <para>
43178 <indexterm role="option">
43179 <primary><option>max_output</option></primary>
43180 </indexterm>
43181 </para>
43182 <informaltable frame="all">
43183 <tgroup cols="4" colsep="0" rowsep="0">
43184 <colspec colwidth="8*" align="left"/>
43185 <colspec colwidth="6*" align="center"/>
43186 <colspec colwidth="6*" align="center"/>
43187 <colspec colwidth="6*" align="right"/>
43188 <tbody>
43189 <row>
43190 <entry><option>max_output</option></entry>
43191 <entry>Use: <emphasis>pipe</emphasis></entry>
43192 <entry>Type: <emphasis>integer</emphasis></entry>
43193 <entry>Default: <emphasis>20K</emphasis></entry>
43194 </row>
43195 </tbody>
43196 </tgroup>
43197 </informaltable>
43198 <para>
43199 This specifies the maximum amount of output that the command may produce on its
43200 standard output and standard error file combined. If the limit is exceeded, the
43201 process running the command is killed. This is intended as a safety measure to
43202 catch runaway processes. The limit is applied independently of the settings of
43203 the options that control what is done with such output (for example,
43204 <option>return_output</option>). Because of buffering effects, the amount of output may
43205 exceed the limit by a small amount before Exim notices.
43206 </para>
43207 <para>
43208 <indexterm role="option">
43209 <primary><option>message_prefix</option></primary>
43210 </indexterm>
43211 </para>
43212 <informaltable frame="all">
43213 <tgroup cols="4" colsep="0" rowsep="0">
43214 <colspec colwidth="8*" align="left"/>
43215 <colspec colwidth="6*" align="center"/>
43216 <colspec colwidth="6*" align="center"/>
43217 <colspec colwidth="6*" align="right"/>
43218 <tbody>
43219 <row>
43220 <entry><option>message_prefix</option></entry>
43221 <entry>Use: <emphasis>pipe</emphasis></entry>
43222 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43223 <entry>Default: <emphasis>see below</emphasis></entry>
43224 </row>
43225 </tbody>
43226 </tgroup>
43227 </informaltable>
43228 <para>
43229 The string specified here is expanded and output at the start of every message.
43230 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
43231 </para>
43232 <literallayout class="monospaced">
43233 message_prefix = \
43234   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
43235   ${tod_bsdinbox}\n
43236 </literallayout>
43237 <para>
43238 <indexterm role="concept">
43239 <primary>Cyrus</primary>
43240 </indexterm>
43241 <indexterm role="concept">
43242 <primary><option>tmail</option></primary>
43243 </indexterm>
43244 <indexterm role="concept">
43245 <primary><quote>From</quote> line</primary>
43246 </indexterm>
43247 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
43248 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
43249 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
43250 setting
43251 </para>
43252 <literallayout class="monospaced">
43253 message_prefix =
43254 </literallayout>
43255 <para>
43256 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43257 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
43258 </para>
43259 <para>
43260 <indexterm role="option">
43261 <primary><option>message_suffix</option></primary>
43262 </indexterm>
43263 </para>
43264 <informaltable frame="all">
43265 <tgroup cols="4" colsep="0" rowsep="0">
43266 <colspec colwidth="8*" align="left"/>
43267 <colspec colwidth="6*" align="center"/>
43268 <colspec colwidth="6*" align="center"/>
43269 <colspec colwidth="6*" align="right"/>
43270 <tbody>
43271 <row>
43272 <entry><option>message_suffix</option></entry>
43273 <entry>Use: <emphasis>pipe</emphasis></entry>
43274 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43275 <entry>Default: <emphasis>see below</emphasis></entry>
43276 </row>
43277 </tbody>
43278 </tgroup>
43279 </informaltable>
43280 <para>
43281 The string specified here is expanded and output at the end of every message.
43282 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
43283 The suffix can be suppressed by setting
43284 </para>
43285 <literallayout class="monospaced">
43286 message_suffix =
43287 </literallayout>
43288 <para>
43289 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43290 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
43291 </para>
43292 <para>
43293 <indexterm role="option">
43294 <primary><option>path</option></primary>
43295 </indexterm>
43296 </para>
43297 <informaltable frame="all">
43298 <tgroup cols="4" colsep="0" rowsep="0">
43299 <colspec colwidth="8*" align="left"/>
43300 <colspec colwidth="6*" align="center"/>
43301 <colspec colwidth="6*" align="center"/>
43302 <colspec colwidth="6*" align="right"/>
43303 <tbody>
43304 <row>
43305 <entry><option>path</option></entry>
43306 <entry>Use: <emphasis>pipe</emphasis></entry>
43307 <entry>Type: <emphasis>string</emphasis></entry>
43308 <entry>Default: <emphasis>see below</emphasis></entry>
43309 </row>
43310 </tbody>
43311 </tgroup>
43312 </informaltable>
43313 <para>
43314 This option specifies the string that is set up in the PATH environment
43315 variable of the subprocess. The default is:
43316 </para>
43317 <literallayout class="monospaced">
43318 /bin:/usr/bin
43319 </literallayout>
43320 <para>
43321 If the <option>command</option> option does not yield an absolute path name, the command is
43322 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
43323 apply to a command specified as a transport filter.
43324 </para>
43325 <para>
43326 <indexterm role="option">
43327 <primary><option>permit_coredump</option></primary>
43328 </indexterm>
43329 </para>
43330 <informaltable frame="all">
43331 <tgroup cols="4" colsep="0" rowsep="0">
43332 <colspec colwidth="8*" align="left"/>
43333 <colspec colwidth="6*" align="center"/>
43334 <colspec colwidth="6*" align="center"/>
43335 <colspec colwidth="6*" align="right"/>
43336 <tbody>
43337 <row>
43338 <entry><option>permit_coredump</option></entry>
43339 <entry>Use: <emphasis>pipe</emphasis></entry>
43340 <entry>Type: <emphasis>boolean</emphasis></entry>
43341 <entry>Default: <emphasis>false</emphasis></entry>
43342 </row>
43343 </tbody>
43344 </tgroup>
43345 </informaltable>
43346 <para>
43347 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
43348 a core-dump of a pipe command, enable this command.  This enables core-dumps
43349 during delivery and affects both the Exim binary and the pipe command run.
43350 It is recommended that this option remain off unless and until you have a need
43351 for it and that this only be enabled when needed, as the risk of excessive
43352 resource consumption can be quite high.  Note also that Exim is typically
43353 installed as a setuid binary and most operating systems will inhibit coredumps
43354 of these by default, so further OS-specific action may be required.
43355 </para>
43356 <para>
43357 <indexterm role="option">
43358 <primary><option>pipe_as_creator</option></primary>
43359 </indexterm>
43360 </para>
43361 <informaltable frame="all">
43362 <tgroup cols="4" colsep="0" rowsep="0">
43363 <colspec colwidth="8*" align="left"/>
43364 <colspec colwidth="6*" align="center"/>
43365 <colspec colwidth="6*" align="center"/>
43366 <colspec colwidth="6*" align="right"/>
43367 <tbody>
43368 <row>
43369 <entry><option>pipe_as_creator</option></entry>
43370 <entry>Use: <emphasis>pipe</emphasis></entry>
43371 <entry>Type: <emphasis>boolean</emphasis></entry>
43372 <entry>Default: <emphasis>false</emphasis></entry>
43373 </row>
43374 </tbody>
43375 </tgroup>
43376 </informaltable>
43377 <para>
43378 <indexterm role="concept">
43379 <primary>uid (user id)</primary>
43380 <secondary>local delivery</secondary>
43381 </indexterm>
43382 If the generic <option>user</option> option is not set and this option is true, the delivery
43383 process is run under the uid that was in force when Exim was originally called
43384 to accept the message. If the group id is not otherwise set (via the generic
43385 <option>group</option> option), the gid that was in force when Exim was originally called to
43386 accept the message is used.
43387 </para>
43388 <para>
43389 <indexterm role="option">
43390 <primary><option>restrict_to_path</option></primary>
43391 </indexterm>
43392 </para>
43393 <informaltable frame="all">
43394 <tgroup cols="4" colsep="0" rowsep="0">
43395 <colspec colwidth="8*" align="left"/>
43396 <colspec colwidth="6*" align="center"/>
43397 <colspec colwidth="6*" align="center"/>
43398 <colspec colwidth="6*" align="right"/>
43399 <tbody>
43400 <row>
43401 <entry><option>restrict_to_path</option></entry>
43402 <entry>Use: <emphasis>pipe</emphasis></entry>
43403 <entry>Type: <emphasis>boolean</emphasis></entry>
43404 <entry>Default: <emphasis>false</emphasis></entry>
43405 </row>
43406 </tbody>
43407 </tgroup>
43408 </informaltable>
43409 <para>
43410 When this option is set, any command name not listed in <option>allow_commands</option> must
43411 contain no slashes. The command is searched for only in the directories listed
43412 in the <option>path</option> option. This option is intended for use in the case when a pipe
43413 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
43414 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
43415 </para>
43416 <para>
43417 <indexterm role="option">
43418 <primary><option>return_fail_output</option></primary>
43419 </indexterm>
43420 </para>
43421 <informaltable frame="all">
43422 <tgroup cols="4" colsep="0" rowsep="0">
43423 <colspec colwidth="8*" align="left"/>
43424 <colspec colwidth="6*" align="center"/>
43425 <colspec colwidth="6*" align="center"/>
43426 <colspec colwidth="6*" align="right"/>
43427 <tbody>
43428 <row>
43429 <entry><option>return_fail_output</option></entry>
43430 <entry>Use: <emphasis>pipe</emphasis></entry>
43431 <entry>Type: <emphasis>boolean</emphasis></entry>
43432 <entry>Default: <emphasis>false</emphasis></entry>
43433 </row>
43434 </tbody>
43435 </tgroup>
43436 </informaltable>
43437 <para>
43438 If this option is true, and the command produced any output and ended with a
43439 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
43440 is, the delivery failed), the output is returned in the bounce message.
43441 However, if the message has a null sender (that is, it is itself a bounce
43442 message), output from the command is discarded. This option and
43443 <option>return_output</option> are mutually exclusive. Only one of them may be set.
43444 </para>
43445 <para>
43446 <indexterm role="option">
43447 <primary><option>return_output</option></primary>
43448 </indexterm>
43449 </para>
43450 <informaltable frame="all">
43451 <tgroup cols="4" colsep="0" rowsep="0">
43452 <colspec colwidth="8*" align="left"/>
43453 <colspec colwidth="6*" align="center"/>
43454 <colspec colwidth="6*" align="center"/>
43455 <colspec colwidth="6*" align="right"/>
43456 <tbody>
43457 <row>
43458 <entry><option>return_output</option></entry>
43459 <entry>Use: <emphasis>pipe</emphasis></entry>
43460 <entry>Type: <emphasis>boolean</emphasis></entry>
43461 <entry>Default: <emphasis>false</emphasis></entry>
43462 </row>
43463 </tbody>
43464 </tgroup>
43465 </informaltable>
43466 <para>
43467 If this option is true, and the command produced any output, the delivery is
43468 deemed to have failed whatever the return code from the command, and the output
43469 is returned in the bounce message. Otherwise, the output is just discarded.
43470 However, if the message has a null sender (that is, it is a bounce message),
43471 output from the command is always discarded, whatever the setting of this
43472 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
43473 of them may be set.
43474 </para>
43475 <para>
43476 <indexterm role="option">
43477 <primary><option>temp_errors</option></primary>
43478 </indexterm>
43479 </para>
43480 <informaltable frame="all">
43481 <tgroup cols="4" colsep="0" rowsep="0">
43482 <colspec colwidth="8*" align="left"/>
43483 <colspec colwidth="6*" align="center"/>
43484 <colspec colwidth="6*" align="center"/>
43485 <colspec colwidth="6*" align="right"/>
43486 <tbody>
43487 <row>
43488 <entry><option>temp_errors</option></entry>
43489 <entry>Use: <emphasis>pipe</emphasis></entry>
43490 <entry>Type: <emphasis>string list</emphasis></entry>
43491 <entry>Default: <emphasis>see below</emphasis></entry>
43492 </row>
43493 </tbody>
43494 </tgroup>
43495 </informaltable>
43496 <para>
43497 <indexterm role="concept">
43498 <primary><command>pipe</command> transport</primary>
43499 <secondary>temporary failure</secondary>
43500 </indexterm>
43501 This option contains either a colon-separated list of numbers, or a single
43502 asterisk. If <option>ignore_status</option> is false
43503 and <option>return_output</option> is not set,
43504 and the command exits with a non-zero return code, the failure is treated as
43505 temporary and the delivery is deferred if the return code matches one of the
43506 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
43507 codes are treated as permanent errors. The default setting contains the codes
43508 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
43509 compiled on a system that does not define these macros, it assumes values of 75
43510 and 73, respectively.
43511 </para>
43512 <para>
43513 <indexterm role="option">
43514 <primary><option>timeout</option></primary>
43515 </indexterm>
43516 </para>
43517 <informaltable frame="all">
43518 <tgroup cols="4" colsep="0" rowsep="0">
43519 <colspec colwidth="8*" align="left"/>
43520 <colspec colwidth="6*" align="center"/>
43521 <colspec colwidth="6*" align="center"/>
43522 <colspec colwidth="6*" align="right"/>
43523 <tbody>
43524 <row>
43525 <entry><option>timeout</option></entry>
43526 <entry>Use: <emphasis>pipe</emphasis></entry>
43527 <entry>Type: <emphasis>time</emphasis></entry>
43528 <entry>Default: <emphasis>1h</emphasis></entry>
43529 </row>
43530 </tbody>
43531 </tgroup>
43532 </informaltable>
43533 <para>
43534 If the command fails to complete within this time, it is killed. This normally
43535 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
43536 specifies no timeout. In order to ensure that any subprocesses created by the
43537 command are also killed, Exim makes the initial process a process group leader,
43538 and kills the whole process group on a timeout. However, this can be defeated
43539 if one of the processes starts a new process group.
43540 </para>
43541 <para>
43542 <indexterm role="option">
43543 <primary><option>timeout_defer</option></primary>
43544 </indexterm>
43545 </para>
43546 <informaltable frame="all">
43547 <tgroup cols="4" colsep="0" rowsep="0">
43548 <colspec colwidth="8*" align="left"/>
43549 <colspec colwidth="6*" align="center"/>
43550 <colspec colwidth="6*" align="center"/>
43551 <colspec colwidth="6*" align="right"/>
43552 <tbody>
43553 <row>
43554 <entry><option>timeout_defer</option></entry>
43555 <entry>Use: <emphasis>pipe</emphasis></entry>
43556 <entry>Type: <emphasis>boolean</emphasis></entry>
43557 <entry>Default: <emphasis>false</emphasis></entry>
43558 </row>
43559 </tbody>
43560 </tgroup>
43561 </informaltable>
43562 <para>
43563 A timeout in a <command>pipe</command> transport, either in the command that the transport
43564 runs, or in a transport filter that is associated with it, is by default
43565 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
43566 is set true, both kinds of timeout become temporary errors, causing the
43567 delivery to be deferred.
43568 </para>
43569 <para>
43570 <indexterm role="option">
43571 <primary><option>umask</option></primary>
43572 </indexterm>
43573 </para>
43574 <informaltable frame="all">
43575 <tgroup cols="4" colsep="0" rowsep="0">
43576 <colspec colwidth="8*" align="left"/>
43577 <colspec colwidth="6*" align="center"/>
43578 <colspec colwidth="6*" align="center"/>
43579 <colspec colwidth="6*" align="right"/>
43580 <tbody>
43581 <row>
43582 <entry><option>umask</option></entry>
43583 <entry>Use: <emphasis>pipe</emphasis></entry>
43584 <entry>Type: <emphasis>octal integer</emphasis></entry>
43585 <entry>Default: <emphasis>022</emphasis></entry>
43586 </row>
43587 </tbody>
43588 </tgroup>
43589 </informaltable>
43590 <para>
43591 This specifies the umask setting for the subprocess that runs the command.
43592 </para>
43593 <para>
43594 <indexterm role="option">
43595 <primary><option>use_bsmtp</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>use_bsmtp</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 <indexterm role="concept">
43616 <primary>envelope sender</primary>
43617 </indexterm>
43618 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
43619 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
43620 commands. If you want to include a leading HELO command with such messages,
43621 you can do so by setting the <option>message_prefix</option> option. See section
43622 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
43623 </para>
43624 <para>
43625 <indexterm role="option">
43626 <primary><option>use_classresources</option></primary>
43627 </indexterm>
43628 </para>
43629 <informaltable frame="all">
43630 <tgroup cols="4" colsep="0" rowsep="0">
43631 <colspec colwidth="8*" align="left"/>
43632 <colspec colwidth="6*" align="center"/>
43633 <colspec colwidth="6*" align="center"/>
43634 <colspec colwidth="6*" align="right"/>
43635 <tbody>
43636 <row>
43637 <entry><option>use_classresources</option></entry>
43638 <entry>Use: <emphasis>pipe</emphasis></entry>
43639 <entry>Type: <emphasis>boolean</emphasis></entry>
43640 <entry>Default: <emphasis>false</emphasis></entry>
43641 </row>
43642 </tbody>
43643 </tgroup>
43644 </informaltable>
43645 <para>
43646 <indexterm role="concept">
43647 <primary>class resources (BSD)</primary>
43648 </indexterm>
43649 This option is available only when Exim is running on FreeBSD, NetBSD, or
43650 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
43651 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
43652 limits for the uid under which the pipe is to run are obtained from the login
43653 class database.
43654 </para>
43655 <para>
43656 <indexterm role="option">
43657 <primary><option>use_crlf</option></primary>
43658 </indexterm>
43659 </para>
43660 <informaltable frame="all">
43661 <tgroup cols="4" colsep="0" rowsep="0">
43662 <colspec colwidth="8*" align="left"/>
43663 <colspec colwidth="6*" align="center"/>
43664 <colspec colwidth="6*" align="center"/>
43665 <colspec colwidth="6*" align="right"/>
43666 <tbody>
43667 <row>
43668 <entry><option>use_crlf</option></entry>
43669 <entry>Use: <emphasis>pipe</emphasis></entry>
43670 <entry>Type: <emphasis>boolean</emphasis></entry>
43671 <entry>Default: <emphasis>false</emphasis></entry>
43672 </row>
43673 </tbody>
43674 </tgroup>
43675 </informaltable>
43676 <para>
43677 <indexterm role="concept">
43678 <primary>carriage return</primary>
43679 </indexterm>
43680 <indexterm role="concept">
43681 <primary>linefeed</primary>
43682 </indexterm>
43683 This option causes lines to be terminated with the two-character CRLF sequence
43684 (carriage return, linefeed) instead of just a linefeed character. In the case
43685 of batched SMTP, the byte sequence written to the pipe is then an exact image
43686 of what would be sent down a real SMTP connection.
43687 </para>
43688 <para>
43689 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
43690 written verbatim, so must contain their own carriage return characters if these
43691 are needed. When <option>use_bsmtp</option> is not set, the default values for both
43692 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
43693 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43694 </para>
43695 <para>
43696 <indexterm role="option">
43697 <primary><option>use_shell</option></primary>
43698 </indexterm>
43699 </para>
43700 <informaltable frame="all">
43701 <tgroup cols="4" colsep="0" rowsep="0">
43702 <colspec colwidth="8*" align="left"/>
43703 <colspec colwidth="6*" align="center"/>
43704 <colspec colwidth="6*" align="center"/>
43705 <colspec colwidth="6*" align="right"/>
43706 <tbody>
43707 <row>
43708 <entry><option>use_shell</option></entry>
43709 <entry>Use: <emphasis>pipe</emphasis></entry>
43710 <entry>Type: <emphasis>boolean</emphasis></entry>
43711 <entry>Default: <emphasis>false</emphasis></entry>
43712 </row>
43713 </tbody>
43714 </tgroup>
43715 </informaltable>
43716 <para>
43717 <indexterm role="variable">
43718 <primary><varname>$pipe_addresses</varname></primary>
43719 </indexterm>
43720 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
43721 instead of being run directly from the transport, as described in section
43722 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
43723 where the command is expected to be run under a shell and cannot easily be
43724 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
43725 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
43726 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
43727 its <option>-c</option> option.
43728 </para>
43729 </section>
43730 <section id="SECID143">
43731 <title>Using an external local delivery agent</title>
43732 <para>
43733 <indexterm role="concept">
43734 <primary>local delivery</primary>
43735 <secondary>using an external agent</secondary>
43736 </indexterm>
43737 <indexterm role="concept">
43738 <primary><emphasis>procmail</emphasis></primary>
43739 </indexterm>
43740 <indexterm role="concept">
43741 <primary>external local delivery</primary>
43742 </indexterm>
43743 <indexterm role="concept">
43744 <primary>delivery</primary>
43745 <secondary><emphasis>procmail</emphasis></secondary>
43746 </indexterm>
43747 <indexterm role="concept">
43748 <primary>delivery</primary>
43749 <secondary>by external agent</secondary>
43750 </indexterm>
43751 The <command>pipe</command> transport can be used to pass all messages that require local
43752 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
43753 this, care must be taken to ensure that the pipe is run under an appropriate
43754 uid and gid. In some configurations one wants this to be a uid that is trusted
43755 by the delivery agent to supply the correct sender of the message. It may be
43756 necessary to recompile or reconfigure the delivery agent so that it trusts an
43757 appropriate user. The following is an example transport and router
43758 configuration for <option>procmail</option>:
43759 </para>
43760 <literallayout class="monospaced">
43761 # transport
43762 procmail_pipe:
43763   driver = pipe
43764   command = /usr/local/bin/procmail -d $local_part
43765   return_path_add
43766   delivery_date_add
43767   envelope_to_add
43768   check_string = "From "
43769   escape_string = "&gt;From "
43770   umask = 077
43771   user = $local_part
43772   group = mail
43773
43774 # router
43775 procmail:
43776   driver = accept
43777   check_local_user
43778   transport = procmail_pipe
43779 </literallayout>
43780 <para>
43781 In this example, the pipe is run as the local user, but with the group set to
43782 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
43783 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
43784 user to supply a correct sender address. If you do not specify either a
43785 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
43786 home directory is the user&#x2019;s home directory by default.
43787 </para>
43788 <para>
43789 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
43790 </para>
43791 <literallayout class="monospaced">
43792 IFS=" "
43793 </literallayout>
43794 <para>
43795 as shown in some <option>procmail</option> documentation, because Exim does not by default
43796 use a shell to run pipe commands.
43797 </para>
43798 <para>
43799 <indexterm role="concept">
43800 <primary>Cyrus</primary>
43801 </indexterm>
43802 The next example shows a transport and a router for a system where local
43803 deliveries are handled by the Cyrus IMAP server.
43804 </para>
43805 <literallayout class="monospaced">
43806 # transport
43807 local_delivery_cyrus:
43808   driver = pipe
43809   command = /usr/cyrus/bin/deliver \
43810             -m ${substr_1:$local_part_suffix} -- $local_part
43811   user = cyrus
43812   group = mail
43813   return_output
43814   log_output
43815   message_prefix =
43816   message_suffix =
43817
43818 # router
43819 local_user_cyrus:
43820   driver = accept
43821   check_local_user
43822   local_part_suffix = .*
43823   transport = local_delivery_cyrus
43824 </literallayout>
43825 <para>
43826 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
43827 <option>return_output</option> to cause any text written by Cyrus to be returned to the
43828 sender.
43829 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
43830 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
43831 </para>
43832 </section>
43833 </chapter>
43834
43835 <chapter id="CHAPsmtptrans">
43836 <title>The smtp transport</title>
43837 <para>
43838 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
43839 <primary>transports</primary>
43840 <secondary><command>smtp</command></secondary>
43841 </indexterm>
43842 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
43843 <primary><command>smtp</command> transport</primary>
43844 </indexterm>
43845 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
43846 or LMTP protocol. The list of hosts to try can either be taken from the address
43847 that is being processed (having been set up by the router), or specified
43848 explicitly for the transport. Timeout and retry processing (see chapter
43849 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
43850 </para>
43851 <section id="SECID144">
43852 <title>Multiple messages on a single connection</title>
43853 <para>
43854 The sending of multiple messages over a single TCP/IP connection can arise in
43855 two ways:
43856 </para>
43857 <itemizedlist>
43858 <listitem>
43859 <para>
43860 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
43861 routed to the same host, more than one copy of the message has to be sent to
43862 that host. In this situation, multiple copies may be sent in a single run of
43863 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
43864 does when it has too many addresses to send in one message also depends on the
43865 value of the global <option>remote_max_parallel</option> option. Details are given in
43866 section <xref linkend="SECToutSMTPTCP"/>.)
43867 </para>
43868 </listitem>
43869 <listitem>
43870 <para>
43871 <indexterm role="concept">
43872 <primary>hints database</primary>
43873 <secondary>remembering routing</secondary>
43874 </indexterm>
43875 When a message has been successfully delivered over a TCP/IP connection, Exim
43876 looks in its hints database to see if there are any other messages awaiting a
43877 connection to the same host. If there are, a new delivery process is started
43878 for one of them, and the current TCP/IP connection is passed on to it. The new
43879 process may in turn send multiple copies and possibly create yet another
43880 process.
43881 </para>
43882 </listitem>
43883 </itemizedlist>
43884 <para>
43885 For each copy sent over the same TCP/IP connection, a sequence counter is
43886 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
43887 no further messages are sent over that connection.
43888 </para>
43889 </section>
43890 <section id="SECID145">
43891 <title>Use of the $host and $host_address variables</title>
43892 <para>
43893 <indexterm role="variable">
43894 <primary><varname>$host</varname></primary>
43895 </indexterm>
43896 <indexterm role="variable">
43897 <primary><varname>$host_address</varname></primary>
43898 </indexterm>
43899 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
43900 <varname>$host_address</varname> are the name and IP address of the first host on the host list
43901 passed by the router. However, when the transport is about to connect to a
43902 specific host, and while it is connected to that host, <varname>$host</varname> and
43903 <varname>$host_address</varname> are set to the values for that host. These are the values
43904 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
43905 <option>serialize_hosts</option>, and the various TLS options are expanded.
43906 </para>
43907 </section>
43908 <section id="usecippeer">
43909 <title>Use of $tls_cipher and $tls_peerdn</title>
43910 <para>
43911 <indexterm role="variable">
43912 <primary><varname>$tls_bits</varname></primary>
43913 </indexterm>
43914 <indexterm role="variable">
43915 <primary><varname>$tls_cipher</varname></primary>
43916 </indexterm>
43917 <indexterm role="variable">
43918 <primary><varname>$tls_peerdn</varname></primary>
43919 </indexterm>
43920 <indexterm role="variable">
43921 <primary><varname>$tls_sni</varname></primary>
43922 </indexterm>
43923 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
43924 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
43925 are the values that were set when the message was received.
43926 These are the values that are used for options that are expanded before any
43927 SMTP connections are made. Just before each connection is made, these four
43928 variables are emptied. If TLS is subsequently started, they are set to the
43929 appropriate values for the outgoing connection, and these are the values that
43930 are in force when any authenticators are run and when the
43931 <option>authenticated_sender</option> option is expanded.
43932 </para>
43933 <para>
43934 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
43935 and will be removed in a future release.
43936 </para>
43937 </section>
43938 <section id="SECID146">
43939 <title>Private options for smtp</title>
43940 <para>
43941 <indexterm role="concept">
43942 <primary>options</primary>
43943 <secondary><command>smtp</command> transport</secondary>
43944 </indexterm>
43945 The private options of the <command>smtp</command> transport are as follows:
43946 </para>
43947 <para>
43948 <indexterm role="option">
43949 <primary><option>address_retry_include_sender</option></primary>
43950 </indexterm>
43951 </para>
43952 <informaltable frame="all">
43953 <tgroup cols="4" colsep="0" rowsep="0">
43954 <colspec colwidth="8*" align="left"/>
43955 <colspec colwidth="6*" align="center"/>
43956 <colspec colwidth="6*" align="center"/>
43957 <colspec colwidth="6*" align="right"/>
43958 <tbody>
43959 <row>
43960 <entry><option>address_retry_include_sender</option></entry>
43961 <entry>Use: <emphasis>smtp</emphasis></entry>
43962 <entry>Type: <emphasis>boolean</emphasis></entry>
43963 <entry>Default: <emphasis>true</emphasis></entry>
43964 </row>
43965 </tbody>
43966 </tgroup>
43967 </informaltable>
43968 <para>
43969 <indexterm role="concept">
43970 <primary>4<emphasis>xx</emphasis> responses</primary>
43971 <secondary>retrying after</secondary>
43972 </indexterm>
43973 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
43974 is the combination of sender and recipient that is delayed in subsequent queue
43975 runs until the retry time is reached. You can delay the recipient without
43976 reference to the sender (which is what earlier versions of Exim did), by
43977 setting <option>address_retry_include_sender</option> false. However, this can lead to
43978 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
43979 </para>
43980 <para>
43981 <indexterm role="option">
43982 <primary><option>allow_localhost</option></primary>
43983 </indexterm>
43984 </para>
43985 <informaltable frame="all">
43986 <tgroup cols="4" colsep="0" rowsep="0">
43987 <colspec colwidth="8*" align="left"/>
43988 <colspec colwidth="6*" align="center"/>
43989 <colspec colwidth="6*" align="center"/>
43990 <colspec colwidth="6*" align="right"/>
43991 <tbody>
43992 <row>
43993 <entry><option>allow_localhost</option></entry>
43994 <entry>Use: <emphasis>smtp</emphasis></entry>
43995 <entry>Type: <emphasis>boolean</emphasis></entry>
43996 <entry>Default: <emphasis>false</emphasis></entry>
43997 </row>
43998 </tbody>
43999 </tgroup>
44000 </informaltable>
44001 <para>
44002 <indexterm role="concept">
44003 <primary>local host</primary>
44004 <secondary>sending to</secondary>
44005 </indexterm>
44006 <indexterm role="concept">
44007 <primary>fallback</primary>
44008 <secondary>hosts specified on transport</secondary>
44009 </indexterm>
44010 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
44011 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
44012 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
44013 the delivery anyway. This should be used only in special cases when the
44014 configuration ensures that no looping will result (for example, a differently
44015 configured Exim is listening on the port to which the message is sent).
44016 </para>
44017 <para>
44018 <indexterm role="option">
44019 <primary><option>authenticated_sender</option></primary>
44020 </indexterm>
44021 </para>
44022 <informaltable frame="all">
44023 <tgroup cols="4" colsep="0" rowsep="0">
44024 <colspec colwidth="8*" align="left"/>
44025 <colspec colwidth="6*" align="center"/>
44026 <colspec colwidth="6*" align="center"/>
44027 <colspec colwidth="6*" align="right"/>
44028 <tbody>
44029 <row>
44030 <entry><option>authenticated_sender</option></entry>
44031 <entry>Use: <emphasis>smtp</emphasis></entry>
44032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44033 <entry>Default: <emphasis>unset</emphasis></entry>
44034 </row>
44035 </tbody>
44036 </tgroup>
44037 </informaltable>
44038 <para>
44039 <indexterm role="concept">
44040 <primary>Cyrus</primary>
44041 </indexterm>
44042 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
44043 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
44044 overriding any existing authenticated sender value. If the string expansion is
44045 forced to fail, the option is ignored. Other expansion failures cause delivery
44046 to be deferred. If the result of expansion is an empty string, that is also
44047 ignored.
44048 </para>
44049 <para>
44050 The expansion happens after the outgoing connection has been made and TLS
44051 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
44052 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
44053 particular connection.
44054 </para>
44055 <para>
44056 If the SMTP session is not authenticated, the expansion of
44057 <option>authenticated_sender</option> still happens (and can cause the delivery to be
44058 deferred if it fails), but no AUTH= item is added to MAIL commands
44059 unless <option>authenticated_sender_force</option> is true.
44060 </para>
44061 <para>
44062 This option allows you to use the <command>smtp</command> transport in LMTP mode to
44063 deliver mail to Cyrus IMAP and provide the proper local part as the
44064 <quote>authenticated sender</quote>, via a setting such as:
44065 </para>
44066 <literallayout class="monospaced">
44067 authenticated_sender = $local_part
44068 </literallayout>
44069 <para>
44070 This removes the need for IMAP subfolders to be assigned special ACLs to
44071 allow direct delivery to those subfolders.
44072 </para>
44073 <para>
44074 Because of expected uses such as that just described for Cyrus (when no
44075 domain is involved), there is no checking on the syntax of the provided
44076 value.
44077 </para>
44078 <para>
44079 <indexterm role="option">
44080 <primary><option>authenticated_sender_force</option></primary>
44081 </indexterm>
44082 </para>
44083 <informaltable frame="all">
44084 <tgroup cols="4" colsep="0" rowsep="0">
44085 <colspec colwidth="8*" align="left"/>
44086 <colspec colwidth="6*" align="center"/>
44087 <colspec colwidth="6*" align="center"/>
44088 <colspec colwidth="6*" align="right"/>
44089 <tbody>
44090 <row>
44091 <entry><option>authenticated_sender_force</option></entry>
44092 <entry>Use: <emphasis>smtp</emphasis></entry>
44093 <entry>Type: <emphasis>boolean</emphasis></entry>
44094 <entry>Default: <emphasis>false</emphasis></entry>
44095 </row>
44096 </tbody>
44097 </tgroup>
44098 </informaltable>
44099 <para>
44100 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
44101 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
44102 authenticated as a client.
44103 </para>
44104 <para>
44105 <indexterm role="option">
44106 <primary><option>command_timeout</option></primary>
44107 </indexterm>
44108 </para>
44109 <informaltable frame="all">
44110 <tgroup cols="4" colsep="0" rowsep="0">
44111 <colspec colwidth="8*" align="left"/>
44112 <colspec colwidth="6*" align="center"/>
44113 <colspec colwidth="6*" align="center"/>
44114 <colspec colwidth="6*" align="right"/>
44115 <tbody>
44116 <row>
44117 <entry><option>command_timeout</option></entry>
44118 <entry>Use: <emphasis>smtp</emphasis></entry>
44119 <entry>Type: <emphasis>time</emphasis></entry>
44120 <entry>Default: <emphasis>5m</emphasis></entry>
44121 </row>
44122 </tbody>
44123 </tgroup>
44124 </informaltable>
44125 <para>
44126 This sets a timeout for receiving a response to an SMTP command that has been
44127 sent out. It is also used when waiting for the initial banner line from the
44128 remote host. Its value must not be zero.
44129 </para>
44130 <para>
44131 <indexterm role="option">
44132 <primary><option>connect_timeout</option></primary>
44133 </indexterm>
44134 </para>
44135 <informaltable frame="all">
44136 <tgroup cols="4" colsep="0" rowsep="0">
44137 <colspec colwidth="8*" align="left"/>
44138 <colspec colwidth="6*" align="center"/>
44139 <colspec colwidth="6*" align="center"/>
44140 <colspec colwidth="6*" align="right"/>
44141 <tbody>
44142 <row>
44143 <entry><option>connect_timeout</option></entry>
44144 <entry>Use: <emphasis>smtp</emphasis></entry>
44145 <entry>Type: <emphasis>time</emphasis></entry>
44146 <entry>Default: <emphasis>5m</emphasis></entry>
44147 </row>
44148 </tbody>
44149 </tgroup>
44150 </informaltable>
44151 <para>
44152 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
44153 to a remote host. A setting of zero allows the system timeout (typically
44154 several minutes) to act. To have any effect, the value of this option must be
44155 less than the system timeout. However, it has been observed that on some
44156 systems there is no system timeout, which is why the default value for this
44157 option is 5 minutes, a value recommended by RFC 1123.
44158 </para>
44159 <para>
44160 <indexterm role="option">
44161 <primary><option>connection_max_messages</option></primary>
44162 </indexterm>
44163 </para>
44164 <informaltable frame="all">
44165 <tgroup cols="4" colsep="0" rowsep="0">
44166 <colspec colwidth="8*" align="left"/>
44167 <colspec colwidth="6*" align="center"/>
44168 <colspec colwidth="6*" align="center"/>
44169 <colspec colwidth="6*" align="right"/>
44170 <tbody>
44171 <row>
44172 <entry><option>connection_max_messages</option></entry>
44173 <entry>Use: <emphasis>smtp</emphasis></entry>
44174 <entry>Type: <emphasis>integer</emphasis></entry>
44175 <entry>Default: <emphasis>500</emphasis></entry>
44176 </row>
44177 </tbody>
44178 </tgroup>
44179 </informaltable>
44180 <para>
44181 <indexterm role="concept">
44182 <primary>SMTP</primary>
44183 <secondary>passed connection</secondary>
44184 </indexterm>
44185 <indexterm role="concept">
44186 <primary>SMTP</primary>
44187 <secondary>multiple deliveries</secondary>
44188 </indexterm>
44189 <indexterm role="concept">
44190 <primary>multiple SMTP deliveries</primary>
44191 </indexterm>
44192 This controls the maximum number of separate message deliveries that are sent
44193 over a single TCP/IP connection. If the value is zero, there is no limit.
44194 For testing purposes, this value can be overridden by the <option>-oB</option> command line
44195 option.
44196 </para>
44197 <para>
44198 <indexterm role="option">
44199 <primary><option>data_timeout</option></primary>
44200 </indexterm>
44201 </para>
44202 <informaltable frame="all">
44203 <tgroup cols="4" colsep="0" rowsep="0">
44204 <colspec colwidth="8*" align="left"/>
44205 <colspec colwidth="6*" align="center"/>
44206 <colspec colwidth="6*" align="center"/>
44207 <colspec colwidth="6*" align="right"/>
44208 <tbody>
44209 <row>
44210 <entry><option>data_timeout</option></entry>
44211 <entry>Use: <emphasis>smtp</emphasis></entry>
44212 <entry>Type: <emphasis>time</emphasis></entry>
44213 <entry>Default: <emphasis>5m</emphasis></entry>
44214 </row>
44215 </tbody>
44216 </tgroup>
44217 </informaltable>
44218 <para>
44219 This sets a timeout for the transmission of each block in the data portion of
44220 the message. As a result, the overall timeout for a message depends on the size
44221 of the message. Its value must not be zero. See also <option>final_timeout</option>.
44222 </para>
44223 <para>
44224 <indexterm role="option">
44225 <primary><option>delay_after_cutoff</option></primary>
44226 </indexterm>
44227 </para>
44228 <informaltable frame="all">
44229 <tgroup cols="4" colsep="0" rowsep="0">
44230 <colspec colwidth="8*" align="left"/>
44231 <colspec colwidth="6*" align="center"/>
44232 <colspec colwidth="6*" align="center"/>
44233 <colspec colwidth="6*" align="right"/>
44234 <tbody>
44235 <row>
44236 <entry><option>delay_after_cutoff</option></entry>
44237 <entry>Use: <emphasis>smtp</emphasis></entry>
44238 <entry>Type: <emphasis>boolean</emphasis></entry>
44239 <entry>Default: <emphasis>true</emphasis></entry>
44240 </row>
44241 </tbody>
44242 </tgroup>
44243 </informaltable>
44244 <para>
44245 This option controls what happens when all remote IP addresses for a given
44246 domain have been inaccessible for so long that they have passed their retry
44247 cutoff times.
44248 </para>
44249 <para>
44250 In the default state, if the next retry time has not been reached for any of
44251 them, the address is bounced without trying any deliveries. In other words,
44252 Exim delays retrying an IP address after the final cutoff time until a new
44253 retry time is reached, and can therefore bounce an address without ever trying
44254 a delivery, when machines have been down for a long time. Some people are
44255 unhappy at this prospect, so...
44256 </para>
44257 <para>
44258 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44259 addresses are past their final cutoff time, Exim tries to deliver to those
44260 IP addresses that have not been tried since the message arrived. If there are
44261 none, of if they all fail, the address is bounced. In other words, it does not
44262 delay when a new message arrives, but immediately tries those expired IP
44263 addresses that haven&#x2019;t been tried since the message arrived. If there is a
44264 continuous stream of messages for the dead hosts, unsetting
44265 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
44266 to them.
44267 </para>
44268 <para>
44269 <indexterm role="option">
44270 <primary><option>dns_qualify_single</option></primary>
44271 </indexterm>
44272 </para>
44273 <informaltable frame="all">
44274 <tgroup cols="4" colsep="0" rowsep="0">
44275 <colspec colwidth="8*" align="left"/>
44276 <colspec colwidth="6*" align="center"/>
44277 <colspec colwidth="6*" align="center"/>
44278 <colspec colwidth="6*" align="right"/>
44279 <tbody>
44280 <row>
44281 <entry><option>dns_qualify_single</option></entry>
44282 <entry>Use: <emphasis>smtp</emphasis></entry>
44283 <entry>Type: <emphasis>boolean</emphasis></entry>
44284 <entry>Default: <emphasis>true</emphasis></entry>
44285 </row>
44286 </tbody>
44287 </tgroup>
44288 </informaltable>
44289 <para>
44290 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
44291 and the <option>gethostbyname</option> option is false,
44292 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
44293 in chapter <xref linkend="CHAPdnslookup"/> for more details.
44294 </para>
44295 <para>
44296 <indexterm role="option">
44297 <primary><option>dns_search_parents</option></primary>
44298 </indexterm>
44299 </para>
44300 <informaltable frame="all">
44301 <tgroup cols="4" colsep="0" rowsep="0">
44302 <colspec colwidth="8*" align="left"/>
44303 <colspec colwidth="6*" align="center"/>
44304 <colspec colwidth="6*" align="center"/>
44305 <colspec colwidth="6*" align="right"/>
44306 <tbody>
44307 <row>
44308 <entry><option>dns_search_parents</option></entry>
44309 <entry>Use: <emphasis>smtp</emphasis></entry>
44310 <entry>Type: <emphasis>boolean</emphasis></entry>
44311 <entry>Default: <emphasis>false</emphasis></entry>
44312 </row>
44313 </tbody>
44314 </tgroup>
44315 </informaltable>
44316 <para>
44317 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
44318 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
44319 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
44320 details.
44321 </para>
44322 <para>
44323 <indexterm role="option">
44324 <primary><option>dnssec_request_domains</option></primary>
44325 </indexterm>
44326 </para>
44327 <informaltable frame="all">
44328 <tgroup cols="4" colsep="0" rowsep="0">
44329 <colspec colwidth="8*" align="left"/>
44330 <colspec colwidth="6*" align="center"/>
44331 <colspec colwidth="6*" align="center"/>
44332 <colspec colwidth="6*" align="right"/>
44333 <tbody>
44334 <row>
44335 <entry><option>dnssec_request_domains</option></entry>
44336 <entry>Use: <emphasis>smtp</emphasis></entry>
44337 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44338 <entry>Default: <emphasis>unset</emphasis></entry>
44339 </row>
44340 </tbody>
44341 </tgroup>
44342 </informaltable>
44343 <para>
44344 <indexterm role="concept">
44345 <primary>MX record</primary>
44346 <secondary>security</secondary>
44347 </indexterm>
44348 <indexterm role="concept">
44349 <primary>DNSSEC</primary>
44350 <secondary>MX lookup</secondary>
44351 </indexterm>
44352 <indexterm role="concept">
44353 <primary>security</primary>
44354 <secondary>MX lookup</secondary>
44355 </indexterm>
44356 <indexterm role="concept">
44357 <primary>DNS</primary>
44358 <secondary>DNSSEC</secondary>
44359 </indexterm>
44360 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44361 the dnssec request bit set.
44362 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44363 </para>
44364 <para>
44365 <indexterm role="option">
44366 <primary><option>dnssec_require_domains</option></primary>
44367 </indexterm>
44368 </para>
44369 <informaltable frame="all">
44370 <tgroup cols="4" colsep="0" rowsep="0">
44371 <colspec colwidth="8*" align="left"/>
44372 <colspec colwidth="6*" align="center"/>
44373 <colspec colwidth="6*" align="center"/>
44374 <colspec colwidth="6*" align="right"/>
44375 <tbody>
44376 <row>
44377 <entry><option>dnssec_require_domains</option></entry>
44378 <entry>Use: <emphasis>smtp</emphasis></entry>
44379 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44380 <entry>Default: <emphasis>unset</emphasis></entry>
44381 </row>
44382 </tbody>
44383 </tgroup>
44384 </informaltable>
44385 <para>
44386 <indexterm role="concept">
44387 <primary>MX record</primary>
44388 <secondary>security</secondary>
44389 </indexterm>
44390 <indexterm role="concept">
44391 <primary>DNSSEC</primary>
44392 <secondary>MX lookup</secondary>
44393 </indexterm>
44394 <indexterm role="concept">
44395 <primary>security</primary>
44396 <secondary>MX lookup</secondary>
44397 </indexterm>
44398 <indexterm role="concept">
44399 <primary>DNS</primary>
44400 <secondary>DNSSEC</secondary>
44401 </indexterm>
44402 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44403 the dnssec request bit set.  Any returns not having the Authenticated Data bit
44404 (AD bit) set wil be ignored and logged as a host-lookup failure.
44405 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44406 </para>
44407 <para>
44408 <indexterm role="option">
44409 <primary><option>dscp</option></primary>
44410 </indexterm>
44411 </para>
44412 <informaltable frame="all">
44413 <tgroup cols="4" colsep="0" rowsep="0">
44414 <colspec colwidth="8*" align="left"/>
44415 <colspec colwidth="6*" align="center"/>
44416 <colspec colwidth="6*" align="center"/>
44417 <colspec colwidth="6*" align="right"/>
44418 <tbody>
44419 <row>
44420 <entry><option>dscp</option></entry>
44421 <entry>Use: <emphasis>smtp</emphasis></entry>
44422 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44423 <entry>Default: <emphasis>unset</emphasis></entry>
44424 </row>
44425 </tbody>
44426 </tgroup>
44427 </informaltable>
44428 <para>
44429 <indexterm role="concept">
44430 <primary>DCSP</primary>
44431 <secondary>outbound</secondary>
44432 </indexterm>
44433 This option causes the DSCP value associated with a socket to be set to one
44434 of a number of fixed strings or to numeric value.
44435 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
44436 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
44437 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
44438 </para>
44439 <para>
44440 The outbound packets from Exim will be marked with this value in the header
44441 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
44442 that these values will have any effect, not be stripped by networking
44443 equipment, or do much of anything without cooperation with your Network
44444 Engineer and those of all network operators between the source and destination.
44445 </para>
44446 <para>
44447 <indexterm role="option">
44448 <primary><option>fallback_hosts</option></primary>
44449 </indexterm>
44450 </para>
44451 <informaltable frame="all">
44452 <tgroup cols="4" colsep="0" rowsep="0">
44453 <colspec colwidth="8*" align="left"/>
44454 <colspec colwidth="6*" align="center"/>
44455 <colspec colwidth="6*" align="center"/>
44456 <colspec colwidth="6*" align="right"/>
44457 <tbody>
44458 <row>
44459 <entry><option>fallback_hosts</option></entry>
44460 <entry>Use: <emphasis>smtp</emphasis></entry>
44461 <entry>Type: <emphasis>string list</emphasis></entry>
44462 <entry>Default: <emphasis>unset</emphasis></entry>
44463 </row>
44464 </tbody>
44465 </tgroup>
44466 </informaltable>
44467 <para>
44468 <indexterm role="concept">
44469 <primary>fallback</primary>
44470 <secondary>hosts specified on transport</secondary>
44471 </indexterm>
44472 String expansion is not applied to this option. The argument must be a
44473 colon-separated list of host names or IP addresses, optionally also including
44474 port numbers, though the separator can be changed, as described in section
44475 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44476 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44477 in section <xref linkend="SECTformatonehostitem"/>.
44478 </para>
44479 <para>
44480 Fallback hosts can also be specified on routers, which associate them with the
44481 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
44482 <option>fallback_hosts</option> specified on the transport is used only if the address does
44483 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
44484 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
44485 However, <option>hosts_randomize</option> does apply to fallback host lists.
44486 </para>
44487 <para>
44488 If Exim is unable to deliver to any of the hosts for a particular address, and
44489 the errors are not permanent rejections, the address is put on a separate
44490 transport queue with its host list replaced by the fallback hosts, unless the
44491 address was routed via MX records and the current host was in the original MX
44492 list. In that situation, the fallback host list is not used.
44493 </para>
44494 <para>
44495 Once normal deliveries are complete, the fallback queue is delivered by
44496 re-running the same transports with the new host lists. If several failing
44497 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
44498 copy of the message is sent.
44499 </para>
44500 <para>
44501 The resolution of the host names on the fallback list is controlled by the
44502 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
44503 both to cases when the host list comes with the address and when it is taken
44504 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
44505 fails</quote> facility.
44506 </para>
44507 <para>
44508 <indexterm role="option">
44509 <primary><option>final_timeout</option></primary>
44510 </indexterm>
44511 </para>
44512 <informaltable frame="all">
44513 <tgroup cols="4" colsep="0" rowsep="0">
44514 <colspec colwidth="8*" align="left"/>
44515 <colspec colwidth="6*" align="center"/>
44516 <colspec colwidth="6*" align="center"/>
44517 <colspec colwidth="6*" align="right"/>
44518 <tbody>
44519 <row>
44520 <entry><option>final_timeout</option></entry>
44521 <entry>Use: <emphasis>smtp</emphasis></entry>
44522 <entry>Type: <emphasis>time</emphasis></entry>
44523 <entry>Default: <emphasis>10m</emphasis></entry>
44524 </row>
44525 </tbody>
44526 </tgroup>
44527 </informaltable>
44528 <para>
44529 This is the timeout that applies while waiting for the response to the final
44530 line containing just <quote>.</quote> that terminates a message. Its value must not be
44531 zero.
44532 </para>
44533 <para>
44534 <indexterm role="option">
44535 <primary><option>gethostbyname</option></primary>
44536 </indexterm>
44537 </para>
44538 <informaltable frame="all">
44539 <tgroup cols="4" colsep="0" rowsep="0">
44540 <colspec colwidth="8*" align="left"/>
44541 <colspec colwidth="6*" align="center"/>
44542 <colspec colwidth="6*" align="center"/>
44543 <colspec colwidth="6*" align="right"/>
44544 <tbody>
44545 <row>
44546 <entry><option>gethostbyname</option></entry>
44547 <entry>Use: <emphasis>smtp</emphasis></entry>
44548 <entry>Type: <emphasis>boolean</emphasis></entry>
44549 <entry>Default: <emphasis>false</emphasis></entry>
44550 </row>
44551 </tbody>
44552 </tgroup>
44553 </informaltable>
44554 <para>
44555 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
44556 being used, names are looked up using <function>gethostbyname()</function>
44557 (or <function>getipnodebyname()</function> when available)
44558 instead of using the DNS. Of course, that function may in fact use the DNS, but
44559 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
44560 </para>
44561 <para>
44562 <indexterm role="option">
44563 <primary><option>gnutls_compat_mode</option></primary>
44564 </indexterm>
44565 </para>
44566 <informaltable frame="all">
44567 <tgroup cols="4" colsep="0" rowsep="0">
44568 <colspec colwidth="8*" align="left"/>
44569 <colspec colwidth="6*" align="center"/>
44570 <colspec colwidth="6*" align="center"/>
44571 <colspec colwidth="6*" align="right"/>
44572 <tbody>
44573 <row>
44574 <entry><option>gnutls_compat_mode</option></entry>
44575 <entry>Use: <emphasis>smtp</emphasis></entry>
44576 <entry>Type: <emphasis>boolean</emphasis></entry>
44577 <entry>Default: <emphasis>unset</emphasis></entry>
44578 </row>
44579 </tbody>
44580 </tgroup>
44581 </informaltable>
44582 <para>
44583 This option controls whether GnuTLS is used in compatibility mode in an Exim
44584 server. This reduces security slightly, but improves interworking with older
44585 implementations of TLS.
44586 </para>
44587 <para>
44588 <indexterm role="option">
44589 <primary><option>helo_data</option></primary>
44590 </indexterm>
44591 </para>
44592 <informaltable frame="all">
44593 <tgroup cols="4" colsep="0" rowsep="0">
44594 <colspec colwidth="8*" align="left"/>
44595 <colspec colwidth="6*" align="center"/>
44596 <colspec colwidth="6*" align="center"/>
44597 <colspec colwidth="6*" align="right"/>
44598 <tbody>
44599 <row>
44600 <entry><option>helo_data</option></entry>
44601 <entry>Use: <emphasis>smtp</emphasis></entry>
44602 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44603 <entry>Default: <emphasis>see below</emphasis></entry>
44604 </row>
44605 </tbody>
44606 </tgroup>
44607 </informaltable>
44608 <para>
44609 <indexterm role="concept">
44610 <primary>HELO</primary>
44611 <secondary>argument, setting</secondary>
44612 </indexterm>
44613 <indexterm role="concept">
44614 <primary>EHLO</primary>
44615 <secondary>argument, setting</secondary>
44616 </indexterm>
44617 <indexterm role="concept">
44618 <primary>LHLO argument setting</primary>
44619 </indexterm>
44620 The value of this option is expanded after a connection to a another host has
44621 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
44622 command that starts the outgoing SMTP or LMTP session. The default value of the
44623 option is:
44624 </para>
44625 <literallayout class="monospaced">
44626 $primary_hostname
44627 </literallayout>
44628 <para>
44629 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
44630 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
44631 <varname>$sending_port</varname> are set to the local IP address and port number that are being
44632 used. These variables can be used to generate different values for different
44633 servers or different local IP addresses. For example, if you want the string
44634 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
44635 interface address, you could use this:
44636 </para>
44637 <literallayout class="monospaced">
44638 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
44639   {$primary_hostname}}
44640 </literallayout>
44641 <para>
44642 The use of <option>helo_data</option> applies both to sending messages and when doing
44643 callouts.
44644 </para>
44645 <para>
44646 <indexterm role="option">
44647 <primary><option>hosts</option></primary>
44648 </indexterm>
44649 </para>
44650 <informaltable frame="all">
44651 <tgroup cols="4" colsep="0" rowsep="0">
44652 <colspec colwidth="8*" align="left"/>
44653 <colspec colwidth="6*" align="center"/>
44654 <colspec colwidth="6*" align="center"/>
44655 <colspec colwidth="6*" align="right"/>
44656 <tbody>
44657 <row>
44658 <entry><option>hosts</option></entry>
44659 <entry>Use: <emphasis>smtp</emphasis></entry>
44660 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44661 <entry>Default: <emphasis>unset</emphasis></entry>
44662 </row>
44663 </tbody>
44664 </tgroup>
44665 </informaltable>
44666 <para>
44667 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
44668 finds the hosts by looking up the address domain in the DNS, or by
44669 <command>manualroute</command>, which has lists of hosts in its configuration. However,
44670 email addresses can be passed to the <command>smtp</command> transport by any router, and not
44671 all of them can provide an associated list of hosts.
44672 </para>
44673 <para>
44674 The <option>hosts</option> option specifies a list of hosts to be used if the address being
44675 processed does not have any hosts associated with it. The hosts specified by
44676 <option>hosts</option> are also used, whether or not the address has its own hosts, if
44677 <option>hosts_override</option> is set.
44678 </para>
44679 <para>
44680 The string is first expanded, before being interpreted as a colon-separated
44681 list of host names or IP addresses, possibly including port numbers. The
44682 separator may be changed to something other than colon, as described in section
44683 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44684 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44685 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
44686 of the <command>manualroute</command> router is not available here.
44687 </para>
44688 <para>
44689 If the expansion fails, delivery is deferred. Unless the failure was caused by
44690 the inability to complete a lookup, the error is logged to the panic log as
44691 well as the main log. Host names are looked up either by searching directly for
44692 address records in the DNS or by calling <function>gethostbyname()</function> (or
44693 <function>getipnodebyname()</function> when available), depending on the setting of the
44694 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
44695 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
44696 address are used.
44697 </para>
44698 <para>
44699 During delivery, the hosts are tried in order, subject to their retry status,
44700 unless <option>hosts_randomize</option> is set.
44701 </para>
44702 <para>
44703 <indexterm role="option">
44704 <primary><option>hosts_avoid_esmtp</option></primary>
44705 </indexterm>
44706 </para>
44707 <informaltable frame="all">
44708 <tgroup cols="4" colsep="0" rowsep="0">
44709 <colspec colwidth="8*" align="left"/>
44710 <colspec colwidth="6*" align="center"/>
44711 <colspec colwidth="6*" align="center"/>
44712 <colspec colwidth="6*" align="right"/>
44713 <tbody>
44714 <row>
44715 <entry><option>hosts_avoid_esmtp</option></entry>
44716 <entry>Use: <emphasis>smtp</emphasis></entry>
44717 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44718 <entry>Default: <emphasis>unset</emphasis></entry>
44719 </row>
44720 </tbody>
44721 </tgroup>
44722 </informaltable>
44723 <para>
44724 <indexterm role="concept">
44725 <primary>ESMTP, avoiding use of</primary>
44726 </indexterm>
44727 <indexterm role="concept">
44728 <primary>HELO</primary>
44729 <secondary>forcing use of</secondary>
44730 </indexterm>
44731 <indexterm role="concept">
44732 <primary>EHLO</primary>
44733 <secondary>avoiding use of</secondary>
44734 </indexterm>
44735 <indexterm role="concept">
44736 <primary>PIPELINING</primary>
44737 <secondary>avoiding the use of</secondary>
44738 </indexterm>
44739 This option is for use with broken hosts that announce ESMTP facilities (for
44740 example, PIPELINING) and then fail to implement them properly. When a host
44741 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
44742 start of the SMTP session. This means that it cannot use any of the ESMTP
44743 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
44744 </para>
44745 <para>
44746 <indexterm role="option">
44747 <primary><option>hosts_avoid_pipelining</option></primary>
44748 </indexterm>
44749 </para>
44750 <informaltable frame="all">
44751 <tgroup cols="4" colsep="0" rowsep="0">
44752 <colspec colwidth="8*" align="left"/>
44753 <colspec colwidth="6*" align="center"/>
44754 <colspec colwidth="6*" align="center"/>
44755 <colspec colwidth="6*" align="right"/>
44756 <tbody>
44757 <row>
44758 <entry><option>hosts_avoid_pipelining</option></entry>
44759 <entry>Use: <emphasis>smtp</emphasis></entry>
44760 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44761 <entry>Default: <emphasis>unset</emphasis></entry>
44762 </row>
44763 </tbody>
44764 </tgroup>
44765 </informaltable>
44766 <para>
44767 <indexterm role="concept">
44768 <primary>PIPELINING</primary>
44769 <secondary>avoiding the use of</secondary>
44770 </indexterm>
44771 Exim will not use the SMTP PIPELINING extension when delivering to any host
44772 that matches this list, even if the server host advertises PIPELINING support.
44773 </para>
44774 <para>
44775 <indexterm role="option">
44776 <primary><option>hosts_avoid_tls</option></primary>
44777 </indexterm>
44778 </para>
44779 <informaltable frame="all">
44780 <tgroup cols="4" colsep="0" rowsep="0">
44781 <colspec colwidth="8*" align="left"/>
44782 <colspec colwidth="6*" align="center"/>
44783 <colspec colwidth="6*" align="center"/>
44784 <colspec colwidth="6*" align="right"/>
44785 <tbody>
44786 <row>
44787 <entry><option>hosts_avoid_tls</option></entry>
44788 <entry>Use: <emphasis>smtp</emphasis></entry>
44789 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44790 <entry>Default: <emphasis>unset</emphasis></entry>
44791 </row>
44792 </tbody>
44793 </tgroup>
44794 </informaltable>
44795 <para>
44796 <indexterm role="concept">
44797 <primary>TLS</primary>
44798 <secondary>avoiding for certain hosts</secondary>
44799 </indexterm>
44800 Exim will not try to start a TLS session when delivering to any host that
44801 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44802 </para>
44803 <para>
44804 <indexterm role="option">
44805 <primary><option>hosts_verify_avoid_tls</option></primary>
44806 </indexterm>
44807 </para>
44808 <informaltable frame="all">
44809 <tgroup cols="4" colsep="0" rowsep="0">
44810 <colspec colwidth="8*" align="left"/>
44811 <colspec colwidth="6*" align="center"/>
44812 <colspec colwidth="6*" align="center"/>
44813 <colspec colwidth="6*" align="right"/>
44814 <tbody>
44815 <row>
44816 <entry><option>hosts_verify_avoid_tls</option></entry>
44817 <entry>Use: <emphasis>smtp</emphasis></entry>
44818 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44819 <entry>Default: <emphasis>*</emphasis></entry>
44820 </row>
44821 </tbody>
44822 </tgroup>
44823 </informaltable>
44824 <para>
44825 <indexterm role="concept">
44826 <primary>TLS</primary>
44827 <secondary>avoiding for certain hosts</secondary>
44828 </indexterm>
44829 Exim will not try to start a TLS session for a verify callout,
44830 or when delivering in cutthrough mode,
44831 to any host that matches this list.
44832 Note that the default is to not use TLS.
44833 </para>
44834 <para>
44835 <indexterm role="option">
44836 <primary><option>hosts_max_try</option></primary>
44837 </indexterm>
44838 </para>
44839 <informaltable frame="all">
44840 <tgroup cols="4" colsep="0" rowsep="0">
44841 <colspec colwidth="8*" align="left"/>
44842 <colspec colwidth="6*" align="center"/>
44843 <colspec colwidth="6*" align="center"/>
44844 <colspec colwidth="6*" align="right"/>
44845 <tbody>
44846 <row>
44847 <entry><option>hosts_max_try</option></entry>
44848 <entry>Use: <emphasis>smtp</emphasis></entry>
44849 <entry>Type: <emphasis>integer</emphasis></entry>
44850 <entry>Default: <emphasis>5</emphasis></entry>
44851 </row>
44852 </tbody>
44853 </tgroup>
44854 </informaltable>
44855 <para>
44856 <indexterm role="concept">
44857 <primary>host</primary>
44858 <secondary>maximum number to try</secondary>
44859 </indexterm>
44860 <indexterm role="concept">
44861 <primary>limit</primary>
44862 <secondary>number of hosts tried</secondary>
44863 </indexterm>
44864 <indexterm role="concept">
44865 <primary>limit</primary>
44866 <secondary>number of MX tried</secondary>
44867 </indexterm>
44868 <indexterm role="concept">
44869 <primary>MX record</primary>
44870 <secondary>maximum tried</secondary>
44871 </indexterm>
44872 This option limits the number of IP addresses that are tried for any one
44873 delivery in cases where there are temporary delivery errors. Section
44874 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
44875 </para>
44876 <para>
44877 <indexterm role="option">
44878 <primary><option>hosts_max_try_hardlimit</option></primary>
44879 </indexterm>
44880 </para>
44881 <informaltable frame="all">
44882 <tgroup cols="4" colsep="0" rowsep="0">
44883 <colspec colwidth="8*" align="left"/>
44884 <colspec colwidth="6*" align="center"/>
44885 <colspec colwidth="6*" align="center"/>
44886 <colspec colwidth="6*" align="right"/>
44887 <tbody>
44888 <row>
44889 <entry><option>hosts_max_try_hardlimit</option></entry>
44890 <entry>Use: <emphasis>smtp</emphasis></entry>
44891 <entry>Type: <emphasis>integer</emphasis></entry>
44892 <entry>Default: <emphasis>50</emphasis></entry>
44893 </row>
44894 </tbody>
44895 </tgroup>
44896 </informaltable>
44897 <para>
44898 This is an additional check on the maximum number of IP addresses that Exim
44899 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
44900 why it exists.
44901 </para>
44902 <para>
44903 <indexterm role="option">
44904 <primary><option>hosts_nopass_tls</option></primary>
44905 </indexterm>
44906 </para>
44907 <informaltable frame="all">
44908 <tgroup cols="4" colsep="0" rowsep="0">
44909 <colspec colwidth="8*" align="left"/>
44910 <colspec colwidth="6*" align="center"/>
44911 <colspec colwidth="6*" align="center"/>
44912 <colspec colwidth="6*" align="right"/>
44913 <tbody>
44914 <row>
44915 <entry><option>hosts_nopass_tls</option></entry>
44916 <entry>Use: <emphasis>smtp</emphasis></entry>
44917 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44918 <entry>Default: <emphasis>unset</emphasis></entry>
44919 </row>
44920 </tbody>
44921 </tgroup>
44922 </informaltable>
44923 <para>
44924 <indexterm role="concept">
44925 <primary>TLS</primary>
44926 <secondary>passing connection</secondary>
44927 </indexterm>
44928 <indexterm role="concept">
44929 <primary>multiple SMTP deliveries</primary>
44930 </indexterm>
44931 <indexterm role="concept">
44932 <primary>TLS</primary>
44933 <secondary>multiple message deliveries</secondary>
44934 </indexterm>
44935 For any host that matches this list, a connection on which a TLS session has
44936 been started will not be passed to a new delivery process for sending another
44937 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
44938 explanation of when this might be needed.
44939 </para>
44940 <para>
44941 <indexterm role="option">
44942 <primary><option>hosts_override</option></primary>
44943 </indexterm>
44944 </para>
44945 <informaltable frame="all">
44946 <tgroup cols="4" colsep="0" rowsep="0">
44947 <colspec colwidth="8*" align="left"/>
44948 <colspec colwidth="6*" align="center"/>
44949 <colspec colwidth="6*" align="center"/>
44950 <colspec colwidth="6*" align="right"/>
44951 <tbody>
44952 <row>
44953 <entry><option>hosts_override</option></entry>
44954 <entry>Use: <emphasis>smtp</emphasis></entry>
44955 <entry>Type: <emphasis>boolean</emphasis></entry>
44956 <entry>Default: <emphasis>false</emphasis></entry>
44957 </row>
44958 </tbody>
44959 </tgroup>
44960 </informaltable>
44961 <para>
44962 If this option is set and the <option>hosts</option> option is also set, any hosts that are
44963 attached to the address are ignored, and instead the hosts specified by the
44964 <option>hosts</option> option are always used. This option does not apply to
44965 <option>fallback_hosts</option>.
44966 </para>
44967 <para>
44968 <indexterm role="option">
44969 <primary><option>hosts_randomize</option></primary>
44970 </indexterm>
44971 </para>
44972 <informaltable frame="all">
44973 <tgroup cols="4" colsep="0" rowsep="0">
44974 <colspec colwidth="8*" align="left"/>
44975 <colspec colwidth="6*" align="center"/>
44976 <colspec colwidth="6*" align="center"/>
44977 <colspec colwidth="6*" align="right"/>
44978 <tbody>
44979 <row>
44980 <entry><option>hosts_randomize</option></entry>
44981 <entry>Use: <emphasis>smtp</emphasis></entry>
44982 <entry>Type: <emphasis>boolean</emphasis></entry>
44983 <entry>Default: <emphasis>false</emphasis></entry>
44984 </row>
44985 </tbody>
44986 </tgroup>
44987 </informaltable>
44988 <para>
44989 <indexterm role="concept">
44990 <primary>randomized host list</primary>
44991 </indexterm>
44992 <indexterm role="concept">
44993 <primary>host</primary>
44994 <secondary>list of; randomized</secondary>
44995 </indexterm>
44996 <indexterm role="concept">
44997 <primary>fallback</primary>
44998 <secondary>randomized hosts</secondary>
44999 </indexterm>
45000 If this option is set, and either the list of hosts is taken from the
45001 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
45002 were not obtained from MX records (this includes fallback hosts from the
45003 router), and were not randomized by the router, the order of trying the hosts
45004 is randomized each time the transport runs. Randomizing the order of a host
45005 list can be used to do crude load sharing.
45006 </para>
45007 <para>
45008 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
45009 order is separately randomized. This makes it possible to set up MX-like
45010 behaviour. The boundaries between groups are indicated by an item that is just
45011 <literal>+</literal> in the host list. For example:
45012 </para>
45013 <literallayout class="monospaced">
45014 hosts = host1:host2:host3:+:host4:host5
45015 </literallayout>
45016 <para>
45017 The order of the first three hosts and the order of the last two hosts is
45018 randomized for each use, but the first three always end up before the last two.
45019 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
45020 </para>
45021 <para>
45022 <indexterm role="option">
45023 <primary><option>hosts_require_auth</option></primary>
45024 </indexterm>
45025 </para>
45026 <informaltable frame="all">
45027 <tgroup cols="4" colsep="0" rowsep="0">
45028 <colspec colwidth="8*" align="left"/>
45029 <colspec colwidth="6*" align="center"/>
45030 <colspec colwidth="6*" align="center"/>
45031 <colspec colwidth="6*" align="right"/>
45032 <tbody>
45033 <row>
45034 <entry><option>hosts_require_auth</option></entry>
45035 <entry>Use: <emphasis>smtp</emphasis></entry>
45036 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45037 <entry>Default: <emphasis>unset</emphasis></entry>
45038 </row>
45039 </tbody>
45040 </tgroup>
45041 </informaltable>
45042 <para>
45043 <indexterm role="concept">
45044 <primary>authentication</primary>
45045 <secondary>required by client</secondary>
45046 </indexterm>
45047 This option provides a list of servers for which authentication must succeed
45048 before Exim will try to transfer a message. If authentication fails for
45049 servers which are not in this list, Exim tries to send unauthenticated. If
45050 authentication fails for one of these servers, delivery is deferred. This
45051 temporary error is detectable in the retry rules, so it can be turned into a
45052 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
45053 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45054 </para>
45055 <para>
45056 <indexterm role="option">
45057 <primary><option>hosts_request_ocsp</option></primary>
45058 </indexterm>
45059 </para>
45060 <informaltable frame="all">
45061 <tgroup cols="4" colsep="0" rowsep="0">
45062 <colspec colwidth="8*" align="left"/>
45063 <colspec colwidth="6*" align="center"/>
45064 <colspec colwidth="6*" align="center"/>
45065 <colspec colwidth="6*" align="right"/>
45066 <tbody>
45067 <row>
45068 <entry><option>hosts_request_ocsp</option></entry>
45069 <entry>Use: <emphasis>smtp</emphasis></entry>
45070 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45071 <entry>Default: <emphasis>*</emphasis></entry>
45072 </row>
45073 </tbody>
45074 </tgroup>
45075 </informaltable>
45076 <para>
45077 <indexterm role="concept">
45078 <primary>TLS</primary>
45079 <secondary>requiring for certain servers</secondary>
45080 </indexterm>
45081 Exim will request a Certificate Status on a
45082 TLS session for any host that matches this list.
45083 <option>tls_verify_certificates</option> should also be set for the transport.
45084 </para>
45085 <para>
45086 <indexterm role="option">
45087 <primary><option>hosts_require_ocsp</option></primary>
45088 </indexterm>
45089 </para>
45090 <informaltable frame="all">
45091 <tgroup cols="4" colsep="0" rowsep="0">
45092 <colspec colwidth="8*" align="left"/>
45093 <colspec colwidth="6*" align="center"/>
45094 <colspec colwidth="6*" align="center"/>
45095 <colspec colwidth="6*" align="right"/>
45096 <tbody>
45097 <row>
45098 <entry><option>hosts_require_ocsp</option></entry>
45099 <entry>Use: <emphasis>smtp</emphasis></entry>
45100 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45101 <entry>Default: <emphasis>unset</emphasis></entry>
45102 </row>
45103 </tbody>
45104 </tgroup>
45105 </informaltable>
45106 <para>
45107 <indexterm role="concept">
45108 <primary>TLS</primary>
45109 <secondary>requiring for certain servers</secondary>
45110 </indexterm>
45111 Exim will request, and check for a valid Certificate Status being given, on a
45112 TLS session for any host that matches this list.
45113 <option>tls_verify_certificates</option> should also be set for the transport.
45114 </para>
45115 <para>
45116 <indexterm role="option">
45117 <primary><option>hosts_require_tls</option></primary>
45118 </indexterm>
45119 </para>
45120 <informaltable frame="all">
45121 <tgroup cols="4" colsep="0" rowsep="0">
45122 <colspec colwidth="8*" align="left"/>
45123 <colspec colwidth="6*" align="center"/>
45124 <colspec colwidth="6*" align="center"/>
45125 <colspec colwidth="6*" align="right"/>
45126 <tbody>
45127 <row>
45128 <entry><option>hosts_require_tls</option></entry>
45129 <entry>Use: <emphasis>smtp</emphasis></entry>
45130 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45131 <entry>Default: <emphasis>unset</emphasis></entry>
45132 </row>
45133 </tbody>
45134 </tgroup>
45135 </informaltable>
45136 <para>
45137 <indexterm role="concept">
45138 <primary>TLS</primary>
45139 <secondary>requiring for certain servers</secondary>
45140 </indexterm>
45141 Exim will insist on using a TLS session when delivering to any host that
45142 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45143 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
45144 incoming messages, use an appropriate ACL.
45145 </para>
45146 <para>
45147 <indexterm role="option">
45148 <primary><option>hosts_try_auth</option></primary>
45149 </indexterm>
45150 </para>
45151 <informaltable frame="all">
45152 <tgroup cols="4" colsep="0" rowsep="0">
45153 <colspec colwidth="8*" align="left"/>
45154 <colspec colwidth="6*" align="center"/>
45155 <colspec colwidth="6*" align="center"/>
45156 <colspec colwidth="6*" align="right"/>
45157 <tbody>
45158 <row>
45159 <entry><option>hosts_try_auth</option></entry>
45160 <entry>Use: <emphasis>smtp</emphasis></entry>
45161 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45162 <entry>Default: <emphasis>unset</emphasis></entry>
45163 </row>
45164 </tbody>
45165 </tgroup>
45166 </informaltable>
45167 <para>
45168 <indexterm role="concept">
45169 <primary>authentication</primary>
45170 <secondary>optional in client</secondary>
45171 </indexterm>
45172 This option provides a list of servers to which, provided they announce
45173 authentication support, Exim will attempt to authenticate as a client when it
45174 connects. If authentication fails, Exim will try to transfer the message
45175 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
45176 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45177 </para>
45178 <para>
45179 <indexterm role="option">
45180 <primary><option>hosts_try_prdr</option></primary>
45181 </indexterm>
45182 </para>
45183 <informaltable frame="all">
45184 <tgroup cols="4" colsep="0" rowsep="0">
45185 <colspec colwidth="8*" align="left"/>
45186 <colspec colwidth="6*" align="center"/>
45187 <colspec colwidth="6*" align="center"/>
45188 <colspec colwidth="6*" align="right"/>
45189 <tbody>
45190 <row>
45191 <entry><option>hosts_try_prdr</option></entry>
45192 <entry>Use: <emphasis>smtp</emphasis></entry>
45193 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45194 <entry>Default: <emphasis>unset</emphasis></entry>
45195 </row>
45196 </tbody>
45197 </tgroup>
45198 </informaltable>
45199 <para>
45200 <indexterm role="concept">
45201 <primary>PRDR</primary>
45202 <secondary>enabling, optional in client</secondary>
45203 </indexterm>
45204 This option provides a list of servers to which, provided they announce
45205 PRDR support, Exim will attempt to negotiate PRDR
45206 for multi-recipient messages.
45207 </para>
45208 <para>
45209 <indexterm role="option">
45210 <primary><option>interface</option></primary>
45211 </indexterm>
45212 </para>
45213 <informaltable frame="all">
45214 <tgroup cols="4" colsep="0" rowsep="0">
45215 <colspec colwidth="8*" align="left"/>
45216 <colspec colwidth="6*" align="center"/>
45217 <colspec colwidth="6*" align="center"/>
45218 <colspec colwidth="6*" align="right"/>
45219 <tbody>
45220 <row>
45221 <entry><option>interface</option></entry>
45222 <entry>Use: <emphasis>smtp</emphasis></entry>
45223 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45224 <entry>Default: <emphasis>unset</emphasis></entry>
45225 </row>
45226 </tbody>
45227 </tgroup>
45228 </informaltable>
45229 <para>
45230 <indexterm role="concept">
45231 <primary>bind IP address</primary>
45232 </indexterm>
45233 <indexterm role="concept">
45234 <primary>IP address</primary>
45235 <secondary>binding</secondary>
45236 </indexterm>
45237 <indexterm role="variable">
45238 <primary><varname>$host</varname></primary>
45239 </indexterm>
45240 <indexterm role="variable">
45241 <primary><varname>$host_address</varname></primary>
45242 </indexterm>
45243 This option specifies which interface to bind to when making an outgoing SMTP
45244 call. The value is an IP address, not an interface name such as
45245 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
45246 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
45247 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
45248 outgoing interface address. There is no variable that contains an outgoing
45249 interface address because, unless it is set by this option, its value is
45250 unknown.
45251 </para>
45252 <para>
45253 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
45254 <varname>$host_address</varname> refer to the host to which a connection is about to be made
45255 during the expansion of the string. Forced expansion failure, or an empty
45256 string result causes the option to be ignored. Otherwise, after expansion, the
45257 string must be a list of IP addresses, colon-separated by default, but the
45258 separator can be changed in the usual way. For example:
45259 </para>
45260 <literallayout class="monospaced">
45261 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
45262 </literallayout>
45263 <para>
45264 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
45265 connection. If none of them are the correct type, the option is ignored. If
45266 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
45267 interface to use if the host has more than one.
45268 </para>
45269 <para>
45270 <indexterm role="option">
45271 <primary><option>keepalive</option></primary>
45272 </indexterm>
45273 </para>
45274 <informaltable frame="all">
45275 <tgroup cols="4" colsep="0" rowsep="0">
45276 <colspec colwidth="8*" align="left"/>
45277 <colspec colwidth="6*" align="center"/>
45278 <colspec colwidth="6*" align="center"/>
45279 <colspec colwidth="6*" align="right"/>
45280 <tbody>
45281 <row>
45282 <entry><option>keepalive</option></entry>
45283 <entry>Use: <emphasis>smtp</emphasis></entry>
45284 <entry>Type: <emphasis>boolean</emphasis></entry>
45285 <entry>Default: <emphasis>true</emphasis></entry>
45286 </row>
45287 </tbody>
45288 </tgroup>
45289 </informaltable>
45290 <para>
45291 <indexterm role="concept">
45292 <primary>keepalive</primary>
45293 <secondary>on outgoing connection</secondary>
45294 </indexterm>
45295 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
45296 connections. When set, it causes the kernel to probe idle connections
45297 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
45298 of the connection should send a acknowledgment if the connection is still okay
45299 or a reset if the connection has been aborted. The reason for doing this is
45300 that it has the beneficial effect of freeing up certain types of connection
45301 that can get stuck when the remote host is disconnected without tidying up the
45302 TCP/IP call properly. The keepalive mechanism takes several hours to detect
45303 unreachable hosts.
45304 </para>
45305 <para>
45306 <indexterm role="option">
45307 <primary><option>lmtp_ignore_quota</option></primary>
45308 </indexterm>
45309 </para>
45310 <informaltable frame="all">
45311 <tgroup cols="4" colsep="0" rowsep="0">
45312 <colspec colwidth="8*" align="left"/>
45313 <colspec colwidth="6*" align="center"/>
45314 <colspec colwidth="6*" align="center"/>
45315 <colspec colwidth="6*" align="right"/>
45316 <tbody>
45317 <row>
45318 <entry><option>lmtp_ignore_quota</option></entry>
45319 <entry>Use: <emphasis>smtp</emphasis></entry>
45320 <entry>Type: <emphasis>boolean</emphasis></entry>
45321 <entry>Default: <emphasis>false</emphasis></entry>
45322 </row>
45323 </tbody>
45324 </tgroup>
45325 </informaltable>
45326 <para>
45327 <indexterm role="concept">
45328 <primary>LMTP</primary>
45329 <secondary>ignoring quota errors</secondary>
45330 </indexterm>
45331 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
45332 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
45333 has advertised support for IGNOREQUOTA in its response to the LHLO command.
45334 </para>
45335 <para>
45336 <indexterm role="option">
45337 <primary><option>max_rcpt</option></primary>
45338 </indexterm>
45339 </para>
45340 <informaltable frame="all">
45341 <tgroup cols="4" colsep="0" rowsep="0">
45342 <colspec colwidth="8*" align="left"/>
45343 <colspec colwidth="6*" align="center"/>
45344 <colspec colwidth="6*" align="center"/>
45345 <colspec colwidth="6*" align="right"/>
45346 <tbody>
45347 <row>
45348 <entry><option>max_rcpt</option></entry>
45349 <entry>Use: <emphasis>smtp</emphasis></entry>
45350 <entry>Type: <emphasis>integer</emphasis></entry>
45351 <entry>Default: <emphasis>100</emphasis></entry>
45352 </row>
45353 </tbody>
45354 </tgroup>
45355 </informaltable>
45356 <para>
45357 <indexterm role="concept">
45358 <primary>RCPT</primary>
45359 <secondary>maximum number of outgoing</secondary>
45360 </indexterm>
45361 This option limits the number of RCPT commands that are sent in a single
45362 SMTP message transaction. Each set of addresses is treated independently, and
45363 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
45364 permits this.
45365 </para>
45366 <para>
45367 <indexterm role="option">
45368 <primary><option>multi_domain</option></primary>
45369 </indexterm>
45370 </para>
45371 <informaltable frame="all">
45372 <tgroup cols="4" colsep="0" rowsep="0">
45373 <colspec colwidth="8*" align="left"/>
45374 <colspec colwidth="6*" align="center"/>
45375 <colspec colwidth="6*" align="center"/>
45376 <colspec colwidth="6*" align="right"/>
45377 <tbody>
45378 <row>
45379 <entry><option>multi_domain</option></entry>
45380 <entry>Use: <emphasis>smtp</emphasis></entry>
45381 <entry>Type: <emphasis>boolean</emphasis></entry>
45382 <entry>Default: <emphasis>true</emphasis></entry>
45383 </row>
45384 </tbody>
45385 </tgroup>
45386 </informaltable>
45387 <para>
45388 <indexterm role="variable">
45389 <primary><varname>$domain</varname></primary>
45390 </indexterm>
45391 When this option is set, the <command>smtp</command> transport can handle a number of
45392 addresses containing a mixture of different domains provided they all resolve
45393 to the same list of hosts. Turning the option off restricts the transport to
45394 handling only one domain at a time. This is useful if you want to use
45395 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
45396 is a single domain involved in a remote delivery.
45397 </para>
45398 <para>
45399 <indexterm role="option">
45400 <primary><option>port</option></primary>
45401 </indexterm>
45402 </para>
45403 <informaltable frame="all">
45404 <tgroup cols="4" colsep="0" rowsep="0">
45405 <colspec colwidth="8*" align="left"/>
45406 <colspec colwidth="6*" align="center"/>
45407 <colspec colwidth="6*" align="center"/>
45408 <colspec colwidth="6*" align="right"/>
45409 <tbody>
45410 <row>
45411 <entry><option>port</option></entry>
45412 <entry>Use: <emphasis>smtp</emphasis></entry>
45413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45414 <entry>Default: <emphasis>see below</emphasis></entry>
45415 </row>
45416 </tbody>
45417 </tgroup>
45418 </informaltable>
45419 <para>
45420 <indexterm role="concept">
45421 <primary>port</primary>
45422 <secondary>sending TCP/IP</secondary>
45423 </indexterm>
45424 <indexterm role="concept">
45425 <primary>TCP/IP</primary>
45426 <secondary>setting outgoing port</secondary>
45427 </indexterm>
45428 This option specifies the TCP/IP port on the server to which Exim connects.
45429 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
45430 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
45431 The name was changed to minimize confusion with the outgoing port. There is no
45432 variable that contains an outgoing port.
45433 </para>
45434 <para>
45435 If the value of this option begins with a digit it is taken as a port number;
45436 otherwise it is looked up using <function>getservbyname()</function>. The default value is
45437 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
45438 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
45439 is deferred.
45440 </para>
45441 <para>
45442 <indexterm role="option">
45443 <primary><option>protocol</option></primary>
45444 </indexterm>
45445 </para>
45446 <informaltable frame="all">
45447 <tgroup cols="4" colsep="0" rowsep="0">
45448 <colspec colwidth="8*" align="left"/>
45449 <colspec colwidth="6*" align="center"/>
45450 <colspec colwidth="6*" align="center"/>
45451 <colspec colwidth="6*" align="right"/>
45452 <tbody>
45453 <row>
45454 <entry><option>protocol</option></entry>
45455 <entry>Use: <emphasis>smtp</emphasis></entry>
45456 <entry>Type: <emphasis>string</emphasis></entry>
45457 <entry>Default: <emphasis>smtp</emphasis></entry>
45458 </row>
45459 </tbody>
45460 </tgroup>
45461 </informaltable>
45462 <para>
45463 <indexterm role="concept">
45464 <primary>LMTP</primary>
45465 <secondary>over TCP/IP</secondary>
45466 </indexterm>
45467 <indexterm role="concept">
45468 <primary>ssmtp protocol</primary>
45469 <secondary>outbound</secondary>
45470 </indexterm>
45471 <indexterm role="concept">
45472 <primary>TLS</primary>
45473 <secondary>SSL-on-connect outbound</secondary>
45474 </indexterm>
45475 <indexterm role="variable">
45476 <primary><varname>$port</varname></primary>
45477 </indexterm>
45478 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
45479 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
45480 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
45481 deliveries into closed message stores. Exim also has support for running LMTP
45482 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
45483 </para>
45484 <para>
45485 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
45486 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
45487 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
45488 The Internet standards bodies strongly discourage use of this mode.
45489 </para>
45490 <para>
45491 <indexterm role="option">
45492 <primary><option>retry_include_ip_address</option></primary>
45493 </indexterm>
45494 </para>
45495 <informaltable frame="all">
45496 <tgroup cols="4" colsep="0" rowsep="0">
45497 <colspec colwidth="8*" align="left"/>
45498 <colspec colwidth="6*" align="center"/>
45499 <colspec colwidth="6*" align="center"/>
45500 <colspec colwidth="6*" align="right"/>
45501 <tbody>
45502 <row>
45503 <entry><option>retry_include_ip_address</option></entry>
45504 <entry>Use: <emphasis>smtp</emphasis></entry>
45505 <entry>Type: <emphasis>boolean</emphasis></entry>
45506 <entry>Default: <emphasis>true</emphasis></entry>
45507 </row>
45508 </tbody>
45509 </tgroup>
45510 </informaltable>
45511 <para>
45512 Exim normally includes both the host name and the IP address in the key it
45513 constructs for indexing retry data after a temporary delivery failure. This
45514 means that when one of several IP addresses for a host is failing, it gets
45515 tried periodically (controlled by the retry rules), but use of the other IP
45516 addresses is not affected.
45517 </para>
45518 <para>
45519 However, in some dialup environments hosts are assigned a different IP address
45520 each time they connect. In this situation the use of the IP address as part of
45521 the retry key leads to undesirable behaviour. Setting this option false causes
45522 Exim to use only the host name. This should normally be done on a separate
45523 instance of the <command>smtp</command> transport, set up specially to handle the dialup
45524 hosts.
45525 </para>
45526 <para>
45527 <indexterm role="option">
45528 <primary><option>serialize_hosts</option></primary>
45529 </indexterm>
45530 </para>
45531 <informaltable frame="all">
45532 <tgroup cols="4" colsep="0" rowsep="0">
45533 <colspec colwidth="8*" align="left"/>
45534 <colspec colwidth="6*" align="center"/>
45535 <colspec colwidth="6*" align="center"/>
45536 <colspec colwidth="6*" align="right"/>
45537 <tbody>
45538 <row>
45539 <entry><option>serialize_hosts</option></entry>
45540 <entry>Use: <emphasis>smtp</emphasis></entry>
45541 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45542 <entry>Default: <emphasis>unset</emphasis></entry>
45543 </row>
45544 </tbody>
45545 </tgroup>
45546 </informaltable>
45547 <para>
45548 <indexterm role="concept">
45549 <primary>serializing connections</primary>
45550 </indexterm>
45551 <indexterm role="concept">
45552 <primary>host</primary>
45553 <secondary>serializing connections</secondary>
45554 </indexterm>
45555 Because Exim operates in a distributed manner, if several messages for the same
45556 host arrive at around the same time, more than one simultaneous connection to
45557 the remote host can occur. This is not usually a problem except when there is a
45558 slow link between the hosts. In that situation it may be helpful to restrict
45559 Exim to one connection at a time. This can be done by setting
45560 <option>serialize_hosts</option> to match the relevant hosts.
45561 </para>
45562 <para>
45563 <indexterm role="concept">
45564 <primary>hints database</primary>
45565 <secondary>serializing deliveries to a host</secondary>
45566 </indexterm>
45567 Exim implements serialization by means of a hints database in which a record is
45568 written whenever a process connects to one of the restricted hosts. The record
45569 is deleted when the connection is completed. Obviously there is scope for
45570 records to get left lying around if there is a system or program crash. To
45571 guard against this, Exim ignores any records that are more than six hours old.
45572 </para>
45573 <para>
45574 If you set up this kind of serialization, you should also arrange to delete the
45575 relevant hints database whenever your system reboots. The names of the files
45576 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
45577 may be one or two files, depending on the type of DBM in use. The same files
45578 are used for ETRN serialization.
45579 </para>
45580 <para>
45581 <indexterm role="option">
45582 <primary><option>size_addition</option></primary>
45583 </indexterm>
45584 </para>
45585 <informaltable frame="all">
45586 <tgroup cols="4" colsep="0" rowsep="0">
45587 <colspec colwidth="8*" align="left"/>
45588 <colspec colwidth="6*" align="center"/>
45589 <colspec colwidth="6*" align="center"/>
45590 <colspec colwidth="6*" align="right"/>
45591 <tbody>
45592 <row>
45593 <entry><option>size_addition</option></entry>
45594 <entry>Use: <emphasis>smtp</emphasis></entry>
45595 <entry>Type: <emphasis>integer</emphasis></entry>
45596 <entry>Default: <emphasis>1024</emphasis></entry>
45597 </row>
45598 </tbody>
45599 </tgroup>
45600 </informaltable>
45601 <para>
45602 <indexterm role="concept">
45603 <primary>SMTP</primary>
45604 <secondary>SIZE</secondary>
45605 </indexterm>
45606 <indexterm role="concept">
45607 <primary>message</primary>
45608 <secondary>size issue for transport filter</secondary>
45609 </indexterm>
45610 <indexterm role="concept">
45611 <primary>size</primary>
45612 <secondary>of message</secondary>
45613 </indexterm>
45614 <indexterm role="concept">
45615 <primary>transport</primary>
45616 <secondary>filter</secondary>
45617 </indexterm>
45618 <indexterm role="concept">
45619 <primary>filter</primary>
45620 <secondary>transport filter</secondary>
45621 </indexterm>
45622 If a remote SMTP server indicates that it supports the SIZE option of the
45623 MAIL command, Exim uses this to pass over the message size at the start of
45624 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
45625 sends, to allow for headers and other text that may be added during delivery by
45626 configuration options or in a transport filter. It may be necessary to increase
45627 this if a lot of text is added to messages.
45628 </para>
45629 <para>
45630 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
45631 the use of the SIZE option altogether.
45632 </para>
45633 <para>
45634 <indexterm role="option">
45635 <primary><option>tls_certificate</option></primary>
45636 </indexterm>
45637 </para>
45638 <informaltable frame="all">
45639 <tgroup cols="4" colsep="0" rowsep="0">
45640 <colspec colwidth="8*" align="left"/>
45641 <colspec colwidth="6*" align="center"/>
45642 <colspec colwidth="6*" align="center"/>
45643 <colspec colwidth="6*" align="right"/>
45644 <tbody>
45645 <row>
45646 <entry><option>tls_certificate</option></entry>
45647 <entry>Use: <emphasis>smtp</emphasis></entry>
45648 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45649 <entry>Default: <emphasis>unset</emphasis></entry>
45650 </row>
45651 </tbody>
45652 </tgroup>
45653 </informaltable>
45654 <para>
45655 <indexterm role="concept">
45656 <primary>TLS</primary>
45657 <secondary>client certificate, location of</secondary>
45658 </indexterm>
45659 <indexterm role="concept">
45660 <primary>certificate</primary>
45661 <secondary>client, location of</secondary>
45662 </indexterm>
45663 <indexterm role="variable">
45664 <primary><varname>$host</varname></primary>
45665 </indexterm>
45666 <indexterm role="variable">
45667 <primary><varname>$host_address</varname></primary>
45668 </indexterm>
45669 The value of this option must be the absolute path to a file which contains the
45670 client&#x2019;s certificate, for possible use when sending a message over an encrypted
45671 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
45672 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
45673 details of TLS.
45674 </para>
45675 <para>
45676 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
45677 certificate when sending messages as a client. The global option of the same
45678 name specifies the certificate for Exim as a server; it is not automatically
45679 assumed that the same certificate should be used when Exim is operating as a
45680 client.
45681 </para>
45682 <para>
45683 <indexterm role="option">
45684 <primary><option>tls_crl</option></primary>
45685 </indexterm>
45686 </para>
45687 <informaltable frame="all">
45688 <tgroup cols="4" colsep="0" rowsep="0">
45689 <colspec colwidth="8*" align="left"/>
45690 <colspec colwidth="6*" align="center"/>
45691 <colspec colwidth="6*" align="center"/>
45692 <colspec colwidth="6*" align="right"/>
45693 <tbody>
45694 <row>
45695 <entry><option>tls_crl</option></entry>
45696 <entry>Use: <emphasis>smtp</emphasis></entry>
45697 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45698 <entry>Default: <emphasis>unset</emphasis></entry>
45699 </row>
45700 </tbody>
45701 </tgroup>
45702 </informaltable>
45703 <para>
45704 <indexterm role="concept">
45705 <primary>TLS</primary>
45706 <secondary>client certificate revocation list</secondary>
45707 </indexterm>
45708 <indexterm role="concept">
45709 <primary>certificate</primary>
45710 <secondary>revocation list for client</secondary>
45711 </indexterm>
45712 This option specifies a certificate revocation list. The expanded value must
45713 be the name of a file that contains a CRL in PEM format.
45714 </para>
45715 <para>
45716 <indexterm role="option">
45717 <primary><option>tls_dh_min_bits</option></primary>
45718 </indexterm>
45719 </para>
45720 <informaltable frame="all">
45721 <tgroup cols="4" colsep="0" rowsep="0">
45722 <colspec colwidth="8*" align="left"/>
45723 <colspec colwidth="6*" align="center"/>
45724 <colspec colwidth="6*" align="center"/>
45725 <colspec colwidth="6*" align="right"/>
45726 <tbody>
45727 <row>
45728 <entry><option>tls_dh_min_bits</option></entry>
45729 <entry>Use: <emphasis>smtp</emphasis></entry>
45730 <entry>Type: <emphasis>integer</emphasis></entry>
45731 <entry>Default: <emphasis>1024</emphasis></entry>
45732 </row>
45733 </tbody>
45734 </tgroup>
45735 </informaltable>
45736 <para>
45737 <indexterm role="concept">
45738 <primary>TLS</primary>
45739 <secondary>Diffie-Hellman minimum acceptable size</secondary>
45740 </indexterm>
45741 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
45742 key agreement is negotiated, the server will provide a large prime number
45743 for use.  This option establishes the minimum acceptable size of that number.
45744 If the parameter offered by the server is too small, then the TLS handshake
45745 will fail.
45746 </para>
45747 <para>
45748 Only supported when using GnuTLS.
45749 </para>
45750 <para>
45751 <indexterm role="option">
45752 <primary><option>tls_privatekey</option></primary>
45753 </indexterm>
45754 </para>
45755 <informaltable frame="all">
45756 <tgroup cols="4" colsep="0" rowsep="0">
45757 <colspec colwidth="8*" align="left"/>
45758 <colspec colwidth="6*" align="center"/>
45759 <colspec colwidth="6*" align="center"/>
45760 <colspec colwidth="6*" align="right"/>
45761 <tbody>
45762 <row>
45763 <entry><option>tls_privatekey</option></entry>
45764 <entry>Use: <emphasis>smtp</emphasis></entry>
45765 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45766 <entry>Default: <emphasis>unset</emphasis></entry>
45767 </row>
45768 </tbody>
45769 </tgroup>
45770 </informaltable>
45771 <para>
45772 <indexterm role="concept">
45773 <primary>TLS</primary>
45774 <secondary>client private key, location of</secondary>
45775 </indexterm>
45776 <indexterm role="variable">
45777 <primary><varname>$host</varname></primary>
45778 </indexterm>
45779 <indexterm role="variable">
45780 <primary><varname>$host_address</varname></primary>
45781 </indexterm>
45782 The value of this option must be the absolute path to a file which contains the
45783 client&#x2019;s private key. This is used when sending a message over an encrypted
45784 connection using a client certificate. The values of <varname>$host</varname> and
45785 <varname>$host_address</varname> are set to the name and address of the server during the
45786 expansion. If this option is unset, or the expansion is forced to fail, or the
45787 result is an empty string, the private key is assumed to be in the same file as
45788 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45789 </para>
45790 <para>
45791 <indexterm role="option">
45792 <primary><option>tls_require_ciphers</option></primary>
45793 </indexterm>
45794 </para>
45795 <informaltable frame="all">
45796 <tgroup cols="4" colsep="0" rowsep="0">
45797 <colspec colwidth="8*" align="left"/>
45798 <colspec colwidth="6*" align="center"/>
45799 <colspec colwidth="6*" align="center"/>
45800 <colspec colwidth="6*" align="right"/>
45801 <tbody>
45802 <row>
45803 <entry><option>tls_require_ciphers</option></entry>
45804 <entry>Use: <emphasis>smtp</emphasis></entry>
45805 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45806 <entry>Default: <emphasis>unset</emphasis></entry>
45807 </row>
45808 </tbody>
45809 </tgroup>
45810 </informaltable>
45811 <para>
45812 <indexterm role="concept">
45813 <primary>TLS</primary>
45814 <secondary>requiring specific ciphers</secondary>
45815 </indexterm>
45816 <indexterm role="concept">
45817 <primary>cipher</primary>
45818 <secondary>requiring specific</secondary>
45819 </indexterm>
45820 <indexterm role="variable">
45821 <primary><varname>$host</varname></primary>
45822 </indexterm>
45823 <indexterm role="variable">
45824 <primary><varname>$host_address</varname></primary>
45825 </indexterm>
45826 The value of this option must be a list of permitted cipher suites, for use
45827 when setting up an outgoing encrypted connection. (There is a global option of
45828 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
45829 <varname>$host_address</varname> are set to the name and address of the server during the
45830 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
45831 is used in different ways by OpenSSL and GnuTLS (see sections
45832 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
45833 ciphers is a preference order.
45834 </para>
45835 <para>
45836 <indexterm role="option">
45837 <primary><option>tls_sni</option></primary>
45838 </indexterm>
45839 </para>
45840 <informaltable frame="all">
45841 <tgroup cols="4" colsep="0" rowsep="0">
45842 <colspec colwidth="8*" align="left"/>
45843 <colspec colwidth="6*" align="center"/>
45844 <colspec colwidth="6*" align="center"/>
45845 <colspec colwidth="6*" align="right"/>
45846 <tbody>
45847 <row>
45848 <entry><option>tls_sni</option></entry>
45849 <entry>Use: <emphasis>smtp</emphasis></entry>
45850 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45851 <entry>Default: <emphasis>unset</emphasis></entry>
45852 </row>
45853 </tbody>
45854 </tgroup>
45855 </informaltable>
45856 <para>
45857 <indexterm role="concept">
45858 <primary>TLS</primary>
45859 <secondary>Server Name Indication</secondary>
45860 </indexterm>
45861 <indexterm role="variable">
45862 <primary><varname>$tls_sni</varname></primary>
45863 </indexterm>
45864 If this option is set then it sets the $tls_out_sni variable and causes any
45865 TLS session to pass this value as the Server Name Indication extension to
45866 the remote side, which can be used by the remote side to select an appropriate
45867 certificate and private key for the session.
45868 </para>
45869 <para>
45870 See <xref linkend="SECTtlssni"/> for more information.
45871 </para>
45872 <para>
45873 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
45874 TLS extensions.
45875 </para>
45876 <para>
45877 <indexterm role="option">
45878 <primary><option>tls_tempfail_tryclear</option></primary>
45879 </indexterm>
45880 </para>
45881 <informaltable frame="all">
45882 <tgroup cols="4" colsep="0" rowsep="0">
45883 <colspec colwidth="8*" align="left"/>
45884 <colspec colwidth="6*" align="center"/>
45885 <colspec colwidth="6*" align="center"/>
45886 <colspec colwidth="6*" align="right"/>
45887 <tbody>
45888 <row>
45889 <entry><option>tls_tempfail_tryclear</option></entry>
45890 <entry>Use: <emphasis>smtp</emphasis></entry>
45891 <entry>Type: <emphasis>boolean</emphasis></entry>
45892 <entry>Default: <emphasis>true</emphasis></entry>
45893 </row>
45894 </tbody>
45895 </tgroup>
45896 </informaltable>
45897 <para>
45898 <indexterm role="concept">
45899 <primary>4<emphasis>xx</emphasis> responses</primary>
45900 <secondary>to STARTTLS</secondary>
45901 </indexterm>
45902 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
45903 setting up a TLS session, this option determines whether or not Exim should try
45904 to deliver the message unencrypted. If it is set false, delivery to the
45905 current host is deferred; if there are other hosts, they are tried. If this
45906 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
45907 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
45908 TLS negotiation fails, Exim closes the current connection (because it is in an
45909 unknown state), opens a new one to the same host, and then tries the delivery
45910 in clear.
45911 </para>
45912 <para>
45913 <indexterm role="option">
45914 <primary><option>tls_try_verify_hosts</option></primary>
45915 </indexterm>
45916 </para>
45917 <informaltable frame="all">
45918 <tgroup cols="4" colsep="0" rowsep="0">
45919 <colspec colwidth="8*" align="left"/>
45920 <colspec colwidth="6*" align="center"/>
45921 <colspec colwidth="6*" align="center"/>
45922 <colspec colwidth="6*" align="right"/>
45923 <tbody>
45924 <row>
45925 <entry><option>tls_try_verify_hosts</option></entry>
45926 <entry>Use: <emphasis>smtp</emphasis></entry>
45927 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis> unset</emphasis></entry>
45928 <entry>Default: <emphasis></emphasis></entry>
45929 </row>
45930 </tbody>
45931 </tgroup>
45932 </informaltable>
45933 <para>
45934 <indexterm role="concept">
45935 <primary>TLS</primary>
45936 <secondary>server certificate verification</secondary>
45937 </indexterm>
45938 <indexterm role="concept">
45939 <primary>certificate</primary>
45940 <secondary>verification of server</secondary>
45941 </indexterm>
45942 This option gives a list of hosts for which, on encrypted connections,
45943 certificate verification will be tried but need not succeed.
45944 The <option>tls_verify_certificates</option> option must also be set.
45945 Note that unless the host is in this list
45946 TLS connections will be denied to hosts using self-signed certificates
45947 when <option>tls_verify_certificates</option> is set.
45948 The <varname>$tls_out_certificate_verified</varname> variable is set when
45949 certificate verification succeeds.
45950 </para>
45951 <para>
45952 <indexterm role="option">
45953 <primary><option>tls_verify_certificates</option></primary>
45954 </indexterm>
45955 </para>
45956 <informaltable frame="all">
45957 <tgroup cols="4" colsep="0" rowsep="0">
45958 <colspec colwidth="8*" align="left"/>
45959 <colspec colwidth="6*" align="center"/>
45960 <colspec colwidth="6*" align="center"/>
45961 <colspec colwidth="6*" align="right"/>
45962 <tbody>
45963 <row>
45964 <entry><option>tls_verify_certificates</option></entry>
45965 <entry>Use: <emphasis>smtp</emphasis></entry>
45966 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45967 <entry>Default: <emphasis>unset</emphasis></entry>
45968 </row>
45969 </tbody>
45970 </tgroup>
45971 </informaltable>
45972 <para>
45973 <indexterm role="concept">
45974 <primary>TLS</primary>
45975 <secondary>server certificate verification</secondary>
45976 </indexterm>
45977 <indexterm role="concept">
45978 <primary>certificate</primary>
45979 <secondary>verification of server</secondary>
45980 </indexterm>
45981 <indexterm role="variable">
45982 <primary><varname>$host</varname></primary>
45983 </indexterm>
45984 <indexterm role="variable">
45985 <primary><varname>$host_address</varname></primary>
45986 </indexterm>
45987 The value of this option must be the absolute path to a file containing
45988 permitted server certificates, for use when setting up an encrypted connection.
45989 Alternatively, if you are using OpenSSL, you can set
45990 <option>tls_verify_certificates</option> to the name of a directory containing certificate
45991 files. This does not work with GnuTLS; the option must be set to the name of a
45992 single file if you are using GnuTLS. The values of <varname>$host</varname> and
45993 <varname>$host_address</varname> are set to the name and address of the server during the
45994 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45995 </para>
45996 <para>
45997 For back-compatability,
45998 if neither tls_verify_hosts nor tls_try_verify_hosts are set
45999 and certificate verification fails the TLS connection is closed.
46000 </para>
46001 <para>
46002 <indexterm role="option">
46003 <primary><option>tls_verify_hosts</option></primary>
46004 </indexterm>
46005 </para>
46006 <informaltable frame="all">
46007 <tgroup cols="4" colsep="0" rowsep="0">
46008 <colspec colwidth="8*" align="left"/>
46009 <colspec colwidth="6*" align="center"/>
46010 <colspec colwidth="6*" align="center"/>
46011 <colspec colwidth="6*" align="right"/>
46012 <tbody>
46013 <row>
46014 <entry><option>tls_verify_hosts</option></entry>
46015 <entry>Use: <emphasis>smtp</emphasis></entry>
46016 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis> unset</emphasis></entry>
46017 <entry>Default: <emphasis></emphasis></entry>
46018 </row>
46019 </tbody>
46020 </tgroup>
46021 </informaltable>
46022 <para>
46023 <indexterm role="concept">
46024 <primary>TLS</primary>
46025 <secondary>server certificate verification</secondary>
46026 </indexterm>
46027 <indexterm role="concept">
46028 <primary>certificate</primary>
46029 <secondary>verification of server</secondary>
46030 </indexterm>
46031 This option gives a list of hosts for which. on encrypted connections,
46032 certificate verification must succeed.
46033 The <option>tls_verify_certificates</option> option must also be set.
46034 If both this option and <option>tls_try_verify_hosts</option> are unset
46035 operation is as if this option selected all hosts.
46036 </para>
46037 </section>
46038 <section id="SECTvalhosmax">
46039 <title>How the limits for the number of hosts to try are used</title>
46040 <para>
46041 <indexterm role="concept">
46042 <primary>host</primary>
46043 <secondary>maximum number to try</secondary>
46044 </indexterm>
46045 <indexterm role="concept">
46046 <primary>limit</primary>
46047 <secondary>hosts; maximum number tried</secondary>
46048 </indexterm>
46049 There are two options that are concerned with the number of hosts that are
46050 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
46051 <option>hosts_max_try_hardlimit</option>.
46052 </para>
46053 <para>
46054 The <option>hosts_max_try</option> option limits the number of hosts that are tried
46055 for a single delivery. However, despite the term <quote>host</quote> in its name, the
46056 option actually applies to each IP address independently. In other words, a
46057 multihomed host is treated as several independent hosts, just as it is for
46058 retrying.
46059 </para>
46060 <para>
46061 Many of the larger ISPs have multiple MX records which often point to
46062 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
46063 created as a result of routing one of these domains.
46064 </para>
46065 <para>
46066 Trying every single IP address on such a long list does not seem sensible; if
46067 several at the top of the list fail, it is reasonable to assume there is some
46068 problem that is likely to affect all of them. Roughly speaking, the value of
46069 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
46070 delivery. However, the logic cannot be quite that simple.
46071 </para>
46072 <para>
46073 Firstly, IP addresses that are skipped because their retry times have not
46074 arrived do not count, and in addition, addresses that are past their retry
46075 limits are also not counted, even when they are tried. This means that when
46076 some IP addresses are past their retry limits, more than the value of
46077 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
46078 that all IP addresses are considered before timing out an email address (but
46079 see below for an exception).
46080 </para>
46081 <para>
46082 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
46083 list to see if there is a subsequent host with a different (higher valued) MX.
46084 If there is, that host is considered next, and the current IP address is used
46085 but not counted. This behaviour helps in the case of a domain with a retry rule
46086 that hardly ever delays any hosts, as is now explained:
46087 </para>
46088 <para>
46089 Consider the case of a long list of hosts with one MX value, and a few with a
46090 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
46091 hosts at the top of the list are tried at first. With the default retry rule,
46092 which specifies increasing retry times, the higher MX hosts are eventually
46093 tried when those at the top of the list are skipped because they have not
46094 reached their retry times.
46095 </para>
46096 <para>
46097 However, it is common practice to put a fixed short retry time on domains for
46098 large ISPs, on the grounds that their servers are rarely down for very long.
46099 Unfortunately, these are exactly the domains that tend to resolve to long lists
46100 of hosts. The short retry time means that the lowest MX hosts are tried every
46101 time. The attempts may be in a different order because of random sorting, but
46102 without the special MX check, the higher MX hosts would never be tried until
46103 all the lower MX hosts had timed out (which might be several days), because
46104 there are always some lower MX hosts that have reached their retry times. With
46105 the special check, Exim considers at least one IP address from each MX value at
46106 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
46107 reached.
46108 </para>
46109 <para>
46110 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
46111 particular, Exim normally eventually tries all the IP addresses before timing
46112 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
46113 reasonable thing to do. Recently, however, some lunatic DNS configurations have
46114 been set up with hundreds of IP addresses for some domains. It can
46115 take a very long time indeed for an address to time out in these cases.
46116 </para>
46117 <para>
46118 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
46119 Exim never tries more than this number of IP addresses; if it hits this limit
46120 and they are all timed out, the email address is bounced, even though not all
46121 possible IP addresses have been tried.
46122 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
46123 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
46124 </para>
46125 </section>
46126 </chapter>
46127
46128 <chapter id="CHAPrewrite">
46129 <title>Address rewriting</title>
46130 <para>
46131 <indexterm role="concept" id="IIDaddrew" class="startofrange">
46132 <primary>rewriting</primary>
46133 <secondary>addresses</secondary>
46134 </indexterm>
46135 There are some circumstances in which Exim automatically rewrites domains in
46136 addresses. The two most common are when an address is given without a domain
46137 (referred to as an <quote>unqualified address</quote>) or when an address contains an
46138 abbreviated domain that is expanded by DNS lookup.
46139 </para>
46140 <para>
46141 Unqualified envelope addresses are accepted only for locally submitted
46142 messages, or for messages that are received from hosts matching
46143 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
46144 appropriate. Unqualified addresses in header lines are qualified if they are in
46145 locally submitted messages, or messages from hosts that are permitted to send
46146 unqualified envelope addresses. Otherwise, unqualified addresses in header
46147 lines are neither qualified nor rewritten.
46148 </para>
46149 <para>
46150 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
46151 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
46152 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
46153 do this. The new RFCs do not contain this suggestion.
46154 </para>
46155 <section id="SECID147">
46156 <title>Explicitly configured address rewriting</title>
46157 <para>
46158 This chapter describes the rewriting rules that can be used in the
46159 main rewrite section of the configuration file, and also in the generic
46160 <option>headers_rewrite</option> option that can be set on any transport.
46161 </para>
46162 <para>
46163 Some people believe that configured address rewriting is a Mortal Sin.
46164 Others believe that life is not possible without it. Exim provides the
46165 facility; you do not have to use it.
46166 </para>
46167 <para>
46168 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
46169 configuration file are applied to addresses in incoming messages, both envelope
46170 addresses and addresses in header lines. Each rule specifies the types of
46171 address to which it applies.
46172 </para>
46173 <para>
46174 Whether or not addresses in header lines are rewritten depends on the origin of
46175 the headers and the type of rewriting. Global rewriting, that is, rewriting
46176 rules from the rewrite section of the configuration file, is applied only to
46177 those headers that were received with the message. Header lines that are added
46178 by ACLs or by a system filter or by individual routers or transports (which
46179 are specific to individual recipient addresses) are not rewritten by the global
46180 rules.
46181 </para>
46182 <para>
46183 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
46184 applies all headers except those added by routers and transports. That is, as
46185 well as the headers that were received with the message, it also applies to
46186 headers that were added by an ACL or a system filter.
46187 </para>
46188 <para>
46189 In general, rewriting addresses from your own system or domain has some
46190 legitimacy. Rewriting other addresses should be done only with great care and
46191 in special circumstances. The author of Exim believes that rewriting should be
46192 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
46193 Although it can sometimes be used as a routing tool, this is very strongly
46194 discouraged.
46195 </para>
46196 <para>
46197 There are two commonly encountered circumstances where rewriting is used, as
46198 illustrated by these examples:
46199 </para>
46200 <itemizedlist>
46201 <listitem>
46202 <para>
46203 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
46204 exchange mail with each other behind a firewall, but there is only a single
46205 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
46206 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
46207 </para>
46208 </listitem>
46209 <listitem>
46210 <para>
46211 A host rewrites the local parts of its own users so that, for example,
46212 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
46213 </para>
46214 </listitem>
46215 </itemizedlist>
46216 </section>
46217 <section id="SECID148">
46218 <title>When does rewriting happen?</title>
46219 <para>
46220 <indexterm role="concept">
46221 <primary>rewriting</primary>
46222 <secondary>timing of</secondary>
46223 </indexterm>
46224 <indexterm role="concept">
46225 <primary>access control lists (ACLs)</primary>
46226 <secondary>rewriting addresses in</secondary>
46227 </indexterm>
46228 Configured address rewriting can take place at several different stages of a
46229 message&#x2019;s processing.
46230 </para>
46231 <para>
46232 <indexterm role="variable">
46233 <primary><varname>$sender_address</varname></primary>
46234 </indexterm>
46235 At the start of an ACL for MAIL, the sender address may have been rewritten
46236 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
46237 ordinary rewrite rules have yet been applied. If, however, the sender address
46238 is verified in the ACL, it is rewritten before verification, and remains
46239 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
46240 rewritten address. This also applies if sender verification happens in a
46241 RCPT ACL. Otherwise, when the sender address is not verified, it is
46242 rewritten as soon as a message&#x2019;s header lines have been received.
46243 </para>
46244 <para>
46245 <indexterm role="variable">
46246 <primary><varname>$domain</varname></primary>
46247 </indexterm>
46248 <indexterm role="variable">
46249 <primary><varname>$local_part</varname></primary>
46250 </indexterm>
46251 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
46252 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
46253 rewrite rules have yet been applied to it. However, the behaviour is different
46254 from the sender address when a recipient is verified. The address is rewritten
46255 for the verification, but the rewriting is not remembered at this stage. The
46256 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
46257 as they were before (that is, they contain the unrewritten &ndash; except for
46258 SMTP-time rewriting &ndash; address).
46259 </para>
46260 <para>
46261 As soon as a message&#x2019;s header lines have been received, all the envelope
46262 recipient addresses are permanently rewritten, and rewriting is also applied to
46263 the addresses in the header lines (if configured). This happens before adding
46264 any header lines that were specified in MAIL or RCPT ACLs, and
46265 <indexterm role="concept">
46266 <primary><function>local_scan()</function> function</primary>
46267 <secondary>address rewriting; timing of</secondary>
46268 </indexterm>
46269 before the DATA ACL and <function>local_scan()</function> functions are run.
46270 </para>
46271 <para>
46272 When an address is being routed, either for delivery or for verification,
46273 rewriting is applied immediately to child addresses that are generated by
46274 redirection, unless <option>no_rewrite</option> is set on the router.
46275 </para>
46276 <para>
46277 <indexterm role="concept">
46278 <primary>envelope sender</primary>
46279 <secondary>rewriting at transport time</secondary>
46280 </indexterm>
46281 <indexterm role="concept">
46282 <primary>rewriting</primary>
46283 <secondary>at transport time</secondary>
46284 </indexterm>
46285 <indexterm role="concept">
46286 <primary>header lines</primary>
46287 <secondary>rewriting at transport time</secondary>
46288 </indexterm>
46289 At transport time, additional rewriting of addresses in header lines can be
46290 specified by setting the generic <option>headers_rewrite</option> option on a transport.
46291 This option contains rules that are identical in form to those in the rewrite
46292 section of the configuration file. They are applied to the original message
46293 header lines and any that were added by ACLs or a system filter. They are not
46294 applied to header lines that are added by routers or the transport.
46295 </para>
46296 <para>
46297 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
46298 transport option. However, it is not possible to rewrite envelope recipients at
46299 transport time.
46300 </para>
46301 </section>
46302 <section id="SECID149">
46303 <title>Testing the rewriting rules that apply on input</title>
46304 <para>
46305 <indexterm role="concept">
46306 <primary>rewriting</primary>
46307 <secondary>testing</secondary>
46308 </indexterm>
46309 <indexterm role="concept">
46310 <primary>testing</primary>
46311 <secondary>rewriting</secondary>
46312 </indexterm>
46313 Exim&#x2019;s input rewriting configuration appears in a part of the run time
46314 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
46315 <option>-brw</option> command line option. This takes an address (which can be a full RFC
46316 2822 address) as its argument. The output is a list of how the address would be
46317 transformed by the rewriting rules for each of the different places it might
46318 appear in an incoming message, that is, for each different header and for the
46319 envelope sender and recipient fields. For example,
46320 </para>
46321 <literallayout class="monospaced">
46322 exim -brw ph10@exim.workshop.example
46323 </literallayout>
46324 <para>
46325 might produce the output
46326 </para>
46327 <literallayout class="monospaced">
46328 sender: Philip.Hazel@exim.workshop.example
46329 from: Philip.Hazel@exim.workshop.example
46330 to: ph10@exim.workshop.example
46331 cc: ph10@exim.workshop.example
46332 bcc: ph10@exim.workshop.example
46333 reply-to: Philip.Hazel@exim.workshop.example
46334 env-from: Philip.Hazel@exim.workshop.example
46335 env-to: ph10@exim.workshop.example
46336 </literallayout>
46337 <para>
46338 which shows that rewriting has been set up for that address when used in any of
46339 the source fields, but not when it appears as a recipient address. At the
46340 present time, there is no equivalent way of testing rewriting rules that are
46341 set for a particular transport.
46342 </para>
46343 </section>
46344 <section id="SECID150">
46345 <title>Rewriting rules</title>
46346 <para>
46347 <indexterm role="concept">
46348 <primary>rewriting</primary>
46349 <secondary>rules</secondary>
46350 </indexterm>
46351 The rewrite section of the configuration file consists of lines of rewriting
46352 rules in the form
46353 </para>
46354 <literallayout>
46355 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
46356 </literallayout>
46357 <para>
46358 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
46359 transport option are given as a colon-separated list. Each item in the list
46360 takes the same form as a line in the main rewriting configuration (except that
46361 any colons must be doubled, of course).
46362 </para>
46363 <para>
46364 The formats of source patterns and replacement strings are described below.
46365 Each is terminated by white space, unless enclosed in double quotes, in which
46366 case normal quoting conventions apply inside the quotes. The flags are single
46367 characters which may appear in any order. Spaces and tabs between them are
46368 ignored.
46369 </para>
46370 <para>
46371 For each address that could potentially be rewritten, the rules are scanned in
46372 order, and replacements for the address from earlier rules can themselves be
46373 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
46374 </para>
46375 <para>
46376 The order in which addresses are rewritten is undefined, may change between
46377 releases, and must not be relied on, with one exception: when a message is
46378 received, the envelope sender is always rewritten first, before any header
46379 lines are rewritten. For example, the replacement string for a rewrite of an
46380 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
46381 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
46382 that the envelope sender has already been rewritten.
46383 </para>
46384 <para>
46385 <indexterm role="variable">
46386 <primary><varname>$domain</varname></primary>
46387 </indexterm>
46388 <indexterm role="variable">
46389 <primary><varname>$local_part</varname></primary>
46390 </indexterm>
46391 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
46392 string to refer to the address that is being rewritten. Note that lookup-driven
46393 rewriting can be done by a rule of the form
46394 </para>
46395 <literallayout class="monospaced">
46396 *@*   ${lookup ...
46397 </literallayout>
46398 <para>
46399 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
46400 refer to the address that is being rewritten.
46401 </para>
46402 </section>
46403 <section id="SECID151">
46404 <title>Rewriting patterns</title>
46405 <para>
46406 <indexterm role="concept">
46407 <primary>rewriting</primary>
46408 <secondary>patterns</secondary>
46409 </indexterm>
46410 <indexterm role="concept">
46411 <primary>address list</primary>
46412 <secondary>in a rewriting pattern</secondary>
46413 </indexterm>
46414 The source pattern in a rewriting rule is any item which may appear in an
46415 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
46416 single-item address list, which means that it is expanded before being tested
46417 against the address. As always, if you use a regular expression as a pattern,
46418 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
46419 facility to suppress string expansion within the regular expression.
46420 </para>
46421 <para>
46422 Domains in patterns should be given in lower case. Local parts in patterns are
46423 case-sensitive. If you want to do case-insensitive matching of local parts, you
46424 can use a regular expression that starts with <literal>^(?i)</literal>.
46425 </para>
46426 <para>
46427 <indexterm role="concept">
46428 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46429 <secondary>in rewriting rules</secondary>
46430 </indexterm>
46431 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
46432 depending on the type of match which occurred. These can be used in the
46433 replacement string to insert portions of the incoming address. <varname>$0</varname> always
46434 refers to the complete incoming address. When a regular expression is used, the
46435 numerical variables are set from its capturing subexpressions. For other types
46436 of pattern they are set as follows:
46437 </para>
46438 <itemizedlist>
46439 <listitem>
46440 <para>
46441 If a local part or domain starts with an asterisk, the numerical variables
46442 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
46443 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
46444 pattern
46445 </para>
46446 <literallayout class="monospaced">
46447 *queen@*.fict.example
46448 </literallayout>
46449 <para>
46450 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
46451 </para>
46452 <literallayout class="monospaced">
46453 $0 = hearts-queen@wonderland.fict.example
46454 $1 = hearts-
46455 $2 = wonderland
46456 </literallayout>
46457 <para>
46458 Note that if the local part does not start with an asterisk, but the domain
46459 does, it is <varname>$1</varname> that contains the wild part of the domain.
46460 </para>
46461 </listitem>
46462 <listitem>
46463 <para>
46464 If the domain part of the pattern is a partial lookup, the wild and fixed parts
46465 of the domain are placed in the next available numerical variables. Suppose,
46466 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
46467 rewriting rule of the form
46468 </para>
46469 <literallayout>
46470 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
46471 </literallayout>
46472 <para>
46473 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
46474 </para>
46475 <literallayout class="monospaced">
46476 $1 = foo
46477 $2 = bar
46478 $3 = baz.example
46479 </literallayout>
46480 <para>
46481 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
46482 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
46483 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
46484 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
46485 whole domain. For non-partial domain lookups, no numerical variables are set.
46486 </para>
46487 </listitem>
46488 </itemizedlist>
46489 </section>
46490 <section id="SECID152">
46491 <title>Rewriting replacements</title>
46492 <para>
46493 <indexterm role="concept">
46494 <primary>rewriting</primary>
46495 <secondary>replacements</secondary>
46496 </indexterm>
46497 If the replacement string for a rule is a single asterisk, addresses that
46498 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
46499 rewriting rules are scanned. For example,
46500 </para>
46501 <literallayout class="monospaced">
46502 hatta@lookingglass.fict.example  *  f
46503 </literallayout>
46504 <para>
46505 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
46506 <emphasis>From:</emphasis> headers.
46507 </para>
46508 <para>
46509 <indexterm role="variable">
46510 <primary><varname>$domain</varname></primary>
46511 </indexterm>
46512 <indexterm role="variable">
46513 <primary><varname>$local_part</varname></primary>
46514 </indexterm>
46515 If the replacement string is not a single asterisk, it is expanded, and must
46516 yield a fully qualified address. Within the expansion, the variables
46517 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
46518 Any letters they contain retain their original case &ndash; they are not lower
46519 cased. The numerical variables are set up according to the type of pattern that
46520 matched the address, as described above. If the expansion is forced to fail by
46521 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
46522 current rule is abandoned, but subsequent rules may take effect. Any other
46523 expansion failure causes the entire rewriting operation to be abandoned, and an
46524 entry written to the panic log.
46525 </para>
46526 </section>
46527 <section id="SECID153">
46528 <title>Rewriting flags</title>
46529 <para>
46530 There are three different kinds of flag that may appear on rewriting rules:
46531 </para>
46532 <itemizedlist>
46533 <listitem>
46534 <para>
46535 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
46536 c, f, h, r, s, t.
46537 </para>
46538 </listitem>
46539 <listitem>
46540 <para>
46541 A flag that specifies rewriting at SMTP time: S.
46542 </para>
46543 </listitem>
46544 <listitem>
46545 <para>
46546 Flags that control the rewriting process: Q, q, R, w.
46547 </para>
46548 </listitem>
46549 </itemizedlist>
46550 <para>
46551 For rules that are part of the <option>headers_rewrite</option> generic transport option,
46552 E, F, T, and S are not permitted.
46553 </para>
46554 </section>
46555 <section id="SECID154">
46556 <title>Flags specifying which headers and envelope addresses to rewrite</title>
46557 <para>
46558 <indexterm role="concept">
46559 <primary>rewriting</primary>
46560 <secondary>flags</secondary>
46561 </indexterm>
46562 If none of the following flag letters, nor the <quote>S</quote> flag (see section
46563 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
46564 and to both the sender and recipient fields of the envelope, whereas a
46565 transport-time rewriting rule just applies to all headers. Otherwise, the
46566 rewriting rule is skipped unless the relevant addresses are being processed.
46567 </para>
46568 <literallayout>
46569 <literal>E</literal>       rewrite all envelope fields
46570 <literal>F</literal>       rewrite the envelope From field
46571 <literal>T</literal>       rewrite the envelope To field
46572 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
46573 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
46574 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
46575 <literal>h</literal>       rewrite all headers
46576 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
46577 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
46578 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
46579 </literallayout>
46580 <para>
46581 "All headers" means all of the headers listed above that can be selected
46582 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
46583 other headers such as <emphasis>Subject:</emphasis> etc.
46584 </para>
46585 <para>
46586 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
46587 restrict this to special known cases in your own domains.
46588 </para>
46589 </section>
46590 <section id="SECTrewriteS">
46591 <title>The SMTP-time rewriting flag</title>
46592 <para>
46593 <indexterm role="concept">
46594 <primary>SMTP</primary>
46595 <secondary>rewriting malformed addresses</secondary>
46596 </indexterm>
46597 <indexterm role="concept">
46598 <primary>RCPT</primary>
46599 <secondary>rewriting argument of</secondary>
46600 </indexterm>
46601 <indexterm role="concept">
46602 <primary>MAIL</primary>
46603 <secondary>rewriting argument of</secondary>
46604 </indexterm>
46605 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
46606 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
46607 before any other processing; even before syntax checking. The pattern is
46608 required to be a regular expression, and it is matched against the whole of the
46609 data for the command, including any surrounding angle brackets.
46610 </para>
46611 <para>
46612 <indexterm role="variable">
46613 <primary><varname>$domain</varname></primary>
46614 </indexterm>
46615 <indexterm role="variable">
46616 <primary><varname>$local_part</varname></primary>
46617 </indexterm>
46618 This form of rewrite rule allows for the handling of addresses that are not
46619 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
46620 input). Because the input is not required to be a syntactically valid address,
46621 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
46622 expansion of the replacement string. The result of rewriting replaces the
46623 original address in the MAIL or RCPT command.
46624 </para>
46625 </section>
46626 <section id="SECID155">
46627 <title>Flags controlling the rewriting process</title>
46628 <para>
46629 There are four flags which control the way the rewriting process works. These
46630 take effect only when a rule is invoked, that is, when the address is of the
46631 correct type (matches the flags) and matches the pattern:
46632 </para>
46633 <itemizedlist>
46634 <listitem>
46635 <para>
46636 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
46637 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
46638 absence of <quote>Q</quote> the rewritten address must always include a domain.
46639 </para>
46640 </listitem>
46641 <listitem>
46642 <para>
46643 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
46644 even if no rewriting actually takes place because of a <quote>fail</quote> in the
46645 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
46646 (does not match the flags) or does not match the pattern.
46647 </para>
46648 </listitem>
46649 <listitem>
46650 <para>
46651 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
46652 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
46653 rewriting once it fails to match (after at least one successful rewrite).
46654 </para>
46655 </listitem>
46656 <listitem>
46657 <para>
46658 <indexterm role="concept">
46659 <primary>rewriting</primary>
46660 <secondary>whole addresses</secondary>
46661 </indexterm>
46662 When an address in a header is rewritten, the rewriting normally applies only
46663 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
46664 left unchanged. For example, rewriting might change
46665 </para>
46666 <literallayout class="monospaced">
46667 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
46668 </literallayout>
46669 <para>
46670 into
46671 </para>
46672 <literallayout class="monospaced">
46673 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
46674 </literallayout>
46675 <para>
46676 <indexterm role="concept">
46677 <primary>RFC 2047</primary>
46678 </indexterm>
46679 Sometimes there is a need to replace the whole address item, and this can be
46680 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
46681 causes an address in a header line to be rewritten, the entire address is
46682 replaced, not just the working part. The replacement must be a complete RFC
46683 2822 address, including the angle brackets if necessary. If text outside angle
46684 brackets contains a character whose value is greater than 126 or less than 32
46685 (except for tab), the text is encoded according to RFC 2047. The character set
46686 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
46687 </para>
46688 <para>
46689 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
46690 rewritten, all but the working part of the replacement address is discarded.
46691 </para>
46692 </listitem>
46693 </itemizedlist>
46694 </section>
46695 <section id="SECID156">
46696 <title>Rewriting examples</title>
46697 <para>
46698 Here is an example of the two common rewriting paradigms:
46699 </para>
46700 <literallayout class="monospaced">
46701 *@*.hitch.fict.example  $1@hitch.fict.example
46702 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
46703                      {$value}fail}@hitch.fict.example bctfrF
46704 </literallayout>
46705 <para>
46706 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
46707 the string expansion to fail if the lookup does not succeed. In this context it
46708 has the effect of leaving the original address unchanged, but Exim goes on to
46709 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
46710 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
46711 explicitly, which would cause the rewritten address to be the same as before,
46712 at the cost of a small bit of processing. Not supplying either of these is an
46713 error, since the rewritten address would then contain no local part.
46714 </para>
46715 <para>
46716 The first example above replaces the domain with a superior, more general
46717 domain. This may not be desirable for certain local parts. If the rule
46718 </para>
46719 <literallayout class="monospaced">
46720 root@*.hitch.fict.example  *
46721 </literallayout>
46722 <para>
46723 were inserted before the first rule, rewriting would be suppressed for the
46724 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
46725 </para>
46726 <para>
46727 Rewriting can be made conditional on a number of tests, by making use of
46728 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
46729 messages that originate outside the local host:
46730 </para>
46731 <literallayout class="monospaced">
46732 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
46733                          {$1@hitch.fict.example}fail}"
46734 </literallayout>
46735 <para>
46736 The replacement string is quoted in this example because it contains white
46737 space.
46738 </para>
46739 <para>
46740 <indexterm role="concept">
46741 <primary>rewriting</primary>
46742 <secondary>bang paths</secondary>
46743 </indexterm>
46744 <indexterm role="concept">
46745 <primary>bang paths</primary>
46746 <secondary>rewriting</secondary>
46747 </indexterm>
46748 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
46749 an address it treats it as an unqualified local part which it qualifies with
46750 the local qualification domain (if the source of the message is local or if the
46751 remote host is permitted to send unqualified addresses). Rewriting can
46752 sometimes be used to handle simple bang paths with a fixed number of
46753 components. For example, the rule
46754 </para>
46755 <literallayout class="monospaced">
46756 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
46757 </literallayout>
46758 <para>
46759 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
46760 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
46761 a global rewriting rule for envelope addresses. It can provide a backdoor
46762 method for using your system as a relay, because the incoming addresses appear
46763 to be local. If the bang path addresses are received via SMTP, it is safer to
46764 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
46765 can be done on the rewritten addresses.
46766 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
46767 </para>
46768 </section>
46769 </chapter>
46770
46771 <chapter id="CHAPretry">
46772 <title>Retry configuration</title>
46773 <para>
46774 <indexterm role="concept" id="IIDretconf1" class="startofrange">
46775 <primary>retry</primary>
46776 <secondary>configuration, description of</secondary>
46777 </indexterm>
46778 <indexterm role="concept" id="IIDregconf2" class="startofrange">
46779 <primary>configuration file</primary>
46780 <secondary>retry section</secondary>
46781 </indexterm>
46782 The <quote>retry</quote> section of the runtime configuration file contains a list of
46783 retry rules that control how often Exim tries to deliver messages that cannot
46784 be delivered at the first attempt. If there are no retry rules (the section is
46785 empty or not present), there are no retries. In this situation, temporary
46786 errors are treated as permanent. The default configuration contains a single,
46787 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
46788 line option can be used to test which retry rule will be used for a given
46789 address, domain and error.
46790 </para>
46791 <para>
46792 The most common cause of retries is temporary failure to deliver to a remote
46793 host because the host is down, or inaccessible because of a network problem.
46794 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
46795 address) basis, not on a per-message basis. Thus, if one message has recently
46796 been delayed, delivery of a new message to the same host is not immediately
46797 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
46798 log selector is set, the message
46799 <indexterm role="concept">
46800 <primary>retry</primary>
46801 <secondary>time not reached</secondary>
46802 </indexterm>
46803 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
46804 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
46805 the handling of errors during remote deliveries.
46806 </para>
46807 <para>
46808 Retry processing applies to routing as well as to delivering, except as covered
46809 in the next paragraph. The retry rules do not distinguish between these
46810 actions. It is not possible, for example, to specify different behaviour for
46811 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
46812 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
46813 added complication, so did not implement it. However, although they share the
46814 same retry rule, the actual retry times for routing and transporting a given
46815 domain are maintained independently.
46816 </para>
46817 <para>
46818 When a delivery is not part of a queue run (typically an immediate delivery on
46819 receipt of a message), the routers are always run, and local deliveries are
46820 always attempted, even if retry times are set for them. This makes for better
46821 behaviour if one particular message is causing problems (for example, causing
46822 quota overflow, or provoking an error in a filter file). If such a delivery
46823 suffers a temporary failure, the retry data is updated as normal, and
46824 subsequent delivery attempts from queue runs occur only when the retry time for
46825 the local address is reached.
46826 </para>
46827 <section id="SECID157">
46828 <title>Changing retry rules</title>
46829 <para>
46830 If you change the retry rules in your configuration, you should consider
46831 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
46832 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
46833 always safe; that is why they are called <quote>hints</quote>.
46834 </para>
46835 <para>
46836 The hints retry data contains suggested retry times based on the previous
46837 rules. In the case of a long-running problem with a remote host, it might
46838 record the fact that the host has timed out. If your new rules increase the
46839 timeout time for such a host, you should definitely remove the old retry data
46840 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
46841 messages that it should now be retaining.
46842 </para>
46843 </section>
46844 <section id="SECID158">
46845 <title>Format of retry rules</title>
46846 <para>
46847 <indexterm role="concept">
46848 <primary>retry</primary>
46849 <secondary>rules</secondary>
46850 </indexterm>
46851 Each retry rule occupies one line and consists of three or four parts,
46852 separated by white space: a pattern, an error name, an optional list of sender
46853 addresses, and a list of retry parameters. The pattern and sender lists must be
46854 enclosed in double quotes if they contain white space. The rules are searched
46855 in order until one is found where the pattern, error name, and sender list (if
46856 present) match the failing host or address, the error that occurred, and the
46857 message&#x2019;s sender, respectively.
46858 </para>
46859 <para>
46860 The pattern is any single item that may appear in an address list (see section
46861 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
46862 which means that it is expanded before being tested against the address that
46863 has been delayed. A negated address list item is permitted. Address
46864 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
46865 which makes it possible for many retry rules to start with just a domain. For
46866 example,
46867 </para>
46868 <literallayout class="monospaced">
46869 lookingglass.fict.example        *  F,24h,30m;
46870 </literallayout>
46871 <para>
46872 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
46873 whereas
46874 </para>
46875 <literallayout class="monospaced">
46876 alice@lookingglass.fict.example  *  F,24h,30m;
46877 </literallayout>
46878 <para>
46879 applies only to temporary failures involving the local part <option>alice</option>.
46880 In practice, almost all rules start with a domain name pattern without a local
46881 part.
46882 </para>
46883 <para>
46884 <indexterm role="concept">
46885 <primary>regular expressions</primary>
46886 <secondary>in retry rules</secondary>
46887 </indexterm>
46888 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
46889 must match a complete address, not just a domain, because that is how regular
46890 expressions work in address lists.
46891 </para>
46892 <literallayout>
46893 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
46894 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
46895 </literallayout>
46896 </section>
46897 <section id="SECID159">
46898 <title>Choosing which retry rule to use for address errors</title>
46899 <para>
46900 When Exim is looking for a retry rule after a routing attempt has failed (for
46901 example, after a DNS timeout), each line in the retry configuration is tested
46902 against the complete address only if <option>retry_use_local_part</option> is set for the
46903 router. Otherwise, only the domain is used, except when matching against a
46904 regular expression, when the local part of the address is replaced with <quote>*</quote>.
46905 A domain on its own can match a domain pattern, or a pattern that starts with
46906 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
46907 <option>check_local_user</option> is true, and false for other routers.
46908 </para>
46909 <para>
46910 Similarly, when Exim is looking for a retry rule after a local delivery has
46911 failed (for example, after a mailbox full error), each line in the retry
46912 configuration is tested against the complete address only if
46913 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
46914 local transports).
46915 </para>
46916 <para>
46917 <indexterm role="concept">
46918 <primary>4<emphasis>xx</emphasis> responses</primary>
46919 <secondary>retry rules for</secondary>
46920 </indexterm>
46921 However, when Exim is looking for a retry rule after a remote delivery attempt
46922 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
46923 whole address is always used as the key when searching the retry rules. The
46924 rule that is found is used to create a retry time for the combination of the
46925 failing address and the message&#x2019;s sender. It is the combination of sender and
46926 recipient that is delayed in subsequent queue runs until its retry time is
46927 reached. You can delay the recipient without regard to the sender by setting
46928 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
46929 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
46930 commands.
46931 </para>
46932 </section>
46933 <section id="SECID160">
46934 <title>Choosing which retry rule to use for host and message errors</title>
46935 <para>
46936 For a temporary error that is not related to an individual address (for
46937 example, a connection timeout), each line in the retry configuration is checked
46938 twice. First, the name of the remote host is used as a domain name (preceded by
46939 <quote>*@</quote> when matching a regular expression). If this does not match the line,
46940 the domain from the email address is tried in a similar fashion. For example,
46941 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
46942 </para>
46943 <literallayout class="monospaced">
46944 a.b.c.example  MX  5  x.y.z.example
46945                MX  6  p.q.r.example
46946                MX  7  m.n.o.example
46947 </literallayout>
46948 <para>
46949 and the retry rules are
46950 </para>
46951 <literallayout class="monospaced">
46952 p.q.r.example    *      F,24h,30m;
46953 a.b.c.example    *      F,4d,45m;
46954 </literallayout>
46955 <para>
46956 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
46957 first rule matches neither the host nor the domain, so Exim looks at the second
46958 rule. This does not match the host, but it does match the domain, so it is used
46959 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
46960 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
46961 first retry rule is used, because it matches the host.
46962 </para>
46963 <para>
46964 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
46965 first rule to determine retry times, but for all the other hosts for the domain
46966 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
46967 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
46968 </para>
46969 <para>
46970 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
46971 However, if a message is routed directly to an IP address without the use of a
46972 host name, for example, if a <command>manualroute</command> router contains a setting such as:
46973 </para>
46974 <literallayout class="monospaced">
46975 route_list = *.a.example  192.168.34.23
46976 </literallayout>
46977 <para>
46978 then the <quote>host name</quote> that is used when searching for a retry rule is the
46979 textual form of the IP address.
46980 </para>
46981 </section>
46982 <section id="SECID161">
46983 <title>Retry rules for specific errors</title>
46984 <para>
46985 <indexterm role="concept">
46986 <primary>retry</primary>
46987 <secondary>specific errors; specifying</secondary>
46988 </indexterm>
46989 The second field in a retry rule is the name of a particular error, or an
46990 asterisk, which matches any error. The errors that can be tested for are:
46991 </para>
46992 <variablelist>
46993 <varlistentry>
46994 <term><option>auth_failed</option></term>
46995 <listitem>
46996 <para>
46997 Authentication failed when trying to send to a host in the
46998 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
46999 </para>
47000 </listitem></varlistentry>
47001 <varlistentry>
47002 <term><option>data_4xx</option></term>
47003 <listitem>
47004 <para>
47005 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
47006 after the command, or after sending the message&#x2019;s data.
47007 </para>
47008 </listitem></varlistentry>
47009 <varlistentry>
47010 <term><option>mail_4xx</option></term>
47011 <listitem>
47012 <para>
47013 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
47014 </para>
47015 </listitem></varlistentry>
47016 <varlistentry>
47017 <term><option>rcpt_4xx</option></term>
47018 <listitem>
47019 <para>
47020 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
47021 </para>
47022 </listitem></varlistentry>
47023 </variablelist>
47024 <para>
47025 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
47026 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
47027 recognize 452 errors given to RCPT commands for addresses in a certain domain,
47028 and have retries every ten minutes with a one-hour timeout, you could set up a
47029 retry rule of this form:
47030 </para>
47031 <literallayout class="monospaced">
47032 the.domain.name  rcpt_452   F,1h,10m
47033 </literallayout>
47034 <para>
47035 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
47036 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
47037 </para>
47038 <variablelist>
47039 <varlistentry>
47040 <term><option>lost_connection</option></term>
47041 <listitem>
47042 <para>
47043 A server unexpectedly closed the SMTP connection. There may, of course,
47044 legitimate reasons for this (host died, network died), but if it repeats a lot
47045 for the same host, it indicates something odd.
47046 </para>
47047 </listitem></varlistentry>
47048 <varlistentry>
47049 <term><option>refused_MX</option></term>
47050 <listitem>
47051 <para>
47052 A connection to a host obtained from an MX record was refused.
47053 </para>
47054 </listitem></varlistentry>
47055 <varlistentry>
47056 <term><option>refused_A</option></term>
47057 <listitem>
47058 <para>
47059 A connection to a host not obtained from an MX record was refused.
47060 </para>
47061 </listitem></varlistentry>
47062 <varlistentry>
47063 <term><option>refused</option></term>
47064 <listitem>
47065 <para>
47066 A connection was refused.
47067 </para>
47068 </listitem></varlistentry>
47069 <varlistentry>
47070 <term><option>timeout_connect_MX</option></term>
47071 <listitem>
47072 <para>
47073 A connection attempt to a host obtained from an MX record timed out.
47074 </para>
47075 </listitem></varlistentry>
47076 <varlistentry>
47077 <term><option>timeout_connect_A</option></term>
47078 <listitem>
47079 <para>
47080 A connection attempt to a host not obtained from an MX record timed out.
47081 </para>
47082 </listitem></varlistentry>
47083 <varlistentry>
47084 <term><option>timeout_connect</option></term>
47085 <listitem>
47086 <para>
47087 A connection attempt timed out.
47088 </para>
47089 </listitem></varlistentry>
47090 <varlistentry>
47091 <term><option>timeout_MX</option></term>
47092 <listitem>
47093 <para>
47094 There was a timeout while connecting or during an SMTP session with a host
47095 obtained from an MX record.
47096 </para>
47097 </listitem></varlistentry>
47098 <varlistentry>
47099 <term><option>timeout_A</option></term>
47100 <listitem>
47101 <para>
47102 There was a timeout while connecting or during an SMTP session with a host not
47103 obtained from an MX record.
47104 </para>
47105 </listitem></varlistentry>
47106 <varlistentry>
47107 <term><option>timeout</option></term>
47108 <listitem>
47109 <para>
47110 There was a timeout while connecting or during an SMTP session.
47111 </para>
47112 </listitem></varlistentry>
47113 <varlistentry>
47114 <term><option>tls_required</option></term>
47115 <listitem>
47116 <para>
47117 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
47118 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
47119 to STARTTLS, or there was a problem setting up the TLS connection.
47120 </para>
47121 </listitem></varlistentry>
47122 <varlistentry>
47123 <term><option>quota</option></term>
47124 <listitem>
47125 <para>
47126 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47127 transport.
47128 </para>
47129 </listitem></varlistentry>
47130 <varlistentry>
47131 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
47132 <listitem>
47133 <para>
47134 <indexterm role="concept">
47135 <primary>quota</primary>
47136 <secondary>error testing in retry rule</secondary>
47137 </indexterm>
47138 <indexterm role="concept">
47139 <primary>retry</primary>
47140 <secondary>quota error testing</secondary>
47141 </indexterm>
47142 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47143 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
47144 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
47145 for four days.
47146 </para>
47147 </listitem></varlistentry>
47148 </variablelist>
47149 <para>
47150 <indexterm role="concept">
47151 <primary>mailbox</primary>
47152 <secondary>time of last read</secondary>
47153 </indexterm>
47154 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
47155 timeouts when the mailbox is full and is not being read by its owner. Ideally,
47156 it should be based on the last time that the user accessed the mailbox.
47157 However, it is not always possible to determine this. Exim uses the following
47158 heuristic rules:
47159 </para>
47160 <itemizedlist>
47161 <listitem>
47162 <para>
47163 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
47164 used. As no new messages are being delivered (because the mailbox is over
47165 quota), Exim does not access the file, so this is the time of last user access.
47166 </para>
47167 </listitem>
47168 <listitem>
47169 <para>
47170 <indexterm role="concept">
47171 <primary>maildir format</primary>
47172 <secondary>time of last read</secondary>
47173 </indexterm>
47174 For a maildir delivery, the time of last modification of the <filename>new</filename>
47175 subdirectory is used. As the mailbox is over quota, no new files are created in
47176 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
47177 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
47178 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
47179 time that is used is therefore the last time that the user read a new message.
47180 </para>
47181 </listitem>
47182 <listitem>
47183 <para>
47184 For other kinds of multi-file mailbox, the time of last access cannot be
47185 obtained, so a retry rule that uses this type of error field is never matched.
47186 </para>
47187 </listitem>
47188 </itemizedlist>
47189 <para>
47190 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
47191 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
47192 when a local delivery is deferred because a partition is full (the ENOSPC
47193 error).
47194 </para>
47195 </section>
47196 <section id="SECID162">
47197 <title>Retry rules for specified senders</title>
47198 <para>
47199 <indexterm role="concept">
47200 <primary>retry</primary>
47201 <secondary>rules; sender-specific</secondary>
47202 </indexterm>
47203 You can specify retry rules that apply only when the failing message has a
47204 specific sender. In particular, this can be used to define retry rules that
47205 apply only to bounce messages. The third item in a retry rule can be of this
47206 form:
47207 </para>
47208 <literallayout>
47209 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
47210 </literallayout>
47211 <para>
47212 The retry timings themselves are then the fourth item. For example:
47213 </para>
47214 <literallayout class="monospaced">
47215 *   rcpt_4xx   senders=:   F,1h,30m
47216 </literallayout>
47217 <para>
47218 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
47219 host. If the address list contains white space, it must be enclosed in quotes.
47220 For example:
47221 </para>
47222 <literallayout class="monospaced">
47223 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
47224 </literallayout>
47225 <para>
47226 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
47227 (which do not depend on the recipient). The reason is that the sender is used
47228 only to match the retry rule. Once the rule has been found for a host error,
47229 its contents are used to set a retry time for the host, and this will apply to
47230 all messages, not just those with specific senders.
47231 </para>
47232 <para>
47233 When testing retry rules using <option>-brt</option>, you can supply a sender using the
47234 <option>-f</option> command line option, like this:
47235 </para>
47236 <literallayout class="monospaced">
47237 exim -f "" -brt user@dom.ain
47238 </literallayout>
47239 <para>
47240 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
47241 list is never matched.
47242 </para>
47243 </section>
47244 <section id="SECID163">
47245 <title>Retry parameters</title>
47246 <para>
47247 <indexterm role="concept">
47248 <primary>retry</primary>
47249 <secondary>parameters in rules</secondary>
47250 </indexterm>
47251 The third (or fourth, if a senders list is present) field in a retry rule is a
47252 sequence of retry parameter sets, separated by semicolons. Each set consists of
47253 </para>
47254 <literallayout>
47255 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
47256 </literallayout>
47257 <para>
47258 The letter identifies the algorithm for computing a new retry time; the cutoff
47259 time is the time beyond which this algorithm no longer applies, and the
47260 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
47261 time that the first failure for the domain (combined with the local part if
47262 relevant) was detected, not from the time the message was received.
47263 </para>
47264 <para>
47265 <indexterm role="concept">
47266 <primary>retry</primary>
47267 <secondary>algorithms</secondary>
47268 </indexterm>
47269 <indexterm role="concept">
47270 <primary>retry</primary>
47271 <secondary>fixed intervals</secondary>
47272 </indexterm>
47273 <indexterm role="concept">
47274 <primary>retry</primary>
47275 <secondary>increasing intervals</secondary>
47276 </indexterm>
47277 <indexterm role="concept">
47278 <primary>retry</primary>
47279 <secondary>random intervals</secondary>
47280 </indexterm>
47281 The available algorithms are:
47282 </para>
47283 <itemizedlist>
47284 <listitem>
47285 <para>
47286 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
47287 the interval.
47288 </para>
47289 </listitem>
47290 <listitem>
47291 <para>
47292 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
47293 specifies a starting value for the interval, and the second a multiplier, which
47294 is used to increase the size of the interval at each retry.
47295 </para>
47296 </listitem>
47297 <listitem>
47298 <para>
47299 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
47300 retry, the previous interval is multiplied by the factor in order to get a
47301 maximum for the next interval. The minimum interval is the first argument of
47302 the parameter, and an actual interval is chosen randomly between them. Such a
47303 rule has been found to be helpful in cluster configurations when all the
47304 members of the cluster restart at once, and may therefore synchronize their
47305 queue processing times.
47306 </para>
47307 </listitem>
47308 </itemizedlist>
47309 <para>
47310 When computing the next retry time, the algorithm definitions are scanned in
47311 order until one whose cutoff time has not yet passed is reached. This is then
47312 used to compute a new retry time that is later than the current time. In the
47313 case of fixed interval retries, this simply means adding the interval to the
47314 current time. For geometrically increasing intervals, retry intervals are
47315 computed from the rule&#x2019;s parameters until one that is greater than the previous
47316 interval is found. The main configuration variable
47317 <indexterm role="concept">
47318 <primary>limit</primary>
47319 <secondary>retry interval</secondary>
47320 </indexterm>
47321 <indexterm role="concept">
47322 <primary>retry</primary>
47323 <secondary>interval, maximum</secondary>
47324 </indexterm>
47325 <indexterm role="option">
47326 <primary><option>retry_interval_max</option></primary>
47327 </indexterm>
47328 <option>retry_interval_max</option> limits the maximum interval between retries. It
47329 cannot be set greater than <literal>24h</literal>, which is its default value.
47330 </para>
47331 <para>
47332 A single remote domain may have a number of hosts associated with it, and each
47333 host may have more than one IP address. Retry algorithms are selected on the
47334 basis of the domain name, but are applied to each IP address independently. If,
47335 for example, a host has two IP addresses and one is unusable, Exim will
47336 generate retry times for it and will not try to use it until its next retry
47337 time comes. Thus the good IP address is likely to be tried first most of the
47338 time.
47339 </para>
47340 <para>
47341 <indexterm role="concept">
47342 <primary>hints database</primary>
47343 <secondary>use for retrying</secondary>
47344 </indexterm>
47345 Retry times are hints rather than promises. Exim does not make any attempt to
47346 run deliveries exactly at the computed times. Instead, a queue runner process
47347 starts delivery processes for delayed messages periodically, and these attempt
47348 new deliveries only for those addresses that have passed their next retry time.
47349 If a new message arrives for a deferred address, an immediate delivery attempt
47350 occurs only if the address has passed its retry time. In the absence of new
47351 messages, the minimum time between retries is the interval between queue runner
47352 processes. There is not much point in setting retry times of five minutes if
47353 your queue runners happen only once an hour, unless there are a significant
47354 number of incoming messages (which might be the case on a system that is
47355 sending everything to a smart host, for example).
47356 </para>
47357 <para>
47358 The data in the retry hints database can be inspected by using the
47359 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
47360 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
47361 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
47362 are for the hosts associated with a particular mail domain, and also for local
47363 deliveries that have been deferred.
47364 </para>
47365 </section>
47366 <section id="SECID164">
47367 <title>Retry rule examples</title>
47368 <para>
47369 Here are some example retry rules:
47370 </para>
47371 <literallayout class="monospaced">
47372 alice@wonderland.fict.example quota_5d  F,7d,3h
47373 wonderland.fict.example       quota_5d
47374 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
47375 lookingglass.fict.example     *         F,24h,30m;
47376 *                 refused_A   F,2h,20m;
47377 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
47378 </literallayout>
47379 <para>
47380 The first rule sets up special handling for mail to
47381 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
47382 mailbox has not been read for at least 5 days. Retries continue every three
47383 hours for 7 days. The second rule handles over-quota errors for all other local
47384 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
47385 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
47386 fail are bounced immediately if the mailbox has not been read for at least 5
47387 days.
47388 </para>
47389 <para>
47390 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
47391 happen every 15 minutes for an hour, then with geometrically increasing
47392 intervals until two days have passed since a delivery first failed. After the
47393 first hour there is a delay of one hour, then two hours, then four hours, and
47394 so on (this is a rather extreme example).
47395 </para>
47396 <para>
47397 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
47398 They happen every 30 minutes for 24 hours only. The remaining two rules handle
47399 all other domains, with special action for connection refusal from hosts that
47400 were not obtained from an MX record.
47401 </para>
47402 <para>
47403 The final rule in a retry configuration should always have asterisks in the
47404 first two fields so as to provide a general catch-all for any addresses that do
47405 not have their own special handling. This example tries every 15 minutes for 2
47406 hours, then with intervals starting at one hour and increasing by a factor of
47407 1.5 up to 16 hours, then every 8 hours up to 5 days.
47408 </para>
47409 </section>
47410 <section id="SECID165">
47411 <title>Timeout of retry data</title>
47412 <para>
47413 <indexterm role="concept">
47414 <primary>timeout</primary>
47415 <secondary>of retry data</secondary>
47416 </indexterm>
47417 <indexterm role="option">
47418 <primary><option>retry_data_expire</option></primary>
47419 </indexterm>
47420 <indexterm role="concept">
47421 <primary>hints database</primary>
47422 <secondary>data expiry</secondary>
47423 </indexterm>
47424 <indexterm role="concept">
47425 <primary>retry</primary>
47426 <secondary>timeout of data</secondary>
47427 </indexterm>
47428 Exim timestamps the data that it writes to its retry hints database. When it
47429 consults the data during a delivery it ignores any that is older than the value
47430 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
47431 been tried for 7 days, Exim will try to deliver to it immediately a message
47432 arrives, and if that fails, it will calculate a retry time as if it were
47433 failing for the first time.
47434 </para>
47435 <para>
47436 This improves the behaviour for messages routed to rarely-used hosts such as MX
47437 backups. If such a host was down at one time, and happens to be down again when
47438 Exim tries a month later, using the old retry data would imply that it had been
47439 down all the time, which is not a justified assumption.
47440 </para>
47441 <para>
47442 If a host really is permanently dead, this behaviour causes a burst of retries
47443 every now and again, but only if messages routed to it are rare. If there is a
47444 message at least once every 7 days the retry data never expires.
47445 </para>
47446 </section>
47447 <section id="SECID166">
47448 <title>Long-term failures</title>
47449 <para>
47450 <indexterm role="concept">
47451 <primary>delivery failure, long-term</primary>
47452 </indexterm>
47453 <indexterm role="concept">
47454 <primary>retry</primary>
47455 <secondary>after long-term failure</secondary>
47456 </indexterm>
47457 Special processing happens when an email address has been failing for so long
47458 that the cutoff time for the last algorithm is reached. For example, using the
47459 default retry rule:
47460 </para>
47461 <literallayout class="monospaced">
47462 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
47463 </literallayout>
47464 <para>
47465 the cutoff time is four days. Reaching the retry cutoff is independent of how
47466 long any specific message has been failing; it is the length of continuous
47467 failure for the recipient address that counts.
47468 </para>
47469 <para>
47470 When the cutoff time is reached for a local delivery, or for all the IP
47471 addresses associated with a remote delivery, a subsequent delivery failure
47472 causes Exim to give up on the address, and a bounce message is generated.
47473 In order to cater for new messages that use the failing address, a next retry
47474 time is still computed from the final algorithm, and is used as follows:
47475 </para>
47476 <para>
47477 For local deliveries, one delivery attempt is always made for any subsequent
47478 messages. If this delivery fails, the address fails immediately. The
47479 post-cutoff retry time is not used.
47480 </para>
47481 <para>
47482 If the delivery is remote, there are two possibilities, controlled by the
47483 <indexterm role="option">
47484 <primary><option>delay_after_cutoff</option></primary>
47485 </indexterm>
47486 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
47487 default. Until the post-cutoff retry time for one of the IP addresses is
47488 reached, the failing email address is bounced immediately, without a delivery
47489 attempt taking place. After that time, one new delivery attempt is made to
47490 those IP addresses that are past their retry times, and if that still fails,
47491 the address is bounced and new retry times are computed.
47492 </para>
47493 <para>
47494 In other words, when all the hosts for a given email address have been failing
47495 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
47496 times is reached. Then it tries once, and bounces if that attempt fails. This
47497 behaviour ensures that few resources are wasted in repeatedly trying to deliver
47498 to a broken destination, but if the host does recover, Exim will eventually
47499 notice.
47500 </para>
47501 <para>
47502 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
47503 addresses are past their final cutoff time, Exim tries to deliver to those IP
47504 addresses that have not been tried since the message arrived. If there are
47505 no suitable IP addresses, or if they all fail, the address is bounced. In other
47506 words, it does not delay when a new message arrives, but tries the expired
47507 addresses immediately, unless they have been tried since the message arrived.
47508 If there is a continuous stream of messages for the failing domains, setting
47509 <option>delay_after_cutoff</option> false means that there will be many more attempts to
47510 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
47511 true.
47512 </para>
47513 </section>
47514 <section id="SECID167">
47515 <title>Deliveries that work intermittently</title>
47516 <para>
47517 <indexterm role="concept">
47518 <primary>retry</primary>
47519 <secondary>intermittently working deliveries</secondary>
47520 </indexterm>
47521 Some additional logic is needed to cope with cases where a host is
47522 intermittently available, or when a message has some attribute that prevents
47523 its delivery when others to the same address get through. In this situation,
47524 because some messages are successfully delivered, the <quote>retry clock</quote> for the
47525 host or address keeps getting reset by the successful deliveries, and so
47526 failing messages remain on the queue for ever because the cutoff time is never
47527 reached.
47528 </para>
47529 <para>
47530 Two exceptional actions are applied to prevent this happening. The first
47531 applies to errors that are related to a message rather than a remote host.
47532 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
47533 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
47534 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
47535 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
47536 is used when scanning the retry rules to decide when to try next and when to
47537 time out the address.
47538 </para>
47539 <para>
47540 The exceptional second action applies in all cases. If a message has been on
47541 the queue for longer than the cutoff time of any applicable retry rule for a
47542 given address, a delivery is attempted for that address, even if it is not yet
47543 time, and if this delivery fails, the address is timed out. A new retry time is
47544 not computed in this case, so that other messages for the same address are
47545 considered immediately.
47546 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
47547 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
47548 </para>
47549 </section>
47550 </chapter>
47551
47552 <chapter id="CHAPSMTPAUTH">
47553 <title>SMTP authentication</title>
47554 <para>
47555 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
47556 <primary>SMTP</primary>
47557 <secondary>authentication configuration</secondary>
47558 </indexterm>
47559 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
47560 <primary>authentication</primary>
47561 </indexterm>
47562 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
47563 with SMTP authentication. This facility is an extension to the SMTP protocol,
47564 described in RFC 2554, which allows a client SMTP host to authenticate itself
47565 to a server. This is a common way for a server to recognize clients that are
47566 permitted to use it as a relay. SMTP authentication is not of relevance to the
47567 transfer of mail between servers that have no managerial connection with each
47568 other.
47569 </para>
47570 <para>
47571 <indexterm role="concept">
47572 <primary>AUTH</primary>
47573 <secondary>description of</secondary>
47574 </indexterm>
47575 Very briefly, the way SMTP authentication works is as follows:
47576 </para>
47577 <itemizedlist>
47578 <listitem>
47579 <para>
47580 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
47581 the client&#x2019;s EHLO command.
47582 </para>
47583 </listitem>
47584 <listitem>
47585 <para>
47586 The client issues an AUTH command, naming a specific mechanism. The command
47587 may, optionally, contain some authentication data.
47588 </para>
47589 </listitem>
47590 <listitem>
47591 <para>
47592 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
47593 appropriate responses. In simple authentication mechanisms, the challenges are
47594 just prompts for user names and passwords. The server does not have to issue
47595 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
47596 with the AUTH command.
47597 </para>
47598 </listitem>
47599 <listitem>
47600 <para>
47601 The server either accepts or denies authentication.
47602 </para>
47603 </listitem>
47604 <listitem>
47605 <para>
47606 If authentication succeeds, the client may optionally make use of the AUTH
47607 option on the MAIL command to pass an authenticated sender in subsequent
47608 mail transactions. Authentication lasts for the remainder of the SMTP
47609 connection.
47610 </para>
47611 </listitem>
47612 <listitem>
47613 <para>
47614 If authentication fails, the client may give up, or it may try a different
47615 authentication mechanism, or it may try transferring mail over the
47616 unauthenticated connection.
47617 </para>
47618 </listitem>
47619 </itemizedlist>
47620 <para>
47621 If you are setting up a client, and want to know which authentication
47622 mechanisms the server supports, you can use Telnet to connect to port 25 (the
47623 SMTP port) on the server, and issue an EHLO command. The response to this
47624 includes the list of supported mechanisms. For example:
47625 </para>
47626 <literallayout>
47627 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
47628 <literal>Trying 192.168.34.25...</literal>
47629 <literal>Connected to server.example.</literal>
47630 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
47631 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
47632 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
47633 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
47634 <literal>250-SIZE 52428800</literal>
47635 <literal>250-PIPELINING</literal>
47636 <literal>250-AUTH PLAIN</literal>
47637 <literal>250 HELP</literal>
47638 </literallayout>
47639 <para>
47640 The second-last line of this example output shows that the server supports
47641 authentication using the PLAIN mechanism. In Exim, the different authentication
47642 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
47643 routers and transports, which authenticators are included in the binary is
47644 controlled by build-time definitions. The following are currently available,
47645 included by setting
47646 </para>
47647 <literallayout class="monospaced">
47648 AUTH_CRAM_MD5=yes
47649 AUTH_CYRUS_SASL=yes
47650 AUTH_DOVECOT=yes
47651 AUTH_GSASL=yes
47652 AUTH_HEIMDAL_GSSAPI=yes
47653 AUTH_PLAINTEXT=yes
47654 AUTH_SPA=yes
47655 </literallayout>
47656 <para>
47657 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
47658 authentication mechanism (RFC 2195), and the second provides an interface to
47659 the Cyrus SASL authentication library.
47660 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
47661 work via a socket interface.
47662 The fourth provides an interface to the GNU SASL authentication library, which
47663 provides mechanisms but typically not data sources.
47664 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
47665 supporting setting a server keytab.
47666 The sixth can be configured to support
47667 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
47668 not formally documented, but used by several MUAs. The seventh authenticator
47669 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
47670 </para>
47671 <para>
47672 The authenticators are configured using the same syntax as other drivers (see
47673 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
47674 authentication section need be present in the configuration file. Each
47675 authenticator can in principle have both server and client functions. When Exim
47676 is receiving SMTP mail, it is acting as a server; when it is sending out
47677 messages over SMTP, it is acting as a client. Authenticator configuration
47678 options are provided for use in both these circumstances.
47679 </para>
47680 <para>
47681 To make it clear which options apply to which situation, the prefixes
47682 <option>server_</option> and <option>client_</option> are used on option names that are specific to
47683 either the server or the client function, respectively. Server and client
47684 functions are disabled if none of their options are set. If an authenticator is
47685 to be used for both server and client functions, a single definition, using
47686 both sets of options, is required. For example:
47687 </para>
47688 <literallayout class="monospaced">
47689 cram:
47690   driver = cram_md5
47691   public_name = CRAM-MD5
47692   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
47693   client_name = ph10
47694   client_secret = secret2
47695 </literallayout>
47696 <para>
47697 The <option>server_</option> option is used when Exim is acting as a server, and the
47698 <option>client_</option> options when it is acting as a client.
47699 </para>
47700 <para>
47701 Descriptions of the individual authenticators are given in subsequent chapters.
47702 The remainder of this chapter covers the generic options for the
47703 authenticators, followed by general discussion of the way authentication works
47704 in Exim.
47705 </para>
47706 <para>
47707 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
47708 per-mechanism basis.  Please read carefully to determine which variables hold
47709 account labels such as usercodes and which hold passwords or other
47710 authenticating data.
47711 </para>
47712 <para>
47713 Note that some mechanisms support two different identifiers for accounts: the
47714 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
47715 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
47716 Conceptually, authentication data such as passwords are tied to the identifier
47717 used to authenticate; servers may have rules to permit one user to act as a
47718 second user, so that after login the session is treated as though that second
47719 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
47720 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
47721 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
47722 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
47723 choose to honour.
47724 </para>
47725 <para>
47726 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
47727 to a client to help it select an account and credentials to use.  In some
47728 mechanisms, the client and server provably agree on the realm, but clients
47729 typically can not treat the realm as secure data to be blindly trusted.
47730 </para>
47731 <section id="SECID168">
47732 <title>Generic options for authenticators</title>
47733 <para>
47734 <indexterm role="concept">
47735 <primary>authentication</primary>
47736 <secondary>generic options</secondary>
47737 </indexterm>
47738 <indexterm role="concept">
47739 <primary>options</primary>
47740 <secondary>generic; for authenticators</secondary>
47741 </indexterm>
47742 </para>
47743 <para>
47744 <indexterm role="option">
47745 <primary><option>client_condition</option></primary>
47746 </indexterm>
47747 </para>
47748 <informaltable frame="all">
47749 <tgroup cols="4" colsep="0" rowsep="0">
47750 <colspec colwidth="8*" align="left"/>
47751 <colspec colwidth="6*" align="center"/>
47752 <colspec colwidth="6*" align="center"/>
47753 <colspec colwidth="6*" align="right"/>
47754 <tbody>
47755 <row>
47756 <entry><option>client_condition</option></entry>
47757 <entry>Use: <emphasis>authenticators</emphasis></entry>
47758 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47759 <entry>Default: <emphasis>unset</emphasis></entry>
47760 </row>
47761 </tbody>
47762 </tgroup>
47763 </informaltable>
47764 <para>
47765 When Exim is authenticating as a client, it skips any authenticator whose
47766 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
47767 used, for example, to skip plain text authenticators when the connection is not
47768 encrypted by a setting such as:
47769 </para>
47770 <literallayout class="monospaced">
47771 client_condition = ${if !eq{$tls_out_cipher}{}}
47772 </literallayout>
47773 <para>
47774 <indexterm role="option">
47775 <primary><option>client_set_id</option></primary>
47776 </indexterm>
47777 </para>
47778 <informaltable frame="all">
47779 <tgroup cols="4" colsep="0" rowsep="0">
47780 <colspec colwidth="8*" align="left"/>
47781 <colspec colwidth="6*" align="center"/>
47782 <colspec colwidth="6*" align="center"/>
47783 <colspec colwidth="6*" align="right"/>
47784 <tbody>
47785 <row>
47786 <entry><option>client_set_id</option></entry>
47787 <entry>Use: <emphasis>authenticators</emphasis></entry>
47788 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47789 <entry>Default: <emphasis>unset</emphasis></entry>
47790 </row>
47791 </tbody>
47792 </tgroup>
47793 </informaltable>
47794 <para>
47795 When client authentication succeeds, this condition is expanded; the
47796 result is used in the log lines for outbound messasges.
47797 Typically it will be the user name used for authentication.
47798 </para>
47799 <para>
47800 <indexterm role="option">
47801 <primary><option>driver</option></primary>
47802 </indexterm>
47803 </para>
47804 <informaltable frame="all">
47805 <tgroup cols="4" colsep="0" rowsep="0">
47806 <colspec colwidth="8*" align="left"/>
47807 <colspec colwidth="6*" align="center"/>
47808 <colspec colwidth="6*" align="center"/>
47809 <colspec colwidth="6*" align="right"/>
47810 <tbody>
47811 <row>
47812 <entry><option>driver</option></entry>
47813 <entry>Use: <emphasis>authenticators</emphasis></entry>
47814 <entry>Type: <emphasis>string</emphasis></entry>
47815 <entry>Default: <emphasis>unset</emphasis></entry>
47816 </row>
47817 </tbody>
47818 </tgroup>
47819 </informaltable>
47820 <para>
47821 This option must always be set. It specifies which of the available
47822 authenticators is to be used.
47823 </para>
47824 <para>
47825 <indexterm role="option">
47826 <primary><option>public_name</option></primary>
47827 </indexterm>
47828 </para>
47829 <informaltable frame="all">
47830 <tgroup cols="4" colsep="0" rowsep="0">
47831 <colspec colwidth="8*" align="left"/>
47832 <colspec colwidth="6*" align="center"/>
47833 <colspec colwidth="6*" align="center"/>
47834 <colspec colwidth="6*" align="right"/>
47835 <tbody>
47836 <row>
47837 <entry><option>public_name</option></entry>
47838 <entry>Use: <emphasis>authenticators</emphasis></entry>
47839 <entry>Type: <emphasis>string</emphasis></entry>
47840 <entry>Default: <emphasis>unset</emphasis></entry>
47841 </row>
47842 </tbody>
47843 </tgroup>
47844 </informaltable>
47845 <para>
47846 This option specifies the name of the authentication mechanism that the driver
47847 implements, and by which it is known to the outside world. These names should
47848 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
47849 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
47850 defaults to the driver&#x2019;s instance name.
47851 </para>
47852 <para>
47853 <indexterm role="option">
47854 <primary><option>server_advertise_condition</option></primary>
47855 </indexterm>
47856 </para>
47857 <informaltable frame="all">
47858 <tgroup cols="4" colsep="0" rowsep="0">
47859 <colspec colwidth="8*" align="left"/>
47860 <colspec colwidth="6*" align="center"/>
47861 <colspec colwidth="6*" align="center"/>
47862 <colspec colwidth="6*" align="right"/>
47863 <tbody>
47864 <row>
47865 <entry><option>server_advertise_condition</option></entry>
47866 <entry>Use: <emphasis>authenticators</emphasis></entry>
47867 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47868 <entry>Default: <emphasis>unset</emphasis></entry>
47869 </row>
47870 </tbody>
47871 </tgroup>
47872 </informaltable>
47873 <para>
47874 When a server is about to advertise an authentication mechanism, the condition
47875 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
47876 mechanism is not advertised.
47877 If the expansion fails, the mechanism is not advertised. If the failure was not
47878 forced, and was not caused by a lookup defer, the incident is logged.
47879 See section <xref linkend="SECTauthexiser"/> below for further discussion.
47880 </para>
47881 <para>
47882 <indexterm role="option">
47883 <primary><option>server_condition</option></primary>
47884 </indexterm>
47885 </para>
47886 <informaltable frame="all">
47887 <tgroup cols="4" colsep="0" rowsep="0">
47888 <colspec colwidth="8*" align="left"/>
47889 <colspec colwidth="6*" align="center"/>
47890 <colspec colwidth="6*" align="center"/>
47891 <colspec colwidth="6*" align="right"/>
47892 <tbody>
47893 <row>
47894 <entry><option>server_condition</option></entry>
47895 <entry>Use: <emphasis>authenticators</emphasis></entry>
47896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47897 <entry>Default: <emphasis>unset</emphasis></entry>
47898 </row>
47899 </tbody>
47900 </tgroup>
47901 </informaltable>
47902 <para>
47903 This option must be set for a <option>plaintext</option> server authenticator, where it
47904 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
47905 for details.
47906 </para>
47907 <para>
47908 For the <command>gsasl</command> authenticator, this option is required for various
47909 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
47910 </para>
47911 <para>
47912 For the other authenticators, <option>server_condition</option> can be used as an additional
47913 authentication or authorization mechanism that is applied after the other
47914 authenticator conditions succeed. If it is set, it is expanded when the
47915 authenticator would otherwise return a success code. If the expansion is forced
47916 to fail, authentication fails. Any other expansion failure causes a temporary
47917 error code to be returned. If the result of a successful expansion is an empty
47918 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
47919 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
47920 other result, a temporary error code is returned, with the expanded string as
47921 the error text.
47922 </para>
47923 <para>
47924 <indexterm role="option">
47925 <primary><option>server_debug_print</option></primary>
47926 </indexterm>
47927 </para>
47928 <informaltable frame="all">
47929 <tgroup cols="4" colsep="0" rowsep="0">
47930 <colspec colwidth="8*" align="left"/>
47931 <colspec colwidth="6*" align="center"/>
47932 <colspec colwidth="6*" align="center"/>
47933 <colspec colwidth="6*" align="right"/>
47934 <tbody>
47935 <row>
47936 <entry><option>server_debug_print</option></entry>
47937 <entry>Use: <emphasis>authenticators</emphasis></entry>
47938 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47939 <entry>Default: <emphasis>unset</emphasis></entry>
47940 </row>
47941 </tbody>
47942 </tgroup>
47943 </informaltable>
47944 <para>
47945 If this option is set and authentication debugging is enabled (see the <option>-d</option>
47946 command line option), the string is expanded and included in the debugging
47947 output when the authenticator is run as a server. This can help with checking
47948 out the values of variables.
47949 If expansion of the string fails, the error message is written to the debugging
47950 output, and Exim carries on processing.
47951 </para>
47952 <para>
47953 <indexterm role="option">
47954 <primary><option>server_set_id</option></primary>
47955 </indexterm>
47956 </para>
47957 <informaltable frame="all">
47958 <tgroup cols="4" colsep="0" rowsep="0">
47959 <colspec colwidth="8*" align="left"/>
47960 <colspec colwidth="6*" align="center"/>
47961 <colspec colwidth="6*" align="center"/>
47962 <colspec colwidth="6*" align="right"/>
47963 <tbody>
47964 <row>
47965 <entry><option>server_set_id</option></entry>
47966 <entry>Use: <emphasis>authenticators</emphasis></entry>
47967 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47968 <entry>Default: <emphasis>unset</emphasis></entry>
47969 </row>
47970 </tbody>
47971 </tgroup>
47972 </informaltable>
47973 <para>
47974 <indexterm role="variable">
47975 <primary><varname>$authenticated_id</varname></primary>
47976 </indexterm>
47977 When an Exim server successfully authenticates a client, this string is
47978 expanded using data from the authentication, and preserved for any incoming
47979 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
47980 lines for incoming messages. For example, a user/password authenticator
47981 configuration might preserve the user name that was used to authenticate, and
47982 refer to it subsequently during delivery of the message.
47983 If expansion fails, the option is ignored.
47984 </para>
47985 <para>
47986 <indexterm role="option">
47987 <primary><option>server_mail_auth_condition</option></primary>
47988 </indexterm>
47989 </para>
47990 <informaltable frame="all">
47991 <tgroup cols="4" colsep="0" rowsep="0">
47992 <colspec colwidth="8*" align="left"/>
47993 <colspec colwidth="6*" align="center"/>
47994 <colspec colwidth="6*" align="center"/>
47995 <colspec colwidth="6*" align="right"/>
47996 <tbody>
47997 <row>
47998 <entry><option>server_mail_auth_condition</option></entry>
47999 <entry>Use: <emphasis>authenticators</emphasis></entry>
48000 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48001 <entry>Default: <emphasis>unset</emphasis></entry>
48002 </row>
48003 </tbody>
48004 </tgroup>
48005 </informaltable>
48006 <para>
48007 This option allows a server to discard authenticated sender addresses supplied
48008 as part of MAIL commands in SMTP connections that are authenticated by the
48009 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
48010 as part of the authentication process; instead its (unexpanded) value is
48011 remembered for later use.
48012 How it is used is described in the following section.
48013 </para>
48014 </section>
48015 <section id="SECTauthparamail">
48016 <title>The AUTH parameter on MAIL commands</title>
48017 <para>
48018 <indexterm role="concept">
48019 <primary>authentication</primary>
48020 <secondary>sender; authenticated</secondary>
48021 </indexterm>
48022 <indexterm role="concept">
48023 <primary>AUTH</primary>
48024 <secondary>on MAIL command</secondary>
48025 </indexterm>
48026 When a client supplied an AUTH= item on a MAIL command, Exim applies
48027 the following checks before accepting it as the authenticated sender of the
48028 message:
48029 </para>
48030 <itemizedlist>
48031 <listitem>
48032 <para>
48033 If the connection is not using extended SMTP (that is, HELO was used rather
48034 than EHLO), the use of AUTH= is a syntax error.
48035 </para>
48036 </listitem>
48037 <listitem>
48038 <para>
48039 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
48040 </para>
48041 </listitem>
48042 <listitem>
48043 <para>
48044 <indexterm role="variable">
48045 <primary><varname>$authenticated_sender</varname></primary>
48046 </indexterm>
48047 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
48048 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
48049 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
48050 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
48051 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
48052 given for the MAIL command.
48053 </para>
48054 </listitem>
48055 <listitem>
48056 <para>
48057 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
48058 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
48059 authenticated.
48060 </para>
48061 </listitem>
48062 <listitem>
48063 <para>
48064 If the AUTH= value was accepted by either of the two previous rules, and
48065 the client has authenticated, and the authenticator has a setting for the
48066 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
48067 valued that was saved from the authenticator is expanded. If the expansion
48068 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
48069 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
48070 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
48071 message.
48072 </para>
48073 </listitem>
48074 </itemizedlist>
48075 <para>
48076 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
48077 hosts to which Exim authenticates as a client. Do not confuse this value with
48078 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
48079 process, and which is not usually a complete email address.
48080 </para>
48081 <para>
48082 <indexterm role="variable">
48083 <primary><varname>$sender_address</varname></primary>
48084 </indexterm>
48085 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
48086 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
48087 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
48088 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
48089 ACL is run.
48090 </para>
48091 </section>
48092 <section id="SECTauthexiser">
48093 <title>Authentication on an Exim server</title>
48094 <para>
48095 <indexterm role="concept">
48096 <primary>authentication</primary>
48097 <secondary>on an Exim server</secondary>
48098 </indexterm>
48099 When Exim receives an EHLO command, it advertises the public names of those
48100 authenticators that are configured as servers, subject to the following
48101 conditions:
48102 </para>
48103 <itemizedlist>
48104 <listitem>
48105 <para>
48106 The client host must match <option>auth_advertise_hosts</option> (default *).
48107 </para>
48108 </listitem>
48109 <listitem>
48110 <para>
48111 It the <option>server_advertise_condition</option> option is set, its expansion must not
48112 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
48113 </para>
48114 </listitem>
48115 </itemizedlist>
48116 <para>
48117 The order in which the authenticators are defined controls the order in which
48118 the mechanisms are advertised.
48119 </para>
48120 <para>
48121 Some mail clients (for example, some versions of Netscape) require the user to
48122 provide a name and password for authentication whenever AUTH is advertised,
48123 even though authentication may not in fact be needed (for example, Exim may be
48124 set up to allow unconditional relaying from the client by an IP address check).
48125 You can make such clients more friendly by not advertising AUTH to them.
48126 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
48127 that runs for RCPT) to relay without authentication, you should set
48128 </para>
48129 <literallayout class="monospaced">
48130 auth_advertise_hosts = ! 10.9.8.0/24
48131 </literallayout>
48132 <para>
48133 so that no authentication mechanisms are advertised to them.
48134 </para>
48135 <para>
48136 The <option>server_advertise_condition</option> controls the advertisement of individual
48137 authentication mechanisms. For example, it can be used to restrict the
48138 advertisement of a particular mechanism to encrypted connections, by a setting
48139 such as:
48140 </para>
48141 <literallayout class="monospaced">
48142 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
48143 </literallayout>
48144 <para>
48145 <indexterm role="variable">
48146 <primary><varname>$tls_in_cipher</varname></primary>
48147 </indexterm>
48148 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
48149 yields <quote>yes</quote>, which allows the advertisement to happen.
48150 </para>
48151 <para>
48152 When an Exim server receives an AUTH command from a client, it rejects it
48153 immediately if AUTH was not advertised in response to an earlier EHLO
48154 command. This is the case if
48155 </para>
48156 <itemizedlist>
48157 <listitem>
48158 <para>
48159 The client host does not match <option>auth_advertise_hosts</option>; or
48160 </para>
48161 </listitem>
48162 <listitem>
48163 <para>
48164 No authenticators are configured with server options; or
48165 </para>
48166 </listitem>
48167 <listitem>
48168 <para>
48169 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
48170 server authenticators.
48171 </para>
48172 </listitem>
48173 </itemizedlist>
48174 <para>
48175 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
48176 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
48177 AUTH is accepted from any client host.
48178 </para>
48179 <para>
48180 If AUTH is not rejected by the ACL, Exim searches its configuration for a
48181 server authentication mechanism that was advertised in response to EHLO and
48182 that matches the one named in the AUTH command. If it finds one, it runs
48183 the appropriate authentication protocol, and authentication either succeeds or
48184 fails. If there is no matching advertised mechanism, the AUTH command is
48185 rejected with a 504 error.
48186 </para>
48187 <para>
48188 <indexterm role="variable">
48189 <primary><varname>$received_protocol</varname></primary>
48190 </indexterm>
48191 <indexterm role="variable">
48192 <primary><varname>$sender_host_authenticated</varname></primary>
48193 </indexterm>
48194 When a message is received from an authenticated host, the value of
48195 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
48196 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
48197 public name) of the authenticator driver that successfully authenticated the
48198 client from which the message was received. This variable is empty if there was
48199 no successful authentication.
48200 </para>
48201 </section>
48202 <section id="SECID169">
48203 <title>Testing server authentication</title>
48204 <para>
48205 <indexterm role="concept">
48206 <primary>authentication</primary>
48207 <secondary>testing a server</secondary>
48208 </indexterm>
48209 <indexterm role="concept">
48210 <primary>AUTH</primary>
48211 <secondary>testing a server</secondary>
48212 </indexterm>
48213 <indexterm role="concept">
48214 <primary>base64 encoding</primary>
48215 <secondary>creating authentication test data</secondary>
48216 </indexterm>
48217 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
48218 configurations. The data for the AUTH command has to be sent using base64
48219 encoding. A quick way to produce such data for testing is the following Perl
48220 script:
48221 </para>
48222 <literallayout class="monospaced">
48223 use MIME::Base64;
48224 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
48225 </literallayout>
48226 <para>
48227 <indexterm role="concept">
48228 <primary>binary zero</primary>
48229 <secondary>in authentication data</secondary>
48230 </indexterm>
48231 This interprets its argument as a Perl string, and then encodes it. The
48232 interpretation as a Perl string allows binary zeros, which are required for
48233 some kinds of authentication, to be included in the data. For example, a
48234 command line to run this script on such data might be
48235 </para>
48236 <literallayout class="monospaced">
48237 encode '\0user\0password'
48238 </literallayout>
48239 <para>
48240 Note the use of single quotes to prevent the shell interpreting the
48241 backslashes, so that they can be interpreted by Perl to specify characters
48242 whose code value is zero.
48243 </para>
48244 <para>
48245 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
48246 digit, you must use three zeros instead of one after the leading backslash. If
48247 you do not, the octal digit that starts your string will be incorrectly
48248 interpreted as part of the code for the first character.
48249 </para>
48250 <para>
48251 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
48252 specially, you must use a Perl escape to prevent them being misinterpreted. For
48253 example, a command such as
48254 </para>
48255 <literallayout class="monospaced">
48256 encode '\0user@domain.com\0pas$$word'
48257 </literallayout>
48258 <para>
48259 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
48260 </para>
48261 <para>
48262 If you have the <option>mimencode</option> command installed, another way to do produce
48263 base64-encoded strings is to run the command
48264 </para>
48265 <literallayout class="monospaced">
48266 echo -e -n `\0user\0password' | mimencode
48267 </literallayout>
48268 <para>
48269 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
48270 in the argument, and the <option>-n</option> option specifies no newline at the end of its
48271 output. However, not all versions of <option>echo</option> recognize these options, so you
48272 should check your version before relying on this suggestion.
48273 </para>
48274 </section>
48275 <section id="SECID170">
48276 <title>Authentication by an Exim client</title>
48277 <para>
48278 <indexterm role="concept">
48279 <primary>authentication</primary>
48280 <secondary>on an Exim client</secondary>
48281 </indexterm>
48282 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
48283 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
48284 announces support for authentication, and the host matches an entry in either
48285 of these options, Exim (as a client) tries to authenticate as follows:
48286 </para>
48287 <itemizedlist>
48288 <listitem>
48289 <para>
48290 For each authenticator that is configured as a client, in the order in which
48291 they are defined in the configuration, it searches the authentication
48292 mechanisms announced by the server for one whose name matches the public name
48293 of the authenticator.
48294 </para>
48295 </listitem>
48296 <listitem>
48297 <para>
48298 <indexterm role="variable">
48299 <primary><varname>$host</varname></primary>
48300 </indexterm>
48301 <indexterm role="variable">
48302 <primary><varname>$host_address</varname></primary>
48303 </indexterm>
48304 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
48305 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
48306 that the client might do. They are set to the server&#x2019;s name and IP address. If
48307 any expansion is forced to fail, the authentication attempt is abandoned, and
48308 Exim moves on to the next authenticator. Otherwise an expansion failure causes
48309 delivery to be deferred.
48310 </para>
48311 </listitem>
48312 <listitem>
48313 <para>
48314 If the result of the authentication attempt is a temporary error or a timeout,
48315 Exim abandons trying to send the message to the host for the moment. It will
48316 try again later. If there are any backup hosts available, they are tried in the
48317 usual way.
48318 </para>
48319 </listitem>
48320 <listitem>
48321 <para>
48322 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
48323 carries on searching the list of authenticators and tries another one if
48324 possible. If all authentication attempts give permanent errors, or if there are
48325 no attempts because no mechanisms match (or option expansions force failure),
48326 what happens depends on whether the host matches <option>hosts_require_auth</option> or
48327 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
48328 delivery is deferred. The error can be detected in the retry rules, and thereby
48329 turned into a permanent error if you wish. In the second case, Exim tries to
48330 deliver the message unauthenticated.
48331 </para>
48332 </listitem>
48333 </itemizedlist>
48334 <para>
48335 <indexterm role="concept">
48336 <primary>AUTH</primary>
48337 <secondary>on MAIL command</secondary>
48338 </indexterm>
48339 When Exim has authenticated itself to a remote server, it adds the AUTH
48340 parameter to the MAIL commands it sends, if it has an authenticated sender for
48341 the message. If the message came from a remote host, the authenticated sender
48342 is the one that was receiving on an incoming MAIL command, provided that the
48343 incoming connection was authenticated and the <option>server_mail_auth</option> condition
48344 allowed the authenticated sender to be retained. If a local process calls Exim
48345 to send a message, the sender address that is built from the login name and
48346 <option>qualify_domain</option> is treated as authenticated. However, if the
48347 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
48348 the authenticated sender that was received with the message.
48349 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
48350 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
48351 </para>
48352 </section>
48353 </chapter>
48354
48355 <chapter id="CHAPplaintext">
48356 <title>The plaintext authenticator</title>
48357 <para>
48358 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
48359 <primary><command>plaintext</command> authenticator</primary>
48360 </indexterm>
48361 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
48362 <primary>authenticators</primary>
48363 <secondary><command>plaintext</command></secondary>
48364 </indexterm>
48365 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
48366 LOGIN authentication mechanisms, both of which transfer authentication data as
48367 plain (unencrypted) text (though base64 encoded). The use of plain text is a
48368 security risk; you are strongly advised to insist on the use of SMTP encryption
48369 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
48370 use unencrypted plain text, you should not use the same passwords for SMTP
48371 connections as you do for login accounts.
48372 </para>
48373 <section id="SECID171">
48374 <title>Plaintext options</title>
48375 <para>
48376 <indexterm role="concept">
48377 <primary>options</primary>
48378 <secondary><command>plaintext</command> authenticator (server)</secondary>
48379 </indexterm>
48380 When configured as a server, <command>plaintext</command> uses the following options:
48381 </para>
48382 <para>
48383 <indexterm role="option">
48384 <primary><option>server_condition</option></primary>
48385 </indexterm>
48386 </para>
48387 <informaltable frame="all">
48388 <tgroup cols="4" colsep="0" rowsep="0">
48389 <colspec colwidth="8*" align="left"/>
48390 <colspec colwidth="6*" align="center"/>
48391 <colspec colwidth="6*" align="center"/>
48392 <colspec colwidth="6*" align="right"/>
48393 <tbody>
48394 <row>
48395 <entry><option>server_condition</option></entry>
48396 <entry>Use: <emphasis>authenticators</emphasis></entry>
48397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48398 <entry>Default: <emphasis>unset</emphasis></entry>
48399 </row>
48400 </tbody>
48401 </tgroup>
48402 </informaltable>
48403 <para>
48404 This is actually a global authentication option, but it must be set in order to
48405 configure the <command>plaintext</command> driver as a server. Its use is described below.
48406 </para>
48407 <para>
48408 <indexterm role="option">
48409 <primary><option>server_prompts</option></primary>
48410 </indexterm>
48411 </para>
48412 <informaltable frame="all">
48413 <tgroup cols="4" colsep="0" rowsep="0">
48414 <colspec colwidth="8*" align="left"/>
48415 <colspec colwidth="6*" align="center"/>
48416 <colspec colwidth="6*" align="center"/>
48417 <colspec colwidth="6*" align="right"/>
48418 <tbody>
48419 <row>
48420 <entry><option>server_prompts</option></entry>
48421 <entry>Use: <emphasis>plaintext</emphasis></entry>
48422 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48423 <entry>Default: <emphasis>unset</emphasis></entry>
48424 </row>
48425 </tbody>
48426 </tgroup>
48427 </informaltable>
48428 <para>
48429 The contents of this option, after expansion, must be a colon-separated list of
48430 prompt strings. If expansion fails, a temporary authentication rejection is
48431 given.
48432 </para>
48433 </section>
48434 <section id="SECTplainserver">
48435 <title>Using plaintext in a server</title>
48436 <para>
48437 <indexterm role="concept">
48438 <primary>AUTH</primary>
48439 <secondary>in <command>plaintext</command> authenticator</secondary>
48440 </indexterm>
48441 <indexterm role="concept">
48442 <primary>binary zero</primary>
48443 <secondary>in <command>plaintext</command> authenticator</secondary>
48444 </indexterm>
48445 <indexterm role="concept">
48446 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48447 <secondary>in <command>plaintext</command> authenticator</secondary>
48448 </indexterm>
48449 <indexterm role="variable">
48450 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
48451 </indexterm>
48452 <indexterm role="concept">
48453 <primary>base64 encoding</primary>
48454 <secondary>in <command>plaintext</command> authenticator</secondary>
48455 </indexterm>
48456 </para>
48457 <para>
48458 When running as a server, <command>plaintext</command> performs the authentication test by
48459 expanding a string. The data sent by the client with the AUTH command, or in
48460 response to subsequent prompts, is base64 encoded, and so may contain any byte
48461 values when decoded. If any data is supplied with the command, it is treated as
48462 a list of strings, separated by NULs (binary zeros), the first three of which
48463 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
48464 (neither LOGIN nor PLAIN uses more than three strings).
48465 </para>
48466 <para>
48467 For compatibility with previous releases of Exim, the values are also placed in
48468 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
48469 variables for this purpose is now deprecated, as it can lead to confusion in
48470 string expansions that also use them for other things.
48471 </para>
48472 <para>
48473 If there are more strings in <option>server_prompts</option> than the number of strings
48474 supplied with the AUTH command, the remaining prompts are used to obtain more
48475 data. Each response from the client may be a list of NUL-separated strings.
48476 </para>
48477 <para>
48478 <indexterm role="variable">
48479 <primary><varname>$authenticated_id</varname></primary>
48480 </indexterm>
48481 Once a sufficient number of data strings have been received,
48482 <option>server_condition</option> is expanded. If the expansion is forced to fail,
48483 authentication fails. Any other expansion failure causes a temporary error code
48484 to be returned. If the result of a successful expansion is an empty string,
48485 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48486 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
48487 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
48488 For any other result, a temporary error code is returned, with the expanded
48489 string as the error text
48490 </para>
48491 <para>
48492 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
48493 password, be sure to make the authentication fail if the user is unknown.
48494 There are good and bad examples at the end of the next section.
48495 </para>
48496 </section>
48497 <section id="SECID172">
48498 <title>The PLAIN authentication mechanism</title>
48499 <para>
48500 <indexterm role="concept">
48501 <primary>PLAIN authentication mechanism</primary>
48502 </indexterm>
48503 <indexterm role="concept">
48504 <primary>authentication</primary>
48505 <secondary>PLAIN mechanism</secondary>
48506 </indexterm>
48507 <indexterm role="concept">
48508 <primary>binary zero</primary>
48509 <secondary>in <command>plaintext</command> authenticator</secondary>
48510 </indexterm>
48511 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
48512 sent as one item of data (that is, one combined string containing two NUL
48513 separators). The data is sent either as part of the AUTH command, or
48514 subsequently in response to an empty prompt from the server.
48515 </para>
48516 <para>
48517 The second and third strings are a user name and a corresponding password.
48518 Using a single fixed user name and password as an example, this could be
48519 configured as follows:
48520 </para>
48521 <literallayout class="monospaced">
48522 fixed_plain:
48523   driver = plaintext
48524   public_name = PLAIN
48525   server_prompts = :
48526   server_condition = \
48527     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
48528   server_set_id = $auth2
48529 </literallayout>
48530 <para>
48531 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
48532 are exactly what we want here, so they need not be specified. Obviously, if the
48533 password contains expansion-significant characters such as dollar, backslash,
48534 or closing brace, they have to be escaped.
48535 </para>
48536 <para>
48537 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
48538 the end of a string list are ignored). If all the data comes as part of the
48539 AUTH command, as is commonly the case, the prompt is not used. This
48540 authenticator is advertised in the response to EHLO as
48541 </para>
48542 <literallayout class="monospaced">
48543 250-AUTH PLAIN
48544 </literallayout>
48545 <para>
48546 and a client host can authenticate itself by sending the command
48547 </para>
48548 <literallayout class="monospaced">
48549 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
48550 </literallayout>
48551 <para>
48552 As this contains three strings (more than the number of prompts), no further
48553 data is required from the client. Alternatively, the client may just send
48554 </para>
48555 <literallayout class="monospaced">
48556 AUTH PLAIN
48557 </literallayout>
48558 <para>
48559 to initiate authentication, in which case the server replies with an empty
48560 prompt. The client must respond with the combined data string.
48561 </para>
48562 <para>
48563 The data string is base64 encoded, as required by the RFC. This example,
48564 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;
48565 represents a zero byte. This is split up into three strings, the first of which
48566 is empty. The <option>server_condition</option> option in the authenticator checks that the
48567 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
48568 </para>
48569 <para>
48570 Having just one fixed user name and password, as in this example, is not very
48571 realistic, though for a small organization with only a handful of
48572 authenticating clients it could make sense.
48573 </para>
48574 <para>
48575 A more sophisticated instance of this authenticator could use the user name in
48576 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
48577 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
48578 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
48579 This is an incorrect example:
48580 </para>
48581 <literallayout class="monospaced">
48582 server_condition = \
48583   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
48584 </literallayout>
48585 <para>
48586 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
48587 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
48588 incorrect? It works fine for existing users, but consider what happens if a
48589 non-existent user name is given. The lookup fails, but as no success/failure
48590 strings are given for the lookup, it yields an empty string. Thus, to defeat
48591 the authentication, all a client has to do is to supply a non-existent user
48592 name and an empty password. The correct way of writing this test is:
48593 </para>
48594 <literallayout class="monospaced">
48595 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
48596   {${if eq{$value}{$auth3}}} {false}}
48597 </literallayout>
48598 <para>
48599 In this case, if the lookup succeeds, the result is checked; if the lookup
48600 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
48601 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
48602 always fails if its second argument is empty. However, the second way of
48603 writing the test makes the logic clearer.
48604 </para>
48605 </section>
48606 <section id="SECID173">
48607 <title>The LOGIN authentication mechanism</title>
48608 <para>
48609 <indexterm role="concept">
48610 <primary>LOGIN authentication mechanism</primary>
48611 </indexterm>
48612 <indexterm role="concept">
48613 <primary>authentication</primary>
48614 <secondary>LOGIN mechanism</secondary>
48615 </indexterm>
48616 The LOGIN authentication mechanism is not documented in any RFC, but is in use
48617 in a number of programs. No data is sent with the AUTH command. Instead, a
48618 user name and password are supplied separately, in response to prompts. The
48619 plaintext authenticator can be configured to support this as in this example:
48620 </para>
48621 <literallayout class="monospaced">
48622 fixed_login:
48623   driver = plaintext
48624   public_name = LOGIN
48625   server_prompts = User Name : Password
48626   server_condition = \
48627     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
48628   server_set_id = $auth1
48629 </literallayout>
48630 <para>
48631 Because of the way plaintext operates, this authenticator accepts data supplied
48632 with the AUTH command (in contravention of the specification of LOGIN), but
48633 if the client does not supply it (as is the case for LOGIN clients), the prompt
48634 strings are used to obtain two data items.
48635 </para>
48636 <para>
48637 Some clients are very particular about the precise text of the prompts. For
48638 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
48639 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
48640 strings. It uses the <option>ldapauth</option> expansion condition to check the user
48641 name and password by binding to an LDAP server:
48642 </para>
48643 <literallayout class="monospaced">
48644 login:
48645   driver = plaintext
48646   public_name = LOGIN
48647   server_prompts = Username:: : Password::
48648   server_condition = ${if and{{ \
48649     !eq{}{$auth1} }{ \
48650     ldapauth{\
48651       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
48652       pass=${quote:$auth2} \
48653       ldap://ldap.example.org/} }} }
48654   server_set_id = uid=$auth1,ou=people,o=example.org
48655 </literallayout>
48656 <para>
48657 We have to check that the username is not empty before using it, because LDAP
48658 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
48659 operator to correctly quote the DN for authentication. However, the basic
48660 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
48661 correct one to use for the password, because quoting is needed only to make
48662 the password conform to the Exim syntax. At the LDAP level, the password is an
48663 uninterpreted string.
48664 </para>
48665 </section>
48666 <section id="SECID174">
48667 <title>Support for different kinds of authentication</title>
48668 <para>
48669 A number of string expansion features are provided for the purpose of
48670 interfacing to different ways of user authentication. These include checking
48671 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
48672 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
48673 <xref linkend="SECTexpcond"/>.
48674 </para>
48675 </section>
48676 <section id="SECID175">
48677 <title>Using plaintext in a client</title>
48678 <para>
48679 <indexterm role="concept">
48680 <primary>options</primary>
48681 <secondary><command>plaintext</command> authenticator (client)</secondary>
48682 </indexterm>
48683 The <command>plaintext</command> authenticator has two client options:
48684 </para>
48685 <para>
48686 <indexterm role="option">
48687 <primary><option>client_ignore_invalid_base64</option></primary>
48688 </indexterm>
48689 </para>
48690 <informaltable frame="all">
48691 <tgroup cols="4" colsep="0" rowsep="0">
48692 <colspec colwidth="8*" align="left"/>
48693 <colspec colwidth="6*" align="center"/>
48694 <colspec colwidth="6*" align="center"/>
48695 <colspec colwidth="6*" align="right"/>
48696 <tbody>
48697 <row>
48698 <entry><option>client_ignore_invalid_base64</option></entry>
48699 <entry>Use: <emphasis>plaintext</emphasis></entry>
48700 <entry>Type: <emphasis>boolean</emphasis></entry>
48701 <entry>Default: <emphasis>false</emphasis></entry>
48702 </row>
48703 </tbody>
48704 </tgroup>
48705 </informaltable>
48706 <para>
48707 If the client receives a server prompt that is not a valid base64 string,
48708 authentication is abandoned by default. However, if this option is set true,
48709 the error in the challenge is ignored and the client sends the response as
48710 usual.
48711 </para>
48712 <para>
48713 <indexterm role="option">
48714 <primary><option>client_send</option></primary>
48715 </indexterm>
48716 </para>
48717 <informaltable frame="all">
48718 <tgroup cols="4" colsep="0" rowsep="0">
48719 <colspec colwidth="8*" align="left"/>
48720 <colspec colwidth="6*" align="center"/>
48721 <colspec colwidth="6*" align="center"/>
48722 <colspec colwidth="6*" align="right"/>
48723 <tbody>
48724 <row>
48725 <entry><option>client_send</option></entry>
48726 <entry>Use: <emphasis>plaintext</emphasis></entry>
48727 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48728 <entry>Default: <emphasis>unset</emphasis></entry>
48729 </row>
48730 </tbody>
48731 </tgroup>
48732 </informaltable>
48733 <para>
48734 The string is a colon-separated list of authentication data strings. Each
48735 string is independently expanded before being sent to the server. The first
48736 string is sent with the AUTH command; any more strings are sent in response
48737 to prompts from the server. Before each string is expanded, the value of the
48738 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
48739 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
48740 way. Thus, the prompt that is received in response to sending the first string
48741 (with the AUTH command) can be used in the expansion of the second string, and
48742 so on. If an invalid base64 string is received when
48743 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
48744 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
48745 </para>
48746 <para>
48747 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
48748 splitting takes priority and happens first.
48749 </para>
48750 <para>
48751 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
48752 the data, further processing is applied to each string before it is sent. If
48753 there are any single circumflex characters in the string, they are converted to
48754 NULs. Should an actual circumflex be required as data, it must be doubled in
48755 the string.
48756 </para>
48757 <para>
48758 This is an example of a client configuration that implements the PLAIN
48759 authentication mechanism with a fixed user name and password:
48760 </para>
48761 <literallayout class="monospaced">
48762 fixed_plain:
48763   driver = plaintext
48764   public_name = PLAIN
48765   client_send = ^username^mysecret
48766 </literallayout>
48767 <para>
48768 The lack of colons means that the entire text is sent with the AUTH
48769 command, with the circumflex characters converted to NULs. A similar example
48770 that uses the LOGIN mechanism is:
48771 </para>
48772 <literallayout class="monospaced">
48773 fixed_login:
48774   driver = plaintext
48775   public_name = LOGIN
48776   client_send = : username : mysecret
48777 </literallayout>
48778 <para>
48779 The initial colon means that the first string is empty, so no data is sent with
48780 the AUTH command itself. The remaining strings are sent in response to
48781 prompts.
48782 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
48783 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
48784 </para>
48785 </section>
48786 </chapter>
48787
48788 <chapter id="CHID9">
48789 <title>The cram_md5 authenticator</title>
48790 <para>
48791 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
48792 <primary><command>cram_md5</command> authenticator</primary>
48793 </indexterm>
48794 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
48795 <primary>authenticators</primary>
48796 <secondary><command>cram_md5</command></secondary>
48797 </indexterm>
48798 <indexterm role="concept">
48799 <primary>CRAM-MD5 authentication mechanism</primary>
48800 </indexterm>
48801 <indexterm role="concept">
48802 <primary>authentication</primary>
48803 <secondary>CRAM-MD5 mechanism</secondary>
48804 </indexterm>
48805 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
48806 sends a challenge string to the client, and the response consists of a user
48807 name and the CRAM-MD5 digest of the challenge string combined with a secret
48808 string (password) which is known to both server and client. Thus, the secret
48809 is not sent over the network as plain text, which makes this authenticator more
48810 secure than <command>plaintext</command>. However, the downside is that the secret has to be
48811 available in plain text at either end.
48812 </para>
48813 <section id="SECID176">
48814 <title>Using cram_md5 as a server</title>
48815 <para>
48816 <indexterm role="concept">
48817 <primary>options</primary>
48818 <secondary><command>cram_md5</command> authenticator (server)</secondary>
48819 </indexterm>
48820 This authenticator has one server option, which must be set to configure the
48821 authenticator as a server:
48822 </para>
48823 <para>
48824 <indexterm role="option">
48825 <primary><option>server_secret</option></primary>
48826 </indexterm>
48827 </para>
48828 <informaltable frame="all">
48829 <tgroup cols="4" colsep="0" rowsep="0">
48830 <colspec colwidth="8*" align="left"/>
48831 <colspec colwidth="6*" align="center"/>
48832 <colspec colwidth="6*" align="center"/>
48833 <colspec colwidth="6*" align="right"/>
48834 <tbody>
48835 <row>
48836 <entry><option>server_secret</option></entry>
48837 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48839 <entry>Default: <emphasis>unset</emphasis></entry>
48840 </row>
48841 </tbody>
48842 </tgroup>
48843 </informaltable>
48844 <para>
48845 <indexterm role="concept">
48846 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48847 <secondary>in <command>cram_md5</command> authenticator</secondary>
48848 </indexterm>
48849 When the server receives the client&#x2019;s response, the user name is placed in
48850 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
48851 obtain the password for that user. The server then computes the CRAM-MD5 digest
48852 that the client should have sent, and checks that it received the correct
48853 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
48854 fails. If the expansion fails for some other reason, a temporary error code is
48855 returned to the client.
48856 </para>
48857 <para>
48858 For compatibility with previous releases of Exim, the user name is also placed
48859 in <varname>$1</varname>. However, the use of this variables for this purpose is now
48860 deprecated, as it can lead to confusion in string expansions that also use
48861 numeric variables for other things.
48862 </para>
48863 <para>
48864 For example, the following authenticator checks that the user name given by the
48865 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
48866 user name, authentication fails.
48867 </para>
48868 <literallayout class="monospaced">
48869 fixed_cram:
48870   driver = cram_md5
48871   public_name = CRAM-MD5
48872   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
48873   server_set_id = $auth1
48874 </literallayout>
48875 <para>
48876 <indexterm role="variable">
48877 <primary><varname>$authenticated_id</varname></primary>
48878 </indexterm>
48879 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
48880 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
48881 secret string in a file, using the user name as the key. For example:
48882 </para>
48883 <literallayout class="monospaced">
48884 lookup_cram:
48885   driver = cram_md5
48886   public_name = CRAM-MD5
48887   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
48888                   {$value}fail}
48889   server_set_id = $auth1
48890 </literallayout>
48891 <para>
48892 Note that this expansion explicitly forces failure if the lookup fails
48893 because <varname>$auth1</varname> contains an unknown user name.
48894 </para>
48895 <para>
48896 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
48897 using the relevant libraries, you need to know the realm to specify in the
48898 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
48899 realm, with:
48900 </para>
48901 <literallayout class="monospaced">
48902 cyrusless_crammd5:
48903   driver = cram_md5
48904   public_name = CRAM-MD5
48905   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
48906                   dbmjz{/etc/sasldb2}}
48907   server_set_id = $auth1
48908 </literallayout>
48909 </section>
48910 <section id="SECID177">
48911 <title>Using cram_md5 as a client</title>
48912 <para>
48913 <indexterm role="concept">
48914 <primary>options</primary>
48915 <secondary><command>cram_md5</command> authenticator (client)</secondary>
48916 </indexterm>
48917 When used as a client, the <command>cram_md5</command> authenticator has two options:
48918 </para>
48919 <para>
48920 <indexterm role="option">
48921 <primary><option>client_name</option></primary>
48922 </indexterm>
48923 </para>
48924 <informaltable frame="all">
48925 <tgroup cols="4" colsep="0" rowsep="0">
48926 <colspec colwidth="8*" align="left"/>
48927 <colspec colwidth="6*" align="center"/>
48928 <colspec colwidth="6*" align="center"/>
48929 <colspec colwidth="6*" align="right"/>
48930 <tbody>
48931 <row>
48932 <entry><option>client_name</option></entry>
48933 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48934 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48935 <entry>Default: <emphasis>the primary host name</emphasis></entry>
48936 </row>
48937 </tbody>
48938 </tgroup>
48939 </informaltable>
48940 <para>
48941 This string is expanded, and the result used as the user name data when
48942 computing the response to the server&#x2019;s challenge.
48943 </para>
48944 <para>
48945 <indexterm role="option">
48946 <primary><option>client_secret</option></primary>
48947 </indexterm>
48948 </para>
48949 <informaltable frame="all">
48950 <tgroup cols="4" colsep="0" rowsep="0">
48951 <colspec colwidth="8*" align="left"/>
48952 <colspec colwidth="6*" align="center"/>
48953 <colspec colwidth="6*" align="center"/>
48954 <colspec colwidth="6*" align="right"/>
48955 <tbody>
48956 <row>
48957 <entry><option>client_secret</option></entry>
48958 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48959 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48960 <entry>Default: <emphasis>unset</emphasis></entry>
48961 </row>
48962 </tbody>
48963 </tgroup>
48964 </informaltable>
48965 <para>
48966 This option must be set for the authenticator to work as a client. Its value is
48967 expanded and the result used as the secret string when computing the response.
48968 </para>
48969 <para>
48970 <indexterm role="variable">
48971 <primary><varname>$host</varname></primary>
48972 </indexterm>
48973 <indexterm role="variable">
48974 <primary><varname>$host_address</varname></primary>
48975 </indexterm>
48976 Different user names and secrets can be used for different servers by referring
48977 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
48978 expansion string is treated as an indication that this authenticator is not
48979 prepared to handle this case. Exim moves on to the next configured client
48980 authenticator. Any other expansion failure causes Exim to give up trying to
48981 send the message to the current server.
48982 </para>
48983 <para>
48984 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
48985 strings, is:
48986 </para>
48987 <literallayout class="monospaced">
48988 fixed_cram:
48989   driver = cram_md5
48990   public_name = CRAM-MD5
48991   client_name = ph10
48992   client_secret = secret
48993 </literallayout>
48994 <para>
48995 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
48996 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
48997 </para>
48998 </section>
48999 </chapter>
49000
49001 <chapter id="CHID10">
49002 <title>The cyrus_sasl authenticator</title>
49003 <para>
49004 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
49005 <primary><command>cyrus_sasl</command> authenticator</primary>
49006 </indexterm>
49007 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
49008 <primary>authenticators</primary>
49009 <secondary><command>cyrus_sasl</command></secondary>
49010 </indexterm>
49011 <indexterm role="concept">
49012 <primary>Cyrus</primary>
49013 <secondary>SASL library</secondary>
49014 </indexterm>
49015 <indexterm role="concept">
49016 <primary>Kerberos</primary>
49017 </indexterm>
49018 The code for this authenticator was provided by Matthew Byng-Maddick of A L
49019 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
49020 </para>
49021 <para>
49022 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
49023 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
49024 Layer</quote>). This library supports a number of authentication mechanisms,
49025 including PLAIN and LOGIN, but also several others that Exim does not support
49026 directly. In particular, there is support for Kerberos authentication.
49027 </para>
49028 <para>
49029 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
49030 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
49031 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
49032 name of the driver to determine which mechanism to support.
49033 </para>
49034 <para>
49035 Where access to some kind of secret file is required, for example in GSSAPI
49036 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
49037 user, and that the Cyrus SASL library has no way of escalating privileges
49038 by default. You may also find you need to set environment variables,
49039 depending on the driver you are using.
49040 </para>
49041 <para>
49042 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
49043 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
49044 Kerberos, note that because of limitations in the GSSAPI interface,
49045 changing the server keytab might need to be communicated down to the Kerberos
49046 layer independently. The mechanism for doing so is dependent upon the Kerberos
49047 implementation.
49048 </para>
49049 <para>
49050 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
49051 may be set to point to an alternative keytab file. Exim will pass this
49052 variable through from its own inherited environment when started as root or the
49053 Exim user. The keytab file needs to be readable by the Exim user.
49054 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
49055 environment variable.  In practice, for those releases, the Cyrus authenticator
49056 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
49057 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
49058 </para>
49059 <section id="SECID178">
49060 <title>Using cyrus_sasl as a server</title>
49061 <para>
49062 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
49063 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
49064 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
49065 use of this variable for this purpose is now deprecated, as it can lead to
49066 confusion in string expansions that also use numeric variables for other
49067 things.
49068 </para>
49069 <para>
49070 <indexterm role="option">
49071 <primary><option>server_hostname</option></primary>
49072 </indexterm>
49073 </para>
49074 <informaltable frame="all">
49075 <tgroup cols="4" colsep="0" rowsep="0">
49076 <colspec colwidth="8*" align="left"/>
49077 <colspec colwidth="6*" align="center"/>
49078 <colspec colwidth="6*" align="center"/>
49079 <colspec colwidth="6*" align="right"/>
49080 <tbody>
49081 <row>
49082 <entry><option>server_hostname</option></entry>
49083 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49084 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49085 <entry>Default: <emphasis>see below</emphasis></entry>
49086 </row>
49087 </tbody>
49088 </tgroup>
49089 </informaltable>
49090 <para>
49091 This option selects the hostname that is used when communicating with the
49092 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
49093 SASL plug-in what it does with this data.
49094 </para>
49095 <para>
49096 <indexterm role="option">
49097 <primary><option>server_mech</option></primary>
49098 </indexterm>
49099 </para>
49100 <informaltable frame="all">
49101 <tgroup cols="4" colsep="0" rowsep="0">
49102 <colspec colwidth="8*" align="left"/>
49103 <colspec colwidth="6*" align="center"/>
49104 <colspec colwidth="6*" align="center"/>
49105 <colspec colwidth="6*" align="right"/>
49106 <tbody>
49107 <row>
49108 <entry><option>server_mech</option></entry>
49109 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49110 <entry>Type: <emphasis>string</emphasis></entry>
49111 <entry>Default: <emphasis>see below</emphasis></entry>
49112 </row>
49113 </tbody>
49114 </tgroup>
49115 </informaltable>
49116 <para>
49117 This option selects the authentication mechanism this driver should use. The
49118 default is the value of the generic <option>public_name</option> option. This option allows
49119 you to use a different underlying mechanism from the advertised name. For
49120 example:
49121 </para>
49122 <literallayout class="monospaced">
49123 sasl:
49124   driver = cyrus_sasl
49125   public_name = X-ANYTHING
49126   server_mech = CRAM-MD5
49127   server_set_id = $auth1
49128 </literallayout>
49129 <para>
49130 <indexterm role="option">
49131 <primary><option>server_realm</option></primary>
49132 </indexterm>
49133 </para>
49134 <informaltable frame="all">
49135 <tgroup cols="4" colsep="0" rowsep="0">
49136 <colspec colwidth="8*" align="left"/>
49137 <colspec colwidth="6*" align="center"/>
49138 <colspec colwidth="6*" align="center"/>
49139 <colspec colwidth="6*" align="right"/>
49140 <tbody>
49141 <row>
49142 <entry><option>server_realm</option></entry>
49143 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49144 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49145 <entry>Default: <emphasis>unset</emphasis></entry>
49146 </row>
49147 </tbody>
49148 </tgroup>
49149 </informaltable>
49150 <para>
49151 This specifies the SASL realm that the server claims to be in.
49152 </para>
49153 <para>
49154 <indexterm role="option">
49155 <primary><option>server_service</option></primary>
49156 </indexterm>
49157 </para>
49158 <informaltable frame="all">
49159 <tgroup cols="4" colsep="0" rowsep="0">
49160 <colspec colwidth="8*" align="left"/>
49161 <colspec colwidth="6*" align="center"/>
49162 <colspec colwidth="6*" align="center"/>
49163 <colspec colwidth="6*" align="right"/>
49164 <tbody>
49165 <row>
49166 <entry><option>server_service</option></entry>
49167 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49168 <entry>Type: <emphasis>string</emphasis></entry>
49169 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49170 </row>
49171 </tbody>
49172 </tgroup>
49173 </informaltable>
49174 <para>
49175 This is the SASL service that the server claims to implement.
49176 </para>
49177 <para>
49178 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
49179 private options. All you need to do is to specify an appropriate mechanism as
49180 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
49181 PLAIN, you could have two authenticators as follows:
49182 </para>
49183 <literallayout class="monospaced">
49184 sasl_cram_md5:
49185   driver = cyrus_sasl
49186   public_name = CRAM-MD5
49187   server_set_id = $auth1
49188
49189 sasl_plain:
49190   driver = cyrus_sasl
49191   public_name = PLAIN
49192   server_set_id = $auth2
49193 </literallayout>
49194 <para>
49195 Cyrus SASL does implement the LOGIN authentication method, even though it is
49196 not a standard method. It is disabled by default in the source distribution,
49197 but it is present in many binary distributions.
49198 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
49199 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
49200 </para>
49201 </section>
49202 </chapter>
49203
49204 <chapter id="CHAPdovecot">
49205 <title>The dovecot authenticator</title>
49206 <para>
49207 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
49208 <primary><command>dovecot</command> authenticator</primary>
49209 </indexterm>
49210 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
49211 <primary>authenticators</primary>
49212 <secondary><command>dovecot</command></secondary>
49213 </indexterm>
49214 This authenticator is an interface to the authentication facility of the
49215 Dovecot POP/IMAP server, which can support a number of authentication methods.
49216 </para>
49217 <para revisionflag="changed">
49218 Note that Dovecot must be configured to use auth-client not auth-userdb.
49219 </para>
49220 <para>
49221 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
49222 to use the same mechanisms for SMTP authentication. This is a server
49223 authenticator only. There is only one option:
49224 </para>
49225 <para>
49226 <indexterm role="option">
49227 <primary><option>server_socket</option></primary>
49228 </indexterm>
49229 </para>
49230 <informaltable frame="all">
49231 <tgroup cols="4" colsep="0" rowsep="0">
49232 <colspec colwidth="8*" align="left"/>
49233 <colspec colwidth="6*" align="center"/>
49234 <colspec colwidth="6*" align="center"/>
49235 <colspec colwidth="6*" align="right"/>
49236 <tbody>
49237 <row>
49238 <entry><option>server_socket</option></entry>
49239 <entry>Use: <emphasis>dovecot</emphasis></entry>
49240 <entry>Type: <emphasis>string</emphasis></entry>
49241 <entry>Default: <emphasis>unset</emphasis></entry>
49242 </row>
49243 </tbody>
49244 </tgroup>
49245 </informaltable>
49246 <para>
49247 This option must specify the socket that is the interface to Dovecot
49248 authentication. The <option>public_name</option> option must specify an authentication
49249 mechanism that Dovecot is configured to support. You can have several
49250 authenticators for different mechanisms. For example:
49251 </para>
49252 <literallayout class="monospaced">
49253 dovecot_plain:
49254   driver = dovecot
49255   public_name = PLAIN
49256   server_socket = /var/run/dovecot/auth-client
49257   server_set_id = $auth1
49258
49259 dovecot_ntlm:
49260   driver = dovecot
49261   public_name = NTLM
49262   server_socket = /var/run/dovecot/auth-client
49263   server_set_id = $auth1
49264 </literallayout>
49265 <para>
49266 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
49267 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
49268 option is passed in the Dovecot authentication command. If, for a TLS
49269 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
49270 option is passed. When authentication succeeds, the identity of the user
49271 who authenticated is placed in <varname>$auth1</varname>.
49272 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
49273 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
49274 </para>
49275 </chapter>
49276
49277 <chapter id="CHAPgsasl">
49278 <title>The gsasl authenticator</title>
49279 <para>
49280 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
49281 <primary><command>gsasl</command> authenticator</primary>
49282 </indexterm>
49283 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
49284 <primary>authenticators</primary>
49285 <secondary><command>gsasl</command></secondary>
49286 </indexterm>
49287 <indexterm role="concept">
49288 <primary>authentication</primary>
49289 <secondary>GNU SASL</secondary>
49290 </indexterm>
49291 <indexterm role="concept">
49292 <primary>authentication</primary>
49293 <secondary>SASL</secondary>
49294 </indexterm>
49295 <indexterm role="concept">
49296 <primary>authentication</primary>
49297 <secondary>EXTERNAL</secondary>
49298 </indexterm>
49299 <indexterm role="concept">
49300 <primary>authentication</primary>
49301 <secondary>ANONYMOUS</secondary>
49302 </indexterm>
49303 <indexterm role="concept">
49304 <primary>authentication</primary>
49305 <secondary>PLAIN</secondary>
49306 </indexterm>
49307 <indexterm role="concept">
49308 <primary>authentication</primary>
49309 <secondary>LOGIN</secondary>
49310 </indexterm>
49311 <indexterm role="concept">
49312 <primary>authentication</primary>
49313 <secondary>DIGEST-MD5</secondary>
49314 </indexterm>
49315 <indexterm role="concept">
49316 <primary>authentication</primary>
49317 <secondary>CRAM-MD5</secondary>
49318 </indexterm>
49319 <indexterm role="concept">
49320 <primary>authentication</primary>
49321 <secondary>SCRAM-SHA-1</secondary>
49322 </indexterm>
49323 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
49324 library and the mechanisms it provides.  This is new as of the 4.80 release
49325 and there are a few areas where the library does not let Exim smoothly
49326 scale to handle future authentication mechanisms, so no guarantee can be
49327 made that any particular new authentication mechanism will be supported
49328 without code changes in Exim.
49329 </para>
49330 <para>
49331 <indexterm role="option">
49332 <primary><option>server_channelbinding</option></primary>
49333 </indexterm>
49334 </para>
49335 <informaltable frame="all">
49336 <tgroup cols="4" colsep="0" rowsep="0">
49337 <colspec colwidth="8*" align="left"/>
49338 <colspec colwidth="6*" align="center"/>
49339 <colspec colwidth="6*" align="center"/>
49340 <colspec colwidth="6*" align="right"/>
49341 <tbody>
49342 <row>
49343 <entry><option>server_channelbinding</option></entry>
49344 <entry>Use: <emphasis>gsasl</emphasis></entry>
49345 <entry>Type: <emphasis>boolean</emphasis></entry>
49346 <entry>Default: <emphasis>false</emphasis></entry>
49347 </row>
49348 </tbody>
49349 </tgroup>
49350 </informaltable>
49351 <para>
49352 Some authentication mechanisms are able to use external context at both ends
49353 of the session to bind the authentication to that context, and fail the
49354 authentication process if that context differs.  Specifically, some TLS
49355 ciphersuites can provide identifying information about the cryptographic
49356 context.
49357 </para>
49358 <para>
49359 This means that certificate identity and verification becomes a non-issue,
49360 as a man-in-the-middle attack will cause the correct client and server to
49361 see different identifiers and authentication will fail.
49362 </para>
49363 <para>
49364 This is currently only supported when using the GnuTLS library.  This is
49365 only usable by mechanisms which support "channel binding"; at time of
49366 writing, that&#x2019;s the SCRAM family.
49367 </para>
49368 <para>
49369 This defaults off to ensure smooth upgrade across Exim releases, in case
49370 this option causes some clients to start failing.  Some future release
49371 of Exim may switch the default to be true.
49372 </para>
49373 <para>
49374 <indexterm role="option">
49375 <primary><option>server_hostname</option></primary>
49376 </indexterm>
49377 </para>
49378 <informaltable frame="all">
49379 <tgroup cols="4" colsep="0" rowsep="0">
49380 <colspec colwidth="8*" align="left"/>
49381 <colspec colwidth="6*" align="center"/>
49382 <colspec colwidth="6*" align="center"/>
49383 <colspec colwidth="6*" align="right"/>
49384 <tbody>
49385 <row>
49386 <entry><option>server_hostname</option></entry>
49387 <entry>Use: <emphasis>gsasl</emphasis></entry>
49388 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49389 <entry>Default: <emphasis>see below</emphasis></entry>
49390 </row>
49391 </tbody>
49392 </tgroup>
49393 </informaltable>
49394 <para>
49395 This option selects the hostname that is used when communicating with the
49396 library. The default value is <literal>$primary_hostname</literal>.
49397 Some mechanisms will use this data.
49398 </para>
49399 <para>
49400 <indexterm role="option">
49401 <primary><option>server_mech</option></primary>
49402 </indexterm>
49403 </para>
49404 <informaltable frame="all">
49405 <tgroup cols="4" colsep="0" rowsep="0">
49406 <colspec colwidth="8*" align="left"/>
49407 <colspec colwidth="6*" align="center"/>
49408 <colspec colwidth="6*" align="center"/>
49409 <colspec colwidth="6*" align="right"/>
49410 <tbody>
49411 <row>
49412 <entry><option>server_mech</option></entry>
49413 <entry>Use: <emphasis>gsasl</emphasis></entry>
49414 <entry>Type: <emphasis>string</emphasis></entry>
49415 <entry>Default: <emphasis>see below</emphasis></entry>
49416 </row>
49417 </tbody>
49418 </tgroup>
49419 </informaltable>
49420 <para>
49421 This option selects the authentication mechanism this driver should use. The
49422 default is the value of the generic <option>public_name</option> option. This option allows
49423 you to use a different underlying mechanism from the advertised name. For
49424 example:
49425 </para>
49426 <literallayout class="monospaced">
49427 sasl:
49428   driver = gsasl
49429   public_name = X-ANYTHING
49430   server_mech = CRAM-MD5
49431   server_set_id = $auth1
49432 </literallayout>
49433 <para>
49434 <indexterm role="option">
49435 <primary><option>server_password</option></primary>
49436 </indexterm>
49437 </para>
49438 <informaltable frame="all">
49439 <tgroup cols="4" colsep="0" rowsep="0">
49440 <colspec colwidth="8*" align="left"/>
49441 <colspec colwidth="6*" align="center"/>
49442 <colspec colwidth="6*" align="center"/>
49443 <colspec colwidth="6*" align="right"/>
49444 <tbody>
49445 <row>
49446 <entry><option>server_password</option></entry>
49447 <entry>Use: <emphasis>gsasl</emphasis></entry>
49448 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49449 <entry>Default: <emphasis>unset</emphasis></entry>
49450 </row>
49451 </tbody>
49452 </tgroup>
49453 </informaltable>
49454 <para>
49455 Various mechanisms need access to the cleartext password on the server, so
49456 that proof-of-possession can be demonstrated on the wire, without sending
49457 the password itself.
49458 </para>
49459 <para>
49460 The data available for lookup varies per mechanism.
49461 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
49462 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
49463 if available, else the empty string.
49464 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
49465 else the empty string.
49466 </para>
49467 <para>
49468 A forced failure will cause authentication to defer.
49469 </para>
49470 <para>
49471 If using this option, it may make sense to set the <option>server_condition</option>
49472 option to be simply "true".
49473 </para>
49474 <para>
49475 <indexterm role="option">
49476 <primary><option>server_realm</option></primary>
49477 </indexterm>
49478 </para>
49479 <informaltable frame="all">
49480 <tgroup cols="4" colsep="0" rowsep="0">
49481 <colspec colwidth="8*" align="left"/>
49482 <colspec colwidth="6*" align="center"/>
49483 <colspec colwidth="6*" align="center"/>
49484 <colspec colwidth="6*" align="right"/>
49485 <tbody>
49486 <row>
49487 <entry><option>server_realm</option></entry>
49488 <entry>Use: <emphasis>gsasl</emphasis></entry>
49489 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49490 <entry>Default: <emphasis>unset</emphasis></entry>
49491 </row>
49492 </tbody>
49493 </tgroup>
49494 </informaltable>
49495 <para>
49496 This specifies the SASL realm that the server claims to be in.
49497 Some mechanisms will use this data.
49498 </para>
49499 <para>
49500 <indexterm role="option">
49501 <primary><option>server_scram_iter</option></primary>
49502 </indexterm>
49503 </para>
49504 <informaltable frame="all">
49505 <tgroup cols="4" colsep="0" rowsep="0">
49506 <colspec colwidth="8*" align="left"/>
49507 <colspec colwidth="6*" align="center"/>
49508 <colspec colwidth="6*" align="center"/>
49509 <colspec colwidth="6*" align="right"/>
49510 <tbody>
49511 <row>
49512 <entry><option>server_scram_iter</option></entry>
49513 <entry>Use: <emphasis>gsasl</emphasis></entry>
49514 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49515 <entry>Default: <emphasis>unset</emphasis></entry>
49516 </row>
49517 </tbody>
49518 </tgroup>
49519 </informaltable>
49520 <para>
49521 This option provides data for the SCRAM family of mechanisms.
49522 <varname>$auth1</varname> is not available at evaluation time.
49523 (This may change, as we receive feedback on use)
49524 </para>
49525 <para>
49526 <indexterm role="option">
49527 <primary><option>server_scram_salt</option></primary>
49528 </indexterm>
49529 </para>
49530 <informaltable frame="all">
49531 <tgroup cols="4" colsep="0" rowsep="0">
49532 <colspec colwidth="8*" align="left"/>
49533 <colspec colwidth="6*" align="center"/>
49534 <colspec colwidth="6*" align="center"/>
49535 <colspec colwidth="6*" align="right"/>
49536 <tbody>
49537 <row>
49538 <entry><option>server_scram_salt</option></entry>
49539 <entry>Use: <emphasis>gsasl</emphasis></entry>
49540 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49541 <entry>Default: <emphasis>unset</emphasis></entry>
49542 </row>
49543 </tbody>
49544 </tgroup>
49545 </informaltable>
49546 <para>
49547 This option provides data for the SCRAM family of mechanisms.
49548 <varname>$auth1</varname> is not available at evaluation time.
49549 (This may change, as we receive feedback on use)
49550 </para>
49551 <para>
49552 <indexterm role="option">
49553 <primary><option>server_service</option></primary>
49554 </indexterm>
49555 </para>
49556 <informaltable frame="all">
49557 <tgroup cols="4" colsep="0" rowsep="0">
49558 <colspec colwidth="8*" align="left"/>
49559 <colspec colwidth="6*" align="center"/>
49560 <colspec colwidth="6*" align="center"/>
49561 <colspec colwidth="6*" align="right"/>
49562 <tbody>
49563 <row>
49564 <entry><option>server_service</option></entry>
49565 <entry>Use: <emphasis>gsasl</emphasis></entry>
49566 <entry>Type: <emphasis>string</emphasis></entry>
49567 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49568 </row>
49569 </tbody>
49570 </tgroup>
49571 </informaltable>
49572 <para>
49573 This is the SASL service that the server claims to implement.
49574 Some mechanisms will use this data.
49575 </para>
49576 <section id="SECTgsaslauthvar">
49577 <title><command>gsasl</command> auth variables</title>
49578 <para>
49579 <indexterm role="variable">
49580 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49581 </indexterm>
49582 These may be set when evaluating specific options, as detailed above.
49583 They will also be set when evaluating <option>server_condition</option>.
49584 </para>
49585 <para>
49586 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
49587 meanings for these variables:
49588 </para>
49589 <itemizedlist>
49590 <listitem>
49591 <para>
49592 <indexterm role="variable">
49593 <primary><varname>$auth1</varname></primary>
49594 </indexterm>
49595 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
49596 </para>
49597 </listitem>
49598 <listitem>
49599 <para>
49600 <indexterm role="variable">
49601 <primary><varname>$auth2</varname></primary>
49602 </indexterm>
49603 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
49604 </para>
49605 </listitem>
49606 <listitem>
49607 <para>
49608 <indexterm role="variable">
49609 <primary><varname>$auth3</varname></primary>
49610 </indexterm>
49611 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
49612 </para>
49613 </listitem>
49614 </itemizedlist>
49615 <para>
49616 On a per-mechanism basis:
49617 </para>
49618 <itemizedlist>
49619 <listitem>
49620 <para>
49621 <indexterm role="concept">
49622 <primary>authentication</primary>
49623 <secondary>EXTERNAL</secondary>
49624 </indexterm>
49625 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
49626 the <option>server_condition</option> option must be present.
49627 </para>
49628 </listitem>
49629 <listitem>
49630 <para>
49631 <indexterm role="concept">
49632 <primary>authentication</primary>
49633 <secondary>ANONYMOUS</secondary>
49634 </indexterm>
49635 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
49636 the <option>server_condition</option> option must be present.
49637 </para>
49638 </listitem>
49639 <listitem>
49640 <para>
49641 <indexterm role="concept">
49642 <primary>authentication</primary>
49643 <secondary>GSSAPI</secondary>
49644 </indexterm>
49645 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
49646 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
49647 the <option>server_condition</option> option must be present.
49648 </para>
49649 </listitem>
49650 </itemizedlist>
49651 <para>
49652 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
49653 identifier; this is analogous to FTP anonymous authentication passing an
49654 email address, or software-identifier@, as the "password".
49655 </para>
49656 <para>
49657 An example showing the password having the realm specified in the callback
49658 and demonstrating a Cyrus SASL to GSASL migration approach is:
49659 </para>
49660 <literallayout class="monospaced">
49661 gsasl_cyrusless_crammd5:
49662   driver = gsasl
49663   public_name = CRAM-MD5
49664   server_realm = imap.example.org
49665   server_password = ${lookup{$auth1:$auth3:userPassword}\
49666                     dbmjz{/etc/sasldb2}{$value}fail}
49667   server_set_id = ${quote:$auth1}
49668   server_condition = yes
49669 </literallayout>
49670 </section>
49671 </chapter>
49672
49673 <chapter id="CHAPheimdalgss">
49674 <title>The heimdal_gssapi authenticator</title>
49675 <para>
49676 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
49677 <primary><command>heimdal_gssapi</command> authenticator</primary>
49678 </indexterm>
49679 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
49680 <primary>authenticators</primary>
49681 <secondary><command>heimdal_gssapi</command></secondary>
49682 </indexterm>
49683 <indexterm role="concept">
49684 <primary>authentication</primary>
49685 <secondary>GSSAPI</secondary>
49686 </indexterm>
49687 <indexterm role="concept">
49688 <primary>authentication</primary>
49689 <secondary>Kerberos</secondary>
49690 </indexterm>
49691 The <command>heimdal_gssapi</command> authenticator provides server integration for the
49692 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
49693 reliably.
49694 </para>
49695 <para>
49696 <indexterm role="option">
49697 <primary><option>server_hostname</option></primary>
49698 </indexterm>
49699 </para>
49700 <informaltable frame="all">
49701 <tgroup cols="4" colsep="0" rowsep="0">
49702 <colspec colwidth="8*" align="left"/>
49703 <colspec colwidth="6*" align="center"/>
49704 <colspec colwidth="6*" align="center"/>
49705 <colspec colwidth="6*" align="right"/>
49706 <tbody>
49707 <row>
49708 <entry><option>server_hostname</option></entry>
49709 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49710 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49711 <entry>Default: <emphasis>see below</emphasis></entry>
49712 </row>
49713 </tbody>
49714 </tgroup>
49715 </informaltable>
49716 <para>
49717 This option selects the hostname that is used, with <option>server_service</option>,
49718 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
49719 identifier.  The default value is <literal>$primary_hostname</literal>.
49720 </para>
49721 <para>
49722 <indexterm role="option">
49723 <primary><option>server_keytab</option></primary>
49724 </indexterm>
49725 </para>
49726 <informaltable frame="all">
49727 <tgroup cols="4" colsep="0" rowsep="0">
49728 <colspec colwidth="8*" align="left"/>
49729 <colspec colwidth="6*" align="center"/>
49730 <colspec colwidth="6*" align="center"/>
49731 <colspec colwidth="6*" align="right"/>
49732 <tbody>
49733 <row>
49734 <entry><option>server_keytab</option></entry>
49735 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49736 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49737 <entry>Default: <emphasis>unset</emphasis></entry>
49738 </row>
49739 </tbody>
49740 </tgroup>
49741 </informaltable>
49742 <para>
49743 If set, then Heimdal will not use the system default keytab (typically
49744 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
49745 The value should be a pathname, with no <quote>file:</quote> prefix.
49746 </para>
49747 <para>
49748 <indexterm role="option">
49749 <primary><option>server_service</option></primary>
49750 </indexterm>
49751 </para>
49752 <informaltable frame="all">
49753 <tgroup cols="4" colsep="0" rowsep="0">
49754 <colspec colwidth="8*" align="left"/>
49755 <colspec colwidth="6*" align="center"/>
49756 <colspec colwidth="6*" align="center"/>
49757 <colspec colwidth="6*" align="right"/>
49758 <tbody>
49759 <row>
49760 <entry><option>server_service</option></entry>
49761 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49762 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49763 <entry>Default: <emphasis>smtp</emphasis></entry>
49764 </row>
49765 </tbody>
49766 </tgroup>
49767 </informaltable>
49768 <para>
49769 This option specifies the service identifier used, in conjunction with
49770 <option>server_hostname</option>, for building the identifer for finding credentials
49771 from the keytab.
49772 </para>
49773 <section id="SECTheimdalgssauthvar">
49774 <title><command>heimdal_gssapi</command> auth variables</title>
49775 <para>
49776 Beware that these variables will typically include a realm, thus will appear
49777 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
49778 not verified, so a malicious client can set it to anything.
49779 </para>
49780 <para>
49781 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
49782 Distribution Center.  Note that these are not quite email addresses.
49783 Each identifier is for a role, and so the left-hand-side may include a
49784 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
49785 </para>
49786 <para>
49787 <indexterm role="variable">
49788 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49789 </indexterm>
49790 </para>
49791 <itemizedlist>
49792 <listitem>
49793 <para>
49794 <indexterm role="variable">
49795 <primary><varname>$auth1</varname></primary>
49796 </indexterm>
49797 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
49798 </para>
49799 </listitem>
49800 <listitem>
49801 <para>
49802 <indexterm role="variable">
49803 <primary><varname>$auth2</varname></primary>
49804 </indexterm>
49805 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
49806 authentication.  If that was empty, this will also be set to the
49807 GSS Display Name.
49808 </para>
49809 </listitem>
49810 </itemizedlist>
49811 </section>
49812 </chapter>
49813
49814 <chapter id="CHAPspa">
49815 <title>The spa authenticator</title>
49816 <para>
49817 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
49818 <primary><command>spa</command> authenticator</primary>
49819 </indexterm>
49820 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
49821 <primary>authenticators</primary>
49822 <secondary><command>spa</command></secondary>
49823 </indexterm>
49824 <indexterm role="concept">
49825 <primary>authentication</primary>
49826 <secondary>Microsoft Secure Password</secondary>
49827 </indexterm>
49828 <indexterm role="concept">
49829 <primary>authentication</primary>
49830 <secondary>NTLM</secondary>
49831 </indexterm>
49832 <indexterm role="concept">
49833 <primary>Microsoft Secure Password Authentication</primary>
49834 </indexterm>
49835 <indexterm role="concept">
49836 <primary>NTLM authentication</primary>
49837 </indexterm>
49838 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
49839 Password Authentication</emphasis> mechanism,
49840 which is also sometimes known as NTLM (NT LanMan). The code for client side of
49841 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
49842 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
49843 server side was subsequently contributed by Tom Kistner. The mechanism works as
49844 follows:
49845 </para>
49846 <itemizedlist>
49847 <listitem>
49848 <para>
49849 After the AUTH command has been accepted, the client sends an SPA
49850 authentication request based on the user name and optional domain.
49851 </para>
49852 </listitem>
49853 <listitem>
49854 <para>
49855 The server sends back a challenge.
49856 </para>
49857 </listitem>
49858 <listitem>
49859 <para>
49860 The client builds a challenge response which makes use of the user&#x2019;s password
49861 and sends it to the server, which then accepts or rejects it.
49862 </para>
49863 </listitem>
49864 </itemizedlist>
49865 <para>
49866 Encryption is used to protect the password in transit.
49867 </para>
49868 <section id="SECID179">
49869 <title>Using spa as a server</title>
49870 <para>
49871 <indexterm role="concept">
49872 <primary>options</primary>
49873 <secondary><command>spa</command> authenticator (server)</secondary>
49874 </indexterm>
49875 The <command>spa</command> authenticator has just one server option:
49876 </para>
49877 <para>
49878 <indexterm role="option">
49879 <primary><option>server_password</option></primary>
49880 </indexterm>
49881 </para>
49882 <informaltable frame="all">
49883 <tgroup cols="4" colsep="0" rowsep="0">
49884 <colspec colwidth="8*" align="left"/>
49885 <colspec colwidth="6*" align="center"/>
49886 <colspec colwidth="6*" align="center"/>
49887 <colspec colwidth="6*" align="right"/>
49888 <tbody>
49889 <row>
49890 <entry><option>server_password</option></entry>
49891 <entry>Use: <emphasis>spa</emphasis></entry>
49892 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49893 <entry>Default: <emphasis>unset</emphasis></entry>
49894 </row>
49895 </tbody>
49896 </tgroup>
49897 </informaltable>
49898 <para>
49899 <indexterm role="concept">
49900 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49901 <secondary>in <command>spa</command> authenticator</secondary>
49902 </indexterm>
49903 This option is expanded, and the result must be the cleartext password for the
49904 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
49905 compatibility with previous releases of Exim, the user name is also placed in
49906 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
49907 it can lead to confusion in string expansions that also use numeric variables
49908 for other things. For example:
49909 </para>
49910 <literallayout class="monospaced">
49911 spa:
49912   driver = spa
49913   public_name = NTLM
49914   server_password = \
49915     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
49916 </literallayout>
49917 <para>
49918 If the expansion is forced to fail, authentication fails. Any other expansion
49919 failure causes a temporary error code to be returned.
49920 </para>
49921 </section>
49922 <section id="SECID180">
49923 <title>Using spa as a client</title>
49924 <para>
49925 <indexterm role="concept">
49926 <primary>options</primary>
49927 <secondary><command>spa</command> authenticator (client)</secondary>
49928 </indexterm>
49929 The <command>spa</command> authenticator has the following client options:
49930 </para>
49931 <para>
49932 <indexterm role="option">
49933 <primary><option>client_domain</option></primary>
49934 </indexterm>
49935 </para>
49936 <informaltable frame="all">
49937 <tgroup cols="4" colsep="0" rowsep="0">
49938 <colspec colwidth="8*" align="left"/>
49939 <colspec colwidth="6*" align="center"/>
49940 <colspec colwidth="6*" align="center"/>
49941 <colspec colwidth="6*" align="right"/>
49942 <tbody>
49943 <row>
49944 <entry><option>client_domain</option></entry>
49945 <entry>Use: <emphasis>spa</emphasis></entry>
49946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49947 <entry>Default: <emphasis>unset</emphasis></entry>
49948 </row>
49949 </tbody>
49950 </tgroup>
49951 </informaltable>
49952 <para>
49953 This option specifies an optional domain for the authentication.
49954 </para>
49955 <para>
49956 <indexterm role="option">
49957 <primary><option>client_password</option></primary>
49958 </indexterm>
49959 </para>
49960 <informaltable frame="all">
49961 <tgroup cols="4" colsep="0" rowsep="0">
49962 <colspec colwidth="8*" align="left"/>
49963 <colspec colwidth="6*" align="center"/>
49964 <colspec colwidth="6*" align="center"/>
49965 <colspec colwidth="6*" align="right"/>
49966 <tbody>
49967 <row>
49968 <entry><option>client_password</option></entry>
49969 <entry>Use: <emphasis>spa</emphasis></entry>
49970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49971 <entry>Default: <emphasis>unset</emphasis></entry>
49972 </row>
49973 </tbody>
49974 </tgroup>
49975 </informaltable>
49976 <para>
49977 This option specifies the user&#x2019;s password, and must be set.
49978 </para>
49979 <para>
49980 <indexterm role="option">
49981 <primary><option>client_username</option></primary>
49982 </indexterm>
49983 </para>
49984 <informaltable frame="all">
49985 <tgroup cols="4" colsep="0" rowsep="0">
49986 <colspec colwidth="8*" align="left"/>
49987 <colspec colwidth="6*" align="center"/>
49988 <colspec colwidth="6*" align="center"/>
49989 <colspec colwidth="6*" align="right"/>
49990 <tbody>
49991 <row>
49992 <entry><option>client_username</option></entry>
49993 <entry>Use: <emphasis>spa</emphasis></entry>
49994 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49995 <entry>Default: <emphasis>unset</emphasis></entry>
49996 </row>
49997 </tbody>
49998 </tgroup>
49999 </informaltable>
50000 <para>
50001 This option specifies the user name, and must be set. Here is an example of a
50002 configuration of this authenticator for use with the mail servers at
50003 <emphasis>msn.com</emphasis>:
50004 </para>
50005 <literallayout class="monospaced">
50006 msn:
50007   driver = spa
50008   public_name = MSN
50009   client_username = msn/msn_username
50010   client_password = msn_plaintext_password
50011   client_domain = DOMAIN_OR_UNSET
50012 </literallayout>
50013 <para>
50014 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
50015 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
50016 </para>
50017 </section>
50018 </chapter>
50019
50020 <chapter id="CHAPTLS">
50021 <title>Encrypted SMTP connections using TLS/SSL</title>
50022 <titleabbrev>Encrypted SMTP connections</titleabbrev>
50023 <para>
50024 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
50025 <primary>encryption</primary>
50026 <secondary>on SMTP connection</secondary>
50027 </indexterm>
50028 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
50029 <primary>SMTP</primary>
50030 <secondary>encryption</secondary>
50031 </indexterm>
50032 <indexterm role="concept">
50033 <primary>TLS</primary>
50034 <secondary>on SMTP connection</secondary>
50035 </indexterm>
50036 <indexterm role="concept">
50037 <primary>OpenSSL</primary>
50038 </indexterm>
50039 <indexterm role="concept">
50040 <primary>GnuTLS</primary>
50041 </indexterm>
50042 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
50043 Sockets Layer), is implemented by making use of the OpenSSL library or the
50044 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
50045 cryptographic code in the Exim distribution itself for implementing TLS. In
50046 order to use this feature you must install OpenSSL or GnuTLS, and then build a
50047 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
50048 You also need to understand the basic concepts of encryption at a managerial
50049 level, and in particular, the way that public keys, private keys, and
50050 certificates are used.
50051 </para>
50052 <para>
50053 RFC 3207 defines how SMTP connections can make use of encryption. Once a
50054 connection is established, the client issues a STARTTLS command. If the
50055 server accepts this, the client and the server negotiate an encryption
50056 mechanism. If the negotiation succeeds, the data that subsequently passes
50057 between them is encrypted.
50058 </para>
50059 <para>
50060 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
50061 and if so, what cipher suite is in use, whether the client supplied a
50062 certificate, and whether or not that certificate was verified. This makes it
50063 possible for an Exim server to deny or accept certain commands based on the
50064 encryption state.
50065 </para>
50066 <para>
50067 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
50068 disrupt TLS connections. You need to turn off SMTP scanning for these products
50069 in order to get TLS to work.
50070 </para>
50071 <section id="SECID284">
50072 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
50073 <para>
50074 <indexterm role="concept">
50075 <primary>ssmtp protocol</primary>
50076 </indexterm>
50077 <indexterm role="concept">
50078 <primary>smtps protocol</primary>
50079 </indexterm>
50080 <indexterm role="concept">
50081 <primary>SMTP</primary>
50082 <secondary>ssmtp protocol</secondary>
50083 </indexterm>
50084 <indexterm role="concept">
50085 <primary>SMTP</primary>
50086 <secondary>smtps protocol</secondary>
50087 </indexterm>
50088 Early implementations of encrypted SMTP used a different TCP port from normal
50089 SMTP, and expected an encryption negotiation to start immediately, instead of
50090 waiting for a STARTTLS command from the client using the standard SMTP
50091 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
50092 allocated for this purpose.
50093 </para>
50094 <para>
50095 This approach was abandoned when encrypted SMTP was standardized, but there are
50096 still some legacy clients that use it. Exim supports these clients by means of
50097 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
50098 numbers; the most common use is expected to be:
50099 </para>
50100 <literallayout class="monospaced">
50101 tls_on_connect_ports = 465
50102 </literallayout>
50103 <para>
50104 The port numbers specified by this option apply to all SMTP connections, both
50105 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
50106 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
50107 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
50108 an extra port &ndash; rather, it specifies different behaviour on a port that is
50109 defined elsewhere.
50110 </para>
50111 <para>
50112 There is also a <option>-tls-on-connect</option> command line option. This overrides
50113 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
50114 </para>
50115 </section>
50116 <section id="SECTopenvsgnu">
50117 <title>OpenSSL vs GnuTLS</title>
50118 <para>
50119 <indexterm role="concept">
50120 <primary>TLS</primary>
50121 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
50122 </indexterm>
50123 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
50124 followed later, when the first versions of GnuTLS were released. To build Exim
50125 to use GnuTLS, you need to set
50126 </para>
50127 <literallayout class="monospaced">
50128 USE_GNUTLS=yes
50129 </literallayout>
50130 <para>
50131 in Local/Makefile, in addition to
50132 </para>
50133 <literallayout class="monospaced">
50134 SUPPORT_TLS=yes
50135 </literallayout>
50136 <para>
50137 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
50138 include files and libraries for GnuTLS can be found.
50139 </para>
50140 <para>
50141 There are some differences in usage when using GnuTLS instead of OpenSSL:
50142 </para>
50143 <itemizedlist>
50144 <listitem>
50145 <para>
50146 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
50147 name of a directory (for OpenSSL it can be either).
50148 </para>
50149 </listitem>
50150 <listitem>
50151 <para>
50152 The default value for <option>tls_dhparam</option> differs for historical reasons.
50153 </para>
50154 </listitem>
50155 <listitem>
50156 <para>
50157 <indexterm role="variable">
50158 <primary><varname>$tls_in_peerdn</varname></primary>
50159 </indexterm>
50160 <indexterm role="variable">
50161 <primary><varname>$tls_out_peerdn</varname></primary>
50162 </indexterm>
50163 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
50164 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
50165 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
50166 </para>
50167 </listitem>
50168 <listitem>
50169 <para>
50170 OpenSSL identifies cipher suites using hyphens as separators, for example:
50171 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
50172 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
50173 in a cipher list. To make life simpler, Exim changes underscores to hyphens
50174 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
50175 to handle its own older variants) when processing lists of cipher suites in the
50176 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
50177 option).
50178 </para>
50179 </listitem>
50180 <listitem>
50181 <para>
50182 The <option>tls_require_ciphers</option> options operate differently, as described in the
50183 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
50184 </para>
50185 </listitem>
50186 <listitem>
50187 <para>
50188 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
50189 When using OpenSSL, this option is ignored.
50190 (If an API is found to let OpenSSL be configured in this way,
50191 let the Exim Maintainers know and we&#x2019;ll likely use it).
50192 </para>
50193 </listitem>
50194 <listitem>
50195 <para>
50196 Some other recently added features may only be available in one or the other.
50197 This should be documented with the feature.  If the documentation does not
50198 explicitly state that the feature is infeasible in the other TLS
50199 implementation, then patches are welcome.
50200 </para>
50201 </listitem>
50202 </itemizedlist>
50203 </section>
50204 <section id="SECTgnutlsparam">
50205 <title>GnuTLS parameter computation</title>
50206 <para>
50207 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
50208 an explicit path; if the latter, then the text about generation still applies,
50209 but not the chosen filename.
50210 By default, as of Exim 4.80 a hard-coded D-H prime is used.
50211 See the documentation of <option>tls_dhparam</option> for more information.
50212 </para>
50213 <para>
50214 GnuTLS uses D-H parameters that may take a substantial amount of time
50215 to compute. It is unreasonable to re-compute them for every TLS session.
50216 Therefore, Exim keeps this data in a file in its spool directory, called
50217 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
50218 of bits requested.
50219 The file is owned by the Exim user and is readable only by
50220 its owner. Every Exim process that start up GnuTLS reads the D-H
50221 parameters from this file. If the file does not exist, the first Exim process
50222 that needs it computes the data and writes it to a temporary file which is
50223 renamed once it is complete. It does not matter if several Exim processes do
50224 this simultaneously (apart from wasting a few resources). Once a file is in
50225 place, new Exim processes immediately start using it.
50226 </para>
50227 <para>
50228 For maximum security, the parameters that are stored in this file should be
50229 recalculated periodically, the frequency depending on your paranoia level.
50230 If you are avoiding using the fixed D-H primes published in RFCs, then you
50231 are concerned about some advanced attacks and will wish to do this; if you do
50232 not regenerate then you might as well stick to the standard primes.
50233 </para>
50234 <para>
50235 Arranging this is easy in principle; just delete the file when you want new
50236 values to be computed. However, there may be a problem. The calculation of new
50237 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
50238 If the system is not very active, <filename>/dev/random</filename> may delay returning data
50239 until enough randomness (entropy) is available. This may cause Exim to hang for
50240 a substantial amount of time, causing timeouts on incoming connections.
50241 </para>
50242 <para>
50243 The solution is to generate the parameters externally to Exim. They are stored
50244 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
50245 generated externally using the <command>certtool</command> command that is part of GnuTLS.
50246 </para>
50247 <para>
50248 To replace the parameters with new ones, instead of deleting the file
50249 and letting Exim re-create it, you can generate new parameters using
50250 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
50251 renaming. The relevant commands are something like this:
50252 </para>
50253 <literallayout class="monospaced">
50254 # ls
50255 [ look for file; assume gnutls-params-2236 is the most recent ]
50256 # rm -f new-params
50257 # touch new-params
50258 # chown exim:exim new-params
50259 # chmod 0600 new-params
50260 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
50261 # openssl dhparam -noout -text -in new-params | head
50262 [ check the first line, make sure it's not more than 2236;
50263   if it is, then go back to the start ("rm") and repeat
50264   until the size generated is at most the size requested ]
50265 # chmod 0400 new-params
50266 # mv new-params gnutls-params-2236
50267 </literallayout>
50268 <para>
50269 If Exim never has to generate the parameters itself, the possibility of
50270 stalling is removed.
50271 </para>
50272 <para>
50273 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
50274 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
50275 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
50276 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
50277 and Exim does so.  This attempt to remove Exim from TLS policy decisions
50278 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
50279 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
50280 which applies to all D-H usage, client or server.  If the value returned by
50281 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
50282 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
50283 limit, which is still much higher than Exim historically used.
50284 </para>
50285 <para>
50286 The filename and bits used will change as the GnuTLS maintainers change the
50287 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
50288 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
50289 2432 bits, while NSS is limited to 2236 bits.
50290 </para>
50291 <para>
50292 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
50293 increase the chance of the generated prime actually being within acceptable
50294 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
50295 procedure above.  There is no sane procedure available to Exim to double-check
50296 the size of the generated prime, so it might still be too large.
50297 </para>
50298 </section>
50299 <section id="SECTreqciphssl">
50300 <title>Requiring specific ciphers in OpenSSL</title>
50301 <para>
50302 <indexterm role="concept">
50303 <primary>TLS</primary>
50304 <secondary>requiring specific ciphers (OpenSSL)</secondary>
50305 </indexterm>
50306 <indexterm role="option">
50307 <primary><option>tls_require_ciphers</option></primary>
50308 <secondary>OpenSSL</secondary>
50309 </indexterm>
50310 There is a function in the OpenSSL library that can be passed a list of cipher
50311 suites before the cipher negotiation takes place. This specifies which ciphers
50312 are acceptable. The list is colon separated and may contain names like
50313 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
50314 directly to this function call.
50315 Many systems will install the OpenSSL manual-pages, so you may have
50316 <emphasis>ciphers(1)</emphasis> available to you.
50317 The following quotation from the OpenSSL
50318 documentation specifies what forms of item are allowed in the cipher string:
50319 </para>
50320 <itemizedlist>
50321 <listitem>
50322 <para>
50323 It can consist of a single cipher suite such as RC4-SHA.
50324 </para>
50325 </listitem>
50326 <listitem>
50327 <para>
50328 It can represent a list of cipher suites containing a certain algorithm,
50329 or cipher suites of a certain type. For example SHA1 represents all
50330 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
50331 SSL v3 algorithms.
50332 </para>
50333 </listitem>
50334 <listitem>
50335 <para>
50336 Lists of cipher suites can be combined in a single cipher string using
50337 the + character. This is used as a logical and operation. For example
50338 SHA1+DES represents all cipher suites containing the SHA1 and the DES
50339 algorithms.
50340 </para>
50341 </listitem>
50342 </itemizedlist>
50343 <para>
50344 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
50345 <literal>-</literal> or <literal>+</literal>.
50346 </para>
50347 <itemizedlist>
50348 <listitem>
50349 <para>
50350 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
50351 ciphers deleted can never reappear in the list even if they are explicitly
50352 stated.
50353 </para>
50354 </listitem>
50355 <listitem>
50356 <para>
50357 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
50358 of the ciphers can be added again by later options.
50359 </para>
50360 </listitem>
50361 <listitem>
50362 <para>
50363 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
50364 option does not add any new ciphers; it just moves matching existing ones.
50365 </para>
50366 </listitem>
50367 </itemizedlist>
50368 <para>
50369 If none of these characters is present, the string is interpreted as
50370 a list of ciphers to be appended to the current preference list. If the list
50371 includes any ciphers already present they will be ignored: that is, they will
50372 not be moved to the end of the list.
50373 </para>
50374 <para>
50375 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
50376 string:
50377 </para>
50378 <literallayout class="monospaced">
50379 # note single-quotes to get ! past any shell history expansion
50380 $ openssl ciphers 'HIGH:!MD5:!SHA1'
50381 </literallayout>
50382 <para>
50383 This example will let the library defaults be permitted on the MX port, where
50384 there&#x2019;s probably no identity verification anyway, but ups the ante on the
50385 submission ports where the administrator might have some influence on the
50386 choice of clients used:
50387 </para>
50388 <literallayout class="monospaced">
50389 # OpenSSL variant; see man ciphers(1)
50390 tls_require_ciphers = ${if =={$received_port}{25}\
50391                            {DEFAULT}\
50392                            {HIGH:!MD5:!SHA1}}
50393 </literallayout>
50394 </section>
50395 <section id="SECTreqciphgnu">
50396 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
50397 <para>
50398 <indexterm role="concept">
50399 <primary>GnuTLS</primary>
50400 <secondary>specifying parameters for</secondary>
50401 </indexterm>
50402 <indexterm role="concept">
50403 <primary>TLS</primary>
50404 <secondary>specifying ciphers (GnuTLS)</secondary>
50405 </indexterm>
50406 <indexterm role="concept">
50407 <primary>TLS</primary>
50408 <secondary>specifying key exchange methods (GnuTLS)</secondary>
50409 </indexterm>
50410 <indexterm role="concept">
50411 <primary>TLS</primary>
50412 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
50413 </indexterm>
50414 <indexterm role="concept">
50415 <primary>TLS</primary>
50416 <secondary>specifying protocols (GnuTLS)</secondary>
50417 </indexterm>
50418 <indexterm role="concept">
50419 <primary>TLS</primary>
50420 <secondary>specifying priority string (GnuTLS)</secondary>
50421 </indexterm>
50422 <indexterm role="option">
50423 <primary><option>tls_require_ciphers</option></primary>
50424 <secondary>GnuTLS</secondary>
50425 </indexterm>
50426 The GnuTLS library allows the caller to provide a "priority string", documented
50427 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
50428 ciphersuite specification in OpenSSL.
50429 </para>
50430 <para>
50431 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string.
50432 </para>
50433 <para>
50434 The <option>tls_require_ciphers</option> option is available both as an global option,
50435 controlling how Exim behaves as a server, and also as an option of the
50436 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
50437 the value is string expanded.  The resulting string is not an Exim list and
50438 the string is given to the GnuTLS library, so that Exim does not need to be
50439 aware of future feature enhancements of GnuTLS.
50440 </para>
50441 <para>
50442 Documentation of the strings accepted may be found in the GnuTLS manual, under
50443 "Priority strings".  This is online as
50444 <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>,
50445 but beware that this relates to GnuTLS 3, which may be newer than the version
50446 installed on your system.  If you are using GnuTLS 3,
50447 <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>
50448 on that site can be used to test a given string.
50449 </para>
50450 <para>
50451 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
50452 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
50453 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
50454 </para>
50455 <para>
50456 This example will let the library defaults be permitted on the MX port, where
50457 there&#x2019;s probably no identity verification anyway, and lowers security further
50458 by increasing compatibility; but this ups the ante on the submission ports
50459 where the administrator might have some influence on the choice of clients
50460 used:
50461 </para>
50462 <literallayout class="monospaced">
50463 # GnuTLS variant
50464 tls_require_ciphers = ${if =={$received_port}{25}\
50465                            {NORMAL:%COMPAT}\
50466                            {SECURE128}}
50467 </literallayout>
50468 </section>
50469 <section id="SECID182">
50470 <title>Configuring an Exim server to use TLS</title>
50471 <para>
50472 <indexterm role="concept">
50473 <primary>TLS</primary>
50474 <secondary>configuring an Exim server</secondary>
50475 </indexterm>
50476 When Exim has been built with TLS support, it advertises the availability of
50477 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
50478 but not to any others. The default value of this option is unset, which means
50479 that STARTTLS is not advertised at all. This default is chosen because you
50480 need to set some other options in order to make TLS available, and also it is
50481 sensible for systems that want to use TLS only as a client.
50482 </para>
50483 <para>
50484 If a client issues a STARTTLS command and there is some configuration
50485 problem in the server, the command is rejected with a 454 error. If the client
50486 persists in trying to issue SMTP commands, all except QUIT are rejected
50487 with the error
50488 </para>
50489 <literallayout class="monospaced">
50490 554 Security failure
50491 </literallayout>
50492 <para>
50493 If a STARTTLS command is issued within an existing TLS session, it is
50494 rejected with a 554 error code.
50495 </para>
50496 <para>
50497 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
50498 match some hosts. You can, of course, set it to * to match all hosts.
50499 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
50500 without some further configuration at the server end.
50501 </para>
50502 <para>
50503 It is rumoured that all existing clients that support TLS/SSL use RSA
50504 encryption. To make this work you need to set, in the server,
50505 </para>
50506 <literallayout class="monospaced">
50507 tls_certificate = /some/file/name
50508 tls_privatekey = /some/file/name
50509 </literallayout>
50510 <para>
50511 These options are, in fact, expanded strings, so you can make them depend on
50512 the identity of the client that is connected if you wish. The first file
50513 contains the server&#x2019;s X509 certificate, and the second contains the private key
50514 that goes with it. These files need to be readable by the Exim user, and must
50515 always be given as full path names. They can be the same file if both the
50516 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
50517 set, or if its expansion is forced to fail or results in an empty string, this
50518 is assumed to be the case. The certificate file may also contain intermediate
50519 certificates that need to be sent to the client to enable it to authenticate
50520 the server&#x2019;s certificate.
50521 </para>
50522 <para>
50523 If you do not understand about certificates and keys, please try to find a
50524 source of this background information, which is not Exim-specific. (There are a
50525 few comments below in section <xref linkend="SECTcerandall"/>.)
50526 </para>
50527 <para>
50528 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
50529 they apply only in the case of a server. If you need to use a certificate in an
50530 Exim client, you must set the options of the same names in an <command>smtp</command>
50531 transport.
50532 </para>
50533 <para>
50534 With just these options, an Exim server will be able to use TLS. It does not
50535 require the client to have a certificate (but see below for how to insist on
50536 this). There is one other option that may be needed in other situations. If
50537 </para>
50538 <literallayout class="monospaced">
50539 tls_dhparam = /some/file/name
50540 </literallayout>
50541 <para>
50542 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
50543 with the parameters contained in the file.
50544 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
50545 available:
50546 </para>
50547 <literallayout class="monospaced">
50548 tls_dhparam = none
50549 </literallayout>
50550 <para>
50551 This may also be set to a string identifying a standard prime to be used for
50552 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
50553 used is <literal>ike23</literal>.  There are a few standard primes available, see the
50554 documentation for <option>tls_dhparam</option> for the complete list.
50555 </para>
50556 <para>
50557 See the command
50558 </para>
50559 <literallayout class="monospaced">
50560 openssl dhparam
50561 </literallayout>
50562 <para>
50563 for a way of generating file data.
50564 </para>
50565 <para>
50566 The strings supplied for these three options are expanded every time a client
50567 host connects. It is therefore possible to use different certificates and keys
50568 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
50569 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
50570 forced to fail, Exim behaves as if the option is not set.
50571 </para>
50572 <para>
50573 <indexterm role="concept">
50574 <primary>cipher</primary>
50575 <secondary>logging</secondary>
50576 </indexterm>
50577 <indexterm role="concept">
50578 <primary>log</primary>
50579 <secondary>TLS cipher</secondary>
50580 </indexterm>
50581 <indexterm role="variable">
50582 <primary><varname>$tls_in_cipher</varname></primary>
50583 </indexterm>
50584 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
50585 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
50586 incoming message (by default &ndash; you can, of course, change this), and it is
50587 also included in the log line that records a message&#x2019;s arrival, keyed by
50588 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
50589 condition can be used to test for specific cipher suites in ACLs.
50590 </para>
50591 <para>
50592 Once TLS has been established, the ACLs that run for subsequent SMTP commands
50593 can check the name of the cipher suite and vary their actions accordingly. The
50594 cipher suite names vary, depending on which TLS library is being used. For
50595 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
50596 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
50597 documentation for more details.
50598 </para>
50599 <para>
50600 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
50601 (again depending on the <option>tls_cipher</option> log selector).
50602 </para>
50603 </section>
50604 <section id="SECID183">
50605 <title>Requesting and verifying client certificates</title>
50606 <para>
50607 <indexterm role="concept">
50608 <primary>certificate</primary>
50609 <secondary>verification of client</secondary>
50610 </indexterm>
50611 <indexterm role="concept">
50612 <primary>TLS</primary>
50613 <secondary>client certificate verification</secondary>
50614 </indexterm>
50615 If you want an Exim server to request a certificate when negotiating a TLS
50616 session with a client, you must set either <option>tls_verify_hosts</option> or
50617 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
50618 apply to all TLS connections. For any host that matches one of these options,
50619 Exim requests a certificate as part of the setup of the TLS session. The
50620 contents of the certificate are verified by comparing it with a list of
50621 expected certificates. These must be available in a file or,
50622 for OpenSSL only (not GnuTLS), a directory, identified by
50623 <option>tls_verify_certificates</option>.
50624 </para>
50625 <para>
50626 A file can contain multiple certificates, concatenated end to end. If a
50627 directory is used
50628 (OpenSSL only),
50629 each certificate must be in a separate file, with a name (or a symbolic link)
50630 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
50631 certificate. You can compute the relevant hash by running the command
50632 </para>
50633 <literallayout class="monospaced">
50634 openssl x509 -hash -noout -in /cert/file
50635 </literallayout>
50636 <para>
50637 where <filename>/cert/file</filename> contains a single certificate.
50638 </para>
50639 <para>
50640 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
50641 what happens if the client does not supply a certificate, or if the certificate
50642 does not match any of the certificates in the collection named by
50643 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
50644 attempt to set up a TLS session is aborted, and the incoming connection is
50645 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
50646 session continues. ACLs that run for subsequent SMTP commands can detect the
50647 fact that no certificate was verified, and vary their actions accordingly. For
50648 example, you can insist on a certificate before accepting a message for
50649 relaying, but not when the message is destined for local delivery.
50650 </para>
50651 <para>
50652 <indexterm role="variable">
50653 <primary><varname>$tls_in_peerdn</varname></primary>
50654 </indexterm>
50655 When a client supplies a certificate (whether it verifies or not), the value of
50656 the Distinguished Name of the certificate is made available in the variable
50657 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
50658 </para>
50659 <para>
50660 <indexterm role="concept">
50661 <primary>log</primary>
50662 <secondary>distinguished name</secondary>
50663 </indexterm>
50664 Because it is often a long text string, it is not included in the log line or
50665 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
50666 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
50667 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
50668 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
50669 </para>
50670 </section>
50671 <section id="SECID184">
50672 <title>Revoked certificates</title>
50673 <para>
50674 <indexterm role="concept">
50675 <primary>TLS</primary>
50676 <secondary>revoked certificates</secondary>
50677 </indexterm>
50678 <indexterm role="concept">
50679 <primary>revocation list</primary>
50680 </indexterm>
50681 <indexterm role="concept">
50682 <primary>certificate</primary>
50683 <secondary>revocation list</secondary>
50684 </indexterm>
50685 <indexterm role="concept">
50686 <primary>OCSP</primary>
50687 <secondary>stapling</secondary>
50688 </indexterm>
50689 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
50690 certificates are revoked. If you have such a list, you can pass it to an Exim
50691 server using the global option called <option>tls_crl</option> and to an Exim client using
50692 an identically named option for the <command>smtp</command> transport. In each case, the value
50693 of the option is expanded and must then be the name of a file that contains a
50694 CRL in PEM format.
50695 The downside is that clients have to periodically re-download a potentially huge
50696 file from every certificate authority the know of.
50697 </para>
50698 <para>
50699 The way with most moving parts at query time is Online Certificate
50700 Status Protocol (OCSP), where the client verifies the certificate
50701 against an OCSP server run by the CA.  This lets the CA track all
50702 usage of the certs.  It requires running software with access to the
50703 private key of the CA, to sign the responses to the OCSP queries.  OCSP
50704 is based on HTTP and can be proxied accordingly.
50705 </para>
50706 <para>
50707 The only widespread OCSP server implementation (known to this writer)
50708 comes as part of OpenSSL and aborts on an invalid request, such as
50709 connecting to the port and then disconnecting.  This requires
50710 re-entering the passphrase each time some random client does this.
50711 </para>
50712 <para>
50713 The third way is OCSP Stapling; in this, the server using a certificate
50714 issued by the CA periodically requests an OCSP proof of validity from
50715 the OCSP server, then serves it up inline as part of the TLS
50716 negotiation.   This approach adds no extra round trips, does not let the
50717 CA track users, scales well with number of certs issued by the CA and is
50718 resilient to temporary OCSP server failures, as long as the server
50719 starts retrying to fetch an OCSP proof some time before its current
50720 proof expires.  The downside is that it requires server support.
50721 </para>
50722 <para>
50723 Unless Exim is built with the support disabled,
50724 or with GnuTLS earlier than version 3.1.3,
50725 support for OCSP stapling is included.
50726 </para>
50727 <para>
50728 There is a global option called <option>tls_ocsp_file</option>.
50729 The file specified therein is expected to be in DER format, and contain
50730 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
50731 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
50732 contains <literal>tls_in_sni</literal>, as per other TLS options.
50733 </para>
50734 <para>
50735 Exim does not at this time implement any support for fetching a new OCSP
50736 proof.  The burden is on the administrator to handle this, outside of
50737 Exim.  The file specified should be replaced atomically, so that the
50738 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
50739 on each connection, so a new file will be handled transparently on the
50740 next connection.
50741 </para>
50742 <para>
50743 When built with OpenSSL Exim will check for a valid next update timestamp
50744 in the OCSP proof; if not present, or if the proof has expired, it will be
50745 ignored.
50746 </para>
50747 <para>
50748 For the client to be able to verify the stapled OCSP the server must
50749 also supply, in its stapled information, any intermediate
50750 certificates for the chain leading to the OCSP proof from the signer
50751 of the server certificate.  There may be zero or one such. These
50752 intermediate certificates should be added to the server OCSP stapling
50753 file named by <option>tls_ocsp_file</option>.
50754 </para>
50755 <para>
50756 Note that the proof only covers the terminal server certificate,
50757 not any of the chain from CA to it.
50758 </para>
50759 <para revisionflag="changed">
50760 There is no current way to staple a proof for a client certificate.
50761 </para>
50762 <literallayout class="monospaced">
50763   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
50764   OCSP server is supplied.  The server URL may be included in the
50765   server certificate, if the CA is helpful.
50766
50767   One failure mode seen was the OCSP Signer cert expiring before the end
50768   of validity of the OCSP proof. The checking done by Exim/OpenSSL
50769   noted this as invalid overall, but the re-fetch script did not.
50770 </literallayout>
50771 </section>
50772 <section id="SECID185">
50773 <title>Configuring an Exim client to use TLS</title>
50774 <para>
50775 <indexterm role="concept">
50776 <primary>cipher</primary>
50777 <secondary>logging</secondary>
50778 </indexterm>
50779 <indexterm role="concept">
50780 <primary>log</primary>
50781 <secondary>TLS cipher</secondary>
50782 </indexterm>
50783 <indexterm role="concept">
50784 <primary>log</primary>
50785 <secondary>distinguished name</secondary>
50786 </indexterm>
50787 <indexterm role="concept">
50788 <primary>TLS</primary>
50789 <secondary>configuring an Exim client</secondary>
50790 </indexterm>
50791 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
50792 deliveries as well as to incoming, the latter one causing logging of the
50793 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
50794 within the <command>smtp</command> transport.
50795 </para>
50796 <para>
50797 It is not necessary to set any options to have TLS work in the <command>smtp</command>
50798 transport. If Exim is built with TLS support, and TLS is advertised by a
50799 server, the <command>smtp</command> transport always tries to start a TLS session. However,
50800 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
50801 transport) to a list of server hosts for which TLS should not be used.
50802 </para>
50803 <para>
50804 If you do not want Exim to attempt to send messages unencrypted when an attempt
50805 to set up an encrypted connection fails in any way, you can set
50806 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
50807 those hosts, delivery is always deferred if an encrypted connection cannot be
50808 set up. If there are any other hosts for the address, they are tried in the
50809 usual way.
50810 </para>
50811 <para>
50812 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
50813 the message unencrypted. It always does this if the response to STARTTLS is
50814 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
50815 session after a success response code, what happens is controlled by the
50816 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
50817 delivery to this host is deferred, and other hosts (if available) are tried. If
50818 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
50819 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
50820 negotiation fails, Exim closes the current connection (because it is in an
50821 unknown state), opens a new one to the same host, and then tries the delivery
50822 unencrypted.
50823 </para>
50824 <para>
50825 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
50826 transport provide the client with a certificate, which is passed to the server
50827 if it requests it. If the server is Exim, it will request a certificate only if
50828 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
50829 </para>
50830 <para>
50831 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
50832 must name a file or,
50833 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
50834 expected server certificates. The client verifies the server&#x2019;s certificate
50835 against this collection, taking into account any revoked certificates that are
50836 in the list defined by <option>tls_crl</option>.
50837 Failure to verify fails the TLS connection unless either of the
50838 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
50839 </para>
50840 <para>
50841 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
50842 certificate verification to the listed servers.  Verification either must
50843 or need not succeed respectively.
50844 </para>
50845 <para>
50846 The <command>smtp</command> transport has two OCSP-related options:
50847 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
50848 is requested and required for the connection to proceed.  The default
50849 value is empty.
50850 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
50851 a Certificate Status is requested (but not necessarily verified).  The default
50852 value is "*" meaning that requests are made unless configured
50853 otherwise.
50854 </para>
50855 <para>
50856 The host(s) should also be in <option>hosts_require_tls</option>, and
50857 <option>tls_verify_certificates</option> configured for the transport,
50858 for OCSP to be relevant.
50859 </para>
50860 <para>
50861 If
50862 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
50863 list of permitted cipher suites. If either of these checks fails, delivery to
50864 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
50865 alternative hosts, if any.
50866 </para>
50867 <para>
50868  <emphasis role="bold">Note</emphasis>:
50869 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
50870 is operating as a client. Exim does not assume that a server certificate (set
50871 by the global options of the same name) should also be used when operating as a
50872 client.
50873 </para>
50874 <para>
50875 <indexterm role="variable">
50876 <primary><varname>$host</varname></primary>
50877 </indexterm>
50878 <indexterm role="variable">
50879 <primary><varname>$host_address</varname></primary>
50880 </indexterm>
50881 All the TLS options in the <command>smtp</command> transport are expanded before use, with
50882 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
50883 which the client is connected. Forced failure of an expansion causes Exim to
50884 behave as if the relevant option were unset.
50885 </para>
50886 <para>
50887 <indexterm role="variable">
50888 <primary><varname>$tls_out_bits</varname></primary>
50889 </indexterm>
50890 <indexterm role="variable">
50891 <primary><varname>$tls_out_cipher</varname></primary>
50892 </indexterm>
50893 <indexterm role="variable">
50894 <primary><varname>$tls_out_peerdn</varname></primary>
50895 </indexterm>
50896 <indexterm role="variable">
50897 <primary><varname>$tls_out_sni</varname></primary>
50898 </indexterm>
50899 Before an SMTP connection is established, the
50900 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
50901 variables are emptied. (Until the first connection, they contain the values
50902 that were set when the message was received.) If STARTTLS is subsequently
50903 successfully obeyed, these variables are set to the relevant values for the
50904 outgoing connection.
50905 </para>
50906 </section>
50907 <section id="SECTtlssni">
50908 <title>Use of TLS Server Name Indication</title>
50909 <para>
50910 <indexterm role="concept">
50911 <primary>TLS</primary>
50912 <secondary>Server Name Indication</secondary>
50913 </indexterm>
50914 <indexterm role="variable">
50915 <primary><varname>$tls_in_sni</varname></primary>
50916 </indexterm>
50917 <indexterm role="option">
50918 <primary><option>tls_in_sni</option></primary>
50919 </indexterm>
50920 With TLS1.0 or above, there is an extension mechanism by which extra
50921 information can be included at various points in the protocol.  One of these
50922 extensions, documented in RFC 6066 (and before that RFC 4366) is
50923 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
50924 client in the initial handshake, so that the server can examine the servername
50925 within and possibly choose to use different certificates and keys (and more)
50926 for this session.
50927 </para>
50928 <para>
50929 This is analagous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
50930 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
50931 address.
50932 </para>
50933 <para>
50934 With SMTP to MX, there are the same problems here as in choosing the identity
50935 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
50936 provide the identity which you then cryptographically verify.  So this will
50937 be of limited use in that environment.
50938 </para>
50939 <para>
50940 With SMTP to Submission, there is a well-defined hostname which clients are
50941 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
50942 choose to include this information in the TLS negotiation.  If this becomes
50943 wide-spread, then hosters can choose to present different certificates to
50944 different clients.  Or even negotiate different cipher suites.
50945 </para>
50946 <para>
50947 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
50948 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
50949 nothing more to it.  Choosing a sensible value not derived insecurely is the
50950 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
50951 for the lifetime of the client connection (including during authentication).
50952 </para>
50953 <para>
50954 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
50955 received from a client.
50956 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
50957 </para>
50958 <para>
50959 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
50960 option (prior to expansion) then the following options will be re-expanded
50961 during TLS session handshake, to permit alternative values to be chosen:
50962 </para>
50963 <itemizedlist>
50964 <listitem>
50965 <para>
50966 <indexterm role="variable">
50967 <primary><option>tls_certificate</option></primary>
50968 </indexterm>
50969 <option>tls_certificate</option>
50970 </para>
50971 </listitem>
50972 <listitem>
50973 <para>
50974 <indexterm role="variable">
50975 <primary><option>tls_crl</option></primary>
50976 </indexterm>
50977 <option>tls_crl</option>
50978 </para>
50979 </listitem>
50980 <listitem>
50981 <para>
50982 <indexterm role="variable">
50983 <primary><option>tls_privatekey</option></primary>
50984 </indexterm>
50985 <option>tls_privatekey</option>
50986 </para>
50987 </listitem>
50988 <listitem>
50989 <para>
50990 <indexterm role="variable">
50991 <primary><option>tls_verify_certificates</option></primary>
50992 </indexterm>
50993 <option>tls_verify_certificates</option>
50994 </para>
50995 </listitem>
50996 <listitem>
50997 <para>
50998 <indexterm role="variable">
50999 <primary><option>tls_ocsp_file</option></primary>
51000 </indexterm>
51001 <option>tls_verify_certificates</option>
51002 </para>
51003 </listitem>
51004 </itemizedlist>
51005 <para>
51006 Great care should be taken to deal with matters of case, various injection
51007 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
51008 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
51009 arbitrary unverified data provided prior to authentication.
51010 </para>
51011 <para>
51012 The Exim developers are proceeding cautiously and so far no other TLS options
51013 are re-expanded.
51014 </para>
51015 <para>
51016 When Exim is built againt OpenSSL, OpenSSL must have been built with support
51017 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
51018 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
51019 see <literal>-servername</literal> in the output, then OpenSSL has support.
51020 </para>
51021 <para>
51022 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
51023 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
51024 built, then you have SNI support).
51025 </para>
51026 </section>
51027 <section id="SECTmulmessam">
51028 <title>Multiple messages on the same encrypted TCP/IP connection</title>
51029 <para>
51030 <indexterm role="concept">
51031 <primary>multiple SMTP deliveries with TLS</primary>
51032 </indexterm>
51033 <indexterm role="concept">
51034 <primary>TLS</primary>
51035 <secondary>multiple message deliveries</secondary>
51036 </indexterm>
51037 Exim sends multiple messages down the same TCP/IP connection by starting up
51038 an entirely new delivery process for each message, passing the socket from
51039 one process to the next. This implementation does not fit well with the use
51040 of TLS, because there is quite a lot of state information associated with a TLS
51041 connection, not just a socket identification. Passing all the state information
51042 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
51043 session before passing the socket to a new process. The new process may then
51044 try to start a new TLS session, and if successful, may try to re-authenticate
51045 if AUTH is in use, before sending the next message.
51046 </para>
51047 <para>
51048 The RFC is not clear as to whether or not an SMTP session continues in clear
51049 after TLS has been shut down, or whether TLS may be restarted again later, as
51050 just described. However, if the server is Exim, this shutdown and
51051 reinitialization works. It is not known which (if any) other servers operate
51052 successfully if the client closes a TLS session and continues with unencrypted
51053 SMTP, but there are certainly some that do not work. For such servers, Exim
51054 should not pass the socket to another process, because the failure of the
51055 subsequent attempt to use it would cause Exim to record a temporary host error,
51056 and delay other deliveries to that host.
51057 </para>
51058 <para>
51059 To test for this case, Exim sends an EHLO command to the server after
51060 closing down the TLS session. If this fails in any way, the connection is
51061 closed instead of being passed to a new delivery process, but no retry
51062 information is recorded.
51063 </para>
51064 <para>
51065 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
51066 <command>smtp</command> transport to match those hosts for which Exim should not pass
51067 connections to new processes if TLS has been used.
51068 </para>
51069 </section>
51070 <section id="SECTcerandall">
51071 <title>Certificates and all that</title>
51072 <para>
51073 <indexterm role="concept">
51074 <primary>certificate</primary>
51075 <secondary>references to discussion</secondary>
51076 </indexterm>
51077 In order to understand fully how TLS works, you need to know about
51078 certificates, certificate signing, and certificate authorities. This is not the
51079 place to give a tutorial, especially as I do not know very much about it
51080 myself. Some helpful introduction can be found in the FAQ for the SSL addition
51081 to Apache, currently at
51082 </para>
51083 <literallayout>
51084 <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>
51085 </literallayout>
51086 <para>
51087 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
51088 links to further files.
51089 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
51090 0-201-61598-3), contains both introductory and more in-depth descriptions.
51091 Some sample programs taken from the book are available from
51092 </para>
51093 <literallayout>
51094 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
51095 </literallayout>
51096 </section>
51097 <section id="SECID186">
51098 <title>Certificate chains</title>
51099 <para>
51100 The file named by <option>tls_certificate</option> may contain more than one
51101 certificate. This is useful in the case where the certificate that is being
51102 sent is validated by an intermediate certificate which the other end does
51103 not have. Multiple certificates must be in the correct order in the file.
51104 First the host&#x2019;s certificate itself, then the first intermediate
51105 certificate to validate the issuer of the host certificate, then the next
51106 intermediate certificate to validate the issuer of the first intermediate
51107 certificate, and so on, until finally (optionally) the root certificate.
51108 The root certificate must already be trusted by the recipient for
51109 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
51110 root certificate along with the rest makes it available for the user to
51111 install if the receiving end is a client MUA that can interact with a user.
51112 </para>
51113 <para>
51114 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
51115 even if your libraries allow loading them for use in Exim when acting as a
51116 server, increasingly clients will not accept such certificates.  The error
51117 diagnostics in such a case can be frustratingly vague.
51118 </para>
51119 </section>
51120 <section id="SECID187">
51121 <title>Self-signed certificates</title>
51122 <para>
51123 <indexterm role="concept">
51124 <primary>certificate</primary>
51125 <secondary>self-signed</secondary>
51126 </indexterm>
51127 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
51128 with OpenSSL, like this:
51129 </para>
51130 <literallayout class="monospaced">
51131 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
51132             -days 9999 -nodes
51133 </literallayout>
51134 <para>
51135 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
51136 delimited and so can be identified independently. The <option>-days</option> option
51137 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
51138 important: if you do not set it, the key is encrypted with a passphrase
51139 that you are prompted for, and any use that is made of the key causes more
51140 prompting for the passphrase. This is not helpful if you are going to use
51141 this certificate and key in an MTA, where prompting is not possible.
51142 </para>
51143 <para>
51144 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
51145 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
51146 the above command might produce a date in the past.  Think carefully about
51147 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
51148 of the certificate or reconsider your platform deployment.  (At time of
51149 writing, reducing the duration is the most likely choice, but the inexorable
51150 progression of time takes us steadily towards an era where this will not
51151 be a sensible resolution).
51152 </para>
51153 <para>
51154 A self-signed certificate made in this way is sufficient for testing, and
51155 may be adequate for all your requirements if you are mainly interested in
51156 encrypting transfers, and not in secure identification.
51157 </para>
51158 <para>
51159 However, many clients require that the certificate presented by the server be a
51160 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
51161 certificate. In this situation, the self-signed certificate described above
51162 must be installed on the client host as a trusted root <emphasis>certification
51163 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
51164 signed with that self-signed certificate.
51165 </para>
51166 <para>
51167 For information on creating self-signed CA certificates and using them to sign
51168 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
51169 Open-source PKI book, available online at
51170 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
51171 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
51172 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
51173 </para>
51174 </section>
51175 </chapter>
51176
51177 <chapter id="CHAPACL">
51178 <title>Access control lists</title>
51179 <para>
51180 <indexterm role="concept" id="IIDacl" class="startofrange">
51181 <primary>access control lists (ACLs)</primary>
51182 <secondary>description</secondary>
51183 </indexterm>
51184 <indexterm role="concept">
51185 <primary>control of incoming mail</primary>
51186 </indexterm>
51187 <indexterm role="concept">
51188 <primary>message</primary>
51189 <secondary>controlling incoming</secondary>
51190 </indexterm>
51191 <indexterm role="concept">
51192 <primary>policy control</primary>
51193 <secondary>access control lists</secondary>
51194 </indexterm>
51195 Access Control Lists (ACLs) are defined in a separate section of the run time
51196 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
51197 name, terminated by a colon. Here is a complete ACL section that contains just
51198 one very small ACL:
51199 </para>
51200 <literallayout class="monospaced">
51201 begin acl
51202 small_acl:
51203   accept   hosts = one.host.only
51204 </literallayout>
51205 <para>
51206 You can have as many lists as you like in the ACL section, and the order in
51207 which they appear does not matter. The lists are self-terminating.
51208 </para>
51209 <para>
51210 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
51211 certain SMTP commands. This applies both to incoming TCP/IP connections, and
51212 when a local process submits a message using SMTP by specifying the <option>-bs</option>
51213 option. The most common use is for controlling which recipients are accepted
51214 in incoming messages. In addition, you can define an ACL that is used to check
51215 local non-SMTP messages. The default configuration file contains an example of
51216 a realistic ACL for checking RCPT commands. This is discussed in chapter
51217 <xref linkend="CHAPdefconfil"/>.
51218 </para>
51219 <section id="SECID188">
51220 <title>Testing ACLs</title>
51221 <para>
51222 The <option>-bh</option> command line option provides a way of testing your ACL
51223 configuration locally by running a fake SMTP session with which you interact.
51224 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
51225 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
51226 </para>
51227 </section>
51228 <section id="SECID189">
51229 <title>Specifying when ACLs are used</title>
51230 <para>
51231 <indexterm role="concept">
51232 <primary>access control lists (ACLs)</primary>
51233 <secondary>options for specifying</secondary>
51234 </indexterm>
51235 In order to cause an ACL to be used, you have to name it in one of the relevant
51236 options in the main part of the configuration. These options are:
51237 <indexterm role="concept">
51238 <primary>AUTH</primary>
51239 <secondary>ACL for</secondary>
51240 </indexterm>
51241 <indexterm role="concept">
51242 <primary>DATA</primary>
51243 <secondary>ACLs for</secondary>
51244 </indexterm>
51245 <indexterm role="concept">
51246 <primary>ETRN</primary>
51247 <secondary>ACL for</secondary>
51248 </indexterm>
51249 <indexterm role="concept">
51250 <primary>EXPN</primary>
51251 <secondary>ACL for</secondary>
51252 </indexterm>
51253 <indexterm role="concept">
51254 <primary>HELO</primary>
51255 <secondary>ACL for</secondary>
51256 </indexterm>
51257 <indexterm role="concept">
51258 <primary>EHLO</primary>
51259 <secondary>ACL for</secondary>
51260 </indexterm>
51261 <indexterm role="concept">
51262 <primary>MAIL</primary>
51263 <secondary>ACL for</secondary>
51264 </indexterm>
51265 <indexterm role="concept">
51266 <primary>QUIT, ACL for</primary>
51267 </indexterm>
51268 <indexterm role="concept">
51269 <primary>RCPT</primary>
51270 <secondary>ACL for</secondary>
51271 </indexterm>
51272 <indexterm role="concept">
51273 <primary>STARTTLS, ACL for</primary>
51274 </indexterm>
51275 <indexterm role="concept">
51276 <primary>VRFY</primary>
51277 <secondary>ACL for</secondary>
51278 </indexterm>
51279 <indexterm role="concept">
51280 <primary>SMTP</primary>
51281 <secondary>connection, ACL for</secondary>
51282 </indexterm>
51283 <indexterm role="concept">
51284 <primary>non-SMTP messages</primary>
51285 <secondary>ACLs for</secondary>
51286 </indexterm>
51287 <indexterm role="concept">
51288 <primary>MIME content scanning</primary>
51289 <secondary>ACL for</secondary>
51290 </indexterm>
51291 <indexterm role="concept">
51292 <primary>PRDR</primary>
51293 <secondary>ACL for</secondary>
51294 </indexterm>
51295 </para>
51296 <informaltable frame="none">
51297 <tgroup cols="2" colsep="0" rowsep="0">
51298 <colspec colwidth="140pt" align="left"/>
51299 <colspec colwidth="254pt" align="left"/>
51300 <tbody>
51301 <row>
51302 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
51303 <entry>ACL for non-SMTP messages</entry>
51304 </row>
51305 <row>
51306 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
51307 <entry>ACL for non-SMTP MIME parts</entry>
51308 </row>
51309 <row>
51310 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
51311 <entry>ACL at start of non-SMTP message</entry>
51312 </row>
51313 <row>
51314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
51315 <entry>ACL for AUTH</entry>
51316 </row>
51317 <row>
51318 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
51319 <entry>ACL for start of SMTP connection</entry>
51320 </row>
51321 <row>
51322 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
51323 <entry>ACL after DATA is complete</entry>
51324 </row>
51325 <row>
51326 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
51327 <entry>ACL for each recipient, after DATA is complete</entry>
51328 </row>
51329 <row>
51330 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
51331 <entry>ACL for ETRN</entry>
51332 </row>
51333 <row>
51334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
51335 <entry>ACL for EXPN</entry>
51336 </row>
51337 <row>
51338 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
51339 <entry>ACL for HELO or EHLO</entry>
51340 </row>
51341 <row>
51342 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
51343 <entry>ACL for MAIL</entry>
51344 </row>
51345 <row>
51346 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
51347 <entry>ACL for the AUTH parameter of MAIL</entry>
51348 </row>
51349 <row>
51350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
51351 <entry>ACL for content-scanning MIME parts</entry>
51352 </row>
51353 <row>
51354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
51355 <entry>ACL for non-QUIT terminations</entry>
51356 </row>
51357 <row>
51358 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
51359 <entry>ACL at start of DATA command</entry>
51360 </row>
51361 <row>
51362 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
51363 <entry>ACL for QUIT</entry>
51364 </row>
51365 <row>
51366 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
51367 <entry>ACL for RCPT</entry>
51368 </row>
51369 <row>
51370 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
51371 <entry>ACL for STARTTLS</entry>
51372 </row>
51373 <row>
51374 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
51375 <entry>ACL for VRFY</entry>
51376 </row>
51377 </tbody>
51378 </tgroup>
51379 </informaltable>
51380 <para>
51381 For example, if you set
51382 </para>
51383 <literallayout class="monospaced">
51384 acl_smtp_rcpt = small_acl
51385 </literallayout>
51386 <para>
51387 the little ACL defined above is used whenever Exim receives a RCPT command
51388 in an SMTP dialogue. The majority of policy tests on incoming messages can be
51389 done when RCPT commands arrive. A rejection of RCPT should cause the
51390 sending MTA to give up on the recipient address contained in the RCPT
51391 command, whereas rejection at other times may cause the client MTA to keep on
51392 trying to deliver the message. It is therefore recommended that you do as much
51393 testing as possible at RCPT time.
51394 </para>
51395 </section>
51396 <section id="SECID190">
51397 <title>The non-SMTP ACLs</title>
51398 <para>
51399 <indexterm role="concept">
51400 <primary>non-SMTP messages</primary>
51401 <secondary>ACLs for</secondary>
51402 </indexterm>
51403 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
51404 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
51405 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
51406 the state of the SMTP connection such as encryption and authentication) are not
51407 relevant and are forbidden in these ACLs. However, the sender and recipients
51408 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
51409 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
51410 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
51411 in any of these ACLs.
51412 </para>
51413 <para>
51414 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
51415 non-SMTP message, before any of the message has been read. (This is the
51416 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
51417 batched SMTP input, it runs after the DATA command has been reached. The
51418 result of this ACL is ignored; it cannot be used to reject a message. If you
51419 really need to, you could set a value in an ACL variable here and reject based
51420 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
51421 controls, and in particular, it can be used to set
51422 </para>
51423 <literallayout class="monospaced">
51424 control = suppress_local_fixups
51425 </literallayout>
51426 <para>
51427 This cannot be used in the other non-SMTP ACLs because by the time they are
51428 run, it is too late.
51429 </para>
51430 <para>
51431 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
51432 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51433 </para>
51434 <para>
51435 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
51436 kind of rejection is treated as permanent, because there is no way of sending a
51437 temporary error for these kinds of message.
51438 </para>
51439 </section>
51440 <section id="SECID191">
51441 <title>The SMTP connect ACL</title>
51442 <para>
51443 <indexterm role="concept">
51444 <primary>SMTP</primary>
51445 <secondary>connection, ACL for</secondary>
51446 </indexterm>
51447 <indexterm role="option">
51448 <primary><option>smtp_banner</option></primary>
51449 </indexterm>
51450 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
51451 session, after the test specified by <option>host_reject_connection</option> (which is now
51452 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
51453 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
51454 the message override the banner message that is otherwise specified by the
51455 <option>smtp_banner</option> option.
51456 </para>
51457 </section>
51458 <section id="SECID192">
51459 <title>The EHLO/HELO ACL</title>
51460 <para>
51461 <indexterm role="concept">
51462 <primary>EHLO</primary>
51463 <secondary>ACL for</secondary>
51464 </indexterm>
51465 <indexterm role="concept">
51466 <primary>HELO</primary>
51467 <secondary>ACL for</secondary>
51468 </indexterm>
51469 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
51470 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
51471 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
51472 Note that a client may issue more than one EHLO or HELO command in an SMTP
51473 session, and indeed is required to issue a new EHLO or HELO after successfully
51474 setting up encryption following a STARTTLS command.
51475 </para>
51476 <para>
51477 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
51478 modifier, the message may not contain more than one line (it will be truncated
51479 at the first newline and a panic logged if it does). Such a message cannot
51480 affect the EHLO options that are listed on the second and subsequent lines of
51481 an EHLO response.
51482 </para>
51483 </section>
51484 <section id="SECID193">
51485 <title>The DATA ACLs</title>
51486 <para>
51487 <indexterm role="concept">
51488 <primary>DATA</primary>
51489 <secondary>ACLs for</secondary>
51490 </indexterm>
51491 Two ACLs are associated with the DATA command, because it is two-stage
51492 command, with two responses being sent to the client.
51493 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
51494 is obeyed. This gives you control after all the RCPT commands, but before
51495 the message itself is received. It offers the opportunity to give a negative
51496 response to the DATA command before the data is transmitted. Header lines
51497 added by MAIL or RCPT ACLs are not visible at this time, but any that
51498 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
51499 </para>
51500 <para>
51501 You cannot test the contents of the message, for example, to verify addresses
51502 in the headers, at RCPT time or when the DATA command is received. Such
51503 tests have to appear in the ACL that is run after the message itself has been
51504 received, before the final response to the DATA command is sent. This is
51505 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
51506 associated with the DATA command.
51507 </para>
51508 <para>
51509 For both of these ACLs, it is not possible to reject individual recipients. An
51510 error response rejects the entire message. Unfortunately, it is known that some
51511 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
51512 before or after the data) correctly &ndash; they keep the message on their queues
51513 and try again later, but that is their problem, though it does waste some of
51514 your resources.
51515 </para>
51516 <para>
51517 The <option>acl_smtp_data</option> ACL is run after
51518 the <option>acl_smtp_data_prdr</option>,
51519 the <option>acl_smtp_dkim</option>
51520 and the <option>acl_smtp_mime</option> ACLs.
51521 </para>
51522 </section>
51523 <section id="SECTDKIMACL">
51524 <title>The SMTP DKIM ACL</title>
51525 <para>
51526 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
51527 enabled (which is the default).
51528 </para>
51529 <para>
51530 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
51531 received, and is executed for each DKIM signature found in a message.  If not
51532 otherwise specified, the default action is to accept.
51533 </para>
51534 <para>
51535 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
51536 </para>
51537 <para>
51538 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
51539 </para>
51540 </section>
51541 <section id="SECID194">
51542 <title>The SMTP MIME ACL</title>
51543 <para>
51544 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
51545 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51546 </para>
51547 <para>
51548 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51549 </para>
51550 </section>
51551 <section id="SECTPRDRACL">
51552 <title>The SMTP PRDR ACL</title>
51553 <para>
51554 <indexterm role="option">
51555 <primary><option>prdr_enable</option></primary>
51556 </indexterm>
51557 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
51558 with PRDR support enabled (which is the default).
51559 It becomes active only when the PRDR feature is negotiated between
51560 client and server for a message, and more than one recipient
51561 has been accepted.
51562 </para>
51563 <para>
51564 The ACL test specfied by <option>acl_smtp_data_prdr</option> happens after a message
51565 has been recieved, and is executed for each recipient of the message.
51566 The test may accept or deny for inividual recipients.
51567 The <option>acl_smtp_data</option> will still be called after this ACL and
51568 can reject the message overall, even if this ACL has accepted it
51569 for some or all recipients.
51570 </para>
51571 <para>
51572 PRDR may be used to support per-user content filtering.  Without it
51573 one must defer any recipient after the first that has a different
51574 content-filter configuration.  With PRDR, the RCPT-time check
51575 for this can be disabled when the MAIL-time $smtp_command included
51576 "PRDR".  Any required difference in behaviour of the main DATA-time
51577 ACL should however depend on the PRDR-time ACL having run, as Exim
51578 will avoid doing so in some situations (eg.  single-recipient mails).
51579 </para>
51580 <para>
51581 See also the <option>prdr_enable</option> global option
51582 and the <option>hosts_try_prdr</option> smtp transport option.
51583 </para>
51584 <para>
51585 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51586 If the ACL is not defined, processing completes as if
51587 the feature was not requested by the client.
51588 </para>
51589 </section>
51590 <section id="SECTQUITACL">
51591 <title>The QUIT ACL</title>
51592 <para>
51593 <indexterm role="concept">
51594 <primary>QUIT, ACL for</primary>
51595 </indexterm>
51596 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
51597 does not affect the response code to QUIT, which is always 221. Thus, the ACL
51598 does not in fact control any access. For this reason, the only verbs that are
51599 permitted are <option>accept</option> and <option>warn</option>.
51600 </para>
51601 <para>
51602 This ACL can be used for tasks such as custom logging at the end of an SMTP
51603 session. For example, you can use ACL variables in other ACLs to count
51604 messages, recipients, etc., and log the totals at QUIT time using one or
51605 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
51606 </para>
51607 <para>
51608 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
51609 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
51610 </para>
51611 <para>
51612 You do not need to have a final <option>accept</option>, but if you do, you can use a
51613 <option>message</option> modifier to specify custom text that is sent as part of the 221
51614 response to QUIT.
51615 </para>
51616 <para>
51617 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
51618 failure (for example, failure to open a log file, or when Exim is bombing out
51619 because it has detected an unrecoverable error), all SMTP commands from the
51620 client are given temporary error responses until QUIT is received or the
51621 connection is closed. In these special cases, the QUIT ACL does not run.
51622 </para>
51623 </section>
51624 <section id="SECTNOTQUITACL">
51625 <title>The not-QUIT ACL</title>
51626 <para>
51627 <indexterm role="variable">
51628 <primary><varname>$acl_smtp_notquit</varname></primary>
51629 </indexterm>
51630 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
51631 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
51632 trouble, such as being unable to write to its log files, this ACL is not run,
51633 because it might try to do things (such as write to log files) that make the
51634 situation even worse.
51635 </para>
51636 <para>
51637 Like the QUIT ACL, this ACL is provided to make it possible to do customized
51638 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
51639 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
51640 and <option>warn</option>.
51641 </para>
51642 <para>
51643 <indexterm role="variable">
51644 <primary><varname>$smtp_notquit_reason</varname></primary>
51645 </indexterm>
51646 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
51647 to a string that indicates the reason for the termination of the SMTP
51648 connection. The possible values are:
51649 </para>
51650 <informaltable frame="none">
51651 <tgroup cols="2" colsep="0" rowsep="0">
51652 <colspec colwidth="196pt" align="left"/>
51653 <colspec colwidth="254pt" align="left"/>
51654 <tbody>
51655 <row>
51656 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
51657 <entry>Another ACL issued a <option>drop</option> command</entry>
51658 </row>
51659 <row>
51660 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
51661 <entry>Too many unknown or non-mail commands</entry>
51662 </row>
51663 <row>
51664 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
51665 <entry>Timeout while reading SMTP commands</entry>
51666 </row>
51667 <row>
51668 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
51669 <entry>The SMTP connection has been lost</entry>
51670 </row>
51671 <row>
51672 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
51673 <entry>Timeout while reading message data</entry>
51674 </row>
51675 <row>
51676 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
51677 <entry>The <function>local_scan()</function> function crashed</entry>
51678 </row>
51679 <row>
51680 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
51681 <entry>The <function>local_scan()</function> function timed out</entry>
51682 </row>
51683 <row>
51684 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
51685 <entry>SIGTERM or SIGINT</entry>
51686 </row>
51687 <row>
51688 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
51689 <entry>SMTP synchronization error</entry>
51690 </row>
51691 <row>
51692 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
51693 <entry>TLS failed to start</entry>
51694 </row>
51695 </tbody>
51696 </tgroup>
51697 </informaltable>
51698 <para>
51699 In most cases when an SMTP connection is closed without having received QUIT,
51700 Exim sends an SMTP response message before actually closing the connection.
51701 With the exception of the <literal>acl-drop</literal> case, the default message can be
51702 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
51703 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
51704 used.
51705 </para>
51706 </section>
51707 <section id="SECID195">
51708 <title>Finding an ACL to use</title>
51709 <para>
51710 <indexterm role="concept">
51711 <primary>access control lists (ACLs)</primary>
51712 <secondary>finding which to use</secondary>
51713 </indexterm>
51714 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
51715 you can use different ACLs in different circumstances. For example,
51716 </para>
51717 <literallayout class="monospaced">
51718 acl_smtp_rcpt = ${if ={25}{$interface_port} \
51719                      {acl_check_rcpt} {acl_check_rcpt_submit} }
51720 </literallayout>
51721 <para>
51722 In the default configuration file there are some example settings for
51723 providing an RFC 4409 message submission service on port 587 and a
51724 non-standard <quote>smtps</quote> service on port 465. You can use a string
51725 expansion like this to choose an ACL for MUAs on these ports which is
51726 more appropriate for this purpose than the default ACL on port 25.
51727 </para>
51728 <para>
51729 The expanded string does not have to be the name of an ACL in the
51730 configuration file; there are other possibilities. Having expanded the
51731 string, Exim searches for an ACL as follows:
51732 </para>
51733 <itemizedlist>
51734 <listitem>
51735 <para>
51736 If the string begins with a slash, Exim uses it as a file name, and reads its
51737 contents as an ACL. The lines are processed in the same way as lines in the
51738 Exim configuration file. In particular, continuation lines are supported, blank
51739 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
51740 If the file does not exist or cannot be read, an error occurs (typically
51741 causing a temporary failure of whatever caused the ACL to be run). For example:
51742 </para>
51743 <literallayout class="monospaced">
51744 acl_smtp_data = /etc/acls/\
51745   ${lookup{$sender_host_address}lsearch\
51746   {/etc/acllist}{$value}{default}}
51747 </literallayout>
51748 <para>
51749 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
51750 back to a default if the lookup fails. If an ACL is successfully read from a
51751 file, it is retained in memory for the duration of the Exim process, so that it
51752 can be re-used without having to re-read the file.
51753 </para>
51754 </listitem>
51755 <listitem>
51756 <para>
51757 If the string does not start with a slash, and does not contain any spaces,
51758 Exim searches the ACL section of the configuration for an ACL whose name
51759 matches the string.
51760 </para>
51761 </listitem>
51762 <listitem>
51763 <para>
51764 If no named ACL is found, or if the string contains spaces, Exim parses
51765 the string as an inline ACL. This can save typing in cases where you just
51766 want to have something like
51767 </para>
51768 <literallayout class="monospaced">
51769 acl_smtp_vrfy = accept
51770 </literallayout>
51771 <para>
51772 in order to allow free use of the VRFY command. Such a string may contain
51773 newlines; it is processed in the same way as an ACL that is read from a file.
51774 </para>
51775 </listitem>
51776 </itemizedlist>
51777 </section>
51778 <section id="SECID196">
51779 <title>ACL return codes</title>
51780 <para>
51781 <indexterm role="concept">
51782 <primary>access control lists (ACLs)</primary>
51783 <secondary>return codes</secondary>
51784 </indexterm>
51785 Except for the QUIT ACL, which does not affect the SMTP return code (see
51786 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
51787 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
51788 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
51789 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
51790 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
51791 This also causes a 4<emphasis>xx</emphasis> return code.
51792 </para>
51793 <para>
51794 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
51795 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
51796 submitters of non-SMTP messages.
51797 </para>
51798 <para>
51799 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
51800 has the effect of <quote>accept</quote>, but causes either the entire message or an
51801 individual recipient address to be discarded. In other words, it is a
51802 blackholing facility. Use it with care.
51803 </para>
51804 <para>
51805 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
51806 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
51807 RCPT ACL is to discard just the one recipient address. If there are no
51808 recipients left when the message&#x2019;s data is received, the DATA ACL is not
51809 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
51810 remaining recipients. The <quote>discard</quote> return is not permitted for the
51811 <option>acl_smtp_predata</option> ACL.
51812 </para>
51813 <para>
51814 <indexterm role="concept">
51815 <primary><function>local_scan()</function> function</primary>
51816 <secondary>when all recipients discarded</secondary>
51817 </indexterm>
51818 The <function>local_scan()</function> function is always run, even if there are no remaining
51819 recipients; it may create new recipients.
51820 </para>
51821 </section>
51822 <section id="SECID197">
51823 <title>Unset ACL options</title>
51824 <para>
51825 <indexterm role="concept">
51826 <primary>access control lists (ACLs)</primary>
51827 <secondary>unset options</secondary>
51828 </indexterm>
51829 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
51830 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
51831 not defined at all. For any defined ACL, the default action when control
51832 reaches the end of the ACL statements is <quote>deny</quote>.
51833 </para>
51834 <para>
51835 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
51836 these two are ACLs that are used only for their side effects. They cannot be
51837 used to accept or reject anything.
51838 </para>
51839 <para>
51840 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
51841 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
51842 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
51843 when the ACL is not defined is <quote>accept</quote>.
51844 </para>
51845 <para>
51846 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
51847 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
51848 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
51849 messages over an SMTP connection. For an example, see the ACL in the default
51850 configuration file.
51851 </para>
51852 </section>
51853 <section id="SECID198">
51854 <title>Data for message ACLs</title>
51855 <para>
51856 <indexterm role="concept">
51857 <primary>access control lists (ACLs)</primary>
51858 <secondary>data for message ACL</secondary>
51859 </indexterm>
51860 <indexterm role="variable">
51861 <primary><varname>$domain</varname></primary>
51862 </indexterm>
51863 <indexterm role="variable">
51864 <primary><varname>$local_part</varname></primary>
51865 </indexterm>
51866 <indexterm role="variable">
51867 <primary><varname>$sender_address</varname></primary>
51868 </indexterm>
51869 <indexterm role="variable">
51870 <primary><varname>$sender_host_address</varname></primary>
51871 </indexterm>
51872 <indexterm role="variable">
51873 <primary><varname>$smtp_command</varname></primary>
51874 </indexterm>
51875 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
51876 that contain information about the host and the message&#x2019;s sender (for example,
51877 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
51878 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
51879 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
51880 is available in <varname>$smtp_command</varname>.
51881 </para>
51882 <para>
51883 When an ACL for the AUTH parameter of MAIL is running, the variables that
51884 contain information about the host are set, but <varname>$sender_address</varname> is not yet
51885 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
51886 how it is used.
51887 </para>
51888 <para>
51889 <indexterm role="variable">
51890 <primary><varname>$message_size</varname></primary>
51891 </indexterm>
51892 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
51893 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
51894 that parameter is not given. The value is updated to the true message size by
51895 the time the final DATA ACL is run (after the message data has been
51896 received).
51897 </para>
51898 <para>
51899 <indexterm role="variable">
51900 <primary><varname>$rcpt_count</varname></primary>
51901 </indexterm>
51902 <indexterm role="variable">
51903 <primary><varname>$recipients_count</varname></primary>
51904 </indexterm>
51905 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
51906 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
51907 accepted, so while an ACL for RCPT is being processed, it contains the number
51908 of previously accepted recipients. At DATA time (for both the DATA ACLs),
51909 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
51910 <varname>$recipients_count</varname> contains the total number of accepted recipients.
51911 </para>
51912 </section>
51913 <section id="SECTdatfornon">
51914 <title>Data for non-message ACLs</title>
51915 <para>
51916 <indexterm role="concept">
51917 <primary>access control lists (ACLs)</primary>
51918 <secondary>data for non-message ACL</secondary>
51919 </indexterm>
51920 <indexterm role="variable">
51921 <primary><varname>$smtp_command_argument</varname></primary>
51922 </indexterm>
51923 <indexterm role="variable">
51924 <primary><varname>$smtp_command</varname></primary>
51925 </indexterm>
51926 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
51927 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
51928 and the entire SMTP command is available in <varname>$smtp_command</varname>.
51929 These variables can be tested using a <option>condition</option> condition. For example,
51930 here is an ACL for use with AUTH, which insists that either the session is
51931 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
51932 does not permit authentication methods that use cleartext passwords on
51933 unencrypted connections.
51934 </para>
51935 <literallayout class="monospaced">
51936 acl_check_auth:
51937   accept encrypted = *
51938   accept condition = ${if eq{${uc:$smtp_command_argument}}\
51939                      {CRAM-MD5}}
51940   deny   message   = TLS encryption or CRAM-MD5 required
51941 </literallayout>
51942 <para>
51943 (Another way of applying this restriction is to arrange for the authenticators
51944 that use cleartext passwords not to be advertised when the connection is not
51945 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
51946 option to do this.)
51947 </para>
51948 </section>
51949 <section id="SECID199">
51950 <title>Format of an ACL</title>
51951 <para>
51952 <indexterm role="concept">
51953 <primary>access control lists (ACLs)</primary>
51954 <secondary>format of</secondary>
51955 </indexterm>
51956 <indexterm role="concept">
51957 <primary>access control lists (ACLs)</primary>
51958 <secondary>verbs, definition of</secondary>
51959 </indexterm>
51960 An individual ACL consists of a number of statements. Each statement starts
51961 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
51962 Modifiers can change the way the verb operates, define error and log messages,
51963 set variables, insert delays, and vary the processing of accepted messages.
51964 </para>
51965 <para>
51966 If all the conditions are met, the verb is obeyed. The same condition may be
51967 used (with different arguments) more than once in the same statement. This
51968 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
51969 example:
51970 </para>
51971 <literallayout class="monospaced">
51972 deny  dnslists = list1.example
51973 dnslists = list2.example
51974 </literallayout>
51975 <para>
51976 If there are no conditions, the verb is always obeyed. Exim stops evaluating
51977 the conditions and modifiers when it reaches a condition that fails. What
51978 happens then depends on the verb (and in one case, on a special modifier). Not
51979 all the conditions make sense at every testing point. For example, you cannot
51980 test a sender address in the ACL that is run for a VRFY command.
51981 </para>
51982 </section>
51983 <section id="SECID200">
51984 <title>ACL verbs</title>
51985 <para>
51986 The ACL verbs are as follows:
51987 </para>
51988 <itemizedlist>
51989 <listitem>
51990 <para>
51991 <indexterm role="concept">
51992 <primary><option>accept</option> ACL verb</primary>
51993 </indexterm>
51994 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
51995 of the conditions are not met, what happens depends on whether <option>endpass</option>
51996 appears among the conditions (for syntax see below). If the failing condition
51997 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
51998 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
51999 check a RCPT command:
52000 </para>
52001 <literallayout class="monospaced">
52002 accept domains = +local_domains
52003 endpass
52004 verify = recipient
52005 </literallayout>
52006 <para>
52007 If the recipient domain does not match the <option>domains</option> condition, control
52008 passes to the next statement. If it does match, the recipient is verified, and
52009 the command is accepted if verification succeeds. However, if verification
52010 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
52011 <option>endpass</option>.
52012 </para>
52013 <para>
52014 The <option>endpass</option> feature has turned out to be confusing to many people, so its
52015 use is not recommended nowadays. It is always possible to rewrite an ACL so
52016 that <option>endpass</option> is not needed, and it is no longer used in the default
52017 configuration.
52018 </para>
52019 <para>
52020 <indexterm role="concept">
52021 <primary><option>message</option> ACL modifier</primary>
52022 <secondary>with <option>accept</option></secondary>
52023 </indexterm>
52024 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
52025 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
52026 (when an <option>accept</option> verb either accepts or passes control to the next
52027 statement), <option>message</option> can be used to vary the message that is sent when an
52028 SMTP command is accepted. For example, in a RCPT ACL you could have:
52029 </para>
52030 <literallayout>
52031 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52032 <literal>        message = OK, I will allow you through today</literal>
52033 </literallayout>
52034 <para>
52035 You can specify an SMTP response code, optionally followed by an <quote>extended
52036 response code</quote> at the start of the message, but the first digit must be the
52037 same as would be sent by default, which is 2 for an <option>accept</option> verb.
52038 </para>
52039 <para>
52040 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
52041 an error message that is used when access is denied. This behaviour is retained
52042 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
52043 of <option>endpass</option>.
52044 </para>
52045 </listitem>
52046 <listitem>
52047 <para>
52048 <indexterm role="concept">
52049 <primary><option>defer</option> ACL verb</primary>
52050 </indexterm>
52051 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
52052 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
52053 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
52054 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
52055 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
52056 be used in any ACL, and even for a recipient it might be a simpler approach.
52057 </para>
52058 </listitem>
52059 <listitem>
52060 <para>
52061 <indexterm role="concept">
52062 <primary><option>deny</option> ACL verb</primary>
52063 </indexterm>
52064 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
52065 the conditions are not met, control is passed to the next ACL statement. For
52066 example,
52067 </para>
52068 <literallayout class="monospaced">
52069 deny dnslists = blackholes.mail-abuse.org
52070 </literallayout>
52071 <para>
52072 rejects commands from hosts that are on a DNS black list.
52073 </para>
52074 </listitem>
52075 <listitem>
52076 <para>
52077 <indexterm role="concept">
52078 <primary><option>discard</option> ACL verb</primary>
52079 </indexterm>
52080 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
52081 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
52082 that are concerned with receiving messages. When all the conditions are true,
52083 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
52084 recipients to be discarded. If it is used in an ACL for RCPT, just the one
52085 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
52086 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
52087 do not appear in the log line when the <option>received_recipients</option> log selector is set.
52088 </para>
52089 <para>
52090 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
52091 its contents are added to the line that is automatically written to the log.
52092 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
52093 </para>
52094 </listitem>
52095 <listitem>
52096 <para>
52097 <indexterm role="concept">
52098 <primary><option>drop</option> ACL verb</primary>
52099 </indexterm>
52100 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
52101 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
52102 </para>
52103 <literallayout class="monospaced">
52104 drop   message   = I don't take more than 20 RCPTs
52105        condition = ${if &gt; {$rcpt_count}{20}}
52106 </literallayout>
52107 <para>
52108 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
52109 The connection is always dropped after sending a 550 response.
52110 </para>
52111 </listitem>
52112 <listitem>
52113 <para>
52114 <indexterm role="concept">
52115 <primary><option>require</option> ACL verb</primary>
52116 </indexterm>
52117 <option>require</option>: If all the conditions are met, control is passed to the next ACL
52118 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
52119 example, when checking a RCPT command,
52120 </para>
52121 <literallayout class="monospaced">
52122 require message = Sender did not verify
52123         verify  = sender
52124 </literallayout>
52125 <para>
52126 passes control to subsequent statements only if the message&#x2019;s sender can be
52127 verified. Otherwise, it rejects the command. Note the positioning of the
52128 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
52129 discussed in section <xref linkend="SECTcondmodproc"/>.
52130 </para>
52131 </listitem>
52132 <listitem>
52133 <para>
52134 <indexterm role="concept">
52135 <primary><option>warn</option> ACL verb</primary>
52136 </indexterm>
52137 <option>warn</option>: If all the conditions are true, a line specified by the
52138 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
52139 to the next ACL statement. If any condition is false, the log line is not
52140 written. If an identical log line is requested several times in the same
52141 message, only one copy is actually written to the log. If you want to force
52142 duplicates to be written, use the <option>logwrite</option> modifier instead.
52143 </para>
52144 <para>
52145 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
52146 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
52147 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
52148 first failing condition. There is more about adding header lines in section
52149 <xref linkend="SECTaddheadacl"/>.
52150 </para>
52151 <para>
52152 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
52153 some sort of defer), the log line specified by <option>log_message</option> is not written.
52154 This does not include the case of a forced failure from a lookup, which
52155 is considered to be a successful completion. After a defer, no further
52156 conditions or modifiers in the <option>warn</option> statement are processed. The incident
52157 is logged, and the ACL continues to be processed, from the next statement
52158 onwards.
52159 </para>
52160 <para>
52161 <indexterm role="variable">
52162 <primary><varname>$acl_verify_message</varname></primary>
52163 </indexterm>
52164 When one of the <option>warn</option> conditions is an address verification that fails, the
52165 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
52166 want this logged, you must set it up explicitly. For example:
52167 </para>
52168 <literallayout class="monospaced">
52169 warn   !verify = sender
52170        log_message = sender verify failed: $acl_verify_message
52171 </literallayout>
52172 </listitem>
52173 </itemizedlist>
52174 <para>
52175 At the end of each ACL there is an implicit unconditional <option>deny</option>.
52176 </para>
52177 <para>
52178 As you can see from the examples above, the conditions and modifiers are
52179 written one to a line, with the first one on the same line as the verb, and
52180 subsequent ones on following lines. If you have a very long condition, you can
52181 continue it onto several physical lines by the usual backslash continuation
52182 mechanism. It is conventional to align the conditions vertically.
52183 </para>
52184 </section>
52185 <section id="SECTaclvariables">
52186 <title>ACL variables</title>
52187 <para>
52188 <indexterm role="concept">
52189 <primary>access control lists (ACLs)</primary>
52190 <secondary>variables</secondary>
52191 </indexterm>
52192 There are some special variables that can be set during ACL processing. They
52193 can be used to pass information between different ACLs, different invocations
52194 of the same ACL in the same SMTP connection, and between ACLs and the routers,
52195 transports, and filters that are used to deliver a message. The names of these
52196 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
52197 an underscore, but the remainder of the name can be any sequence of
52198 alphanumeric characters and underscores that you choose. There is no limit on
52199 the number of ACL variables. The two sets act as follows:
52200 </para>
52201 <itemizedlist>
52202 <listitem>
52203 <para>
52204 The values of those variables whose names begin with <varname>$acl_c</varname> persist
52205 throughout an SMTP connection. They are never reset. Thus, a value that is set
52206 while receiving one message is still available when receiving the next message
52207 on the same SMTP connection.
52208 </para>
52209 </listitem>
52210 <listitem>
52211 <para>
52212 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
52213 while a message is being received. They are reset afterwards. They are also
52214 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
52215 </para>
52216 </listitem>
52217 </itemizedlist>
52218 <para>
52219 When a message is accepted, the current values of all the ACL variables are
52220 preserved with the message and are subsequently made available at delivery
52221 time. The ACL variables are set by a modifier called <option>set</option>. For example:
52222 </para>
52223 <literallayout class="monospaced">
52224 accept hosts = whatever
52225        set acl_m4 = some value
52226 accept authenticated = *
52227        set acl_c_auth = yes
52228 </literallayout>
52229 <para>
52230 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
52231 be set. If you want to set a variable without taking any action, you can use a
52232 <option>warn</option> verb without any other modifiers or conditions.
52233 </para>
52234 <para>
52235 <indexterm role="option">
52236 <primary><option>strict_acl_vars</option></primary>
52237 </indexterm>
52238 What happens if a syntactically valid but undefined ACL variable is
52239 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
52240 false (the default), an empty string is substituted; if it is true, an
52241 error is generated.
52242 </para>
52243 <para>
52244 Versions of Exim before 4.64 have a limited set of numbered variables, but
52245 their names are compatible, so there is no problem with upgrading.
52246 </para>
52247 </section>
52248 <section id="SECTcondmodproc">
52249 <title>Condition and modifier processing</title>
52250 <para>
52251 <indexterm role="concept">
52252 <primary>access control lists (ACLs)</primary>
52253 <secondary>conditions; processing</secondary>
52254 </indexterm>
52255 <indexterm role="concept">
52256 <primary>access control lists (ACLs)</primary>
52257 <secondary>modifiers; processing</secondary>
52258 </indexterm>
52259 An exclamation mark preceding a condition negates its result. For example:
52260 </para>
52261 <literallayout class="monospaced">
52262 deny   domains = *.dom.example
52263       !verify  = recipient
52264 </literallayout>
52265 <para>
52266 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
52267 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
52268 negation can be used on the right-hand side of a condition. For example, these
52269 two statements are equivalent:
52270 </para>
52271 <literallayout class="monospaced">
52272 deny  hosts = !192.168.3.4
52273 deny !hosts =  192.168.3.4
52274 </literallayout>
52275 <para>
52276 However, for many conditions (<option>verify</option> being a good example), only left-hand
52277 side negation of the whole condition is possible.
52278 </para>
52279 <para>
52280 The arguments of conditions and modifiers are expanded. A forced failure
52281 of an expansion causes a condition to be ignored, that is, it behaves as if the
52282 condition is true. Consider these two statements:
52283 </para>
52284 <literallayout class="monospaced">
52285 accept  senders = ${lookup{$host_name}lsearch\
52286                   {/some/file}{$value}fail}
52287 accept  senders = ${lookup{$host_name}lsearch\
52288                   {/some/file}{$value}{}}
52289 </literallayout>
52290 <para>
52291 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
52292 the returned list is searched, but if the lookup fails the behaviour is
52293 different in the two cases. The <option>fail</option> in the first statement causes the
52294 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
52295 therefore succeeds. The second statement, however, generates an empty list when
52296 the lookup fails. No sender can match an empty list, so the condition fails,
52297 and therefore the <option>accept</option> also fails.
52298 </para>
52299 <para>
52300 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
52301 specify actions that are taken as the conditions for a statement are checked;
52302 others specify text for messages that are used when access is denied or a
52303 warning is generated. The <option>control</option> modifier affects the way an incoming
52304 message is handled.
52305 </para>
52306 <para>
52307 The positioning of the modifiers in an ACL statement is important, because the
52308 processing of a verb ceases as soon as its outcome is known. Only those
52309 modifiers that have already been encountered will take effect. For example,
52310 consider this use of the <option>message</option> modifier:
52311 </para>
52312 <literallayout class="monospaced">
52313 require message = Can't verify sender
52314         verify  = sender
52315         message = Can't verify recipient
52316         verify  = recipient
52317         message = This message cannot be used
52318 </literallayout>
52319 <para>
52320 If sender verification fails, Exim knows that the result of the statement is
52321 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
52322 so its text is used as the error message. If sender verification succeeds, but
52323 recipient verification fails, the second message is used. If recipient
52324 verification succeeds, the third message becomes <quote>current</quote>, but is never used
52325 because there are no more conditions to cause failure.
52326 </para>
52327 <para>
52328 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
52329 modifier that is used, because all the conditions must be true for rejection to
52330 happen. Specifying more than one <option>message</option> modifier does not make sense, and
52331 the message can even be specified after all the conditions. For example:
52332 </para>
52333 <literallayout class="monospaced">
52334 deny   hosts = ...
52335       !senders = *@my.domain.example
52336        message = Invalid sender from client host
52337 </literallayout>
52338 <para>
52339 The <quote>deny</quote> result does not happen until the end of the statement is reached,
52340 by which time Exim has set up the message.
52341 </para>
52342 </section>
52343 <section id="SECTACLmodi">
52344 <title>ACL modifiers</title>
52345 <para>
52346 <indexterm role="concept">
52347 <primary>access control lists (ACLs)</primary>
52348 <secondary>modifiers; list of</secondary>
52349 </indexterm>
52350 The ACL modifiers are as follows:
52351 </para>
52352 <variablelist>
52353 <varlistentry>
52354 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52355 <listitem>
52356 <para>
52357 This modifier specifies one or more header lines that are to be added to an
52358 incoming message, assuming, of course, that the message is ultimately
52359 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
52360 </para>
52361 </listitem></varlistentry>
52362 <varlistentry>
52363 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52364 <listitem>
52365 <para>
52366 <indexterm role="concept">
52367 <primary><option>continue</option> ACL modifier</primary>
52368 </indexterm>
52369 <indexterm role="concept">
52370 <primary>database</primary>
52371 <secondary>updating in ACL</secondary>
52372 </indexterm>
52373 This modifier does nothing of itself, and processing of the ACL always
52374 continues with the next condition or modifier. The value of <option>continue</option> is in
52375 the side effects of expanding its argument. Typically this could be used to
52376 update a database. It is really just a syntactic tidiness, to avoid having to
52377 write rather ugly lines like this:
52378 </para>
52379 <literallayout>
52380 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
52381 </literallayout>
52382 <para>
52383 Instead, all you need is
52384 </para>
52385 <literallayout>
52386 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
52387 </literallayout>
52388 </listitem></varlistentry>
52389 <varlistentry>
52390 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52391 <listitem>
52392 <para>
52393 <indexterm role="concept">
52394 <primary><option>control</option> ACL modifier</primary>
52395 </indexterm>
52396 This modifier affects the subsequent processing of the SMTP connection or of an
52397 incoming message that is accepted. The effect of the first type of control
52398 lasts for the duration of the connection, whereas the effect of the second type
52399 lasts only until the current message has been received. The message-specific
52400 controls always apply to the whole message, not to individual recipients,
52401 even if the <option>control</option> modifier appears in a RCPT ACL.
52402 </para>
52403 <para>
52404 As there are now quite a few controls that can be applied, they are described
52405 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
52406 in several different ways. For example:
52407 </para>
52408 <itemizedlist>
52409 <listitem>
52410 <para>
52411 It can be at the end of an <option>accept</option> statement:
52412 </para>
52413 <literallayout class="monospaced">
52414     accept  ...some conditions
52415             control = queue_only
52416 </literallayout>
52417 <para>
52418 In this case, the control is applied when this statement yields <quote>accept</quote>, in
52419 other words, when the conditions are all true.
52420 </para>
52421 </listitem>
52422 <listitem>
52423 <para>
52424 It can be in the middle of an <option>accept</option> statement:
52425 </para>
52426 <literallayout class="monospaced">
52427     accept  ...some conditions...
52428             control = queue_only
52429             ...some more conditions...
52430 </literallayout>
52431 <para>
52432 If the first set of conditions are true, the control is applied, even if the
52433 statement does not accept because one of the second set of conditions is false.
52434 In this case, some subsequent statement must yield <quote>accept</quote> for the control
52435 to be relevant.
52436 </para>
52437 </listitem>
52438 <listitem>
52439 <para>
52440 It can be used with <option>warn</option> to apply the control, leaving the
52441 decision about accepting or denying to a subsequent verb. For
52442 example:
52443 </para>
52444 <literallayout class="monospaced">
52445     warn    ...some conditions...
52446             control = freeze
52447     accept  ...
52448 </literallayout>
52449 <para>
52450 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
52451 <option>logwrite</option>, so it does not add anything to the message and does not write a
52452 log entry.
52453 </para>
52454 </listitem>
52455 <listitem>
52456 <para>
52457 If you want to apply a control unconditionally, you can use it with a
52458 <option>require</option> verb. For example:
52459 </para>
52460 <literallayout class="monospaced">
52461     require  control = no_multiline_responses
52462 </literallayout>
52463 </listitem>
52464 </itemizedlist>
52465 </listitem></varlistentry>
52466 <varlistentry>
52467 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
52468 <listitem>
52469 <para>
52470 <indexterm role="concept">
52471 <primary><option>delay</option> ACL modifier</primary>
52472 </indexterm>
52473 <indexterm role="option">
52474 <primary><option>-bh</option></primary>
52475 </indexterm>
52476 This modifier may appear in any ACL except notquit. It causes Exim to wait for
52477 the time interval before proceeding. However, when testing Exim using the
52478 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
52479 output instead). The time is given in the usual Exim notation, and the delay
52480 happens as soon as the modifier is processed. In an SMTP session, pending
52481 output is flushed before the delay is imposed.
52482 </para>
52483 <para>
52484 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
52485 example:
52486 </para>
52487 <literallayout class="monospaced">
52488 deny    ...some conditions...
52489         delay = 30s
52490 </literallayout>
52491 <para>
52492 The delay happens if all the conditions are true, before the statement returns
52493 <quote>deny</quote>. Compare this with:
52494 </para>
52495 <literallayout class="monospaced">
52496 deny    delay = 30s
52497         ...some conditions...
52498 </literallayout>
52499 <para>
52500 which waits for 30s before processing the conditions. The <option>delay</option> modifier
52501 can also be used with <option>warn</option> and together with <option>control</option>:
52502 </para>
52503 <literallayout class="monospaced">
52504 warn    ...some conditions...
52505         delay = 2m
52506         control = freeze
52507 accept  ...
52508 </literallayout>
52509 <para>
52510 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
52511 responses to several commands are no longer buffered and sent in one packet (as
52512 they would normally be) because all output is flushed before imposing the
52513 delay. This optimization is disabled so that a number of small delays do not
52514 appear to the client as one large aggregated delay that might provoke an
52515 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
52516 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
52517 </para>
52518 </listitem></varlistentry>
52519 <varlistentry>
52520 <term><emphasis role="bold">endpass</emphasis></term>
52521 <listitem>
52522 <para>
52523 <indexterm role="concept">
52524 <primary><option>endpass</option> ACL modifier</primary>
52525 </indexterm>
52526 This modifier, which has no argument, is recognized only in <option>accept</option> and
52527 <option>discard</option> statements. It marks the boundary between the conditions whose
52528 failure causes control to pass to the next statement, and the conditions whose
52529 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
52530 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
52531 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
52532 </para>
52533 </listitem></varlistentry>
52534 <varlistentry>
52535 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52536 <listitem>
52537 <para>
52538 <indexterm role="concept">
52539 <primary><option>log_message</option> ACL modifier</primary>
52540 </indexterm>
52541 This modifier sets up a message that is used as part of the log message if the
52542 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
52543 </para>
52544 <literallayout class="monospaced">
52545 require log_message = wrong cipher suite $tls_in_cipher
52546         encrypted   = DES-CBC3-SHA
52547 </literallayout>
52548 <para>
52549 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
52550 example:
52551 </para>
52552 <literallayout>
52553 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52554 <literal>        log_message = Discarded $local_part@$domain because...</literal>
52555 </literallayout>
52556 <para>
52557 When access is denied, <option>log_message</option> adds to any underlying error message
52558 that may exist because of a condition failure. For example, while verifying a
52559 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
52560 message.
52561 </para>
52562 <para>
52563 The message may be defined before the conditions to which it applies, because
52564 the string expansion does not happen until Exim decides that access is to be
52565 denied. This means that any variables that are set by the condition are
52566 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
52567 variables are set after a DNS black list lookup succeeds. If the expansion of
52568 <option>log_message</option> fails, or if the result is an empty string, the modifier is
52569 ignored.
52570 </para>
52571 <para>
52572 <indexterm role="variable">
52573 <primary><varname>$acl_verify_message</varname></primary>
52574 </indexterm>
52575 If you want to use a <option>warn</option> statement to log the result of an address
52576 verification, you can use <varname>$acl_verify_message</varname> to include the verification
52577 error message.
52578 </para>
52579 <para>
52580 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
52581 the start of the logged message. If the same warning log message is requested
52582 more than once while receiving  a single email message, only one copy is
52583 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
52584 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
52585 is logged for a successful <option>warn</option> statement.
52586 </para>
52587 <para>
52588 If <option>log_message</option> is not present and there is no underlying error message (for
52589 example, from the failure of address verification), but <option>message</option> is present,
52590 the <option>message</option> text is used for logging rejections. However, if any text for
52591 logging contains newlines, only the first line is logged. In the absence of
52592 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
52593 logging rejections.
52594 </para>
52595 </listitem></varlistentry>
52596 <varlistentry>
52597 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
52598 <listitem>
52599 <para>
52600 <indexterm role="concept">
52601 <primary><option>log_reject_target</option> ACL modifier</primary>
52602 </indexterm>
52603 <indexterm role="concept">
52604 <primary>logging in ACL</primary>
52605 <secondary>specifying which log</secondary>
52606 </indexterm>
52607 This modifier makes it possible to specify which logs are used for messages
52608 about ACL rejections. Its argument is a colon-separated list of words that can
52609 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
52610 may be empty, in which case a rejection is not logged at all. For example, this
52611 ACL fragment writes no logging information when access is denied:
52612 </para>
52613 <literallayout>
52614 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52615 <literal>     log_reject_target =</literal>
52616 </literallayout>
52617 <para>
52618 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
52619 permanent and temporary rejections. Its effect lasts for the rest of the
52620 current ACL.
52621 </para>
52622 </listitem></varlistentry>
52623 <varlistentry>
52624 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52625 <listitem>
52626 <para>
52627 <indexterm role="concept">
52628 <primary><option>logwrite</option> ACL modifier</primary>
52629 </indexterm>
52630 <indexterm role="concept">
52631 <primary>logging in ACL</primary>
52632 <secondary>immediate</secondary>
52633 </indexterm>
52634 This modifier writes a message to a log file as soon as it is encountered when
52635 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
52636 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
52637 access.) The <option>logwrite</option> modifier can be used to log special incidents in
52638 ACLs. For example:
52639 </para>
52640 <literallayout>
52641 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
52642 <literal>       control  = freeze</literal>
52643 <literal>       logwrite = froze message because ...</literal>
52644 </literallayout>
52645 <para>
52646 By default, the message is written to the main log. However, it may begin
52647 with a colon, followed by a comma-separated list of log names, and then
52648 another colon, to specify exactly which logs are to be written. For
52649 example:
52650 </para>
52651 <literallayout class="monospaced">
52652 logwrite = :main,reject: text for main and reject logs
52653 logwrite = :panic: text for panic log only
52654 </literallayout>
52655 </listitem></varlistentry>
52656 <varlistentry>
52657 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52658 <listitem>
52659 <para>
52660 <indexterm role="concept">
52661 <primary><option>message</option> ACL modifier</primary>
52662 </indexterm>
52663 This modifier sets up a text string that is expanded and used as a response
52664 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
52665 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
52666 there is some complication if <option>endpass</option> is involved; see the description of
52667 <option>accept</option> for details.)
52668 </para>
52669 <para>
52670 The expansion of the message happens at the time Exim decides that the ACL is
52671 to end, not at the time it processes <option>message</option>. If the expansion fails, or
52672 generates an empty string, the modifier is ignored. Here is an example where
52673 <option>message</option> must be specified first, because the ACL ends with a rejection if
52674 the <option>hosts</option> condition fails:
52675 </para>
52676 <literallayout class="monospaced">
52677 require  message = Host not recognized
52678          hosts = 10.0.0.0/8
52679 </literallayout>
52680 <para>
52681 (Once a condition has failed, no further conditions or modifiers are
52682 processed.)
52683 </para>
52684 <para>
52685 <indexterm role="concept">
52686 <primary>SMTP</primary>
52687 <secondary>error codes</secondary>
52688 </indexterm>
52689 <indexterm role="option">
52690 <primary><option>smtp_banner</option></primary>
52691 </indexterm>
52692 For ACLs that are triggered by SMTP commands, the message is returned as part
52693 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
52694 is meaningful only for SMTP, as no message is returned when a non-SMTP message
52695 is accepted. In the case of the connect ACL, accepting with a message modifier
52696 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
52697 accept message may not contain more than one line (otherwise it will be
52698 truncated at the first newline and a panic logged), and it cannot affect the
52699 EHLO options.
52700 </para>
52701 <para>
52702 When SMTP is involved, the message may begin with an overriding response code,
52703 consisting of three digits optionally followed by an <quote>extended response code</quote>
52704 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
52705 </para>
52706 <literallayout class="monospaced">
52707 deny  message = 599 1.2.3 Host not welcome
52708       hosts = 192.168.34.0/24
52709 </literallayout>
52710 <para>
52711 The first digit of the supplied response code must be the same as would be sent
52712 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
52713 access, but for the predata ACL, note that the default success code is 354, not
52714 2<emphasis>xx</emphasis>.
52715 </para>
52716 <para>
52717 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
52718 the message modifier cannot override the 221 response code.
52719 </para>
52720 <para>
52721 The text in a <option>message</option> modifier is literal; any quotes are taken as
52722 literals, but because the string is expanded, backslash escapes are processed
52723 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
52724 response.
52725 </para>
52726 <para>
52727 <indexterm role="variable">
52728 <primary><varname>$acl_verify_message</varname></primary>
52729 </indexterm>
52730 If <option>message</option> is used on a statement that verifies an address, the message
52731 specified overrides any message that is generated by the verification process.
52732 However, the original message is available in the variable
52733 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
52734 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
52735 routers to be passed back as part of the SMTP response, you should either not
52736 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
52737 </para>
52738 <para>
52739 For compatibility with previous releases of Exim, a <option>message</option> modifier that
52740 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
52741 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
52742 all the conditions are true, wherever it appears in an ACL command, whereas
52743 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
52744 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
52745 effect.
52746 </para>
52747 </listitem></varlistentry>
52748 <varlistentry>
52749 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52750 <listitem>
52751 <para>
52752 This modifier specifies one or more header names in a colon-separated list
52753  that are to be removed from an incoming message, assuming, of course, that
52754 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
52755 </para>
52756 </listitem></varlistentry>
52757 <varlistentry>
52758 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
52759 <listitem>
52760 <para>
52761 <indexterm role="concept">
52762 <primary><option>set</option> ACL modifier</primary>
52763 </indexterm>
52764 This modifier puts a value into one of the ACL variables (see section
52765 <xref linkend="SECTaclvariables"/>).
52766 </para>
52767 </listitem></varlistentry>
52768 <varlistentry>
52769 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
52770 <listitem>
52771 <para>
52772 This modifier sends a UDP packet, for purposes such as statistics
52773 collection or behaviour monitoring. The parameters are expanded, and
52774 the result of the expansion must be a colon-separated list consisting
52775 of a destination server, port number, and the packet contents. The
52776 server can be specified as a host name or IPv4 or IPv6 address. The
52777 separator can be changed with the usual angle bracket syntax. For
52778 example, you might want to collect information on which hosts connect
52779 when:
52780 </para>
52781 <literallayout class="monospaced">
52782 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
52783              $tod_zulu $sender_host_address
52784 </literallayout>
52785 </listitem></varlistentry>
52786 </variablelist>
52787 </section>
52788 <section id="SECTcontrols">
52789 <title>Use of the control modifier</title>
52790 <para>
52791 <indexterm role="concept">
52792 <primary><option>control</option> ACL modifier</primary>
52793 </indexterm>
52794 The <option>control</option> modifier supports the following settings:
52795 </para>
52796 <variablelist>
52797 <varlistentry>
52798 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
52799 <listitem>
52800 <para>
52801 This modifier allows a client host to use the SMTP AUTH command even when it
52802 has not been advertised in response to EHLO. Furthermore, because there are
52803 apparently some really broken clients that do this, Exim will accept AUTH after
52804 HELO (rather than EHLO) when this control is set. It should be used only if you
52805 really need it, and you should limit its use to those broken clients that do
52806 not work without it. For example:
52807 </para>
52808 <literallayout class="monospaced">
52809 warn hosts   = 192.168.34.25
52810      control = allow_auth_unadvertised
52811 </literallayout>
52812 <para>
52813 Normally, when an Exim server receives an AUTH command, it checks the name of
52814 the authentication mechanism that is given in the command to ensure that it
52815 matches an advertised mechanism. When this control is set, the check that a
52816 mechanism has been advertised is bypassed. Any configured mechanism can be used
52817 by the client. This control is permitted only in the connection and HELO ACLs.
52818 </para>
52819 </listitem></varlistentry>
52820 <varlistentry>
52821 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
52822 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
52823 <listitem>
52824 <para>
52825 <indexterm role="concept">
52826 <primary>access control lists (ACLs)</primary>
52827 <secondary>case of local part in</secondary>
52828 </indexterm>
52829 <indexterm role="concept">
52830 <primary>case of local parts</primary>
52831 </indexterm>
52832 <indexterm role="variable">
52833 <primary><varname>$local_part</varname></primary>
52834 </indexterm>
52835 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
52836 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
52837 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
52838 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
52839 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
52840 is encountered.
52841 </para>
52842 <para>
52843 These controls affect only the current recipient. Moreover, they apply only to
52844 local part handling that takes place directly in the ACL (for example, as a key
52845 in lookups). If a test to verify the recipient is obeyed, the case-related
52846 handling of the local part during the verification is controlled by the router
52847 configuration (see the <option>caseful_local_part</option> generic router option).
52848 </para>
52849 <para>
52850 This facility could be used, for example, to add a spam score to local parts
52851 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
52852 spam score:
52853 </para>
52854 <literallayout class="monospaced">
52855 warn  control = caseful_local_part
52856       set acl_m4 = ${eval:\
52857                      $acl_m4 + \
52858                      ${if match{$local_part}{[A-Z]}{1}{0}}\
52859                     }
52860       control = caselower_local_part
52861 </literallayout>
52862 <para>
52863 Notice that we put back the lower cased version afterwards, assuming that
52864 is what is wanted for subsequent tests.
52865 </para>
52866 </listitem></varlistentry>
52867 <varlistentry>
52868 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
52869 <listitem>
52870 <para>
52871 <indexterm role="concept">
52872 <primary>access control lists (ACLs)</primary>
52873 <secondary>cutthrough routing</secondary>
52874 </indexterm>
52875 <indexterm role="concept">
52876 <primary>cutthrough</primary>
52877 <secondary>requesting</secondary>
52878 </indexterm>
52879 This option requests delivery be attempted while the item is being received.
52880 It is usable in the RCPT ACL and valid only for single-recipient mails forwarded
52881 from one SMTP connection to another.  If a recipient-verify callout connection is
52882 requested in the same ACL it is held open and used for the data, otherwise one is made
52883 after the ACL completes.
52884 </para>
52885 <para>
52886 Note that routers are used in verify mode,
52887 and cannot depend on content of received headers.
52888 Note also that headers cannot be
52889 modified by any of the post-data ACLs (DATA, MIME and DKIM).
52890 Headers may be modified by routers (subject to the above) and transports.
52891 </para>
52892 <para>
52893 Cutthrough delivery is not supported via transport-filters or when DKIM signing
52894 of outgoing messages is done, because it sends data to the ultimate destination
52895 before the entire message has been received from the source.
52896 </para>
52897 <para>
52898 Should the ultimate destination system positively accept or reject the mail,
52899 a corresponding indication is given to the source system and nothing is queued.
52900 If there is a temporary error the item is queued for later delivery in the
52901 usual fashion. If the item is successfully delivered in cutthrough mode the log line
52902 is tagged with "&gt;&gt;" rather than "=&gt;" and appears before the acceptance "&lt;="
52903 line.
52904 </para>
52905 <para>
52906 Delivery in this mode avoids the generation of a bounce mail to a (possibly faked)
52907 sender when the destination system is doing content-scan based rejection.
52908 </para>
52909 </listitem></varlistentry>
52910 <varlistentry>
52911 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
52912 <listitem>
52913 <para>
52914 <indexterm role="concept">
52915 <primary>access control lists (ACLs)</primary>
52916 <secondary>enabling debug logging</secondary>
52917 </indexterm>
52918 <indexterm role="concept">
52919 <primary>debugging</primary>
52920 <secondary>enabling from an ACL</secondary>
52921 </indexterm>
52922 This control turns on debug logging, almost as though Exim had been invoked
52923 with <literal>-d</literal>, with the output going to a new logfile, by default called
52924 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
52925 may access any variables already defined.  The logging may be adjusted with
52926 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
52927 option.  Some examples (which depend on variables that don&#x2019;t exist in all
52928 contexts):
52929 </para>
52930 <literallayout class="monospaced">
52931       control = debug
52932       control = debug/tag=.$sender_host_address
52933       control = debug/opts=+expand+acl
52934       control = debug/tag=.$message_exim_id/opts=+expand
52935 </literallayout>
52936 </listitem></varlistentry>
52937 <varlistentry>
52938 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
52939 <listitem>
52940 <para>
52941 <indexterm role="concept">
52942 <primary>disable DKIM verify</primary>
52943 </indexterm>
52944 <indexterm role="concept">
52945 <primary>DKIM</primary>
52946 <secondary>disable verify</secondary>
52947 </indexterm>
52948 This control turns off DKIM verification processing entirely.  For details on
52949 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
52950 </para>
52951 </listitem></varlistentry>
52952 <varlistentry>
52953 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
52954 <listitem>
52955 <para>
52956 <indexterm role="concept">
52957 <primary>access control lists (ACLs)</primary>
52958 <secondary>setting DSCP value</secondary>
52959 </indexterm>
52960 <indexterm role="concept">
52961 <primary>DSCP</primary>
52962 <secondary>inbound</secondary>
52963 </indexterm>
52964 This option causes the DSCP value associated with the socket for the inbound
52965 connection to be adjusted to a given value, given as one of a number of fixed
52966 strings or to numeric value.
52967 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
52968 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
52969 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
52970 </para>
52971 <para>
52972 The outbound packets from Exim will be marked with this value in the header
52973 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
52974 that these values will have any effect, not be stripped by networking
52975 equipment, or do much of anything without cooperation with your Network
52976 Engineer and those of all network operators between the source and destination.
52977 </para>
52978 </listitem></varlistentry>
52979 <varlistentry>
52980 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
52981 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
52982 <listitem>
52983 <para>
52984 <indexterm role="concept">
52985 <primary>SMTP</primary>
52986 <secondary>synchronization checking</secondary>
52987 </indexterm>
52988 <indexterm role="concept">
52989 <primary>synchronization checking in SMTP</primary>
52990 </indexterm>
52991 These controls make it possible to be selective about when SMTP synchronization
52992 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
52993 state of the switch (it is true by default). See the description of this option
52994 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
52995 </para>
52996 <para>
52997 The effect of these two controls lasts for the remainder of the SMTP
52998 connection. They can appear in any ACL except the one for the non-SMTP
52999 messages. The most straightforward place to put them is in the ACL defined by
53000 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
53001 before the first synchronization check. The expected use is to turn off the
53002 synchronization checks for badly-behaved hosts that you nevertheless need to
53003 work with.
53004 </para>
53005 </listitem></varlistentry>
53006 <varlistentry>
53007 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
53008 <listitem>
53009 <para>
53010 <indexterm role="concept">
53011 <primary>fake defer</primary>
53012 </indexterm>
53013 <indexterm role="concept">
53014 <primary>defer, fake</primary>
53015 </indexterm>
53016 This control works in exactly the same way as <option>fakereject</option> (described below)
53017 except that it causes an SMTP 450 response after the message data instead of a
53018 550 response. You must take care when using <option>fakedefer</option> because it causes the
53019 messages to be duplicated when the sender retries. Therefore, you should not
53020 use <option>fakedefer</option> if the message is to be delivered normally.
53021 </para>
53022 </listitem></varlistentry>
53023 <varlistentry>
53024 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
53025 <listitem>
53026 <para>
53027 <indexterm role="concept">
53028 <primary>fake rejection</primary>
53029 </indexterm>
53030 <indexterm role="concept">
53031 <primary>rejection, fake</primary>
53032 </indexterm>
53033 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
53034 words, only when an SMTP message is being received. If Exim accepts the
53035 message, instead the final 250 response, a 550 rejection message is sent.
53036 However, Exim proceeds to deliver the message as normal. The control applies
53037 only to the current message, not to any subsequent ones that may be received in
53038 the same SMTP connection.
53039 </para>
53040 <para>
53041 The text for the 550 response is taken from the <option>control</option> modifier. If no
53042 message is supplied, the following is used:
53043 </para>
53044 <literallayout class="monospaced">
53045 550-Your message has been rejected but is being
53046 550-kept for evaluation.
53047 550-If it was a legitimate message, it may still be
53048 550 delivered to the target recipient(s).
53049 </literallayout>
53050 <para>
53051 This facility should be used with extreme caution.
53052 </para>
53053 </listitem></varlistentry>
53054 <varlistentry>
53055 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
53056 <listitem>
53057 <para>
53058 <indexterm role="concept">
53059 <primary>frozen messages</primary>
53060 <secondary>forcing in ACL</secondary>
53061 </indexterm>
53062 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53063 other words, only when a message is being received. If the message is accepted,
53064 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
53065 current message, not to any subsequent ones that may be received in the same
53066 SMTP connection.
53067 </para>
53068 <para>
53069 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
53070 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
53071 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
53072 are obeyed for the current message have the <literal>/no_tell</literal> option.
53073 </para>
53074 </listitem></varlistentry>
53075 <varlistentry>
53076 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
53077 <listitem>
53078 <para>
53079 <indexterm role="concept">
53080 <primary>SMTP</primary>
53081 <secondary>output flushing, disabling for delay</secondary>
53082 </indexterm>
53083 Exim normally flushes SMTP output before implementing a delay in an ACL, to
53084 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
53085 use. This control, as long as it is encountered before the <option>delay</option> modifier,
53086 disables such output flushing.
53087 </para>
53088 </listitem></varlistentry>
53089 <varlistentry>
53090 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
53091 <listitem>
53092 <para>
53093 <indexterm role="concept">
53094 <primary>SMTP</primary>
53095 <secondary>output flushing, disabling for callout</secondary>
53096 </indexterm>
53097 Exim normally flushes SMTP output before performing a callout in an ACL, to
53098 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
53099 use. This control, as long as it is encountered before the <option>verify</option> condition
53100 that causes the callout, disables such output flushing.
53101 </para>
53102 </listitem></varlistentry>
53103 <varlistentry>
53104 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
53105 <listitem>
53106 <para>
53107 This control is available when Exim is compiled with the content scanning
53108 extension. Content scanning may require a copy of the current message, or parts
53109 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
53110 or spam scanner. Normally, such copies are deleted when they are no longer
53111 needed. If this control is set, the copies are not deleted. The control applies
53112 only to the current message, not to any subsequent ones that may be received in
53113 the same SMTP connection. It is provided for debugging purposes and is unlikely
53114 to be useful in production.
53115 </para>
53116 </listitem></varlistentry>
53117 <varlistentry>
53118 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
53119 <listitem>
53120 <para>
53121 <indexterm role="concept">
53122 <primary>multiline responses, suppressing</primary>
53123 </indexterm>
53124 This control is permitted for any ACL except the one for non-SMTP messages.
53125 It seems that there are broken clients in use that cannot handle multiline
53126 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
53127 </para>
53128 <para>
53129 If this control is set, multiline SMTP responses from ACL rejections are
53130 suppressed. One way of doing this would have been to put out these responses as
53131 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
53132 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
53133 responses might get close to that. So this facility, which is after all only a
53134 sop to broken clients, is implemented by doing two very easy things:
53135 </para>
53136 <itemizedlist>
53137 <listitem>
53138 <para>
53139 Extra information that is normally output as part of a rejection caused by
53140 sender verification failure is omitted. Only the final line (typically <quote>sender
53141 verification failed</quote>) is sent.
53142 </para>
53143 </listitem>
53144 <listitem>
53145 <para>
53146 If a <option>message</option> modifier supplies a multiline response, only the first
53147 line is output.
53148 </para>
53149 </listitem>
53150 </itemizedlist>
53151 <para>
53152 The setting of the switch can, of course, be made conditional on the
53153 calling host. Its effect lasts until the end of the SMTP connection.
53154 </para>
53155 </listitem></varlistentry>
53156 <varlistentry>
53157 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
53158 <listitem>
53159 <para>
53160 <indexterm role="concept">
53161 <primary>PIPELINING</primary>
53162 <secondary>suppressing advertising</secondary>
53163 </indexterm>
53164 This control turns off the advertising of the PIPELINING extension to SMTP in
53165 the current session. To be useful, it must be obeyed before Exim sends its
53166 response to an EHLO command. Therefore, it should normally appear in an ACL
53167 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
53168 <option>pipelining_advertise_hosts</option>.
53169 </para>
53170 </listitem></varlistentry>
53171 <varlistentry>
53172 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
53173 <listitem>
53174 <para>
53175 <indexterm role="option">
53176 <primary><option>queue_only</option></primary>
53177 </indexterm>
53178 <indexterm role="concept">
53179 <primary>queueing incoming messages</primary>
53180 </indexterm>
53181 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53182 other words, only when a message is being received. If the message is accepted,
53183 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
53184 runner. No immediate delivery process is started. In other words, it has the
53185 effect as the <option>queue_only</option> global option. However, the control applies only
53186 to the current message, not to any subsequent ones that may be received in the
53187 same SMTP connection.
53188 </para>
53189 </listitem></varlistentry>
53190 <varlistentry>
53191 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53192 <listitem>
53193 <para>
53194 <indexterm role="concept">
53195 <primary>message</primary>
53196 <secondary>submission</secondary>
53197 </indexterm>
53198 <indexterm role="concept">
53199 <primary>submission mode</primary>
53200 </indexterm>
53201 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
53202 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
53203 the current message is a submission from a local MUA. In this case, Exim
53204 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
53205 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
53206 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
53207 late (the message has already been created).
53208 </para>
53209 <para>
53210 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
53211 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
53212 submission mode; the available options for this control are described there.
53213 The control applies only to the current message, not to any subsequent ones
53214 that may be received in the same SMTP connection.
53215 </para>
53216 </listitem></varlistentry>
53217 <varlistentry>
53218 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
53219 <listitem>
53220 <para>
53221 <indexterm role="concept">
53222 <primary>submission fixups, suppressing</primary>
53223 </indexterm>
53224 This control applies to locally submitted (non TCP/IP) messages, and is the
53225 complement of <literal>control = submission</literal>. It disables the fixups that are
53226 normally applied to locally-submitted messages. Specifically:
53227 </para>
53228 <itemizedlist>
53229 <listitem>
53230 <para>
53231 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
53232 dynamic version of <option>local_sender_retain</option>).
53233 </para>
53234 </listitem>
53235 <listitem>
53236 <para>
53237 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
53238 </para>
53239 </listitem>
53240 <listitem>
53241 <para>
53242 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
53243 </para>
53244 </listitem>
53245 </itemizedlist>
53246 <para>
53247 This control may be useful when a remotely-originated message is accepted,
53248 passed to some scanning program, and then re-submitted for delivery. It can be
53249 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
53250 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
53251 data is read.
53252 </para>
53253 <para>
53254 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
53255 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
53256 </para>
53257 </listitem></varlistentry>
53258 </variablelist>
53259 </section>
53260 <section id="SECTsummesfix">
53261 <title>Summary of message fixup control</title>
53262 <para>
53263 All four possibilities for message fixups can be specified:
53264 </para>
53265 <itemizedlist>
53266 <listitem>
53267 <para>
53268 Locally submitted, fixups applied: the default.
53269 </para>
53270 </listitem>
53271 <listitem>
53272 <para>
53273 Locally submitted, no fixups applied: use
53274 <literal>control = suppress_local_fixups</literal>.
53275 </para>
53276 </listitem>
53277 <listitem>
53278 <para>
53279 Remotely submitted, no fixups applied: the default.
53280 </para>
53281 </listitem>
53282 <listitem>
53283 <para>
53284 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
53285 </para>
53286 </listitem>
53287 </itemizedlist>
53288 </section>
53289 <section id="SECTaddheadacl">
53290 <title>Adding header lines in ACLs</title>
53291 <para>
53292 <indexterm role="concept">
53293 <primary>header lines</primary>
53294 <secondary>adding in an ACL</secondary>
53295 </indexterm>
53296 <indexterm role="concept">
53297 <primary>header lines</primary>
53298 <secondary>position of added lines</secondary>
53299 </indexterm>
53300 <indexterm role="concept">
53301 <primary><option>add_header</option> ACL modifier</primary>
53302 </indexterm>
53303 The <option>add_header</option> modifier can be used to add one or more extra header lines
53304 to an incoming message, as in this example:
53305 </para>
53306 <literallayout class="monospaced">
53307 warn dnslists = sbl.spamhaus.org : \
53308                 dialup.mail-abuse.org
53309      add_header = X-blacklisted-at: $dnslist_domain
53310 </literallayout>
53311 <para>
53312 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53313 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53314 receiving a message). The message must ultimately be accepted for
53315 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
53316 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
53317 RCPT ACL).
53318 </para>
53319 <para>
53320 Headers will not be added to the message if the modifier is used in
53321 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53322 </para>
53323 <para>
53324 Leading and trailing newlines are removed from
53325 the data for the <option>add_header</option> modifier; if it then
53326 contains one or more newlines that
53327 are not followed by a space or a tab, it is assumed to contain multiple header
53328 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
53329 front of any line that is not a valid header line.
53330 </para>
53331 <para>
53332 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53333 They are added to the message before processing the DATA and MIME ACLs.
53334 However, if an identical header line is requested more than once, only one copy
53335 is actually added to the message. Further header lines may be accumulated
53336 during the DATA and MIME ACLs, after which they are added to the message, again
53337 with duplicates suppressed. Thus, it is possible to add two identical header
53338 lines to an SMTP message, but only if one is added before DATA and one after.
53339 In the case of non-SMTP messages, new headers are accumulated during the
53340 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
53341 message is rejected after DATA or by the non-SMTP ACL, all added header lines
53342 are included in the entry that is written to the reject log.
53343 </para>
53344 <para>
53345 <indexterm role="concept">
53346 <primary>header lines</primary>
53347 <secondary>added; visibility of</secondary>
53348 </indexterm>
53349 Header lines are not visible in string expansions
53350 of message headers
53351 until they are added to the
53352 message. It follows that header lines defined in the MAIL, RCPT, and predata
53353 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
53354 header lines that are added by the DATA or MIME ACLs are not visible in those
53355 ACLs. Because of this restriction, you cannot use header lines as a way of
53356 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
53357 this, you can use ACL variables, as described in section
53358 <xref linkend="SECTaclvariables"/>.
53359 </para>
53360 <para>
53361 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
53362 </para>
53363 <para>
53364 The <option>add_header</option> modifier acts immediately as it is encountered during the
53365 processing of an ACL. Notice the difference between these two cases:
53366 </para>
53367 <literallayout>
53368 <literal>accept add_header = ADDED: some text</literal>
53369 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53370
53371 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53372 <literal>       add_header = ADDED: some text</literal>
53373 </literallayout>
53374 <para>
53375 In the first case, the header line is always added, whether or not the
53376 condition is true. In the second case, the header line is added only if the
53377 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
53378 ACL statement. All those that are encountered before a condition fails are
53379 honoured.
53380 </para>
53381 <para>
53382 <indexterm role="concept">
53383 <primary><option>warn</option> ACL verb</primary>
53384 </indexterm>
53385 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
53386 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
53387 effect only if all the conditions are true, even if it appears before some of
53388 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
53389 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
53390 are present on a <option>warn</option> verb, both are processed according to their
53391 specifications.
53392 </para>
53393 <para>
53394 By default, new header lines are added to a message at the end of the existing
53395 header lines. However, you can specify that any particular header line should
53396 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
53397 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
53398 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
53399 </para>
53400 <para>
53401 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
53402 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
53403 header line, respectively. (Header text cannot start with a colon, as there has
53404 to be a header name first.) For example:
53405 </para>
53406 <literallayout class="monospaced">
53407 warn add_header = \
53408        :after_received:X-My-Header: something or other...
53409 </literallayout>
53410 <para>
53411 If more than one header line is supplied in a single <option>add_header</option> modifier,
53412 each one is treated independently and can therefore be placed differently. If
53413 you add more than one line at the start, or after the Received: block, they end
53414 up in reverse order.
53415 </para>
53416 <para>
53417 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53418 added in an ACL. It does NOT work for header lines that are added in a
53419 system filter or in a router or transport.
53420 </para>
53421 </section>
53422 <section id="SECTremoveheadacl">
53423 <title>Removing header lines in ACLs</title>
53424 <para>
53425 <indexterm role="concept">
53426 <primary>header lines</primary>
53427 <secondary>removing in an ACL</secondary>
53428 </indexterm>
53429 <indexterm role="concept">
53430 <primary>header lines</primary>
53431 <secondary>position of removed lines</secondary>
53432 </indexterm>
53433 <indexterm role="concept">
53434 <primary><option>remove_header</option> ACL modifier</primary>
53435 </indexterm>
53436 The <option>remove_header</option> modifier can be used to remove one or more header lines
53437 from an incoming message, as in this example:
53438 </para>
53439 <literallayout class="monospaced">
53440 warn   message        = Remove internal headers
53441        remove_header  = x-route-mail1 : x-route-mail2
53442 </literallayout>
53443 <para>
53444 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53445 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53446 receiving a message). The message must ultimately be accepted for
53447 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
53448 with any ACL verb, including <option>deny</option>, though this is really not useful for
53449 any verb that doesn&#x2019;t result in a delivered message.
53450 </para>
53451 <para>
53452 Headers will not be removed to the message if the modifier is used in
53453 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53454 </para>
53455 <para>
53456 More than one header can be removed at the same time by using a colon separated
53457 list of header names. The header matching is case insensitive. Wildcards are
53458 not permitted, nor is list expansion performed, so you cannot use hostlists to
53459 create a list of headers, however both connection and message variable expansion
53460 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
53461 </para>
53462 <literallayout class="monospaced">
53463 warn   hosts           = +internal_hosts
53464        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
53465 warn   message         = Remove internal headers
53466        remove_header   = $acl_c_ihdrs
53467 </literallayout>
53468 <para>
53469 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53470 They are removed from the message before processing the DATA and MIME ACLs.
53471 There is no harm in attempting to remove the same header twice nor is removing
53472 a non-existent header. Further header lines to be removed may be accumulated
53473 during the DATA and MIME ACLs, after which they are removed from the message,
53474 if present. In the case of non-SMTP messages, headers to be removed are
53475 accumulated during the non-SMTP ACLs, and are removed from the message after
53476 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
53477 ACL, there really is no effect because there is no logging of what headers
53478 would have been removed.
53479 </para>
53480 <para>
53481 <indexterm role="concept">
53482 <primary>header lines</primary>
53483 <secondary>removed; visibility of</secondary>
53484 </indexterm>
53485 Header lines are not visible in string expansions until the DATA phase when it
53486 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
53487 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
53488 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
53489 this restriction, you cannot use header lines as a way of controlling data
53490 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
53491 you should instead use ACL variables, as described in section
53492 <xref linkend="SECTaclvariables"/>.
53493 </para>
53494 <para>
53495 The <option>remove_header</option> modifier acts immediately as it is encountered during the
53496 processing of an ACL. Notice the difference between these two cases:
53497 </para>
53498 <literallayout>
53499 <literal>accept remove_header = X-Internal</literal>
53500 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53501
53502 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53503 <literal>       remove_header = X-Internal</literal>
53504 </literallayout>
53505 <para>
53506 In the first case, the header line is always removed, whether or not the
53507 condition is true. In the second case, the header line is removed only if the
53508 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
53509 same ACL statement. All those that are encountered before a condition fails
53510 are honoured.
53511 </para>
53512 <para>
53513 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53514 present during ACL processing. It does NOT remove header lines that are added
53515 in a system filter or in a router or transport.
53516 </para>
53517 </section>
53518 <section id="SECTaclconditions">
53519 <title>ACL conditions</title>
53520 <para>
53521 <indexterm role="concept">
53522 <primary>access control lists (ACLs)</primary>
53523 <secondary>conditions; list of</secondary>
53524 </indexterm>
53525 Some of the conditions listed in this section are available only when Exim is
53526 compiled with the content-scanning extension. They are included here briefly
53527 for completeness. More detailed descriptions can be found in the discussion on
53528 content scanning in chapter <xref linkend="CHAPexiscan"/>.
53529 </para>
53530 <para>
53531 Not all conditions are relevant in all circumstances. For example, testing
53532 senders and recipients does not make sense in an ACL that is being run as the
53533 result of the arrival of an ETRN command, and checks on message headers can be
53534 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
53535 can use the same condition (with different parameters) more than once in the
53536 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
53537 The conditions are as follows:
53538 </para>
53539 <variablelist>
53540 <varlistentry>
53541 <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>
53542 <listitem>
53543 <para>
53544 <indexterm role="concept">
53545 <primary>access control lists (ACLs)</primary>
53546 <secondary>nested</secondary>
53547 </indexterm>
53548 <indexterm role="concept">
53549 <primary>access control lists (ACLs)</primary>
53550 <secondary>indirect</secondary>
53551 </indexterm>
53552 <indexterm role="concept">
53553 <primary>access control lists (ACLs)</primary>
53554 <secondary>arguments</secondary>
53555 </indexterm>
53556 <indexterm role="concept">
53557 <primary><option>acl</option> ACL condition</primary>
53558 </indexterm>
53559 The possible values of the argument are the same as for the
53560 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
53561 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
53562 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
53563 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
53564 condition false. This means that further processing of the <option>warn</option> verb
53565 ceases, but processing of the ACL continues.
53566 </para>
53567 <para>
53568 If the argument is a named ACL, up to nine space-separated optional values
53569 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
53570 and $acl_narg is set to the count of values.
53571 Previous values of these variables are restored after the call returns.
53572 The name and values are expanded separately.
53573 </para>
53574 <para>
53575 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
53576 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
53577 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
53578 conditions are tested.
53579 </para>
53580 <para>
53581 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
53582 loops. This condition allows you to use different ACLs in different
53583 circumstances. For example, different ACLs can be used to handle RCPT commands
53584 for different local users or different local domains.
53585 </para>
53586 </listitem></varlistentry>
53587 <varlistentry>
53588 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53589 <listitem>
53590 <para>
53591 <indexterm role="concept">
53592 <primary><option>authenticated</option> ACL condition</primary>
53593 </indexterm>
53594 <indexterm role="concept">
53595 <primary>authentication</primary>
53596 <secondary>ACL checking</secondary>
53597 </indexterm>
53598 <indexterm role="concept">
53599 <primary>access control lists (ACLs)</primary>
53600 <secondary>testing for authentication</secondary>
53601 </indexterm>
53602 If the SMTP connection is not authenticated, the condition is false. Otherwise,
53603 the name of the authenticator is tested against the list. To test for
53604 authentication by any authenticator, you can set
53605 </para>
53606 <literallayout class="monospaced">
53607 authenticated = *
53608 </literallayout>
53609 </listitem></varlistentry>
53610 <varlistentry>
53611 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
53612 <listitem>
53613 <para>
53614 <indexterm role="concept">
53615 <primary><option>condition</option> ACL condition</primary>
53616 </indexterm>
53617 <indexterm role="concept">
53618 <primary>customizing</primary>
53619 <secondary>ACL condition</secondary>
53620 </indexterm>
53621 <indexterm role="concept">
53622 <primary>access control lists (ACLs)</primary>
53623 <secondary>customized test</secondary>
53624 </indexterm>
53625 <indexterm role="concept">
53626 <primary>access control lists (ACLs)</primary>
53627 <secondary>testing, customized</secondary>
53628 </indexterm>
53629 This feature allows you to make up custom conditions. If the result of
53630 expanding the string is an empty string, the number zero, or one of the strings
53631 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
53632 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
53633 any other value, some error is assumed to have occurred, and the ACL returns
53634 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
53635 ignored. The effect is to treat it as true, whether it is positive or
53636 negative.
53637 </para>
53638 </listitem></varlistentry>
53639 <varlistentry>
53640 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
53641 <listitem>
53642 <para>
53643 <indexterm role="concept">
53644 <primary><option>decode</option> ACL condition</primary>
53645 </indexterm>
53646 This condition is available only when Exim is compiled with the
53647 content-scanning extension, and it is allowed only in the ACL defined by
53648 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
53649 If all goes well, the condition is true. It is false only if there are
53650 problems such as a syntax error or a memory shortage. For more details, see
53651 chapter <xref linkend="CHAPexiscan"/>.
53652 </para>
53653 </listitem></varlistentry>
53654 <varlistentry>
53655 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
53656 <listitem>
53657 <para>
53658 <indexterm role="concept">
53659 <primary><option>demime</option> ACL condition</primary>
53660 </indexterm>
53661 This condition is available only when Exim is compiled with the
53662 content-scanning extension. Its use is described in section
53663 <xref linkend="SECTdemimecond"/>.
53664 </para>
53665 </listitem></varlistentry>
53666 <varlistentry>
53667 <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>
53668 <listitem>
53669 <para>
53670 <indexterm role="concept">
53671 <primary><option>dnslists</option> ACL condition</primary>
53672 </indexterm>
53673 <indexterm role="concept">
53674 <primary>DNS list</primary>
53675 <secondary>in ACL</secondary>
53676 </indexterm>
53677 <indexterm role="concept">
53678 <primary>black list (DNS)</primary>
53679 </indexterm>
53680 <indexterm role="concept">
53681 <primary>access control lists (ACLs)</primary>
53682 <secondary>testing a DNS list</secondary>
53683 </indexterm>
53684 This condition checks for entries in DNS black lists. These are also known as
53685 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
53686 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
53687 different variants of this condition to describe briefly here. See sections
53688 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
53689 </para>
53690 </listitem></varlistentry>
53691 <varlistentry>
53692 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
53693 <listitem>
53694 <para>
53695 <indexterm role="concept">
53696 <primary><option>domains</option> ACL condition</primary>
53697 </indexterm>
53698 <indexterm role="concept">
53699 <primary>domain</primary>
53700 <secondary>ACL checking</secondary>
53701 </indexterm>
53702 <indexterm role="concept">
53703 <primary>access control lists (ACLs)</primary>
53704 <secondary>testing a recipient domain</secondary>
53705 </indexterm>
53706 <indexterm role="variable">
53707 <primary><varname>$domain_data</varname></primary>
53708 </indexterm>
53709 This condition is relevant only after a RCPT command. It checks that the domain
53710 of the recipient address is in the domain list. If percent-hack processing is
53711 enabled, it is done before this test is done. If the check succeeds with a
53712 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
53713 <option>domains</option> test.
53714 </para>
53715 <para>
53716 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
53717 use <option>domains</option> in a DATA ACL.
53718 </para>
53719 </listitem></varlistentry>
53720 <varlistentry>
53721 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53722 <listitem>
53723 <para>
53724 <indexterm role="concept">
53725 <primary><option>encrypted</option> ACL condition</primary>
53726 </indexterm>
53727 <indexterm role="concept">
53728 <primary>encryption</primary>
53729 <secondary>checking in an ACL</secondary>
53730 </indexterm>
53731 <indexterm role="concept">
53732 <primary>access control lists (ACLs)</primary>
53733 <secondary>testing for encryption</secondary>
53734 </indexterm>
53735 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
53736 name of the cipher suite in use is tested against the list. To test for
53737 encryption without testing for any specific cipher suite(s), set
53738 </para>
53739 <literallayout class="monospaced">
53740 encrypted = *
53741 </literallayout>
53742 </listitem></varlistentry>
53743 <varlistentry>
53744 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
53745 <listitem>
53746 <para>
53747 <indexterm role="concept">
53748 <primary><option>hosts</option> ACL condition</primary>
53749 </indexterm>
53750 <indexterm role="concept">
53751 <primary>host</primary>
53752 <secondary>ACL checking</secondary>
53753 </indexterm>
53754 <indexterm role="concept">
53755 <primary>access control lists (ACLs)</primary>
53756 <secondary>testing the client host</secondary>
53757 </indexterm>
53758 This condition tests that the calling host matches the host list. If you have
53759 name lookups or wildcarded host names and IP addresses in the same host list,
53760 you should normally put the IP addresses first. For example, you could have:
53761 </para>
53762 <literallayout class="monospaced">
53763 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
53764 </literallayout>
53765 <para>
53766 The lookup in this example uses the host name for its key. This is implied by
53767 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
53768 and it wouldn&#x2019;t matter which way round you had these two items.)
53769 </para>
53770 <para>
53771 The reason for the problem with host names lies in the left-to-right way that
53772 Exim processes lists. It can test IP addresses without doing any DNS lookups,
53773 but when it reaches an item that requires a host name, it fails if it cannot
53774 find a host name to compare with the pattern. If the above list is given in the
53775 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
53776 found, even if its IP address is 10.9.8.7.
53777 </para>
53778 <para>
53779 If you really do want to do the name check first, and still recognize the IP
53780 address even if the name lookup fails, you can rewrite the ACL like this:
53781 </para>
53782 <literallayout class="monospaced">
53783 accept hosts = dbm;/etc/friendly/hosts
53784 accept hosts = 10.9.8.7
53785 </literallayout>
53786 <para>
53787 The default action on failing to find the host name is to assume that the host
53788 is not in the list, so the first <option>accept</option> statement fails. The second
53789 statement can then check the IP address.
53790 </para>
53791 <para>
53792 <indexterm role="variable">
53793 <primary><varname>$host_data</varname></primary>
53794 </indexterm>
53795 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
53796 of the lookup is made available in the <varname>$host_data</varname> variable. This
53797 allows you, for example, to set up a statement like this:
53798 </para>
53799 <literallayout class="monospaced">
53800 deny  hosts = net-lsearch;/some/file
53801 message = $host_data
53802 </literallayout>
53803 <para>
53804 which gives a custom error message for each denied host.
53805 </para>
53806 </listitem></varlistentry>
53807 <varlistentry>
53808 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
53809 <listitem>
53810 <para>
53811 <indexterm role="concept">
53812 <primary><option>local_parts</option> ACL condition</primary>
53813 </indexterm>
53814 <indexterm role="concept">
53815 <primary>local part</primary>
53816 <secondary>ACL checking</secondary>
53817 </indexterm>
53818 <indexterm role="concept">
53819 <primary>access control lists (ACLs)</primary>
53820 <secondary>testing a local part</secondary>
53821 </indexterm>
53822 <indexterm role="variable">
53823 <primary><varname>$local_part_data</varname></primary>
53824 </indexterm>
53825 This condition is relevant only after a RCPT command. It checks that the local
53826 part of the recipient address is in the list. If percent-hack processing is
53827 enabled, it is done before this test. If the check succeeds with a lookup, the
53828 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
53829 the next <option>local_parts</option> test.
53830 </para>
53831 </listitem></varlistentry>
53832 <varlistentry>
53833 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
53834 <listitem>
53835 <para>
53836 <indexterm role="concept">
53837 <primary><option>malware</option> ACL condition</primary>
53838 </indexterm>
53839 <indexterm role="concept">
53840 <primary>access control lists (ACLs)</primary>
53841 <secondary>virus scanning</secondary>
53842 </indexterm>
53843 <indexterm role="concept">
53844 <primary>access control lists (ACLs)</primary>
53845 <secondary>scanning for viruses</secondary>
53846 </indexterm>
53847 This condition is available only when Exim is compiled with the
53848 content-scanning extension. It causes the incoming message to be scanned for
53849 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
53850 </para>
53851 </listitem></varlistentry>
53852 <varlistentry>
53853 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
53854 <listitem>
53855 <para>
53856 <indexterm role="concept">
53857 <primary><option>mime_regex</option> ACL condition</primary>
53858 </indexterm>
53859 <indexterm role="concept">
53860 <primary>access control lists (ACLs)</primary>
53861 <secondary>testing by regex matching</secondary>
53862 </indexterm>
53863 This condition is available only when Exim is compiled with the
53864 content-scanning extension, and it is allowed only in the ACL defined by
53865 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
53866 with any of the regular expressions. For details, see chapter
53867 <xref linkend="CHAPexiscan"/>.
53868 </para>
53869 </listitem></varlistentry>
53870 <varlistentry>
53871 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
53872 <listitem>
53873 <para>
53874 <indexterm role="concept">
53875 <primary>rate limiting</primary>
53876 </indexterm>
53877 This condition can be used to limit the rate at which a user or host submits
53878 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
53879 </para>
53880 </listitem></varlistentry>
53881 <varlistentry>
53882 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
53883 <listitem>
53884 <para>
53885 <indexterm role="concept">
53886 <primary><option>recipients</option> ACL condition</primary>
53887 </indexterm>
53888 <indexterm role="concept">
53889 <primary>recipient</primary>
53890 <secondary>ACL checking</secondary>
53891 </indexterm>
53892 <indexterm role="concept">
53893 <primary>access control lists (ACLs)</primary>
53894 <secondary>testing a recipient</secondary>
53895 </indexterm>
53896 This condition is relevant only after a RCPT command. It checks the entire
53897 recipient address against a list of recipients.
53898 </para>
53899 </listitem></varlistentry>
53900 <varlistentry>
53901 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
53902 <listitem>
53903 <para>
53904 <indexterm role="concept">
53905 <primary><option>regex</option> ACL condition</primary>
53906 </indexterm>
53907 <indexterm role="concept">
53908 <primary>access control lists (ACLs)</primary>
53909 <secondary>testing by regex matching</secondary>
53910 </indexterm>
53911 This condition is available only when Exim is compiled with the
53912 content-scanning extension, and is available only in the DATA, MIME, and
53913 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
53914 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
53915 </para>
53916 </listitem></varlistentry>
53917 <varlistentry>
53918 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
53919 <listitem>
53920 <para>
53921 <indexterm role="concept">
53922 <primary><option>sender_domains</option> ACL condition</primary>
53923 </indexterm>
53924 <indexterm role="concept">
53925 <primary>sender</primary>
53926 <secondary>ACL checking</secondary>
53927 </indexterm>
53928 <indexterm role="concept">
53929 <primary>access control lists (ACLs)</primary>
53930 <secondary>testing a sender domain</secondary>
53931 </indexterm>
53932 <indexterm role="variable">
53933 <primary><varname>$domain</varname></primary>
53934 </indexterm>
53935 <indexterm role="variable">
53936 <primary><varname>$sender_address_domain</varname></primary>
53937 </indexterm>
53938 This condition tests the domain of the sender of the message against the given
53939 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
53940 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
53941 of this condition. This is an exception to the general rule for testing domain
53942 lists. It is done this way so that, if this condition is used in an ACL for a
53943 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
53944 influence the sender checking.
53945 </para>
53946 <para>
53947 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
53948 relaying, because sender addresses are easily, and commonly, forged.
53949 </para>
53950 </listitem></varlistentry>
53951 <varlistentry>
53952 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
53953 <listitem>
53954 <para>
53955 <indexterm role="concept">
53956 <primary><option>senders</option> ACL condition</primary>
53957 </indexterm>
53958 <indexterm role="concept">
53959 <primary>sender</primary>
53960 <secondary>ACL checking</secondary>
53961 </indexterm>
53962 <indexterm role="concept">
53963 <primary>access control lists (ACLs)</primary>
53964 <secondary>testing a sender</secondary>
53965 </indexterm>
53966 This condition tests the sender of the message against the given list. To test
53967 for a bounce message, which has an empty sender, set
53968 </para>
53969 <literallayout class="monospaced">
53970 senders = :
53971 </literallayout>
53972 <para>
53973 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
53974 relaying, because sender addresses are easily, and commonly, forged.
53975 </para>
53976 </listitem></varlistentry>
53977 <varlistentry>
53978 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
53979 <listitem>
53980 <para>
53981 <indexterm role="concept">
53982 <primary><option>spam</option> ACL condition</primary>
53983 </indexterm>
53984 <indexterm role="concept">
53985 <primary>access control lists (ACLs)</primary>
53986 <secondary>scanning for spam</secondary>
53987 </indexterm>
53988 This condition is available only when Exim is compiled with the
53989 content-scanning extension. It causes the incoming message to be scanned by
53990 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
53991 </para>
53992 </listitem></varlistentry>
53993 <varlistentry>
53994 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
53995 <listitem>
53996 <para>
53997 <indexterm role="concept">
53998 <primary><option>verify</option> ACL condition</primary>
53999 </indexterm>
54000 <indexterm role="concept">
54001 <primary>TLS</primary>
54002 <secondary>client certificate verification</secondary>
54003 </indexterm>
54004 <indexterm role="concept">
54005 <primary>certificate</primary>
54006 <secondary>verification of client</secondary>
54007 </indexterm>
54008 <indexterm role="concept">
54009 <primary>access control lists (ACLs)</primary>
54010 <secondary>certificate verification</secondary>
54011 </indexterm>
54012 <indexterm role="concept">
54013 <primary>access control lists (ACLs)</primary>
54014 <secondary>testing a TLS certificate</secondary>
54015 </indexterm>
54016 This condition is true in an SMTP session if the session is encrypted, and a
54017 certificate was received from the client, and the certificate was verified. The
54018 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
54019 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
54020 </para>
54021 </listitem></varlistentry>
54022 <varlistentry>
54023 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
54024 <listitem>
54025 <para>
54026 <indexterm role="concept">
54027 <primary>CSA verification</primary>
54028 </indexterm>
54029 This condition checks whether the sending host (the client) is authorized to
54030 send email. Details of how this works are given in section
54031 <xref linkend="SECTverifyCSA"/>.
54032 </para>
54033 </listitem></varlistentry>
54034 <varlistentry>
54035 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
54036 <listitem>
54037 <para>
54038 <indexterm role="concept">
54039 <primary><option>verify</option> ACL condition</primary>
54040 </indexterm>
54041 <indexterm role="concept">
54042 <primary>access control lists (ACLs)</primary>
54043 <secondary>verifying header names only ASCII</secondary>
54044 </indexterm>
54045 <indexterm role="concept">
54046 <primary>header lines</primary>
54047 <secondary>verifying header names only ASCII</secondary>
54048 </indexterm>
54049 <indexterm role="concept">
54050 <primary>verifying</primary>
54051 <secondary>header names only ASCII</secondary>
54052 </indexterm>
54053 This condition is relevant only in an ACL that is run after a message has been
54054 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54055 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
54056 there are no non-ASCII characters, also excluding control characters.  The
54057 allowable characters are decimal ASCII values 33 through 126.
54058 </para>
54059 <para>
54060 Exim itself will handle headers with non-ASCII characters, but it can cause
54061 problems for downstream applications, so this option will allow their
54062 detection and rejection in the DATA ACL&#x2019;s.
54063 </para>
54064 </listitem></varlistentry>
54065 <varlistentry>
54066 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54067 <listitem>
54068 <para>
54069 <indexterm role="concept">
54070 <primary><option>verify</option> ACL condition</primary>
54071 </indexterm>
54072 <indexterm role="concept">
54073 <primary>access control lists (ACLs)</primary>
54074 <secondary>verifying sender in the header</secondary>
54075 </indexterm>
54076 <indexterm role="concept">
54077 <primary>header lines</primary>
54078 <secondary>verifying the sender in</secondary>
54079 </indexterm>
54080 <indexterm role="concept">
54081 <primary>sender</primary>
54082 <secondary>verifying in header</secondary>
54083 </indexterm>
54084 <indexterm role="concept">
54085 <primary>verifying</primary>
54086 <secondary>sender in header</secondary>
54087 </indexterm>
54088 This condition is relevant only in an ACL that is run after a message has been
54089 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54090 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
54091 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
54092 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
54093 However, an address that appears in one of these headers need not be an address
54094 that accepts bounce messages; only sender addresses in envelopes are required
54095 to accept bounces. Therefore, if you use the callout option on this check, you
54096 might want to arrange for a non-empty address in the MAIL command.
54097 </para>
54098 <para>
54099 Details of address verification and the options are given later, starting at
54100 section <xref linkend="SECTaddressverification"/> (callouts are described in section
54101 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
54102 condition to restrict it to bounce messages only:
54103 </para>
54104 <literallayout class="monospaced">
54105 deny    senders = :
54106         message = A valid sender header is required for bounces
54107        !verify  = header_sender
54108 </literallayout>
54109 </listitem></varlistentry>
54110 <varlistentry>
54111 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
54112 <listitem>
54113 <para>
54114 <indexterm role="concept">
54115 <primary><option>verify</option> ACL condition</primary>
54116 </indexterm>
54117 <indexterm role="concept">
54118 <primary>access control lists (ACLs)</primary>
54119 <secondary>verifying header syntax</secondary>
54120 </indexterm>
54121 <indexterm role="concept">
54122 <primary>header lines</primary>
54123 <secondary>verifying syntax</secondary>
54124 </indexterm>
54125 <indexterm role="concept">
54126 <primary>verifying</primary>
54127 <secondary>header syntax</secondary>
54128 </indexterm>
54129 This condition is relevant only in an ACL that is run after a message has been
54130 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54131 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
54132 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
54133 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
54134 permitted only in locally generated messages and from hosts that match
54135 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
54136 appropriate.
54137 </para>
54138 <para>
54139 Note that this condition is a syntax check only. However, a common spamming
54140 ploy used to be to send syntactically invalid headers such as
54141 </para>
54142 <literallayout class="monospaced">
54143 To: @
54144 </literallayout>
54145 <para>
54146 and this condition can be used to reject such messages, though they are not as
54147 common as they used to be.
54148 </para>
54149 </listitem></varlistentry>
54150 <varlistentry>
54151 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
54152 <listitem>
54153 <para>
54154 <indexterm role="concept">
54155 <primary><option>verify</option> ACL condition</primary>
54156 </indexterm>
54157 <indexterm role="concept">
54158 <primary>access control lists (ACLs)</primary>
54159 <secondary>verifying HELO/EHLO</secondary>
54160 </indexterm>
54161 <indexterm role="concept">
54162 <primary>HELO</primary>
54163 <secondary>verifying</secondary>
54164 </indexterm>
54165 <indexterm role="concept">
54166 <primary>EHLO</primary>
54167 <secondary>verifying</secondary>
54168 </indexterm>
54169 <indexterm role="concept">
54170 <primary>verifying</primary>
54171 <secondary>EHLO</secondary>
54172 </indexterm>
54173 <indexterm role="concept">
54174 <primary>verifying</primary>
54175 <secondary>HELO</secondary>
54176 </indexterm>
54177 This condition is true if a HELO or EHLO command has been received from the
54178 client host, and its contents have been verified. If there has been no previous
54179 attempt to verify the HELO/EHLO contents, it is carried out when this
54180 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
54181 <option>helo_try_verify_hosts</option> options for details of how to request verification
54182 independently of this condition.
54183 </para>
54184 <para>
54185 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
54186 option), this condition is always true.
54187 </para>
54188 </listitem></varlistentry>
54189 <varlistentry>
54190 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
54191 <listitem>
54192 <para>
54193 <indexterm role="concept">
54194 <primary>verifying</primary>
54195 <secondary>not blind</secondary>
54196 </indexterm>
54197 <indexterm role="concept">
54198 <primary>bcc recipients, verifying none</primary>
54199 </indexterm>
54200 This condition checks that there are no blind (bcc) recipients in the message.
54201 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
54202 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
54203 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
54204 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
54205 used only in a DATA or non-SMTP ACL.
54206 </para>
54207 <para>
54208 There are, of course, many legitimate messages that make use of blind (bcc)
54209 recipients. This check should not be used on its own for blocking messages.
54210 </para>
54211 </listitem></varlistentry>
54212 <varlistentry>
54213 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54214 <listitem>
54215 <para>
54216 <indexterm role="concept">
54217 <primary><option>verify</option> ACL condition</primary>
54218 </indexterm>
54219 <indexterm role="concept">
54220 <primary>access control lists (ACLs)</primary>
54221 <secondary>verifying recipient</secondary>
54222 </indexterm>
54223 <indexterm role="concept">
54224 <primary>recipient</primary>
54225 <secondary>verifying</secondary>
54226 </indexterm>
54227 <indexterm role="concept">
54228 <primary>verifying</primary>
54229 <secondary>recipient</secondary>
54230 </indexterm>
54231 <indexterm role="variable">
54232 <primary><varname>$address_data</varname></primary>
54233 </indexterm>
54234 This condition is relevant only after a RCPT command. It verifies the current
54235 recipient. Details of address verification are given later, starting at section
54236 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
54237 of <varname>$address_data</varname> is the last value that was set while routing the address.
54238 This applies even if the verification fails. When an address that is being
54239 verified is redirected to a single address, verification continues with the new
54240 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
54241 value for the child address.
54242 </para>
54243 </listitem></varlistentry>
54244 <varlistentry>
54245 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
54246 <listitem>
54247 <para>
54248 <indexterm role="concept">
54249 <primary><option>verify</option> ACL condition</primary>
54250 </indexterm>
54251 <indexterm role="concept">
54252 <primary>access control lists (ACLs)</primary>
54253 <secondary>verifying host reverse lookup</secondary>
54254 </indexterm>
54255 <indexterm role="concept">
54256 <primary>host</primary>
54257 <secondary>verifying reverse lookup</secondary>
54258 </indexterm>
54259 This condition ensures that a verified host name has been looked up from the IP
54260 address of the client host. (This may have happened already if the host name
54261 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
54262 Verification ensures that the host name obtained from a reverse DNS lookup, or
54263 one of its aliases, does, when it is itself looked up in the DNS, yield the
54264 original IP address.
54265 </para>
54266 <para>
54267 If this condition is used for a locally generated message (that is, when there
54268 is no client host involved), it always succeeds.
54269 </para>
54270 </listitem></varlistentry>
54271 <varlistentry>
54272 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54273 <listitem>
54274 <para>
54275 <indexterm role="concept">
54276 <primary><option>verify</option> ACL condition</primary>
54277 </indexterm>
54278 <indexterm role="concept">
54279 <primary>access control lists (ACLs)</primary>
54280 <secondary>verifying sender</secondary>
54281 </indexterm>
54282 <indexterm role="concept">
54283 <primary>sender</primary>
54284 <secondary>verifying</secondary>
54285 </indexterm>
54286 <indexterm role="concept">
54287 <primary>verifying</primary>
54288 <secondary>sender</secondary>
54289 </indexterm>
54290 This condition is relevant only after a MAIL or RCPT command, or after a
54291 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
54292 the message&#x2019;s sender is empty (that is, this is a bounce message), the
54293 condition is true. Otherwise, the sender address is verified.
54294 </para>
54295 <para>
54296 <indexterm role="variable">
54297 <primary><varname>$address_data</varname></primary>
54298 </indexterm>
54299 <indexterm role="variable">
54300 <primary><varname>$sender_address_data</varname></primary>
54301 </indexterm>
54302 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
54303 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
54304 value can be used in subsequent conditions and modifiers in the same ACL
54305 statement. It does not persist after the end of the current statement. If you
54306 want to preserve the value for longer, you can save it in an ACL variable.
54307 </para>
54308 <para>
54309 Details of verification are given later, starting at section
54310 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
54311 to avoid doing it more than once per message.
54312 </para>
54313 </listitem></varlistentry>
54314 <varlistentry>
54315 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54316 <listitem>
54317 <para>
54318 <indexterm role="concept">
54319 <primary><option>verify</option> ACL condition</primary>
54320 </indexterm>
54321 This is a variation of the previous option, in which a modified address is
54322 verified as a sender.
54323 </para>
54324 </listitem></varlistentry>
54325 </variablelist>
54326 </section>
54327 <section id="SECTmorednslists">
54328 <title>Using DNS lists</title>
54329 <para>
54330 <indexterm role="concept">
54331 <primary>DNS list</primary>
54332 <secondary>in ACL</secondary>
54333 </indexterm>
54334 <indexterm role="concept">
54335 <primary>black list (DNS)</primary>
54336 </indexterm>
54337 <indexterm role="concept">
54338 <primary>access control lists (ACLs)</primary>
54339 <secondary>testing a DNS list</secondary>
54340 </indexterm>
54341 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
54342 is on at least one of a number of DNS lists by looking up the inverted IP
54343 address in one or more DNS domains. (Note that DNS list domains are not mail
54344 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
54345 special options instead.) For example, if the calling host&#x2019;s IP
54346 address is 192.168.62.43, and the ACL statement is
54347 </para>
54348 <literallayout class="monospaced">
54349 deny dnslists = blackholes.mail-abuse.org : \
54350                 dialups.mail-abuse.org
54351 </literallayout>
54352 <para>
54353 the following records are looked up:
54354 </para>
54355 <literallayout class="monospaced">
54356 43.62.168.192.blackholes.mail-abuse.org
54357 43.62.168.192.dialups.mail-abuse.org
54358 </literallayout>
54359 <para>
54360 As soon as Exim finds an existing DNS record, processing of the list stops.
54361 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
54362 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
54363 use two separate conditions:
54364 </para>
54365 <literallayout class="monospaced">
54366 deny dnslists = blackholes.mail-abuse.org
54367      dnslists = dialups.mail-abuse.org
54368 </literallayout>
54369 <para>
54370 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
54371 behaves as if the host does not match the list item, that is, as if the DNS
54372 record does not exist. If there are further items in the DNS list, they are
54373 processed.
54374 </para>
54375 <para>
54376 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
54377 (which is the most common usage), because it prevents a DNS failure from
54378 blocking mail. However, you can change this behaviour by putting one of the
54379 following special items in the list:
54380 </para>
54381 <literallayout>
54382 <literal>+include_unknown </literal>   behave as if the item is on the list
54383 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
54384 <literal>+defer_unknown   </literal>   give a temporary error
54385 </literallayout>
54386 <para>
54387 <indexterm role="concept">
54388 <primary><literal>+include_unknown</literal></primary>
54389 </indexterm>
54390 <indexterm role="concept">
54391 <primary><literal>+exclude_unknown</literal></primary>
54392 </indexterm>
54393 <indexterm role="concept">
54394 <primary><literal>+defer_unknown</literal></primary>
54395 </indexterm>
54396 Each of these applies to any subsequent items on the list. For example:
54397 </para>
54398 <literallayout class="monospaced">
54399 deny dnslists = +defer_unknown : foo.bar.example
54400 </literallayout>
54401 <para>
54402 Testing the list of domains stops as soon as a match is found. If you want to
54403 warn for one list and block for another, you can use two different statements:
54404 </para>
54405 <literallayout class="monospaced">
54406 deny  dnslists = blackholes.mail-abuse.org
54407 warn  message  = X-Warn: sending host is on dialups list
54408       dnslists = dialups.mail-abuse.org
54409 </literallayout>
54410 <para>
54411 DNS list lookups are cached by Exim for the duration of the SMTP session,
54412 so a lookup based on the IP address is done at most once for any incoming
54413 connection. Exim does not share information between multiple incoming
54414 connections (but your local name server cache should be active).
54415 </para>
54416 </section>
54417 <section id="SECID201">
54418 <title>Specifying the IP address for a DNS list lookup</title>
54419 <para>
54420 <indexterm role="concept">
54421 <primary>DNS list</primary>
54422 <secondary>keyed by explicit IP address</secondary>
54423 </indexterm>
54424 By default, the IP address that is used in a DNS list lookup is the IP address
54425 of the calling host. However, you can specify another IP address by listing it
54426 after the domain name, introduced by a slash. For example:
54427 </para>
54428 <literallayout class="monospaced">
54429 deny dnslists = black.list.tld/192.168.1.2
54430 </literallayout>
54431 <para>
54432 This feature is not very helpful with explicit IP addresses; it is intended for
54433 use with IP addresses that are looked up, for example, the IP addresses of the
54434 MX hosts or nameservers of an email sender address. For an example, see section
54435 <xref linkend="SECTmulkeyfor"/> below.
54436 </para>
54437 </section>
54438 <section id="SECID202">
54439 <title>DNS lists keyed on domain names</title>
54440 <para>
54441 <indexterm role="concept">
54442 <primary>DNS list</primary>
54443 <secondary>keyed by domain name</secondary>
54444 </indexterm>
54445 There are some lists that are keyed on domain names rather than inverted IP
54446 addresses (see for example the <emphasis>domain based zones</emphasis> link at
54447 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
54448 with these lists. You can change the name that is looked up in a DNS list by
54449 listing it after the domain name, introduced by a slash. For example,
54450 </para>
54451 <literallayout class="monospaced">
54452 deny  message  = Sender's domain is listed at $dnslist_domain
54453       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
54454 </literallayout>
54455 <para>
54456 This particular example is useful only in ACLs that are obeyed after the
54457 RCPT or DATA commands, when a sender address is available. If (for
54458 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
54459 up by this example is
54460 </para>
54461 <literallayout class="monospaced">
54462 tld.example.dsn.rfc-ignorant.org
54463 </literallayout>
54464 <para>
54465 A single <option>dnslists</option> condition can contain entries for both names and IP
54466 addresses. For example:
54467 </para>
54468 <literallayout class="monospaced">
54469 deny dnslists = sbl.spamhaus.org : \
54470                 dsn.rfc-ignorant.org/$sender_address_domain
54471 </literallayout>
54472 <para>
54473 The first item checks the sending host&#x2019;s IP address; the second checks a domain
54474 name. The whole condition is true if either of the DNS lookups succeeds.
54475 </para>
54476 </section>
54477 <section id="SECTmulkeyfor">
54478 <title>Multiple explicit keys for a DNS list</title>
54479 <para>
54480 <indexterm role="concept">
54481 <primary>DNS list</primary>
54482 <secondary>multiple keys for</secondary>
54483 </indexterm>
54484 The syntax described above for looking up explicitly-defined values (either
54485 names or IP addresses) in a DNS blacklist is a simplification. After the domain
54486 name for the DNS list, what follows the slash can in fact be a list of items.
54487 As with all lists in Exim, the default separator is a colon. However, because
54488 this is a sublist within the list of DNS blacklist domains, it is necessary
54489 either to double the separators like this:
54490 </para>
54491 <literallayout class="monospaced">
54492 dnslists = black.list.tld/name.1::name.2
54493 </literallayout>
54494 <para>
54495 or to change the separator character, like this:
54496 </para>
54497 <literallayout class="monospaced">
54498 dnslists = black.list.tld/&lt;;name.1;name.2
54499 </literallayout>
54500 <para>
54501 If an item in the list is an IP address, it is inverted before the DNS
54502 blacklist domain is appended. If it is not an IP address, no inversion
54503 occurs. Consider this condition:
54504 </para>
54505 <literallayout class="monospaced">
54506 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
54507 </literallayout>
54508 <para>
54509 The DNS lookups that occur are:
54510 </para>
54511 <literallayout class="monospaced">
54512 2.1.168.192.black.list.tld
54513 a.domain.black.list.tld
54514 </literallayout>
54515 <para>
54516 Once a DNS record has been found (that matches a specific IP return
54517 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
54518 are done. If there is a temporary DNS error, the rest of the sublist of domains
54519 or IP addresses is tried. A temporary error for the whole dnslists item occurs
54520 only if no other DNS lookup in this sublist succeeds. In other words, a
54521 successful lookup for any of the items in the sublist overrides a temporary
54522 error for a previous item.
54523 </para>
54524 <para>
54525 The ability to supply a list of items after the slash is in some sense just a
54526 syntactic convenience. These two examples have the same effect:
54527 </para>
54528 <literallayout class="monospaced">
54529 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
54530 dnslists = black.list.tld/a.domain::b.domain
54531 </literallayout>
54532 <para>
54533 However, when the data for the list is obtained from a lookup, the second form
54534 is usually much more convenient. Consider this example:
54535 </para>
54536 <literallayout class="monospaced">
54537 deny message  = The mail servers for the domain \
54538                 $sender_address_domain \
54539                 are listed at $dnslist_domain ($dnslist_value); \
54540                 see $dnslist_text.
54541      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
54542                                    ${lookup dnsdb {&gt;|mxh=\
54543                                    $sender_address_domain} }} }
54544 </literallayout>
54545 <para>
54546 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
54547 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
54548 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
54549 of expanding the condition might be something like this:
54550 </para>
54551 <literallayout class="monospaced">
54552 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
54553 </literallayout>
54554 <para>
54555 Thus, this example checks whether or not the IP addresses of the sender
54556 domain&#x2019;s mail servers are on the Spamhaus black list.
54557 </para>
54558 <para>
54559 The key that was used for a successful DNS list lookup is put into the variable
54560 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
54561 </para>
54562 </section>
54563 <section id="SECID203">
54564 <title>Data returned by DNS lists</title>
54565 <para>
54566 <indexterm role="concept">
54567 <primary>DNS list</primary>
54568 <secondary>data returned from</secondary>
54569 </indexterm>
54570 DNS lists are constructed using address records in the DNS. The original RBL
54571 just used the address 127.0.0.1 on the right hand side of each record, but the
54572 RBL+ list and some other lists use a number of values with different meanings.
54573 The values used on the RBL+ list are:
54574 </para>
54575 <literallayout>
54576 127.1.0.1  RBL
54577 127.1.0.2  DUL
54578 127.1.0.3  DUL and RBL
54579 127.1.0.4  RSS
54580 127.1.0.5  RSS and RBL
54581 127.1.0.6  RSS and DUL
54582 127.1.0.7  RSS and DUL and RBL
54583 </literallayout>
54584 <para>
54585 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
54586 different values. Some DNS lists may return more than one address record;
54587 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
54588 </para>
54589 </section>
54590 <section id="SECID204">
54591 <title>Variables set from DNS lists</title>
54592 <para>
54593 <indexterm role="concept">
54594 <primary>expansion</primary>
54595 <secondary>variables, set from DNS list</secondary>
54596 </indexterm>
54597 <indexterm role="concept">
54598 <primary>DNS list</primary>
54599 <secondary>variables set from</secondary>
54600 </indexterm>
54601 <indexterm role="variable">
54602 <primary><varname>$dnslist_domain</varname></primary>
54603 </indexterm>
54604 <indexterm role="variable">
54605 <primary><varname>$dnslist_matched</varname></primary>
54606 </indexterm>
54607 <indexterm role="variable">
54608 <primary><varname>$dnslist_text</varname></primary>
54609 </indexterm>
54610 <indexterm role="variable">
54611 <primary><varname>$dnslist_value</varname></primary>
54612 </indexterm>
54613 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
54614 the name of the overall domain that matched (for example,
54615 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
54616 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
54617 the DNS record. When the key is an IP address, it is not reversed in
54618 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
54619 cases, for example:
54620 </para>
54621 <literallayout class="monospaced">
54622 deny dnslists = spamhaus.example
54623 </literallayout>
54624 <para>
54625 the key is also available in another variable (in this case,
54626 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
54627 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
54628 might generate a dnslists lookup like this:
54629 </para>
54630 <literallayout class="monospaced">
54631 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
54632 </literallayout>
54633 <para>
54634 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
54635 <literal>192.168.6.7</literal> (for example).
54636 </para>
54637 <para>
54638 If more than one address record is returned by the DNS lookup, all the IP
54639 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
54640 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
54641 record. For lists such as RBL+ the TXT record for a merged entry is often not
54642 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
54643 information.
54644 </para>
54645 <para>
54646 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
54647 &ndash; although these appear before the condition in the ACL, they are not
54648 expanded until after it has failed. For example:
54649 </para>
54650 <literallayout class="monospaced">
54651 deny    hosts = !+local_networks
54652         message = $sender_host_address is listed \
54653                   at $dnslist_domain
54654         dnslists = rbl-plus.mail-abuse.example
54655 </literallayout>
54656 </section>
54657 <section id="SECTaddmatcon">
54658 <title>Additional matching conditions for DNS lists</title>
54659 <para>
54660 <indexterm role="concept">
54661 <primary>DNS list</primary>
54662 <secondary>matching specific returned data</secondary>
54663 </indexterm>
54664 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
54665 in order to restrict its action to DNS records with a matching right hand side.
54666 For example,
54667 </para>
54668 <literallayout class="monospaced">
54669 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
54670 </literallayout>
54671 <para>
54672 rejects only those hosts that yield 127.0.0.2. Without this additional data,
54673 any address record is considered to be a match. For the moment, we assume
54674 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
54675 describes how multiple records are handled.
54676 </para>
54677 <para>
54678 More than one IP address may be given for checking, using a comma as a
54679 separator. These are alternatives &ndash; if any one of them matches, the
54680 <option>dnslists</option> condition is true. For example:
54681 </para>
54682 <literallayout class="monospaced">
54683 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54684 </literallayout>
54685 <para>
54686 If you want to specify a constraining address list and also specify names or IP
54687 addresses to be looked up, the constraining address list must be specified
54688 first. For example:
54689 </para>
54690 <literallayout class="monospaced">
54691 deny dnslists = dsn.rfc-ignorant.org\
54692                 =127.0.0.2/$sender_address_domain
54693 </literallayout>
54694 <para>
54695 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
54696 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
54697 In other words, the listed addresses are used as bit masks. The comparison is
54698 true if all the bits in the mask are present in the address that is being
54699 tested. For example:
54700 </para>
54701 <literallayout class="monospaced">
54702 dnslists = a.b.c&amp;0.0.0.3
54703 </literallayout>
54704 <para>
54705 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
54706 want to test whether one bit or another bit is present (as opposed to both
54707 being present), you must use multiple values. For example:
54708 </para>
54709 <literallayout class="monospaced">
54710 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
54711 </literallayout>
54712 <para>
54713 matches if the final component of the address is an odd number or two times
54714 an odd number.
54715 </para>
54716 </section>
54717 <section id="SECID205">
54718 <title>Negated DNS matching conditions</title>
54719 <para>
54720 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
54721 condition. Whereas
54722 </para>
54723 <literallayout class="monospaced">
54724 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54725 </literallayout>
54726 <para>
54727 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54728 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
54729 </para>
54730 <literallayout class="monospaced">
54731 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
54732 </literallayout>
54733 <para>
54734 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54735 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
54736 words, the result of the test is inverted if an exclamation mark appears before
54737 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
54738 </para>
54739 <para>
54740 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
54741 host, or address list (which is why the syntax is different).
54742 </para>
54743 <para>
54744 If you are using just one list, the negation syntax does not gain you much. The
54745 previous example is precisely equivalent to
54746 </para>
54747 <literallayout class="monospaced">
54748 deny  dnslists = a.b.c
54749      !dnslists = a.b.c=127.0.0.2,127.0.0.3
54750 </literallayout>
54751 <para>
54752 However, if you are using multiple lists, the negation syntax is clearer.
54753 Consider this example:
54754 </para>
54755 <literallayout class="monospaced">
54756 deny  dnslists = sbl.spamhaus.org : \
54757                  list.dsbl.org : \
54758                  dnsbl.njabl.org!=127.0.0.3 : \
54759                  relays.ordb.org
54760 </literallayout>
54761 <para>
54762 Using only positive lists, this would have to be:
54763 </para>
54764 <literallayout class="monospaced">
54765 deny  dnslists = sbl.spamhaus.org : \
54766                  list.dsbl.org
54767 deny  dnslists = dnsbl.njabl.org
54768      !dnslists = dnsbl.njabl.org=127.0.0.3
54769 deny  dnslists = relays.ordb.org
54770 </literallayout>
54771 <para>
54772 which is less clear, and harder to maintain.
54773 </para>
54774 </section>
54775 <section id="SECThanmuldnsrec">
54776 <title>Handling multiple DNS records from a DNS list</title>
54777 <para>
54778 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
54779 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
54780 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
54781 the match to specific results from the DNS lookup, there are two ways in which
54782 the checking can be handled. For example, consider the condition:
54783 </para>
54784 <literallayout class="monospaced">
54785 dnslists = a.b.c=127.0.0.1
54786 </literallayout>
54787 <para>
54788 What happens if the DNS lookup for the incoming IP address yields both
54789 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
54790 condition true because at least one given value was found, or is it false
54791 because at least one of the found values was not listed? And how does this
54792 affect negated conditions? Both possibilities are provided for with the help of
54793 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
54794 </para>
54795 <itemizedlist>
54796 <listitem>
54797 <para>
54798 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
54799 IP addresses matches one of the listed addresses. For the example above, the
54800 condition is true because 127.0.0.1 matches.
54801 </para>
54802 </listitem>
54803 <listitem>
54804 <para>
54805 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
54806 looked up IP addresses matches one of the listed addresses. If the condition is
54807 changed to:
54808 </para>
54809 <literallayout class="monospaced">
54810 dnslists = a.b.c==127.0.0.1
54811 </literallayout>
54812 <para>
54813 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54814 false because 127.0.0.2 is not listed. You would need to have:
54815 </para>
54816 <literallayout class="monospaced">
54817 dnslists = a.b.c==127.0.0.1,127.0.0.2
54818 </literallayout>
54819 <para>
54820 for the condition to be true.
54821 </para>
54822 </listitem>
54823 </itemizedlist>
54824 <para>
54825 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
54826 the precise opposite of the behaviour above. Thus:
54827 </para>
54828 <itemizedlist>
54829 <listitem>
54830 <para>
54831 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
54832 addresses matches one of the listed addresses. Consider:
54833 </para>
54834 <literallayout class="monospaced">
54835 dnslists = a.b.c!&amp;0.0.0.1
54836 </literallayout>
54837 <para>
54838 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54839 false because 127.0.0.1 matches.
54840 </para>
54841 </listitem>
54842 <listitem>
54843 <para>
54844 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
54845 looked up IP address that does not match. Consider:
54846 </para>
54847 <literallayout class="monospaced">
54848 dnslists = a.b.c!=&amp;0.0.0.1
54849 </literallayout>
54850 <para>
54851 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54852 true, because 127.0.0.2 does not match. You would need to have:
54853 </para>
54854 <literallayout class="monospaced">
54855 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
54856 </literallayout>
54857 <para>
54858 for the condition to be false.
54859 </para>
54860 </listitem>
54861 </itemizedlist>
54862 <para>
54863 When the DNS lookup yields only a single IP address, there is no difference
54864 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
54865 </para>
54866 </section>
54867 <section id="SECTmordetinf">
54868 <title>Detailed information from merged DNS lists</title>
54869 <para>
54870 <indexterm role="concept">
54871 <primary>DNS list</primary>
54872 <secondary>information from merged</secondary>
54873 </indexterm>
54874 When the facility for restricting the matching IP values in a DNS list is used,
54875 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
54876 the true reason for rejection. This happens when lists are merged and the IP
54877 address in the A record is used to distinguish them; unfortunately there is
54878 only one TXT record. One way round this is not to use merged lists, but that
54879 can be inefficient because it requires multiple DNS lookups where one would do
54880 in the vast majority of cases when the host of interest is not on any of the
54881 lists.
54882 </para>
54883 <para>
54884 A less inefficient way of solving this problem is available. If
54885 two domain names, comma-separated, are given, the second is used first to
54886 do an initial check, making use of any IP value restrictions that are set.
54887 If there is a match, the first domain is used, without any IP value
54888 restrictions, to get the TXT record. As a byproduct of this, there is also
54889 a check that the IP being tested is indeed on the first list. The first
54890 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
54891 </para>
54892 <literallayout class="monospaced">
54893 reject message  = \
54894          rejected because $sender_host_address is blacklisted \
54895          at $dnslist_domain\n$dnslist_text
54896        dnslists = \
54897          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
54898          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
54899 </literallayout>
54900 <para>
54901 For the first blacklist item, this starts by doing a lookup in
54902 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
54903 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
54904 value, and as long as something is found, it looks for the corresponding TXT
54905 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
54906 The second blacklist item is processed similarly.
54907 </para>
54908 <para>
54909 If you are interested in more than one merged list, the same list must be
54910 given several times, but because the results of the DNS lookups are cached,
54911 the DNS calls themselves are not repeated. For example:
54912 </para>
54913 <literallayout class="monospaced">
54914 reject dnslists = \
54915          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
54916          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
54917          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
54918          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
54919 </literallayout>
54920 <para>
54921 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
54922 values matches (or if no record is found), this is the only lookup that is
54923 done. Only if there is a match is one of the more specific lists consulted.
54924 </para>
54925 </section>
54926 <section id="SECTmorednslistslast">
54927 <title>DNS lists and IPv6</title>
54928 <para>
54929 <indexterm role="concept">
54930 <primary>IPv6</primary>
54931 <secondary>DNS black lists</secondary>
54932 </indexterm>
54933 <indexterm role="concept">
54934 <primary>DNS list</primary>
54935 <secondary>IPv6 usage</secondary>
54936 </indexterm>
54937 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
54938 nibble by nibble. For example, if the calling host&#x2019;s IP address is
54939 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
54940 </para>
54941 <literallayout class="monospaced">
54942 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
54943   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
54944 </literallayout>
54945 <para>
54946 (split over two lines here to fit on the page). Unfortunately, some of the DNS
54947 lists contain wildcard records, intended for IPv4, that interact badly with
54948 IPv6. For example, the DNS entry
54949 </para>
54950 <literallayout class="monospaced">
54951 *.3.some.list.example.    A    127.0.0.1
54952 </literallayout>
54953 <para>
54954 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
54955 Unfortunately, it also matches the entire 3::/4 IPv6 network.
54956 </para>
54957 <para>
54958 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
54959 <option>condition</option> condition, as in this example:
54960 </para>
54961 <literallayout class="monospaced">
54962 deny   condition = ${if isip4{$sender_host_address}}
54963        dnslists  = some.list.example
54964 </literallayout>
54965 <para>
54966 If an explicit key is being used for a DNS lookup and it may be an IPv6
54967 address you should specify alternate list separators for both the outer
54968 (DNS list name) list and inner (lookup keys) list:
54969 </para>
54970 <literallayout class="monospaced">
54971        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
54972 </literallayout>
54973 </section>
54974 <section id="SECTratelimiting">
54975 <title>Rate limiting incoming messages</title>
54976 <para>
54977 <indexterm role="concept">
54978 <primary>rate limiting</primary>
54979 <secondary>client sending</secondary>
54980 </indexterm>
54981 <indexterm role="concept">
54982 <primary>limiting client sending rates</primary>
54983 </indexterm>
54984 <indexterm role="option">
54985 <primary><option>smtp_ratelimit_*</option></primary>
54986 </indexterm>
54987 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
54988 which clients can send email. This is more powerful than the
54989 <option>smtp_ratelimit_*</option> options, because those options control the rate of
54990 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
54991 works across all connections (concurrent and sequential) from the same client
54992 host. The syntax of the <option>ratelimit</option> condition is:
54993 </para>
54994 <literallayout>
54995 <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;
54996 </literallayout>
54997 <para>
54998 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
54999 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
55000 </para>
55001 <para>
55002 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
55003 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
55004 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
55005 of <emphasis>p</emphasis>.
55006 </para>
55007 <para>
55008 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
55009 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
55010 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
55011 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
55012 send in each time interval. It also specifies the number of messages permitted
55013 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
55014 constant, you can allow a client to send more messages in a burst without
55015 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
55016 both small, messages must be sent at an even rate.
55017 </para>
55018 <para>
55019 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
55020 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
55021 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
55022 instructions when it is run with no arguments.
55023 </para>
55024 <para>
55025 The key is used to look up the data for calculating the client&#x2019;s average
55026 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
55027 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
55028 which means Exim computes the sending rate of each client host IP address.
55029 By changing the key you can change how Exim identifies clients for the purpose
55030 of ratelimiting. For example, to limit the sending rate of each authenticated
55031 user, independent of the computer they are sending from, set the key to
55032 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
55033 example, <varname>$authenticated_id</varname> is only meaningful if the client has
55034 authenticated (which you can check with the <option>authenticated</option> ACL condition).
55035 </para>
55036 <para>
55037 The lookup key does not have to identify clients: If you want to limit the
55038 rate at which a recipient receives messages, you can use the key
55039 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
55040 ACL.
55041 </para>
55042 <para>
55043 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
55044 specifies what Exim measures the rate of, for example messages or recipients
55045 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
55046 <option>count=</option> options. You can also control when Exim updates the recorded rate
55047 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
55048 separated by a slash, like the other parameters. They may appear in any order.
55049 </para>
55050 <para>
55051 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
55052 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
55053 stored, so you can alter the configured maximum rate and Exim will still
55054 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
55055 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
55056 behaviour. The lookup key is not affected by changes to the update mode and
55057 the <option>count=</option> option.
55058 </para>
55059 </section>
55060 <section id="ratoptmea">
55061 <title>Ratelimit options for what is being measured</title>
55062 <para>
55063 <indexterm role="concept">
55064 <primary>rate limiting</primary>
55065 <secondary>per_* options</secondary>
55066 </indexterm>
55067 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
55068 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
55069 <option>acl_not_smtp_start</option> ACLs.
55070 </para>
55071 <para>
55072 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
55073 the default if none of the <option>per_*</option> options is specified. It can be used in
55074 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
55075 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
55076 </para>
55077 <para>
55078 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
55079 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
55080 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
55081 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
55082 in its MAIL command, which may be inaccurate or completely missing. You can
55083 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
55084 in kilobytes, megabytes, or gigabytes, respectively.
55085 </para>
55086 <para>
55087 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
55088 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
55089 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
55090 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
55091 ACLs the rate is updated with the total recipient count in one go. Note that
55092 in either case the rate limiting engine will see a message with many
55093 recipients as a large high-speed burst.
55094 </para>
55095 <para>
55096 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
55097 number of different recipients that the client has sent messages to in the
55098 last time period. That is, if the client repeatedly sends messages to the same
55099 recipient, its measured rate is not increased. This option can only be used in
55100 <option>acl_smtp_rcpt</option>.
55101 </para>
55102 <para>
55103 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
55104 condition is processed. This can be used to limit the rate of any SMTP
55105 command. If it is used in multiple ACLs it can limit the aggregate rate of
55106 multiple different commands.
55107 </para>
55108 <para>
55109 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
55110 measured rate. For example, the <option>per_byte</option> option is equivalent to
55111 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
55112 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
55113 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
55114 </para>
55115 <para>
55116 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
55117 </para>
55118 </section>
55119 <section id="ratoptupd">
55120 <title>Ratelimit update modes</title>
55121 <para>
55122 <indexterm role="concept">
55123 <primary>rate limiting</primary>
55124 <secondary>reading data without updating</secondary>
55125 </indexterm>
55126 You can specify one of three options with the <option>ratelimit</option> condition to
55127 control when its database is updated. This section describes the <option>readonly</option>
55128 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
55129 </para>
55130 <para>
55131 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
55132 previously-computed rate to check against the limit.
55133 </para>
55134 <para>
55135 For example, you can test the client&#x2019;s sending rate and deny it access (when
55136 it is too fast) in the connect ACL. If the client passes this check then it
55137 can go on to send a message, in which case its recorded rate will be updated
55138 in the MAIL ACL. Subsequent connections from the same client will check this
55139 new rate.
55140 </para>
55141 <literallayout class="monospaced">
55142 acl_check_connect:
55143  deny ratelimit = 100 / 5m / readonly
55144     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
55145                   (max $sender_rate_limit)
55146 # ...
55147 acl_check_mail:
55148  warn ratelimit = 100 / 5m / strict
55149     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
55150                   (max $sender_rate_limit)
55151 </literallayout>
55152 <para>
55153 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
55154 processing a message then it may increase the client&#x2019;s measured rate more than
55155 it should. For example, this will happen if you check the <option>per_rcpt</option> option
55156 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
55157 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
55158 multiple update problems by using the <option>readonly</option> option on later ratelimit
55159 checks.
55160 </para>
55161 <para>
55162 The <option>per_*</option> options described above do not make sense in some ACLs. If you
55163 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
55164 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
55165 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
55166 next section) so you must specify the <option>readonly</option> option explicitly.
55167 </para>
55168 </section>
55169 <section id="ratoptfast">
55170 <title>Ratelimit options for handling fast clients</title>
55171 <para>
55172 <indexterm role="concept">
55173 <primary>rate limiting</primary>
55174 <secondary>strict and leaky modes</secondary>
55175 </indexterm>
55176 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
55177 engine can react in two possible ways, depending on the presence of the
55178 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
55179 counter-measures (such as rejecting the message) that may be specified by the
55180 rest of the ACL.
55181 </para>
55182 <para>
55183 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
55184 updated if it is above the limit. The effect of this is that Exim measures the
55185 client&#x2019;s average rate of successfully sent email, which cannot be greater than
55186 the maximum allowed. If the client is over the limit it may suffer some
55187 counter-measures (as specified in the ACL), but it will still be able to send
55188 email at the configured maximum rate, whatever the rate of its attempts. This
55189 is generally the better choice if you have clients that retry automatically.
55190 For example, it does not prevent a sender with an over-aggressive retry rate
55191 from getting any email through.
55192 </para>
55193 <para>
55194 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
55195 updated. The effect of this is that Exim measures the client&#x2019;s average rate
55196 of attempts to send email, which can be much higher than the maximum it is
55197 actually allowed. If the client is over the limit it may be subjected to
55198 counter-measures by the ACL. It must slow down and allow sufficient time to
55199 pass that its computed rate falls below the maximum before it can send email
55200 again. The time (the number of smoothing periods) it must wait and not
55201 attempt to send mail can be calculated with this formula:
55202 </para>
55203 <literallayout class="monospaced">
55204         ln(peakrate/maxrate)
55205 </literallayout>
55206 </section>
55207 <section id="ratoptuniq">
55208 <title>Limiting the rate of different events</title>
55209 <para>
55210 <indexterm role="concept">
55211 <primary>rate limiting</primary>
55212 <secondary>counting unique events</secondary>
55213 </indexterm>
55214 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
55215 rate of different events. For example, the <option>per_addr</option> option uses this
55216 mechanism to count the number of different recipients that the client has
55217 sent messages to in the last time period; it is equivalent to
55218 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
55219 measure the rate that a client uses different sender addresses with the
55220 options <literal>per_mail/unique=$sender_address</literal>.
55221 </para>
55222 <para>
55223 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
55224 has seen for that key. The whole set is thrown away when it is older than the
55225 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
55226 per period. In the <option>leaky</option> update mode, an event that causes the client to
55227 go over the limit is not added to the set, in the same way that the client&#x2019;s
55228 recorded rate is not updated in the same situation.
55229 </para>
55230 <para>
55231 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
55232 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
55233 rate.
55234 </para>
55235 <para>
55236 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
55237 other <option>ratelimit</option> options in order to store the event set. The number of
55238 unique values is potentially as large as the rate limit, so the extra space
55239 required increases with larger limits.
55240 </para>
55241 <para>
55242 The uniqueification is not perfect: there is a small probability that Exim
55243 will think a new event has happened before. If the sender&#x2019;s rate is less than
55244 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
55245 the measured rate can go above the limit, in which case Exim may under-count
55246 events by a significant margin. Fortunately, if the rate is high enough (2.7
55247 times the limit) that the false positive rate goes above 9%, then Exim will
55248 throw away the over-full event set before the measured rate falls below the
55249 limit. Therefore the only harm should be that exceptionally high sending rates
55250 are logged incorrectly; any countermeasures you configure will be as effective
55251 as intended.
55252 </para>
55253 </section>
55254 <section id="useratlim">
55255 <title>Using rate limiting</title>
55256 <para>
55257 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
55258 when the rate limit is exceeded. This might be anything from logging a warning
55259 (for example, while measuring existing sending rates in order to define
55260 policy), through time delays to slow down fast senders, up to rejecting the
55261 message. For example:
55262 </para>
55263 <literallayout class="monospaced">
55264 # Log all senders' rates
55265 warn ratelimit = 0 / 1h / strict
55266      log_message = Sender rate $sender_rate / $sender_rate_period
55267
55268 # Slow down fast senders; note the need to truncate $sender_rate
55269 # at the decimal point.
55270 warn ratelimit = 100 / 1h / per_rcpt / strict
55271      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
55272                    $sender_rate_limit }s
55273
55274 # Keep authenticated users under control
55275 deny authenticated = *
55276      ratelimit = 100 / 1d / strict / $authenticated_id
55277
55278 # System-wide rate limit
55279 defer message = Sorry, too busy. Try again later.
55280      ratelimit = 10 / 1s / $primary_hostname
55281
55282 # Restrict incoming rate from each host, with a default
55283 # set using a macro and special cases looked up in a table.
55284 defer message = Sender rate exceeds $sender_rate_limit \
55285                messages per $sender_rate_period
55286      ratelimit = ${lookup {$sender_host_address} \
55287                    cdb {DB/ratelimits.cdb} \
55288                    {$value} {RATELIMIT} }
55289 </literallayout>
55290 <para>
55291 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
55292 especially with the <option>per_rcpt</option> option, you may suffer from a performance
55293 bottleneck caused by locking on the ratelimit hints database. Apart from
55294 making your ACLs less complicated, you can reduce the problem by using a
55295 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
55296 this means that Exim will lose its hints data after a reboot (including retry
55297 hints, the callout cache, and ratelimit data).
55298 </para>
55299 </section>
55300 <section id="SECTaddressverification">
55301 <title>Address verification</title>
55302 <para>
55303 <indexterm role="concept">
55304 <primary>verifying address</primary>
55305 <secondary>options for</secondary>
55306 </indexterm>
55307 <indexterm role="concept">
55308 <primary>policy control</primary>
55309 <secondary>address verification</secondary>
55310 </indexterm>
55311 Several of the <option>verify</option> conditions described in section
55312 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
55313 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
55314 The verification conditions can be followed by options that modify the
55315 verification process. The options are separated from the keyword and from each
55316 other by slashes, and some of them contain parameters. For example:
55317 </para>
55318 <literallayout class="monospaced">
55319 verify = sender/callout
55320 verify = recipient/defer_ok/callout=10s,defer_ok
55321 </literallayout>
55322 <para>
55323 The first stage of address verification, which always happens, is to run the
55324 address through the routers, in <quote>verify mode</quote>. Routers can detect the
55325 difference between verification and routing for delivery, and their actions can
55326 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
55327 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
55328 The available options are as follows:
55329 </para>
55330 <itemizedlist>
55331 <listitem>
55332 <para>
55333 If the <option>callout</option> option is specified, successful routing to one or more
55334 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
55335 check. Callouts and their sub-options are discussed in the next section.
55336 </para>
55337 </listitem>
55338 <listitem>
55339 <para>
55340 If there is a defer error while doing verification routing, the ACL
55341 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
55342 options, the condition is forced to be true instead. Note that this is a main
55343 verification option as well as a suboption for callouts.
55344 </para>
55345 </listitem>
55346 <listitem>
55347 <para>
55348 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
55349 discusses the reporting of sender address verification failures.
55350 </para>
55351 </listitem>
55352 <listitem>
55353 <para>
55354 The <option>success_on_redirect</option> option causes verification always to succeed
55355 immediately after a successful redirection. By default, if a redirection
55356 generates just one address, that address is also verified. See further
55357 discussion in section <xref linkend="SECTredirwhilveri"/>.
55358 </para>
55359 </listitem>
55360 </itemizedlist>
55361 <para>
55362 <indexterm role="concept">
55363 <primary>verifying address</primary>
55364 <secondary>differentiating failures</secondary>
55365 </indexterm>
55366 <indexterm role="variable">
55367 <primary><varname>$recipient_verify_failure</varname></primary>
55368 </indexterm>
55369 <indexterm role="variable">
55370 <primary><varname>$sender_verify_failure</varname></primary>
55371 </indexterm>
55372 <indexterm role="variable">
55373 <primary><varname>$acl_verify_message</varname></primary>
55374 </indexterm>
55375 After an address verification failure, <varname>$acl_verify_message</varname> contains the
55376 error message that is associated with the failure. It can be preserved by
55377 coding like this:
55378 </para>
55379 <literallayout class="monospaced">
55380 warn  !verify = sender
55381        set acl_m0 = $acl_verify_message
55382 </literallayout>
55383 <para>
55384 If you are writing your own custom rejection message or log message when
55385 denying access, you can use this variable to include information about the
55386 verification failure.
55387 </para>
55388 <para>
55389 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
55390 appropriate) contains one of the following words:
55391 </para>
55392 <itemizedlist>
55393 <listitem>
55394 <para>
55395 <option>qualify</option>: The address was unqualified (no domain), and the message
55396 was neither local nor came from an exempted host.
55397 </para>
55398 </listitem>
55399 <listitem>
55400 <para>
55401 <option>route</option>: Routing failed.
55402 </para>
55403 </listitem>
55404 <listitem>
55405 <para>
55406 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
55407 occurred at or before the MAIL command (that is, on initial
55408 connection, HELO, or MAIL).
55409 </para>
55410 </listitem>
55411 <listitem>
55412 <para>
55413 <option>recipient</option>: The RCPT command in a callout was rejected.
55414 </para>
55415 </listitem>
55416 <listitem>
55417 <para>
55418 <option>postmaster</option>: The postmaster check in a callout was rejected.
55419 </para>
55420 </listitem>
55421 </itemizedlist>
55422 <para>
55423 The main use of these variables is expected to be to distinguish between
55424 rejections of MAIL and rejections of RCPT in callouts.
55425 </para>
55426 </section>
55427 <section id="SECTcallver">
55428 <title>Callout verification</title>
55429 <para>
55430 <indexterm role="concept">
55431 <primary>verifying address</primary>
55432 <secondary>by callout</secondary>
55433 </indexterm>
55434 <indexterm role="concept">
55435 <primary>callout</primary>
55436 <secondary>verification</secondary>
55437 </indexterm>
55438 <indexterm role="concept">
55439 <primary>SMTP</primary>
55440 <secondary>callout verification</secondary>
55441 </indexterm>
55442 For non-local addresses, routing verifies the domain, but is unable to do any
55443 checking of the local part. There are situations where some means of verifying
55444 the local part is desirable. One way this can be done is to make an SMTP
55445 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
55446 a subsequent host for a recipient address, to see if the host accepts the
55447 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
55448 sender address, the callback is not to the client host that is trying to
55449 deliver the message, but to one of the hosts that accepts incoming mail for the
55450 sender&#x2019;s domain.
55451 </para>
55452 <para>
55453 Exim does not do callouts by default. If you want them to happen, you must
55454 request them by setting appropriate options on the <option>verify</option> condition, as
55455 described below. This facility should be used with care, because it can add a
55456 lot of resource usage to the cost of verifying an address. However, Exim does
55457 cache the results of callouts, which helps to reduce the cost. Details of
55458 caching are in section <xref linkend="SECTcallvercache"/>.
55459 </para>
55460 <para>
55461 Recipient callouts are usually used only between hosts that are controlled by
55462 the same administration. For example, a corporate gateway host could use
55463 callouts to check for valid recipients on an internal mailserver. A successful
55464 callout does not guarantee that a real delivery to the address would succeed;
55465 on the other hand, a failing callout does guarantee that a delivery would fail.
55466 </para>
55467 <para>
55468 If the <option>callout</option> option is present on a condition that verifies an address, a
55469 second stage of verification occurs if the address is successfully routed to
55470 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
55471 <command>manualroute</command> router, where the router specifies the hosts. However, if a
55472 router that does not set up hosts routes to an <command>smtp</command> transport with a
55473 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
55474 <option>hosts_override</option> set, its hosts are always used, whether or not the router
55475 supplies a host list.
55476 Callouts are only supported on <command>smtp</command> transports.
55477 </para>
55478 <para>
55479 The port that is used is taken from the transport, if it is specified and is a
55480 remote transport. (For routers that do verification only, no transport need be
55481 specified.) Otherwise, the default SMTP port is used. If a remote transport
55482 specifies an outgoing interface, this is used; otherwise the interface is not
55483 specified. Likewise, the text that is used for the HELO command is taken from
55484 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
55485 <varname>$smtp_active_hostname</varname> is used.
55486 </para>
55487 <para>
55488 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
55489 test whether a bounce message could be delivered to the sender address. The
55490 following SMTP commands are sent:
55491 </para>
55492 <literallayout>
55493 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
55494 <literal>MAIL FROM:&lt;&gt;</literal>
55495 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
55496 <literal>QUIT</literal>
55497 </literallayout>
55498 <para>
55499 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
55500 set to <quote>lmtp</quote>.
55501 </para>
55502 <para>
55503 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
55504 settings.
55505 </para>
55506 <para>
55507 A recipient callout check is similar. By default, it also uses an empty address
55508 for the sender. This default is chosen because most hosts do not make use of
55509 the sender address when verifying a recipient. Using the same address means
55510 that a single cache entry can be used for each recipient. Some sites, however,
55511 do make use of the sender address when verifying. These are catered for by the
55512 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
55513 </para>
55514 <para>
55515 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
55516 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
55517 Exim tries the next host, if any. If there is a problem with all the remote
55518 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
55519 <option>callout</option> option is given, in which case the condition is forced to succeed.
55520 </para>
55521 <para>
55522 <indexterm role="concept">
55523 <primary>SMTP</primary>
55524 <secondary>output flushing, disabling for callout</secondary>
55525 </indexterm>
55526 A callout may take a little time. For this reason, Exim normally flushes SMTP
55527 output before performing a callout in an ACL, to avoid unexpected timeouts in
55528 clients when the SMTP PIPELINING extension is in use. The flushing can be
55529 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
55530 </para>
55531 </section>
55532 <section id="CALLaddparcall">
55533 <title>Additional parameters for callouts</title>
55534 <para>
55535 <indexterm role="concept">
55536 <primary>callout</primary>
55537 <secondary>additional parameters for</secondary>
55538 </indexterm>
55539 The <option>callout</option> option can be followed by an equals sign and a number of
55540 optional parameters, separated by commas. For example:
55541 </para>
55542 <literallayout class="monospaced">
55543 verify = recipient/callout=10s,defer_ok
55544 </literallayout>
55545 <para>
55546 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
55547 separate verify options, is retained for backwards compatibility, but is now
55548 deprecated. The additional parameters for <option>callout</option> are as follows:
55549 </para>
55550 <variablelist>
55551 <varlistentry>
55552 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
55553 <listitem>
55554 <para>
55555 <indexterm role="concept">
55556 <primary>callout</primary>
55557 <secondary>timeout, specifying</secondary>
55558 </indexterm>
55559 This specifies the timeout that applies for the callout attempt to each host.
55560 For example:
55561 </para>
55562 <literallayout class="monospaced">
55563 verify = sender/callout=5s
55564 </literallayout>
55565 <para>
55566 The default is 30 seconds. The timeout is used for each response from the
55567 remote host. It is also used for the initial connection, unless overridden by
55568 the <option>connect</option> parameter.
55569 </para>
55570 </listitem></varlistentry>
55571 <varlistentry>
55572 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55573 <listitem>
55574 <para>
55575 <indexterm role="concept">
55576 <primary>callout</primary>
55577 <secondary>connection timeout, specifying</secondary>
55578 </indexterm>
55579 This parameter makes it possible to set a different (usually smaller) timeout
55580 for making the SMTP connection. For example:
55581 </para>
55582 <literallayout class="monospaced">
55583 verify = sender/callout=5s,connect=1s
55584 </literallayout>
55585 <para>
55586 If not specified, this timeout defaults to the general timeout value.
55587 </para>
55588 </listitem></varlistentry>
55589 <varlistentry>
55590 <term><emphasis role="bold">defer_ok</emphasis></term>
55591 <listitem>
55592 <para>
55593 <indexterm role="concept">
55594 <primary>callout</primary>
55595 <secondary>defer, action on</secondary>
55596 </indexterm>
55597 When this parameter is present, failure to contact any host, or any other kind
55598 of temporary error, is treated as success by the ACL. However, the cache is not
55599 updated in this circumstance.
55600 </para>
55601 </listitem></varlistentry>
55602 <varlistentry>
55603 <term><emphasis role="bold">fullpostmaster</emphasis></term>
55604 <listitem>
55605 <para>
55606 <indexterm role="concept">
55607 <primary>callout</primary>
55608 <secondary>full postmaster check</secondary>
55609 </indexterm>
55610 This operates like the <option>postmaster</option> option (see below), but if the check for
55611 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
55612 accordance with the specification in RFC 2821. The RFC states that the
55613 unqualified address <emphasis>postmaster</emphasis> should be accepted.
55614 </para>
55615 </listitem></varlistentry>
55616 <varlistentry>
55617 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55618 <listitem>
55619 <para>
55620 <indexterm role="concept">
55621 <primary>callout</primary>
55622 <secondary>sender when verifying header</secondary>
55623 </indexterm>
55624 When verifying addresses in header lines using the <option>header_sender</option>
55625 verification option, Exim behaves by default as if the addresses are envelope
55626 sender addresses from a message. Callout verification therefore tests to see
55627 whether a bounce message could be delivered, by using an empty address in the
55628 MAIL command. However, it is arguable that these addresses might never be used
55629 as envelope senders, and could therefore justifiably reject bounce messages
55630 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
55631 address to use in the MAIL command. For example:
55632 </para>
55633 <literallayout class="monospaced">
55634 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
55635 </literallayout>
55636 <para>
55637 This parameter is available only for the <option>header_sender</option> verification option.
55638 </para>
55639 </listitem></varlistentry>
55640 <varlistentry>
55641 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55642 <listitem>
55643 <para>
55644 <indexterm role="concept">
55645 <primary>callout</primary>
55646 <secondary>overall timeout, specifying</secondary>
55647 </indexterm>
55648 This parameter sets an overall timeout for performing a callout verification.
55649 For example:
55650 </para>
55651 <literallayout class="monospaced">
55652 verify = sender/callout=5s,maxwait=30s
55653 </literallayout>
55654 <para>
55655 This timeout defaults to four times the callout timeout for individual SMTP
55656 commands. The overall timeout applies when there is more than one host that can
55657 be tried. The timeout is checked before trying the next host. This prevents
55658 very long delays if there are a large number of hosts and all are timing out
55659 (for example, when network connections are timing out).
55660 </para>
55661 </listitem></varlistentry>
55662 <varlistentry>
55663 <term><emphasis role="bold">no_cache</emphasis></term>
55664 <listitem>
55665 <para>
55666 <indexterm role="concept">
55667 <primary>callout</primary>
55668 <secondary>cache, suppressing</secondary>
55669 </indexterm>
55670 <indexterm role="concept">
55671 <primary>caching callout, suppressing</primary>
55672 </indexterm>
55673 When this parameter is given, the callout cache is neither read nor updated.
55674 </para>
55675 </listitem></varlistentry>
55676 <varlistentry>
55677 <term><emphasis role="bold">postmaster</emphasis></term>
55678 <listitem>
55679 <para>
55680 <indexterm role="concept">
55681 <primary>callout</primary>
55682 <secondary>postmaster; checking</secondary>
55683 </indexterm>
55684 When this parameter is set, a successful callout check is followed by a similar
55685 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
55686 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
55687 the postmaster check is recorded in a cache record; if it is a failure, this is
55688 used to fail subsequent callouts for the domain without a connection being
55689 made, until the cache record expires.
55690 </para>
55691 </listitem></varlistentry>
55692 <varlistentry>
55693 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55694 <listitem>
55695 <para>
55696 The postmaster check uses an empty sender in the MAIL command by default.
55697 You can use this parameter to do a postmaster check using a different address.
55698 For example:
55699 </para>
55700 <literallayout class="monospaced">
55701 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
55702 </literallayout>
55703 <para>
55704 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
55705 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
55706 </para>
55707 <literallayout class="monospaced">
55708 require  verify = sender/callout=postmaster_mailfrom=
55709 </literallayout>
55710 <para>
55711 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
55712 account of the sender address. It is assumed that either the empty address or
55713 a fixed non-empty address will be used. All that Exim remembers is that the
55714 postmaster check for the domain succeeded or failed.
55715 </para>
55716 </listitem></varlistentry>
55717 <varlistentry>
55718 <term><emphasis role="bold">random</emphasis></term>
55719 <listitem>
55720 <para>
55721 <indexterm role="concept">
55722 <primary>callout</primary>
55723 <secondary><quote>random</quote> check</secondary>
55724 </indexterm>
55725 When this parameter is set, before doing the normal callout check, Exim does a
55726 check for a <quote>random</quote> local part at the same domain. The local part is not
55727 really random &ndash; it is defined by the expansion of the option
55728 <option>callout_random_local_part</option>, which defaults to
55729 </para>
55730 <literallayout class="monospaced">
55731 $primary_hostname-$tod_epoch-testing
55732 </literallayout>
55733 <para>
55734 The idea here is to try to determine whether the remote host accepts all local
55735 parts without checking. If it does, there is no point in doing callouts for
55736 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
55737 a cache record, and used to force the current and subsequent callout checks to
55738 succeed without a connection being made, until the cache record expires.
55739 </para>
55740 </listitem></varlistentry>
55741 <varlistentry>
55742 <term><emphasis role="bold">use_postmaster</emphasis></term>
55743 <listitem>
55744 <para>
55745 <indexterm role="concept">
55746 <primary>callout</primary>
55747 <secondary>sender for recipient check</secondary>
55748 </indexterm>
55749 This parameter applies to recipient callouts only. For example:
55750 </para>
55751 <literallayout class="monospaced">
55752 deny  !verify = recipient/callout=use_postmaster
55753 </literallayout>
55754 <para>
55755 <indexterm role="variable">
55756 <primary><varname>$qualify_domain</varname></primary>
55757 </indexterm>
55758 It causes a non-empty postmaster address to be used in the MAIL command when
55759 performing the callout for the recipient, and also for a <quote>random</quote> check if
55760 that is configured. The local part of the address is <literal>postmaster</literal> and the
55761 domain is the contents of <varname>$qualify_domain</varname>.
55762 </para>
55763 </listitem></varlistentry>
55764 <varlistentry>
55765 <term><emphasis role="bold">use_sender</emphasis></term>
55766 <listitem>
55767 <para>
55768 This option applies to recipient callouts only. For example:
55769 </para>
55770 <literallayout class="monospaced">
55771 require  verify = recipient/callout=use_sender
55772 </literallayout>
55773 <para>
55774 It causes the message&#x2019;s actual sender address to be used in the MAIL
55775 command when performing the callout, instead of an empty address. There is no
55776 need to use this option unless you know that the called hosts make use of the
55777 sender when checking recipients. If used indiscriminately, it reduces the
55778 usefulness of callout caching.
55779 </para>
55780 </listitem></varlistentry>
55781 </variablelist>
55782 <para>
55783 If you use any of the parameters that set a non-empty sender for the MAIL
55784 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
55785 <option>use_sender</option>), you should think about possible loops. Recipient checking is
55786 usually done between two hosts that are under the same management, and the host
55787 that receives the callouts is not normally configured to do callouts itself.
55788 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
55789 these circumstances.
55790 </para>
55791 <para>
55792 However, if you use a non-empty sender address for a callout to an arbitrary
55793 host, there is the likelihood that the remote host will itself initiate a
55794 callout check back to your host. As it is checking what appears to be a message
55795 sender, it is likely to use an empty address in MAIL, thus avoiding a
55796 callout loop. However, to be on the safe side it would be best to set up your
55797 own ACLs so that they do not do sender verification checks when the recipient
55798 is the address you use for header sender or postmaster callout checking.
55799 </para>
55800 <para>
55801 Another issue to think about when using non-empty senders for callouts is
55802 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
55803 by the sender/recipient combination; thus, for any given recipient, many more
55804 actual callouts are performed than when an empty sender or postmaster is used.
55805 </para>
55806 </section>
55807 <section id="SECTcallvercache">
55808 <title>Callout caching</title>
55809 <para>
55810 <indexterm role="concept">
55811 <primary>hints database</primary>
55812 <secondary>callout cache</secondary>
55813 </indexterm>
55814 <indexterm role="concept">
55815 <primary>callout</primary>
55816 <secondary>cache, description of</secondary>
55817 </indexterm>
55818 <indexterm role="concept">
55819 <primary>caching</primary>
55820 <secondary>callout</secondary>
55821 </indexterm>
55822 Exim caches the results of callouts in order to reduce the amount of resources
55823 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
55824 option. A hints database called <quote>callout</quote> is used for the cache. Two
55825 different record types are used: one records the result of a callout check for
55826 a specific address, and the other records information that applies to the
55827 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
55828 </para>
55829 <para>
55830 When an original callout fails, a detailed SMTP error message is given about
55831 the failure. However, for subsequent failures use the cache data, this message
55832 is not available.
55833 </para>
55834 <para>
55835 The expiry times for negative and positive address cache records are
55836 independent, and can be set by the global options <option>callout_negative_expire</option>
55837 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
55838 </para>
55839 <para>
55840 If a host gives a negative response to an SMTP connection, or rejects any
55841 commands up to and including
55842 </para>
55843 <literallayout class="monospaced">
55844 MAIL FROM:&lt;&gt;
55845 </literallayout>
55846 <para>
55847 (but not including the MAIL command with a non-empty address),
55848 any callout attempt is bound to fail. Exim remembers such failures in a
55849 domain cache record, which it uses to fail callouts for the domain without
55850 making new connections, until the domain record times out. There are two
55851 separate expiry times for domain cache records:
55852 <option>callout_domain_negative_expire</option> (default 3h) and
55853 <option>callout_domain_positive_expire</option> (default 7d).
55854 </para>
55855 <para>
55856 Domain records expire when the negative expiry time is reached if callouts
55857 cannot be made for the domain, or if the postmaster check failed.
55858 Otherwise, they expire when the positive expiry time is reached. This
55859 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
55860 will eventually be noticed.
55861 </para>
55862 <para>
55863 The callout caching mechanism is based on the domain of the address that is
55864 being tested. If the domain routes to several hosts, it is assumed that their
55865 behaviour will be the same.
55866 </para>
55867 </section>
55868 <section id="SECTsenaddver">
55869 <title>Sender address verification reporting</title>
55870 <para>
55871 <indexterm role="concept">
55872 <primary>verifying</primary>
55873 <secondary>suppressing error details</secondary>
55874 </indexterm>
55875 See section <xref linkend="SECTaddressverification"/> for a general discussion of
55876 verification. When sender verification fails in an ACL, the details of the
55877 failure are given as additional output lines before the 550 response to the
55878 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
55879 you might see:
55880 </para>
55881 <literallayout class="monospaced">
55882 MAIL FROM:&lt;xyz@abc.example&gt;
55883 250 OK
55884 RCPT TO:&lt;pqr@def.example&gt;
55885 550-Verification failed for &lt;xyz@abc.example&gt;
55886 550-Called:   192.168.34.43
55887 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
55888 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
55889 550 Sender verification failed
55890 </literallayout>
55891 <para>
55892 If more than one RCPT command fails in the same way, the details are given
55893 only for the first of them. However, some administrators do not want to send
55894 out this much information. You can suppress the details by adding
55895 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
55896 example:
55897 </para>
55898 <literallayout class="monospaced">
55899 verify = sender/no_details
55900 </literallayout>
55901 </section>
55902 <section id="SECTredirwhilveri">
55903 <title>Redirection while verifying</title>
55904 <para>
55905 <indexterm role="concept">
55906 <primary>verifying</primary>
55907 <secondary>redirection while</secondary>
55908 </indexterm>
55909 <indexterm role="concept">
55910 <primary>address redirection</primary>
55911 <secondary>while verifying</secondary>
55912 </indexterm>
55913 A dilemma arises when a local address is redirected by aliasing or forwarding
55914 during verification: should the generated addresses themselves be verified,
55915 or should the successful expansion of the original address be enough to verify
55916 it? By default, Exim takes the following pragmatic approach:
55917 </para>
55918 <itemizedlist>
55919 <listitem>
55920 <para>
55921 When an incoming address is redirected to just one child address, verification
55922 continues with the child address, and if that fails to verify, the original
55923 verification also fails.
55924 </para>
55925 </listitem>
55926 <listitem>
55927 <para>
55928 When an incoming address is redirected to more than one child address,
55929 verification does not continue. A success result is returned.
55930 </para>
55931 </listitem>
55932 </itemizedlist>
55933 <para>
55934 This seems the most reasonable behaviour for the common use of aliasing as a
55935 way of redirecting different local parts to the same mailbox. It means, for
55936 example, that a pair of alias entries of the form
55937 </para>
55938 <literallayout class="monospaced">
55939 A.Wol:   aw123
55940 aw123:   :fail: Gone away, no forwarding address
55941 </literallayout>
55942 <para>
55943 work as expected, with both local parts causing verification failure. When a
55944 redirection generates more than one address, the behaviour is more like a
55945 mailing list, where the existence of the alias itself is sufficient for
55946 verification to succeed.
55947 </para>
55948 <para>
55949 It is possible, however, to change the default behaviour so that all successful
55950 redirections count as successful verifications, however many new addresses are
55951 generated. This is specified by the <option>success_on_redirect</option> verification
55952 option. For example:
55953 </para>
55954 <literallayout class="monospaced">
55955 require verify = recipient/success_on_redirect/callout=10s
55956 </literallayout>
55957 <para>
55958 In this example, verification succeeds if a router generates a new address, and
55959 the callout does not occur, because no address was routed to a remote host.
55960 </para>
55961 <para>
55962 When verification is being tested via the <option>-bv</option> option, the treatment of
55963 redirections is as just described, unless the <option>-v</option> or any debugging option is
55964 also specified. In that case, full verification is done for every generated
55965 address and a report is output for each of them.
55966 </para>
55967 </section>
55968 <section id="SECTverifyCSA">
55969 <title>Client SMTP authorization (CSA)</title>
55970 <para>
55971 <indexterm role="concept">
55972 <primary>CSA</primary>
55973 <secondary>verifying</secondary>
55974 </indexterm>
55975 Client SMTP Authorization is a system that allows a site to advertise
55976 which machines are and are not permitted to send email. This is done by placing
55977 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
55978 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
55979 Authorization checks in Exim are performed by the ACL condition:
55980 </para>
55981 <literallayout class="monospaced">
55982 verify = csa
55983 </literallayout>
55984 <para>
55985 This fails if the client is not authorized. If there is a DNS problem, or if no
55986 valid CSA SRV record is found, or if the client is authorized, the condition
55987 succeeds. These three cases can be distinguished using the expansion variable
55988 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
55989 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
55990 be likely to cause problems for legitimate email.
55991 </para>
55992 <para>
55993 The error messages produced by the CSA code include slightly more
55994 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
55995 looking up the CSA SRV record, or problems looking up the CSA target
55996 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
55997 </para>
55998 <itemizedlist>
55999 <listitem>
56000 <para>
56001 The client&#x2019;s host name is explicitly not authorized.
56002 </para>
56003 </listitem>
56004 <listitem>
56005 <para>
56006 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
56007 </para>
56008 </listitem>
56009 <listitem>
56010 <para>
56011 The client&#x2019;s host name is authorized but it has no valid target IP addresses
56012 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
56013 </para>
56014 </listitem>
56015 <listitem>
56016 <para>
56017 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
56018 that all subdomains must be explicitly authorized.
56019 </para>
56020 </listitem>
56021 </itemizedlist>
56022 <para>
56023 The <option>csa</option> verification condition can take an argument which is the domain to
56024 use for the DNS query. The default is:
56025 </para>
56026 <literallayout class="monospaced">
56027 verify = csa/$sender_helo_name
56028 </literallayout>
56029 <para>
56030 This implementation includes an extension to CSA. If the query domain
56031 is an address literal such as [192.0.2.95], or if it is a bare IP
56032 address, Exim searches for CSA SRV records in the reverse DNS as if
56033 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
56034 meaningful to say:
56035 </para>
56036 <literallayout class="monospaced">
56037 verify = csa/$sender_host_address
56038 </literallayout>
56039 <para>
56040 In fact, this is the check that Exim performs if the client does not say HELO.
56041 This extension can be turned off by setting the main configuration option
56042 <option>dns_csa_use_reverse</option> to be false.
56043 </para>
56044 <para>
56045 If a CSA SRV record is not found for the domain itself, a search
56046 is performed through its parent domains for a record which might be
56047 making assertions about subdomains. The maximum depth of this search is limited
56048 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
56049 default. Exim does not look for CSA SRV records in a top level domain, so the
56050 default settings handle HELO domains as long as seven
56051 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
56052 of legitimate HELO domains.
56053 </para>
56054 <para>
56055 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
56056 direct SRV lookups, this is not sufficient because of the extra parent domain
56057 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
56058 addresses into lookups in the reverse DNS space. The result of a successful
56059 lookup such as:
56060 </para>
56061 <literallayout class="monospaced">
56062 ${lookup dnsdb {csa=$sender_helo_name}}
56063 </literallayout>
56064 <para>
56065 has two space-separated fields: an authorization code and a target host name.
56066 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
56067 authorization required but absent, or <quote>?</quote> for unknown.
56068 </para>
56069 </section>
56070 <section id="SECTverifyPRVS">
56071 <title>Bounce address tag validation</title>
56072 <para>
56073 <indexterm role="concept">
56074 <primary>BATV, verifying</primary>
56075 </indexterm>
56076 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
56077 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
56078 Genuine incoming bounce messages should therefore always be addressed to
56079 recipients that have a valid tag. This scheme is a way of detecting unwanted
56080 bounce messages caused by sender address forgeries (often called <quote>collateral
56081 spam</quote>), because the recipients of such messages do not include valid tags.
56082 </para>
56083 <para>
56084 There are two expansion items to help with the implementation of the BATV
56085 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
56086 the original envelope sender address by using a simple key to add a hash of the
56087 address and some time-based randomizing information. The <option>prvs</option> expansion
56088 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
56089 The syntax of these expansion items is described in section
56090 <xref linkend="SECTexpansionitems"/>.
56091 </para>
56092 <para>
56093 As an example, suppose the secret per-address keys are stored in an MySQL
56094 database. A query to look up the key for an address could be defined as a macro
56095 like this:
56096 </para>
56097 <literallayout class="monospaced">
56098 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
56099                 WHERE sender='${quote_mysql:$prvscheck_address}'\
56100                 }{$value}}
56101 </literallayout>
56102 <para>
56103 Suppose also that the senders who make use of BATV are defined by an address
56104 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
56105 use this:
56106 </para>
56107 <literallayout class="monospaced">
56108 # Bounces: drop unsigned addresses for BATV senders
56109 deny message = This address does not send an unsigned reverse path
56110      senders = :
56111      recipients = +batv_senders
56112
56113 # Bounces: In case of prvs-signed address, check signature.
56114 deny message = Invalid reverse path signature.
56115      senders = :
56116      condition  = ${prvscheck {$local_part@$domain}\
56117                   {PRVSCHECK_SQL}{1}}
56118      !condition = $prvscheck_result
56119 </literallayout>
56120 <para>
56121 The first statement rejects recipients for bounce messages that are addressed
56122 to plain BATV sender addresses, because it is known that BATV senders do not
56123 send out messages with plain sender addresses. The second statement rejects
56124 recipients that are prvs-signed, but with invalid signatures (either because
56125 the key is wrong, or the signature has timed out).
56126 </para>
56127 <para>
56128 A non-prvs-signed address is not rejected by the second statement, because the
56129 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
56130 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
56131 the first argument is a syntactically valid prvs-signed address, the yield is
56132 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
56133 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
56134 of the checks (empty for failure, <quote>1</quote> for success).
56135 </para>
56136 <para>
56137 There is one more issue you must consider when implementing prvs-signing:
56138 you have to ensure that the routers accept prvs-signed addresses and
56139 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
56140 router to remove the signature with a configuration along these lines:
56141 </para>
56142 <literallayout class="monospaced">
56143 batv_redirect:
56144   driver = redirect
56145   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
56146 </literallayout>
56147 <para>
56148 This works because, if the third argument of <option>prvscheck</option> is empty, the result
56149 of the expansion of a prvs-signed address is the decoded value of the original
56150 address. This router should probably be the first of your routers that handles
56151 local addresses.
56152 </para>
56153 <para>
56154 To create BATV-signed addresses in the first place, a transport of this form
56155 can be used:
56156 </para>
56157 <literallayout class="monospaced">
56158 external_smtp_batv:
56159   driver = smtp
56160   return_path = ${prvs {$return_path} \
56161                        {${lookup mysql{SELECT \
56162                        secret FROM batv_prvs WHERE \
56163                        sender='${quote_mysql:$sender_address}'} \
56164                        {$value}fail}}}
56165 </literallayout>
56166 <para>
56167 If no key can be found for the existing return path, no signing takes place.
56168 </para>
56169 </section>
56170 <section id="SECTrelaycontrol">
56171 <title>Using an ACL to control relaying</title>
56172 <para>
56173 <indexterm role="concept">
56174 <primary>access control lists (ACLs)</primary>
56175 <secondary>relay control</secondary>
56176 </indexterm>
56177 <indexterm role="concept">
56178 <primary>relaying</primary>
56179 <secondary>control by ACL</secondary>
56180 </indexterm>
56181 <indexterm role="concept">
56182 <primary>policy control</primary>
56183 <secondary>relay control</secondary>
56184 </indexterm>
56185 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
56186 delivers it directly to another host as a result of a remote address contained
56187 within it. Redirecting a local address via an alias or forward file and then
56188 passing the message on to another host is not relaying,
56189 <indexterm role="concept">
56190 <primary><quote>percent hack</quote></primary>
56191 </indexterm>
56192 but a redirection as a result of the <quote>percent hack</quote> is.
56193 </para>
56194 <para>
56195 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
56196 A host which is acting as a gateway or an MX backup is concerned with incoming
56197 relaying from arbitrary hosts to a specific set of domains. On the other hand,
56198 a host which is acting as a smart host for a number of clients is concerned
56199 with outgoing relaying from those clients to the Internet at large. Often the
56200 same host is fulfilling both functions,
56201 but in principle these two kinds of relaying are entirely independent. What is
56202 not wanted is the transmission of mail from arbitrary remote hosts through your
56203 system to arbitrary domains.
56204 </para>
56205 <para>
56206 You can implement relay control by means of suitable statements in the ACL that
56207 runs for each RCPT command. For convenience, it is often easiest to use
56208 Exim&#x2019;s named list facility to define the domains and hosts involved. For
56209 example, suppose you want to do the following:
56210 </para>
56211 <itemizedlist>
56212 <listitem>
56213 <para>
56214 Deliver a number of domains to mailboxes on the local host (or process them
56215 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
56216 <emphasis>my.dom2.example</emphasis>.
56217 </para>
56218 </listitem>
56219 <listitem>
56220 <para>
56221 Relay mail for a number of other domains for which you are the secondary MX.
56222 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
56223 </para>
56224 </listitem>
56225 <listitem>
56226 <para>
56227 Relay mail from the hosts on your local LAN, to whatever domains are involved.
56228 Suppose your LAN is 192.168.45.0/24.
56229 </para>
56230 </listitem>
56231 </itemizedlist>
56232 <para>
56233 In the main part of the configuration, you put the following definitions:
56234 </para>
56235 <literallayout class="monospaced">
56236 domainlist local_domains    = my.dom1.example : my.dom2.example
56237 domainlist relay_to_domains = friend1.example : friend2.example
56238 hostlist   relay_from_hosts = 192.168.45.0/24
56239 </literallayout>
56240 <para>
56241 Now you can use these definitions in the ACL that is run for every RCPT
56242 command:
56243 </para>
56244 <literallayout class="monospaced">
56245 acl_check_rcpt:
56246   accept domains = +local_domains : +relay_to_domains
56247   accept hosts   = +relay_from_hosts
56248 </literallayout>
56249 <para>
56250 The first statement accepts any RCPT command that contains an address in
56251 the local or relay domains. For any other domain, control passes to the second
56252 statement, which accepts the command only if it comes from one of the relay
56253 hosts. In practice, you will probably want to make your ACL more sophisticated
56254 than this, for example, by including sender and recipient verification. The
56255 default configuration includes a more comprehensive example, which is described
56256 in chapter <xref linkend="CHAPdefconfil"/>.
56257 </para>
56258 </section>
56259 <section id="SECTcheralcon">
56260 <title>Checking a relay configuration</title>
56261 <para>
56262 <indexterm role="concept">
56263 <primary>relaying</primary>
56264 <secondary>checking control of</secondary>
56265 </indexterm>
56266 You can check the relay characteristics of your configuration in the same way
56267 that you can test any ACL behaviour for an incoming SMTP connection, by using
56268 the <option>-bh</option> option to run a fake SMTP session with which you interact.
56269 </para>
56270 <para>
56271 For specifically testing for unwanted relaying, the host
56272 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
56273 host from the host on which Exim is running, using the normal telnet port, you
56274 will see a normal telnet connection message and then quite a long delay. Be
56275 patient. The remote host is making an SMTP connection back to your host, and
56276 trying a number of common probes to test for open relay vulnerability. The
56277 results of the tests will eventually appear on your terminal.
56278 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
56279 </para>
56280 </section>
56281 </chapter>
56282
56283 <chapter id="CHAPexiscan">
56284 <title>Content scanning at ACL time</title>
56285 <para>
56286 <indexterm role="concept" id="IIDcosca" class="startofrange">
56287 <primary>content scanning</primary>
56288 <secondary>at ACL time</secondary>
56289 </indexterm>
56290 The extension of Exim to include content scanning at ACL time, formerly known
56291 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
56292 was integrated into the main source for Exim release 4.50, and Tom continues to
56293 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
56294 specification.
56295 </para>
56296 <para>
56297 It is also possible to scan the content of messages at other times. The
56298 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
56299 scanning after all the ACLs have run. A transport filter can be used to scan
56300 messages at delivery time (see the <option>transport_filter</option> option, described in
56301 chapter <xref linkend="CHAPtransportgeneric"/>).
56302 </para>
56303 <para>
56304 If you want to include the ACL-time content-scanning features when you compile
56305 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
56306 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
56307 </para>
56308 <itemizedlist>
56309 <listitem>
56310 <para>
56311 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
56312 for all MIME parts for SMTP and non-SMTP messages, respectively.
56313 </para>
56314 </listitem>
56315 <listitem>
56316 <para>
56317 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
56318 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
56319 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
56320 </para>
56321 </listitem>
56322 <listitem>
56323 <para>
56324 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
56325 of messages, or parts of messages, for debugging purposes.
56326 </para>
56327 </listitem>
56328 <listitem>
56329 <para>
56330 Additional expansion variables that are set in the new ACL and by the new
56331 conditions.
56332 </para>
56333 </listitem>
56334 <listitem>
56335 <para>
56336 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
56337 </para>
56338 </listitem>
56339 </itemizedlist>
56340 <para>
56341 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
56342 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
56343 condition is compiled, in addition to all the other content-scanning features.
56344 </para>
56345 <para>
56346 Content-scanning is continually evolving, and new features are still being
56347 added. While such features are still unstable and liable to incompatible
56348 changes, they are made available in Exim by setting options whose names begin
56349 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
56350 this manual. You can find out about them by reading the file called
56351 <filename>doc/experimental.txt</filename>.
56352 </para>
56353 <para>
56354 All the content-scanning facilities work on a MBOX copy of the message that is
56355 temporarily created in a file called:
56356 </para>
56357 <literallayout>
56358 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
56359 </literallayout>
56360 <para>
56361 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
56362 expect an MBOX-like structure inside that file. The file is created when the
56363 first content scanning facility is called. Subsequent calls to content
56364 scanning conditions open the same file again. The directory is recursively
56365 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
56366 </para>
56367 <literallayout class="monospaced">
56368 control = no_mbox_unspool
56369 </literallayout>
56370 <para>
56371 has been encountered. When the MIME ACL decodes files, they are put into the
56372 same directory by default.
56373 </para>
56374 <section id="SECTscanvirus">
56375 <title>Scanning for viruses</title>
56376 <para>
56377 <indexterm role="concept">
56378 <primary>virus scanning</primary>
56379 </indexterm>
56380 <indexterm role="concept">
56381 <primary>content scanning</primary>
56382 <secondary>for viruses</secondary>
56383 </indexterm>
56384 <indexterm role="concept">
56385 <primary>content scanning</primary>
56386 <secondary>the <option>malware</option> condition</secondary>
56387 </indexterm>
56388 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
56389 It supports a <quote>generic</quote> interface to scanners called via the shell, and
56390 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
56391 in memory and thus are much faster.
56392 </para>
56393 <para>
56394 <indexterm role="option">
56395 <primary><option>av_scanner</option></primary>
56396 </indexterm>
56397 You can set the <option>av_scanner</option> option in first part of the Exim configuration
56398 file to specify which scanner to use, together with any additional options that
56399 are needed. The basic syntax is as follows:
56400 </para>
56401 <literallayout>
56402 <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>
56403 </literallayout>
56404 <para>
56405 If you do not set <option>av_scanner</option>, it defaults to
56406 </para>
56407 <literallayout class="monospaced">
56408 av_scanner = sophie:/var/run/sophie
56409 </literallayout>
56410 <para>
56411 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
56412 before use.
56413 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
56414 The following scanner types are supported in this release:
56415 </para>
56416 <variablelist>
56417 <varlistentry>
56418 <term><option>aveserver</option></term>
56419 <listitem>
56420 <para>
56421 <indexterm role="concept">
56422 <primary>virus scanners</primary>
56423 <secondary>Kaspersky</secondary>
56424 </indexterm>
56425 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
56426 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
56427 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
56428 example:
56429 </para>
56430 <literallayout class="monospaced">
56431 av_scanner = aveserver:/var/run/aveserver
56432 </literallayout>
56433 </listitem></varlistentry>
56434 <varlistentry>
56435 <term><option>clamd</option></term>
56436 <listitem>
56437 <para>
56438 <indexterm role="concept">
56439 <primary>virus scanners</primary>
56440 <secondary>clamd</secondary>
56441 </indexterm>
56442 This daemon-type scanner is GPL and free. You can get it at
56443 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
56444 unpack MIME containers, so it used to be recommended to unpack MIME attachments
56445 in the MIME ACL. This no longer believed to be necessary. One option is
56446 required: either the path and name of a UNIX socket file, or a hostname or IP
56447 number, and a port, separated by space, as in the second of these examples:
56448 </para>
56449 <literallayout class="monospaced">
56450 av_scanner = clamd:/opt/clamd/socket
56451 av_scanner = clamd:192.0.2.3 1234
56452 av_scanner = clamd:192.0.2.3 1234:local
56453 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
56454 </literallayout>
56455 <para>
56456 If the value of av_scanner points to a UNIX socket file or contains the local
56457 keyword, then the ClamAV interface will pass a filename containing the data
56458 to be scanned, which will should normally result in less I/O happening and be
56459 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
56460 Exim does not assume that there is a common filesystem with the remote host.
56461 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
56462 you be running a version of ClamAV prior to 0.95.
56463 </para>
56464 <para>
56465 The final example shows that multiple TCP targets can be specified.  Exim will
56466 randomly use one for each incoming email (i.e. it load balances them).  Note
56467 that only TCP targets may be used if specifying a list of scanners; a UNIX
56468 socket cannot be mixed in with TCP targets.  If one of the servers becomes
56469 unavailable, Exim will try the remaining one(s) until it finds one that works.
56470 When a clamd server becomes unreachable, Exim will log a message.  Exim does
56471 not keep track of scanner state between multiple messages, and the scanner
56472 selection is random, so the message will get logged in the mainlog for each
56473 email that the down scanner gets chosen first (message wrapped to be readable):
56474 </para>
56475 <literallayout class="monospaced">
56476 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
56477    clamd: connection to localhost, port 3310 failed
56478    (Connection refused)
56479 </literallayout>
56480 <para>
56481 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
56482 contributing the code for this scanner.
56483 </para>
56484 </listitem></varlistentry>
56485 <varlistentry>
56486 <term><option>cmdline</option></term>
56487 <listitem>
56488 <para>
56489 <indexterm role="concept">
56490 <primary>virus scanners</primary>
56491 <secondary>command line interface</secondary>
56492 </indexterm>
56493 This is the keyword for the generic command line scanner interface. It can be
56494 used to attach virus scanners that are invoked from the shell. This scanner
56495 type takes 3 mandatory options:
56496 </para>
56497 <orderedlist numeration="arabic">
56498 <listitem>
56499 <para>
56500 The full path and name of the scanner binary, with all command line options,
56501 and a placeholder (<literal>%s</literal>) for the directory to scan.
56502 </para>
56503 </listitem>
56504 <listitem>
56505 <para>
56506 A regular expression to match against the STDOUT and STDERR output of the
56507 virus scanner. If the expression matches, a virus was found. You must make
56508 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
56509 the <quote>trigger</quote> expression.
56510 </para>
56511 </listitem>
56512 <listitem>
56513 <para>
56514 Another regular expression, containing exactly one pair of parentheses, to
56515 match the name of the virus found in the scanners output. This is called the
56516 <quote>name</quote> expression.
56517 </para>
56518 </listitem>
56519 </orderedlist>
56520 <para>
56521 For example, Sophos Sweep reports a virus on a line like this:
56522 </para>
56523 <literallayout class="monospaced">
56524 Virus 'W32/Magistr-B' found in file ./those.bat
56525 </literallayout>
56526 <para>
56527 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
56528 name expression, we want to extract the W32/Magistr-B string, so we can match
56529 for the single quotes left and right of it. Altogether, this makes the
56530 configuration setting:
56531 </para>
56532 <literallayout class="monospaced">
56533 av_scanner = cmdline:\
56534              /path/to/sweep -ss -all -rec -archive %s:\
56535              found in file:'(.+)'
56536 </literallayout>
56537 </listitem></varlistentry>
56538 <varlistentry>
56539 <term><option>drweb</option></term>
56540 <listitem>
56541 <para>
56542 <indexterm role="concept">
56543 <primary>virus scanners</primary>
56544 <secondary>DrWeb</secondary>
56545 </indexterm>
56546 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
56547 argument, either a full path to a UNIX socket, or an IP address and port
56548 separated by white space, as in these examples:
56549 </para>
56550 <literallayout class="monospaced">
56551 av_scanner = drweb:/var/run/drwebd.sock
56552 av_scanner = drweb:192.168.2.20 31337
56553 </literallayout>
56554 <para>
56555 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
56556 is used. Thanks to Alex Miller for contributing the code for this scanner.
56557 </para>
56558 </listitem></varlistentry>
56559 <varlistentry>
56560 <term><option>fsecure</option></term>
56561 <listitem>
56562 <para>
56563 <indexterm role="concept">
56564 <primary>virus scanners</primary>
56565 <secondary>F-Secure</secondary>
56566 </indexterm>
56567 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
56568 argument which is the path to a UNIX socket. For example:
56569 </para>
56570 <literallayout class="monospaced">
56571 av_scanner = fsecure:/path/to/.fsav
56572 </literallayout>
56573 <para>
56574 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
56575 Thelmen for contributing the code for this scanner.
56576 </para>
56577 </listitem></varlistentry>
56578 <varlistentry>
56579 <term><option>kavdaemon</option></term>
56580 <listitem>
56581 <para>
56582 <indexterm role="concept">
56583 <primary>virus scanners</primary>
56584 <secondary>Kaspersky</secondary>
56585 </indexterm>
56586 This is the scanner daemon of Kaspersky Version 4. This version of the
56587 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
56588 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
56589 For example:
56590 </para>
56591 <literallayout class="monospaced">
56592 av_scanner = kavdaemon:/opt/AVP/AvpCtl
56593 </literallayout>
56594 <para>
56595 The default path is <filename>/var/run/AvpCtl</filename>.
56596 </para>
56597 </listitem></varlistentry>
56598 <varlistentry>
56599 <term><option>mksd</option></term>
56600 <listitem>
56601 <para>
56602 <indexterm role="concept">
56603 <primary>virus scanners</primary>
56604 <secondary>mksd</secondary>
56605 </indexterm>
56606 This is a daemon type scanner that is aimed mainly at Polish users, though some
56607 parts of documentation are now available in English. You can get it at
56608 <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
56609 the maximum number of processes used simultaneously to scan the attachments,
56610 provided that the demime facility is employed and also provided that mksd has
56611 been run with at least the same number of child processes. For example:
56612 </para>
56613 <literallayout class="monospaced">
56614 av_scanner = mksd:2
56615 </literallayout>
56616 <para>
56617 You can safely omit this option (the default value is 1).
56618 </para>
56619 </listitem></varlistentry>
56620 <varlistentry>
56621 <term><option>sock</option></term>
56622 <listitem>
56623 <para>
56624 <indexterm role="concept">
56625 <primary>virus scanners</primary>
56626 <secondary>simple socket-connected</secondary>
56627 </indexterm>
56628 This is a general-purpose way of talking to simple scanner daemons
56629 running on the local machine.
56630 There are four options:
56631 an address (which may be an IP addres and port, or the path of a Unix socket),
56632 a commandline to send (may include a single %s which will be replaced with
56633 the path to the mail file to be scanned),
56634 an RE to trigger on from the returned data,
56635 an RE to extract malware_name from the returned data.
56636 For example:
56637 </para>
56638 <literallayout class="monospaced">
56639 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
56640 </literallayout>
56641 <para>
56642 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
56643 Default for the commandline is <filename>%s\n</filename>.
56644 Both regular-expressions are required.
56645 </para>
56646 </listitem></varlistentry>
56647 <varlistentry>
56648 <term><option>sophie</option></term>
56649 <listitem>
56650 <para>
56651 <indexterm role="concept">
56652 <primary>virus scanners</primary>
56653 <secondary>Sophos and Sophie</secondary>
56654 </indexterm>
56655 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
56656 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
56657 for this scanner type is the path to the UNIX socket that Sophie uses for
56658 client communication. For example:
56659 </para>
56660 <literallayout class="monospaced">
56661 av_scanner = sophie:/tmp/sophie
56662 </literallayout>
56663 <para>
56664 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
56665 the option.
56666 </para>
56667 </listitem></varlistentry>
56668 </variablelist>
56669 <para>
56670 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
56671 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
56672 ACL.
56673 </para>
56674 <para>
56675 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
56676 makes it possible to use different scanners. See further below for an example.
56677 The <option>malware</option> condition caches its results, so when you use it multiple times
56678 for the same message, the actual scanning process is only carried out once.
56679 However, using expandable items in <option>av_scanner</option> disables this caching, in
56680 which case each use of the <option>malware</option> condition causes a new scan of the
56681 message.
56682 </para>
56683 <para>
56684 The <option>malware</option> condition takes a right-hand argument that is expanded before
56685 use. It can then be one of
56686 </para>
56687 <itemizedlist>
56688 <listitem>
56689 <para>
56690 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
56691 The condition succeeds if a virus was found, and fail otherwise. This is the
56692 recommended usage.
56693 </para>
56694 </listitem>
56695 <listitem>
56696 <para>
56697 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
56698 the condition fails immediately.
56699 </para>
56700 </listitem>
56701 <listitem>
56702 <para>
56703 A regular expression, in which case the message is scanned for viruses. The
56704 condition succeeds if a virus is found and its name matches the regular
56705 expression. This allows you to take special actions on certain types of virus.
56706 </para>
56707 </listitem>
56708 </itemizedlist>
56709 <para>
56710 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
56711 even if there is a problem with the virus scanner. Otherwise, such a problem
56712 causes the ACL to defer.
56713 </para>
56714 <para>
56715 <indexterm role="variable">
56716 <primary><varname>$malware_name</varname></primary>
56717 </indexterm>
56718 When a virus is found, the condition sets up an expansion variable called
56719 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
56720 <option>message</option> modifier that specifies the error returned to the sender, and/or in
56721 logging data.
56722 </para>
56723 <para>
56724 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
56725 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
56726 <option>malware</option> condition.
56727 </para>
56728 <para>
56729 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
56730 imposed by your anti-virus scanner.
56731 </para>
56732 <para>
56733 Here is a very simple scanning example:
56734 </para>
56735 <literallayout class="monospaced">
56736 deny message = This message contains malware ($malware_name)
56737      demime = *
56738      malware = *
56739 </literallayout>
56740 <para>
56741 The next example accepts messages when there is a problem with the scanner:
56742 </para>
56743 <literallayout class="monospaced">
56744 deny message = This message contains malware ($malware_name)
56745      demime = *
56746      malware = */defer_ok
56747 </literallayout>
56748 <para>
56749 The next example shows how to use an ACL variable to scan with both sophie and
56750 aveserver. It assumes you have set:
56751 </para>
56752 <literallayout class="monospaced">
56753 av_scanner = $acl_m0
56754 </literallayout>
56755 <para>
56756 in the main Exim configuration.
56757 </para>
56758 <literallayout class="monospaced">
56759 deny message = This message contains malware ($malware_name)
56760      set acl_m0 = sophie
56761      malware = *
56762
56763 deny message = This message contains malware ($malware_name)
56764      set acl_m0 = aveserver
56765      malware = *
56766 </literallayout>
56767 </section>
56768 <section id="SECTscanspamass">
56769 <title>Scanning with SpamAssassin</title>
56770 <para>
56771 <indexterm role="concept">
56772 <primary>content scanning</primary>
56773 <secondary>for spam</secondary>
56774 </indexterm>
56775 <indexterm role="concept">
56776 <primary>spam scanning</primary>
56777 </indexterm>
56778 <indexterm role="concept">
56779 <primary>SpamAssassin</primary>
56780 </indexterm>
56781 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
56782 score and a report for the message. You can get SpamAssassin at
56783 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
56784 installation, you can use CPAN by running:
56785 </para>
56786 <literallayout class="monospaced">
56787 perl -MCPAN -e 'install Mail::SpamAssassin'
56788 </literallayout>
56789 <para>
56790 SpamAssassin has its own set of configuration files. Please review its
56791 documentation to see how you can tweak it. The default installation should work
56792 nicely, however.
56793 </para>
56794 <para>
56795 <indexterm role="option">
56796 <primary><option>spamd_address</option></primary>
56797 </indexterm>
56798 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
56799 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
56800 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
56801 part of the Exim configuration as follows (example):
56802 </para>
56803 <literallayout class="monospaced">
56804 spamd_address = 192.168.99.45 387
56805 </literallayout>
56806 <para>
56807 You do not need to set this option if you use the default. As of version 2.60,
56808 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
56809 these, supply <option>spamd_address</option> with an absolute file name instead of a
56810 address/port pair:
56811 </para>
56812 <literallayout class="monospaced">
56813 spamd_address = /var/run/spamd_socket
56814 </literallayout>
56815 <para>
56816 You can have multiple <option>spamd</option> servers to improve scalability. These can
56817 reside on other hardware reachable over the network. To specify multiple
56818 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
56819 option, separated with colons:
56820 </para>
56821 <literallayout class="monospaced">
56822 spamd_address = 192.168.2.10 783 : \
56823                 192.168.2.11 783 : \
56824                 192.168.2.12 783
56825 </literallayout>
56826 <para>
56827 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
56828 fashion. When a server fails to respond to the connection attempt, all other
56829 servers are tried until one succeeds. If no server responds, the <option>spam</option>
56830 condition defers.
56831 </para>
56832 <para>
56833 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
56834 multiple <option>spamd</option> servers.
56835 </para>
56836 <para>
56837 The <option>spamd_address</option> variable is expanded before use if it starts with
56838 a dollar sign. In this case, the expansion may return a string that is
56839 used as the list so that multiple spamd servers can be the result of an
56840 expansion.
56841 </para>
56842 </section>
56843 <section id="SECID206">
56844 <title>Calling SpamAssassin from an Exim ACL</title>
56845 <para>
56846 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
56847 </para>
56848 <literallayout class="monospaced">
56849 deny message = This message was classified as SPAM
56850      spam = joe
56851 </literallayout>
56852 <para>
56853 The right-hand side of the <option>spam</option> condition specifies a name. This is
56854 relevant if you have set up multiple SpamAssassin profiles. If you do not want
56855 to scan using a specific profile, but rather use the SpamAssassin system-wide
56856 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
56857 However, you must put something on the right-hand side.
56858 </para>
56859 <para>
56860 The name allows you to use per-domain or per-user antispam profiles in
56861 principle, but this is not straightforward in practice, because a message may
56862 have multiple recipients, not necessarily all in the same domain. Because the
56863 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
56864 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
56865 are not set.
56866 </para>
56867 <para>
56868 The right-hand side of the <option>spam</option> condition is expanded before being used, so
56869 you can put lookups or conditions there. When the right-hand side evaluates to
56870 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
56871 </para>
56872 <para>
56873 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
56874 large ones may cause significant performance degradation. As most spam messages
56875 are quite small, it is recommended that you do not scan the big ones. For
56876 example:
56877 </para>
56878 <literallayout class="monospaced">
56879 deny message = This message was classified as SPAM
56880      condition = ${if &lt; {$message_size}{10K}}
56881      spam = nobody
56882 </literallayout>
56883 <para>
56884 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
56885 SpamAssassin profile has been matched or exceeded. If you want to use the
56886 <option>spam</option> condition for its side effects (see the variables below), you can make
56887 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
56888 </para>
56889 <para>
56890 <indexterm role="concept">
56891 <primary>spam scanning</primary>
56892 <secondary>returned variables</secondary>
56893 </indexterm>
56894 When the <option>spam</option> condition is run, it sets up a number of expansion
56895 variables. These variables are saved with the received message, thus they are
56896 available for use at delivery time.
56897 </para>
56898 <variablelist>
56899 <varlistentry>
56900 <term><varname>$spam_score</varname></term>
56901 <listitem>
56902 <para>
56903 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
56904 for inclusion in log or reject messages.
56905 </para>
56906 </listitem></varlistentry>
56907 <varlistentry>
56908 <term><varname>$spam_score_int</varname></term>
56909 <listitem>
56910 <para>
56911 The spam score of the message, multiplied by ten, as an integer value. For
56912 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
56913 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
56914 The integer value is useful for numeric comparisons in conditions.
56915 </para>
56916 </listitem></varlistentry>
56917 <varlistentry>
56918 <term><varname>$spam_bar</varname></term>
56919 <listitem>
56920 <para>
56921 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
56922 integer part of the spam score value. A spam score of 4.4 would have a
56923 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
56924 headers, since MUAs can match on such strings.
56925 </para>
56926 </listitem></varlistentry>
56927 <varlistentry>
56928 <term><varname>$spam_report</varname></term>
56929 <listitem>
56930 <para>
56931 A multiline text table, containing the full SpamAssassin report for the
56932 message. Useful for inclusion in headers or reject messages.
56933 </para>
56934 </listitem></varlistentry>
56935 </variablelist>
56936 <para>
56937 The <option>spam</option> condition caches its results unless expansion in
56938 spamd_address was used. If you call it again with the same user name, it
56939 does not scan again, but rather returns the same values as before.
56940 </para>
56941 <para>
56942 The <option>spam</option> condition returns DEFER if there is any error while running
56943 the message through SpamAssassin or if the expansion of spamd_address
56944 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
56945 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
56946 spam condition, like this:
56947 </para>
56948 <literallayout class="monospaced">
56949 deny message = This message was classified as SPAM
56950      spam    = joe/defer_ok
56951 </literallayout>
56952 <para>
56953 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
56954 </para>
56955 <para>
56956 Here is a longer, commented example of the use of the <option>spam</option>
56957 condition:
56958 </para>
56959 <literallayout class="monospaced">
56960 # put headers in all messages (no matter if spam or not)
56961 warn  spam = nobody:true
56962       add_header = X-Spam-Score: $spam_score ($spam_bar)
56963       add_header = X-Spam-Report: $spam_report
56964
56965 # add second subject line with *SPAM* marker when message
56966 # is over threshold
56967 warn  spam = nobody
56968       add_header = Subject: *SPAM* $h_Subject:
56969
56970 # reject spam at high scores (&gt; 12)
56971 deny  message = This message scored $spam_score spam points.
56972       spam = nobody:true
56973       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
56974 </literallayout>
56975 </section>
56976 <section id="SECTscanmimepart">
56977 <title>Scanning MIME parts</title>
56978 <para>
56979 <indexterm role="concept">
56980 <primary>content scanning</primary>
56981 <secondary>MIME parts</secondary>
56982 </indexterm>
56983 <indexterm role="concept">
56984 <primary>MIME content scanning</primary>
56985 </indexterm>
56986 <indexterm role="option">
56987 <primary><option>acl_smtp_mime</option></primary>
56988 </indexterm>
56989 <indexterm role="option">
56990 <primary><option>acl_not_smtp_mime</option></primary>
56991 </indexterm>
56992 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
56993 each MIME part of an SMTP message, including multipart types, in the sequence
56994 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
56995 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
56996 options may both refer to the same ACL if you want the same processing in both
56997 cases.
56998 </para>
56999 <para>
57000 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
57001 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
57002 the case of a non-SMTP message. However, a MIME ACL is called only if the
57003 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
57004 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
57005 result code is sent to the client. In the case of an SMTP message, the
57006 <option>acl_smtp_data</option> ACL is not called when this happens.
57007 </para>
57008 <para>
57009 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
57010 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
57011 condition to match against the raw MIME part. You can also use the
57012 <option>mime_regex</option> condition to match against the decoded MIME part (see section
57013 <xref linkend="SECTscanregex"/>).
57014 </para>
57015 <para>
57016 At the start of a MIME ACL, a number of variables are set from the header
57017 information for the relevant MIME part. These are described below. The contents
57018 of the MIME part are not by default decoded into a disk file except for MIME
57019 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
57020 part into a disk file, you can use the <option>decode</option> condition. The general
57021 syntax is:
57022 </para>
57023 <literallayout>
57024 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
57025 </literallayout>
57026 <para>
57027 The right hand side is expanded before use. After expansion,
57028 the value can be:
57029 </para>
57030 <orderedlist numeration="arabic">
57031 <listitem>
57032 <para>
57033 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
57034 </para>
57035 </listitem>
57036 <listitem>
57037 <para>
57038 The string <quote>default</quote>. In that case, the file is put in the temporary
57039 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
57040 a sequential file name consisting of the message id and a sequence number. The
57041 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
57042 </para>
57043 </listitem>
57044 <listitem>
57045 <para>
57046 A full path name starting with a slash. If the full name is an existing
57047 directory, it is used as a replacement for the default directory. The filename
57048 is then sequentially assigned. If the path does not exist, it is used as
57049 the full path and file name.
57050 </para>
57051 </listitem>
57052 <listitem>
57053 <para>
57054 If the string does not start with a slash, it is used as the
57055 filename, and the default path is then used.
57056 </para>
57057 </listitem>
57058 </orderedlist>
57059 <para>
57060 The <option>decode</option> condition normally succeeds. It is only false for syntax
57061 errors or unusual circumstances such as memory shortages. You can easily decode
57062 a file with its original, proposed filename using
57063 </para>
57064 <literallayout class="monospaced">
57065 decode = $mime_filename
57066 </literallayout>
57067 <para>
57068 However, you should keep in mind that <varname>$mime_filename</varname> might contain
57069 anything. If you place files outside of the default path, they are not
57070 automatically unlinked.
57071 </para>
57072 <para>
57073 For RFC822 attachments (these are messages attached to messages, with a
57074 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
57075 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
57076 variable is set (see below). Attached messages are always decoded to disk
57077 before being checked, and the files are unlinked once the check is done.
57078 </para>
57079 <para>
57080 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
57081 used to match regular expressions against raw and decoded MIME parts,
57082 respectively. They are described in section <xref linkend="SECTscanregex"/>.
57083 </para>
57084 <para>
57085 <indexterm role="concept">
57086 <primary>MIME content scanning</primary>
57087 <secondary>returned variables</secondary>
57088 </indexterm>
57089 The following list describes all expansion variables that are
57090 available in the MIME ACL:
57091 </para>
57092 <variablelist>
57093 <varlistentry>
57094 <term><varname>$mime_boundary</varname></term>
57095 <listitem>
57096 <para>
57097 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
57098 have a boundary string, which is stored in this variable. If the current part
57099 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
57100 contains the empty string.
57101 </para>
57102 </listitem></varlistentry>
57103 <varlistentry>
57104 <term><varname>$mime_charset</varname></term>
57105 <listitem>
57106 <para>
57107 This variable contains the character set identifier, if one was found in the
57108 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
57109 </para>
57110 <literallayout class="monospaced">
57111 us-ascii
57112 gb2312 (Chinese)
57113 iso-8859-1
57114 </literallayout>
57115 <para>
57116 Please note that this value is not normalized, so you should do matches
57117 case-insensitively.
57118 </para>
57119 </listitem></varlistentry>
57120 <varlistentry>
57121 <term><varname>$mime_content_description</varname></term>
57122 <listitem>
57123 <para>
57124 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
57125 header. It can contain a human-readable description of the parts content. Some
57126 implementations repeat the filename for attachments here, but they are usually
57127 only used for display purposes.
57128 </para>
57129 </listitem></varlistentry>
57130 <varlistentry>
57131 <term><varname>$mime_content_disposition</varname></term>
57132 <listitem>
57133 <para>
57134 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
57135 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
57136 </para>
57137 </listitem></varlistentry>
57138 <varlistentry>
57139 <term><varname>$mime_content_id</varname></term>
57140 <listitem>
57141 <para>
57142 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
57143 This is a unique ID that can be used to reference a part from another part.
57144 </para>
57145 </listitem></varlistentry>
57146 <varlistentry>
57147 <term><varname>$mime_content_size</varname></term>
57148 <listitem>
57149 <para>
57150 This variable is set only after the <option>decode</option> modifier (see above) has been
57151 successfully run. It contains the size of the decoded part in kilobytes. The
57152 size is always rounded up to full kilobytes, so only a completely empty part
57153 has a <varname>$mime_content_size</varname> of zero.
57154 </para>
57155 </listitem></varlistentry>
57156 <varlistentry>
57157 <term><varname>$mime_content_transfer_encoding</varname></term>
57158 <listitem>
57159 <para>
57160 This variable contains the normalized content of the
57161 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
57162 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
57163 </para>
57164 </listitem></varlistentry>
57165 <varlistentry>
57166 <term><varname>$mime_content_type</varname></term>
57167 <listitem>
57168 <para>
57169 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
57170 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
57171 are some examples of popular MIME types, as they may appear in this variable:
57172 </para>
57173 <literallayout class="monospaced">
57174 text/plain
57175 text/html
57176 application/octet-stream
57177 image/jpeg
57178 audio/midi
57179 </literallayout>
57180 <para>
57181 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
57182 empty string.
57183 </para>
57184 </listitem></varlistentry>
57185 <varlistentry>
57186 <term><varname>$mime_decoded_filename</varname></term>
57187 <listitem>
57188 <para>
57189 This variable is set only after the <option>decode</option> modifier (see above) has been
57190 successfully run. It contains the full path and file name of the file
57191 containing the decoded data.
57192 </para>
57193 </listitem></varlistentry>
57194 </variablelist>
57195 <para>
57196 <indexterm role="concept">
57197 <primary>RFC 2047</primary>
57198 </indexterm>
57199 </para>
57200 <variablelist>
57201 <varlistentry>
57202 <term><varname>$mime_filename</varname></term>
57203 <listitem>
57204 <para>
57205 This is perhaps the most important of the MIME variables. It contains a
57206 proposed filename for an attachment, if one was found in either the
57207 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
57208 RFC2047 decoded, but no additional sanity checks are done. If no filename was
57209 found, this variable contains the empty string.
57210 </para>
57211 </listitem></varlistentry>
57212 <varlistentry>
57213 <term><varname>$mime_is_coverletter</varname></term>
57214 <listitem>
57215 <para>
57216 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
57217 attached data. It can be used to clamp down on flashy or unnecessarily encoded
57218 content in the cover letter, while not restricting attachments at all.
57219 </para>
57220 <para>
57221 The variable contains 1 (true) for a MIME part believed to be part of the
57222 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
57223 follows:
57224 </para>
57225 <orderedlist numeration="arabic">
57226 <listitem>
57227 <para>
57228 The outermost MIME part of a message is always a cover letter.
57229 </para>
57230 </listitem>
57231 <listitem>
57232 <para>
57233 If a multipart/alternative or multipart/related MIME part is a cover letter,
57234 so are all MIME subparts within that multipart.
57235 </para>
57236 </listitem>
57237 <listitem>
57238 <para>
57239 If any other multipart is a cover letter, the first subpart is a cover letter,
57240 and the rest are attachments.
57241 </para>
57242 </listitem>
57243 <listitem>
57244 <para>
57245 All parts contained within an attachment multipart are attachments.
57246 </para>
57247 </listitem>
57248 </orderedlist>
57249 <para>
57250 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
57251 alternative plain text), while allowing HTML files to be attached. HTML
57252 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
57253 </para>
57254 <literallayout class="monospaced">
57255 deny message = HTML mail is not accepted here
57256 !condition = $mime_is_rfc822
57257 condition = $mime_is_coverletter
57258 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
57259 </literallayout>
57260 </listitem></varlistentry>
57261 <varlistentry>
57262 <term><varname>$mime_is_multipart</varname></term>
57263 <listitem>
57264 <para>
57265 This variable has the value 1 (true) when the current part has the main type
57266 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
57267 Since multipart entities only serve as containers for other parts, you may not
57268 want to carry out specific actions on them.
57269 </para>
57270 </listitem></varlistentry>
57271 <varlistentry>
57272 <term><varname>$mime_is_rfc822</varname></term>
57273 <listitem>
57274 <para>
57275 This variable has the value 1 (true) if the current part is not a part of the
57276 checked message itself, but part of an attached message. Attached message
57277 decoding is fully recursive.
57278 </para>
57279 </listitem></varlistentry>
57280 <varlistentry>
57281 <term><varname>$mime_part_count</varname></term>
57282 <listitem>
57283 <para>
57284 This variable is a counter that is raised for each processed MIME part. It
57285 starts at zero for the very first part (which is usually a multipart). The
57286 counter is per-message, so it is reset when processing RFC822 attachments (see
57287 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
57288 complete, so you can use it in the DATA ACL to determine the number of MIME
57289 parts of a message. For non-MIME messages, this variable contains the value -1.
57290 </para>
57291 </listitem></varlistentry>
57292 </variablelist>
57293 </section>
57294 <section id="SECTscanregex">
57295 <title>Scanning with regular expressions</title>
57296 <para>
57297 <indexterm role="concept">
57298 <primary>content scanning</primary>
57299 <secondary>with regular expressions</secondary>
57300 </indexterm>
57301 <indexterm role="concept">
57302 <primary>regular expressions</primary>
57303 <secondary>content scanning with</secondary>
57304 </indexterm>
57305 You can specify your own custom regular expression matches on the full body of
57306 the message, or on individual MIME parts.
57307 </para>
57308 <para>
57309 The <option>regex</option> condition takes one or more regular expressions as arguments and
57310 matches them against the full message (when called in the DATA ACL) or a raw
57311 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
57312 linewise, with a maximum line length of 32K characters. That means you cannot
57313 have multiline matches with the <option>regex</option> condition.
57314 </para>
57315 <para>
57316 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
57317 to 32K of decoded content (the whole content at once, not linewise). If the
57318 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
57319 is decoded automatically when <option>mime_regex</option> is executed (using default path
57320 and filename values). If the decoded data is larger than  32K, only the first
57321 32K characters are checked.
57322 </para>
57323 <para>
57324 The regular expressions are passed as a colon-separated list. To include a
57325 literal colon, you must double it. Since the whole right-hand side string is
57326 expanded before being used, you must also escape dollar signs and backslashes
57327 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
57328 Here is a simple example that contains two regular expressions:
57329 </para>
57330 <literallayout class="monospaced">
57331 deny message = contains blacklisted regex ($regex_match_string)
57332      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
57333 </literallayout>
57334 <para>
57335 The conditions returns true if any one of the regular expressions matches. The
57336 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
57337 matching regular expression.
57338 </para>
57339 <para>
57340 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
57341 CPU-intensive.
57342 </para>
57343 </section>
57344 <section id="SECTdemimecond">
57345 <title>The demime condition</title>
57346 <para>
57347 <indexterm role="concept">
57348 <primary>content scanning</primary>
57349 <secondary>MIME checking</secondary>
57350 </indexterm>
57351 <indexterm role="concept">
57352 <primary>MIME content scanning</primary>
57353 </indexterm>
57354 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
57355 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
57356 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
57357 ACL functionality, but provides no additional facilities. Please note that this
57358 condition is deprecated and kept only for backward compatibility. You must set
57359 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
57360 use the <option>demime</option> condition.
57361 </para>
57362 <para>
57363 The <option>demime</option> condition unpacks MIME containers in the message. It detects
57364 errors in MIME containers and can match file extensions found in the message
57365 against a list. Using this facility produces files containing the unpacked MIME
57366 parts of the message in the temporary scan directory. If you do antivirus
57367 scanning, it is recommended that you use the <option>demime</option> condition before the
57368 antivirus (<option>malware</option>) condition.
57369 </para>
57370 <para>
57371 On the right-hand side of the <option>demime</option> condition you can pass a
57372 colon-separated list of file extensions that it should match against. For
57373 example:
57374 </para>
57375 <literallayout class="monospaced">
57376 deny message = Found blacklisted file attachment
57377      demime  = vbs:com:bat:pif:prf:lnk
57378 </literallayout>
57379 <para>
57380 If one of the file extensions is found, the condition is true, otherwise it is
57381 false. If there is a temporary error while demimeing (for example, <quote>disk
57382 full</quote>), the condition defers, and the message is temporarily rejected (unless
57383 the condition is on a <option>warn</option> verb).
57384 </para>
57385 <para>
57386 The right-hand side is expanded before being treated as a list, so you can have
57387 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
57388 zero (<quote>0</quote>), no demimeing is done and the condition is false.
57389 </para>
57390 <para>
57391 The <option>demime</option> condition set the following variables:
57392 </para>
57393 <variablelist>
57394 <varlistentry>
57395 <term><varname>$demime_errorlevel</varname></term>
57396 <listitem>
57397 <para>
57398 <indexterm role="variable">
57399 <primary><varname>$demime_errorlevel</varname></primary>
57400 </indexterm>
57401 When an error is detected in a MIME container, this variable contains the
57402 severity of the error, as an integer number. The higher the value, the more
57403 severe the error (the current maximum value is 3). If this variable is unset or
57404 zero, no error occurred.
57405 </para>
57406 </listitem></varlistentry>
57407 <varlistentry>
57408 <term><varname>$demime_reason</varname></term>
57409 <listitem>
57410 <para>
57411 <indexterm role="variable">
57412 <primary><varname>$demime_reason</varname></primary>
57413 </indexterm>
57414 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
57415 human-readable text string describing the MIME error that occurred.
57416 </para>
57417 </listitem></varlistentry>
57418 </variablelist>
57419 <variablelist>
57420 <varlistentry>
57421 <term><varname>$found_extension</varname></term>
57422 <listitem>
57423 <para>
57424 <indexterm role="variable">
57425 <primary><varname>$found_extension</varname></primary>
57426 </indexterm>
57427 When the <option>demime</option> condition is true, this variable contains the file
57428 extension it found.
57429 </para>
57430 </listitem></varlistentry>
57431 </variablelist>
57432 <para>
57433 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
57434 the <option>demime</option> condition, and are not changed on subsequent calls.
57435 </para>
57436 <para>
57437 If you do not want to check for file extensions, but rather use the <option>demime</option>
57438 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
57439 right-hand side value. Here is a more elaborate example of how to use this
57440 facility:
57441 </para>
57442 <literallayout class="monospaced">
57443 # Reject messages with serious MIME container errors
57444 deny  message = Found MIME error ($demime_reason).
57445       demime = *
57446       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
57447
57448 # Reject known virus spreading file extensions.
57449 # Accepting these is pretty much braindead.
57450 deny  message = contains $found_extension file (blacklisted).
57451       demime  = com:vbs:bat:pif:scr
57452
57453 # Freeze .exe and .doc files. Postmaster can
57454 # examine them and eventually thaw them.
57455 deny  log_message = Another $found_extension file.
57456       demime = exe:doc
57457       control = freeze
57458 </literallayout>
57459 <para>
57460 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
57461 </para>
57462 </section>
57463 </chapter>
57464
57465 <chapter id="CHAPlocalscan">
57466 <title>Adding a local scan function to Exim</title>
57467 <titleabbrev>Local scan function</titleabbrev>
57468 <para>
57469 <indexterm role="concept" id="IIDlosca" class="startofrange">
57470 <primary><function>local_scan()</function> function</primary>
57471 <secondary>description of</secondary>
57472 </indexterm>
57473 <indexterm role="concept">
57474 <primary>customizing</primary>
57475 <secondary>input scan using C function</secondary>
57476 </indexterm>
57477 <indexterm role="concept">
57478 <primary>policy control</primary>
57479 <secondary>by local scan function</secondary>
57480 </indexterm>
57481 In these days of email worms, viruses, and ever-increasing spam, some sites
57482 want to apply a lot of checking to messages before accepting them.
57483 </para>
57484 <para>
57485 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
57486 passing messages to external virus and spam scanning software. You can also do
57487 a certain amount in Exim itself through string expansions and the <option>condition</option>
57488 condition in the ACL that runs after the SMTP DATA command or the ACL for
57489 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
57490 </para>
57491 <para>
57492 To allow for further customization to a site&#x2019;s own requirements, there is the
57493 possibility of linking Exim with a private message scanning function, written
57494 in C. If you want to run code that is written in something other than C, you
57495 can of course use a little C stub to call it.
57496 </para>
57497 <para>
57498 The local scan function is run once for every incoming message, at the point
57499 when Exim is just about to accept the message.
57500 It can therefore be used to control non-SMTP messages from local processes as
57501 well as messages arriving via SMTP.
57502 </para>
57503 <para>
57504 Exim applies a timeout to calls of the local scan function, and there is an
57505 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
57506 Zero means <quote>no timeout</quote>.
57507 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
57508 before calling the local scan function, so that the most common types of crash
57509 are caught. If the timeout is exceeded or one of those signals is caught, the
57510 incoming message is rejected with a temporary error if it is an SMTP message.
57511 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
57512 code. The incident is logged on the main and reject logs.
57513 </para>
57514 <section id="SECID207">
57515 <title>Building Exim to use a local scan function</title>
57516 <para>
57517 <indexterm role="concept">
57518 <primary><function>local_scan()</function> function</primary>
57519 <secondary>building Exim to use</secondary>
57520 </indexterm>
57521 To make use of the local scan function feature, you must tell Exim where your
57522 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
57523 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
57524 directory, so you might set
57525 </para>
57526 <literallayout class="monospaced">
57527 LOCAL_SCAN_SOURCE=Local/local_scan.c
57528 </literallayout>
57529 <para>
57530 for example. The function must be called <function>local_scan()</function>. It is called by
57531 Exim after it has received a message, when the success return code is about to
57532 be sent. This is after all the ACLs have been run. The return code from your
57533 function controls whether the message is actually accepted or not. There is a
57534 commented template function (that just accepts the message) in the file
57535 _src/local_scan.c_.
57536 </para>
57537 <para>
57538 If you want to make use of Exim&#x2019;s run time configuration file to set options
57539 for your <function>local_scan()</function> function, you must also set
57540 </para>
57541 <literallayout class="monospaced">
57542 LOCAL_SCAN_HAS_OPTIONS=yes
57543 </literallayout>
57544 <para>
57545 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
57546 </para>
57547 </section>
57548 <section id="SECTapiforloc">
57549 <title>API for local_scan()</title>
57550 <para>
57551 <indexterm role="concept">
57552 <primary><function>local_scan()</function> function</primary>
57553 <secondary>API description</secondary>
57554 </indexterm>
57555 You must include this line near the start of your code:
57556 </para>
57557 <literallayout class="monospaced">
57558 #include "local_scan.h"
57559 </literallayout>
57560 <para>
57561 This header file defines a number of variables and other values, and the
57562 prototype for the function itself. Exim is coded to use unsigned char values
57563 almost exclusively, and one of the things this header defines is a shorthand
57564 for <literal>unsigned char</literal> called <literal>uschar</literal>.
57565 It also contains the following macro definitions, to simplify casting character
57566 strings and pointers to character strings:
57567 </para>
57568 <literallayout class="monospaced">
57569 #define CS   (char *)
57570 #define CCS  (const char *)
57571 #define CSS  (char **)
57572 #define US   (unsigned char *)
57573 #define CUS  (const unsigned char *)
57574 #define USS  (unsigned char **)
57575 </literallayout>
57576 <para>
57577 The function prototype for <function>local_scan()</function> is:
57578 </para>
57579 <literallayout class="monospaced">
57580 extern int local_scan(int fd, uschar **return_text);
57581 </literallayout>
57582 <para>
57583 The arguments are as follows:
57584 </para>
57585 <itemizedlist>
57586 <listitem>
57587 <para>
57588 <option>fd</option> is a file descriptor for the file that contains the body of the message
57589 (the -D file). The file is open for reading and writing, but updating it is not
57590 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
57591 </para>
57592 <para>
57593 The descriptor is positioned at character 19 of the file, which is the first
57594 character of the body itself, because the first 19 characters are the message
57595 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
57596 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
57597 case this changes in some future version.
57598 </para>
57599 </listitem>
57600 <listitem>
57601 <para>
57602 <option>return_text</option> is an address which you can use to return a pointer to a text
57603 string at the end of the function. The value it points to on entry is NULL.
57604 </para>
57605 </listitem>
57606 </itemizedlist>
57607 <para>
57608 The function must return an <option>int</option> value which is one of the following macros:
57609 </para>
57610 <variablelist>
57611 <varlistentry>
57612 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
57613 <listitem>
57614 <para>
57615 <indexterm role="variable">
57616 <primary><varname>$local_scan_data</varname></primary>
57617 </indexterm>
57618 The message is accepted. If you pass back a string of text, it is saved with
57619 the message, and made available in the variable <varname>$local_scan_data</varname>. No
57620 newlines are permitted (if there are any, they are turned into spaces) and the
57621 maximum length of text is 1000 characters.
57622 </para>
57623 </listitem></varlistentry>
57624 <varlistentry>
57625 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
57626 <listitem>
57627 <para>
57628 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57629 queued without immediate delivery, and is frozen.
57630 </para>
57631 </listitem></varlistentry>
57632 <varlistentry>
57633 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
57634 <listitem>
57635 <para>
57636 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57637 queued without immediate delivery.
57638 </para>
57639 </listitem></varlistentry>
57640 <varlistentry>
57641 <term><literal>LOCAL_SCAN_REJECT</literal></term>
57642 <listitem>
57643 <para>
57644 The message is rejected; the returned text is used as an error message which is
57645 passed back to the sender and which is also logged. Newlines are permitted &ndash;
57646 they cause a multiline response for SMTP rejections, but are converted to
57647 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
57648 used.
57649 </para>
57650 </listitem></varlistentry>
57651 <varlistentry>
57652 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
57653 <listitem>
57654 <para>
57655 The message is temporarily rejected; the returned text is used as an error
57656 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
57657 problem</quote> is used.
57658 </para>
57659 </listitem></varlistentry>
57660 <varlistentry>
57661 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
57662 <listitem>
57663 <para>
57664 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
57665 message is not written to the reject log. It has the effect of unsetting the
57666 <option>rejected_header</option> log selector for just this rejection. If
57667 <option>rejected_header</option> is already unset (see the discussion of the
57668 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
57669 same as LOCAL_SCAN_REJECT.
57670 </para>
57671 </listitem></varlistentry>
57672 <varlistentry>
57673 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
57674 <listitem>
57675 <para>
57676 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
57677 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
57678 </para>
57679 </listitem></varlistentry>
57680 </variablelist>
57681 <para>
57682 If the message is not being received by interactive SMTP, rejections are
57683 reported by writing to <option>stderr</option> or by sending an email, as configured by the
57684 <option>-oe</option> command line options.
57685 </para>
57686 </section>
57687 <section id="SECTconoptloc">
57688 <title>Configuration options for local_scan()</title>
57689 <para>
57690 <indexterm role="concept">
57691 <primary><function>local_scan()</function> function</primary>
57692 <secondary>configuration options</secondary>
57693 </indexterm>
57694 It is possible to have option settings in the main configuration file
57695 that set values in static variables in the <function>local_scan()</function> module. If you
57696 want to do this, you must have the line
57697 </para>
57698 <literallayout class="monospaced">
57699 LOCAL_SCAN_HAS_OPTIONS=yes
57700 </literallayout>
57701 <para>
57702 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
57703 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
57704 file, you must define static variables to hold the option values, and a table
57705 to define them.
57706 </para>
57707 <para>
57708 The table must be a vector called <option>local_scan_options</option>, of type
57709 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
57710 and a pointer to the variable that holds the value. The entries must appear in
57711 alphabetical order. Following <option>local_scan_options</option> you must also define a
57712 variable called <option>local_scan_options_count</option> that contains the number of
57713 entries in the table. Here is a short example, showing two kinds of option:
57714 </para>
57715 <literallayout class="monospaced">
57716 static int my_integer_option = 42;
57717 static uschar *my_string_option = US"a default string";
57718
57719 optionlist local_scan_options[] = {
57720   { "my_integer", opt_int,       &amp;my_integer_option },
57721   { "my_string",  opt_stringptr, &amp;my_string_option }
57722 };
57723
57724 int local_scan_options_count =
57725   sizeof(local_scan_options)/sizeof(optionlist);
57726 </literallayout>
57727 <para>
57728 The values of the variables can now be changed from Exim&#x2019;s runtime
57729 configuration file by including a local scan section as in this example:
57730 </para>
57731 <literallayout class="monospaced">
57732 begin local_scan
57733 my_integer = 99
57734 my_string = some string of text...
57735 </literallayout>
57736 <para>
57737 The available types of option data are as follows:
57738 </para>
57739 <variablelist>
57740 <varlistentry>
57741 <term><emphasis role="bold">opt_bool</emphasis></term>
57742 <listitem>
57743 <para>
57744 This specifies a boolean (true/false) option. The address should point to a
57745 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
57746 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
57747 whether such a variable has been set at all, you can initialize it to
57748 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
57749 values.)
57750 </para>
57751 </listitem></varlistentry>
57752 <varlistentry>
57753 <term><emphasis role="bold">opt_fixed</emphasis></term>
57754 <listitem>
57755 <para>
57756 This specifies a fixed point number, such as is used for load averages.
57757 The address should point to a variable of type <literal>int</literal>. The value is stored
57758 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
57759 </para>
57760 </listitem></varlistentry>
57761 <varlistentry>
57762 <term><emphasis role="bold">opt_int</emphasis></term>
57763 <listitem>
57764 <para>
57765 This specifies an integer; the address should point to a variable of type
57766 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
57767 Exim.
57768 </para>
57769 </listitem></varlistentry>
57770 <varlistentry>
57771 <term><emphasis role="bold">opt_mkint</emphasis></term>
57772 <listitem>
57773 <para>
57774 This is the same as <option>opt_int</option>, except that when such a value is output in a
57775 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
57776 printed with the suffix K or M.
57777 </para>
57778 </listitem></varlistentry>
57779 <varlistentry>
57780 <term><emphasis role="bold">opt_octint</emphasis></term>
57781 <listitem>
57782 <para>
57783 This also specifies an integer, but the value is always interpreted as an
57784 octal integer, whether or not it starts with the digit zero, and it is
57785 always output in octal.
57786 </para>
57787 </listitem></varlistentry>
57788 <varlistentry>
57789 <term><emphasis role="bold">opt_stringptr</emphasis></term>
57790 <listitem>
57791 <para>
57792 This specifies a string value; the address must be a pointer to a
57793 variable that points to a string (for example, of type <literal>uschar *</literal>).
57794 </para>
57795 </listitem></varlistentry>
57796 <varlistentry>
57797 <term><emphasis role="bold">opt_time</emphasis></term>
57798 <listitem>
57799 <para>
57800 This specifies a time interval value. The address must point to a variable of
57801 type <literal>int</literal>. The value that is placed there is a number of seconds.
57802 </para>
57803 </listitem></varlistentry>
57804 </variablelist>
57805 <para>
57806 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
57807 out the values of all the <function>local_scan()</function> options.
57808 </para>
57809 </section>
57810 <section id="SECID208">
57811 <title>Available Exim variables</title>
57812 <para>
57813 <indexterm role="concept">
57814 <primary><function>local_scan()</function> function</primary>
57815 <secondary>available Exim variables</secondary>
57816 </indexterm>
57817 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
57818 are the only ones that are guaranteed to be maintained from release to release.
57819 Note, however, that you can obtain the value of any Exim expansion variable,
57820 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
57821 C variables are as follows:
57822 </para>
57823 <variablelist>
57824 <varlistentry>
57825 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
57826 <listitem>
57827 <para>
57828 This variable contains the number of lines in the message&#x2019;s body.
57829 </para>
57830 </listitem></varlistentry>
57831 <varlistentry>
57832 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
57833 <listitem>
57834 <para>
57835 This variable contains the number of binary zero bytes in the message&#x2019;s body.
57836 </para>
57837 </listitem></varlistentry>
57838 <varlistentry>
57839 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
57840 <listitem>
57841 <para>
57842 This variable is set to zero when no debugging is taking place. Otherwise, it
57843 is a bitmap of debugging selectors. Two bits are identified for use in
57844 <function>local_scan()</function>; they are defined as macros:
57845 </para>
57846 <itemizedlist>
57847 <listitem>
57848 <para>
57849 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
57850 testing option that is not privileged &ndash; any caller may set it. All the
57851 other selector bits can be set only by admin users.
57852 </para>
57853 </listitem>
57854 <listitem>
57855 <para>
57856 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
57857 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
57858 of debugging bits.
57859 </para>
57860 </listitem>
57861 </itemizedlist>
57862 <para>
57863 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
57864 selected, you should use code like this:
57865 </para>
57866 <literallayout class="monospaced">
57867 if ((debug_selector &amp; D_local_scan) != 0)
57868   debug_printf("xxx", ...);
57869 </literallayout>
57870 </listitem></varlistentry>
57871 <varlistentry>
57872 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
57873 <listitem>
57874 <para>
57875 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
57876 variable <option>expand_string_message</option> contains the error message, zero-terminated.
57877 </para>
57878 </listitem></varlistentry>
57879 <varlistentry>
57880 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
57881 <listitem>
57882 <para>
57883 A pointer to a chain of header lines. The <option>header_line</option> structure is
57884 discussed below.
57885 </para>
57886 </listitem></varlistentry>
57887 <varlistentry>
57888 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
57889 <listitem>
57890 <para>
57891 A pointer to the last of the header lines.
57892 </para>
57893 </listitem></varlistentry>
57894 <varlistentry>
57895 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
57896 <listitem>
57897 <para>
57898 The value of the <option>headers_charset</option> configuration option.
57899 </para>
57900 </listitem></varlistentry>
57901 <varlistentry>
57902 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
57903 <listitem>
57904 <para>
57905 This variable is TRUE during a host checking session that is initiated by the
57906 <option>-bh</option> command line option.
57907 </para>
57908 </listitem></varlistentry>
57909 <varlistentry>
57910 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
57911 <listitem>
57912 <para>
57913 The IP address of the interface that received the message, as a string. This
57914 is NULL for locally submitted messages.
57915 </para>
57916 </listitem></varlistentry>
57917 <varlistentry>
57918 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
57919 <listitem>
57920 <para>
57921 The port on which this message was received. When testing with the <option>-bh</option>
57922 command line option, the value of this variable is -1 unless a port has been
57923 specified via the <option>-oMi</option> option.
57924 </para>
57925 </listitem></varlistentry>
57926 <varlistentry>
57927 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
57928 <listitem>
57929 <para>
57930 This variable contains Exim&#x2019;s message id for the incoming message (the value of
57931 <varname>$message_exim_id</varname>) as a zero-terminated string.
57932 </para>
57933 </listitem></varlistentry>
57934 <varlistentry>
57935 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
57936 <listitem>
57937 <para>
57938 The name of the protocol by which the message was received.
57939 </para>
57940 </listitem></varlistentry>
57941 <varlistentry>
57942 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
57943 <listitem>
57944 <para>
57945 The number of accepted recipients.
57946 </para>
57947 </listitem></varlistentry>
57948 <varlistentry>
57949 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
57950 <listitem>
57951 <para>
57952 <indexterm role="concept">
57953 <primary>recipient</primary>
57954 <secondary>adding in local scan</secondary>
57955 </indexterm>
57956 <indexterm role="concept">
57957 <primary>recipient</primary>
57958 <secondary>removing in local scan</secondary>
57959 </indexterm>
57960 The list of accepted recipients, held in a vector of length
57961 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
57962 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
57963 below). You can delete recipients by removing them from the vector and
57964 adjusting the value in <option>recipients_count</option>. In particular, by setting
57965 <option>recipients_count</option> to zero you remove all recipients. If you then return the
57966 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
57967 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
57968 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
57969 </para>
57970 </listitem></varlistentry>
57971 <varlistentry>
57972 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
57973 <listitem>
57974 <para>
57975 The envelope sender address. For bounce messages this is the empty string.
57976 </para>
57977 </listitem></varlistentry>
57978 <varlistentry>
57979 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
57980 <listitem>
57981 <para>
57982 The IP address of the sending host, as a string. This is NULL for
57983 locally-submitted messages.
57984 </para>
57985 </listitem></varlistentry>
57986 <varlistentry>
57987 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
57988 <listitem>
57989 <para>
57990 The name of the authentication mechanism that was used, or NULL if the message
57991 was not received over an authenticated SMTP connection.
57992 </para>
57993 </listitem></varlistentry>
57994 <varlistentry>
57995 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
57996 <listitem>
57997 <para>
57998 The name of the sending host, if known.
57999 </para>
58000 </listitem></varlistentry>
58001 <varlistentry>
58002 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
58003 <listitem>
58004 <para>
58005 The port on the sending host.
58006 </para>
58007 </listitem></varlistentry>
58008 <varlistentry>
58009 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
58010 <listitem>
58011 <para>
58012 This variable is TRUE for all SMTP input, including BSMTP.
58013 </para>
58014 </listitem></varlistentry>
58015 <varlistentry>
58016 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
58017 <listitem>
58018 <para>
58019 This variable is TRUE for BSMTP input.
58020 </para>
58021 </listitem></varlistentry>
58022 <varlistentry>
58023 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
58024 <listitem>
58025 <para>
58026 The contents of this variable control which pool of memory is used for new
58027 requests. See section <xref linkend="SECTmemhanloc"/> for details.
58028 </para>
58029 </listitem></varlistentry>
58030 </variablelist>
58031 </section>
58032 <section id="SECID209">
58033 <title>Structure of header lines</title>
58034 <para>
58035 The <option>header_line</option> structure contains the members listed below.
58036 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
58037 (see below). You can cause header lines to be ignored (deleted) by setting
58038 their type to *.
58039 </para>
58040 <variablelist>
58041 <varlistentry>
58042 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
58043 <listitem>
58044 <para>
58045 A pointer to the next header line, or NULL for the last line.
58046 </para>
58047 </listitem></varlistentry>
58048 <varlistentry>
58049 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
58050 <listitem>
58051 <para>
58052 A code identifying certain headers that Exim recognizes. The codes are printing
58053 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
58054 Notice in particular that any header line whose type is * is not transmitted
58055 with the message. This flagging is used for header lines that have been
58056 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
58057 lines.) Effectively, * means <quote>deleted</quote>.
58058 </para>
58059 </listitem></varlistentry>
58060 <varlistentry>
58061 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
58062 <listitem>
58063 <para>
58064 The number of characters in the header line, including the terminating and any
58065 internal newlines.
58066 </para>
58067 </listitem></varlistentry>
58068 <varlistentry>
58069 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
58070 <listitem>
58071 <para>
58072 A pointer to the text of the header. It always ends with a newline, followed by
58073 a zero byte. Internal newlines are preserved.
58074 </para>
58075 </listitem></varlistentry>
58076 </variablelist>
58077 </section>
58078 <section id="SECID210">
58079 <title>Structure of recipient items</title>
58080 <para>
58081 The <option>recipient_item</option> structure contains these members:
58082 </para>
58083 <variablelist>
58084 <varlistentry>
58085 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
58086 <listitem>
58087 <para>
58088 This is a pointer to the recipient address as it was received.
58089 </para>
58090 </listitem></varlistentry>
58091 <varlistentry>
58092 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
58093 <listitem>
58094 <para>
58095 This is used in later Exim processing when top level addresses are created by
58096 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
58097 and must always contain -1 at this stage.
58098 </para>
58099 </listitem></varlistentry>
58100 <varlistentry>
58101 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
58102 <listitem>
58103 <para>
58104 If this value is not NULL, bounce messages caused by failing to deliver to the
58105 recipient are sent to the address it contains. In other words, it overrides the
58106 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
58107 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
58108 an unqualified address, Exim qualifies it using the domain from
58109 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
58110 is NULL for all recipients.
58111 </para>
58112 </listitem></varlistentry>
58113 </variablelist>
58114 </section>
58115 <section id="SECID211">
58116 <title>Available Exim functions</title>
58117 <para>
58118 <indexterm role="concept">
58119 <primary><function>local_scan()</function> function</primary>
58120 <secondary>available Exim functions</secondary>
58121 </indexterm>
58122 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
58123 These are the only ones that are guaranteed to be maintained from release to
58124 release:
58125 </para>
58126 <variablelist>
58127 <varlistentry>
58128 <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>
58129 <listitem>
58130 <para>
58131 This function creates a child process that runs the command specified by
58132 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
58133 be NULL if no environment variables are to be passed. A new umask is supplied
58134 for the process in <option>newumask</option>.
58135 </para>
58136 <para>
58137 Pipes to the standard input and output of the new process are set up
58138 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
58139 standard error is cloned to the standard output. If there are any file
58140 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
58141 argument is TRUE, the new process is made into a process group leader.
58142 </para>
58143 <para>
58144 The function returns the pid of the new process, or -1 if things go wrong.
58145 </para>
58146 </listitem></varlistentry>
58147 <varlistentry>
58148 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
58149 <listitem>
58150 <para>
58151 This function waits for a child process to terminate, or for a timeout (in
58152 seconds) to expire. A timeout value of zero means wait as long as it takes. The
58153 return value is as follows:
58154 </para>
58155 <itemizedlist>
58156 <listitem>
58157 <para>
58158 &gt;= 0
58159 </para>
58160 <para>
58161 The process terminated by a normal exit and the value is the process
58162 ending status.
58163 </para>
58164 </listitem>
58165 <listitem>
58166 <para>
58167 &lt; 0 and &gt; &ndash;256
58168 </para>
58169 <para>
58170 The process was terminated by a signal and the value is the negation of the
58171 signal number.
58172 </para>
58173 </listitem>
58174 <listitem>
58175 <para>
58176 &ndash;256
58177 </para>
58178 <para>
58179 The process timed out.
58180 </para>
58181 </listitem>
58182 <listitem>
58183 <para>
58184 &ndash;257
58185 </para>
58186 <para>
58187 The was some other error in wait(); <option>errno</option> is still set.
58188 </para>
58189 </listitem>
58190 </itemizedlist>
58191 </listitem></varlistentry>
58192 <varlistentry>
58193 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
58194 <listitem>
58195 <para>
58196 This function provide you with a means of submitting a new message to
58197 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
58198 want, but this packages it all up for you.) The function creates a pipe,
58199 forks a subprocess that is running
58200 </para>
58201 <literallayout class="monospaced">
58202 exim -t -oem -oi -f &lt;&gt;
58203 </literallayout>
58204 <para>
58205 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
58206 that is connected to the standard input. The yield of the function is the PID
58207 of the subprocess. You can then write a message to the file descriptor, with
58208 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
58209 </para>
58210 <para>
58211 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
58212 finish and to collect its ending status. A timeout value of zero is usually
58213 fine in this circumstance. Unless you have made a mistake with the recipient
58214 addresses, you should get a return code of zero.
58215 </para>
58216 </listitem></varlistentry>
58217 <varlistentry>
58218 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
58219 <listitem>
58220 <para>
58221 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
58222 that it runs is:
58223 </para>
58224 <literallayout>
58225 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
58226 </literallayout>
58227 <para>
58228 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
58229 </para>
58230 </listitem></varlistentry>
58231 <varlistentry>
58232 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58233 <listitem>
58234 <para>
58235 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
58236 output is written to the standard error stream. If no debugging is selected,
58237 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
58238 conditional on the <literal>local_scan</literal> debug selector by coding like this:
58239 </para>
58240 <literallayout class="monospaced">
58241 if ((debug_selector &amp; D_local_scan) != 0)
58242   debug_printf("xxx", ...);
58243 </literallayout>
58244 </listitem></varlistentry>
58245 <varlistentry>
58246 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
58247 <listitem>
58248 <para>
58249 This is an interface to Exim&#x2019;s string expansion code. The return value is the
58250 expanded string, or NULL if there was an expansion failure.
58251 The C variable <option>expand_string_message</option> contains an error message after an
58252 expansion failure. If expansion does not change the string, the return value is
58253 the pointer to the input string. Otherwise, the return value points to a new
58254 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
58255 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
58256 </para>
58257 </listitem></varlistentry>
58258 <varlistentry>
58259 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58260 <listitem>
58261 <para>
58262 This function allows you to an add additional header line at the end of the
58263 existing ones. The first argument is the type, and should normally be a space
58264 character. The second argument is a format string and any number of
58265 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
58266 if you want, and you must ensure that the string ends with a newline.
58267 </para>
58268 </listitem></varlistentry>
58269 <varlistentry>
58270 <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>
58271 <listitem>
58272 <para>
58273 This function adds a new header line at a specified point in the header
58274 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
58275 </para>
58276 <para>
58277 If <option>name</option> is NULL, the new header is added at the end of the chain if
58278 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
58279 NULL, the header lines are searched for the first non-deleted header that
58280 matches the name. If one is found, the new header is added before it if
58281 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
58282 found header and any adjacent subsequent ones with the same name (even if
58283 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
58284 option controls where the header is added. If it is true, addition is at the
58285 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
58286 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
58287 </para>
58288 <literallayout class="monospaced">
58289 header_add_at_position(TRUE, US"Received", TRUE,
58290   ' ', "X-xxx: ...");
58291 </literallayout>
58292 <para>
58293 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
58294 there may not be if <option>received_header_text</option> expands to an empty string.
58295 </para>
58296 </listitem></varlistentry>
58297 <varlistentry>
58298 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
58299 <listitem>
58300 <para>
58301 This function removes header lines. If <option>occurrence</option> is zero or negative, all
58302 occurrences of the header are removed. If occurrence is greater than zero, that
58303 particular instance of the header is removed. If no header(s) can be found that
58304 match the specification, the function does nothing.
58305 </para>
58306 </listitem></varlistentry>
58307 <varlistentry>
58308 <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>
58309 <listitem>
58310 <para>
58311 This function tests whether the given header has the given name. It is not just
58312 a string comparison, because white space is permitted between the name and the
58313 colon. If the <option>notdel</option> argument is true, a false return is forced for all
58314 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
58315 </para>
58316 <literallayout class="monospaced">
58317 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
58318 </literallayout>
58319 </listitem></varlistentry>
58320 <varlistentry>
58321 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
58322 <listitem>
58323 <para>
58324 <indexterm role="concept">
58325 <primary>base64 encoding</primary>
58326 <secondary>functions for <function>local_scan()</function> use</secondary>
58327 </indexterm>
58328 This function base64-encodes a string, which is passed by address and length.
58329 The text may contain bytes of any value, including zero. The result is passed
58330 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
58331 zero-terminated.
58332 </para>
58333 </listitem></varlistentry>
58334 <varlistentry>
58335 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
58336 <listitem>
58337 <para>
58338 This function decodes a base64-encoded string. Its arguments are a
58339 zero-terminated base64-encoded string and the address of a variable that is set
58340 to point to the result, which is in dynamic memory. The length of the decoded
58341 string is the yield of the function. If the input is invalid base64 data, the
58342 yield is -1. A zero byte is added to the end of the output string to make it
58343 easy to interpret as a C string (assuming it contains no zeros of its own). The
58344 added zero byte is not included in the returned count.
58345 </para>
58346 </listitem></varlistentry>
58347 <varlistentry>
58348 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
58349 <listitem>
58350 <para>
58351 This function checks for a match in a domain list. Domains are always
58352 matched caselessly. The return value is one of the following:
58353 </para>
58354 <literallayout>
58355 <literal>OK     </literal> match succeeded
58356 <literal>FAIL   </literal> match failed
58357 <literal>DEFER  </literal> match deferred
58358 </literallayout>
58359 <para>
58360 DEFER is usually caused by some kind of lookup defer, such as the
58361 inability to contact a database.
58362 </para>
58363 </listitem></varlistentry>
58364 <varlistentry>
58365 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58366 <listitem>
58367 <para>
58368 This function checks for a match in a local part list. The third argument
58369 controls case-sensitivity. The return values are as for
58370 <emphasis>lss_match_domain()</emphasis>.
58371 </para>
58372 </listitem></varlistentry>
58373 <varlistentry>
58374 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58375 <listitem>
58376 <para>
58377 This function checks for a match in an address list. The third argument
58378 controls the case-sensitivity of the local part match. The domain is always
58379 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
58380 </para>
58381 </listitem></varlistentry>
58382 <varlistentry>
58383 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
58384 <listitem>
58385 <para>
58386 This function checks for a match in a host list. The most common usage is
58387 expected to be
58388 </para>
58389 <literallayout class="monospaced">
58390 lss_match_host(sender_host_name, sender_host_address, ...)
58391 </literallayout>
58392 <para>
58393 <indexterm role="variable">
58394 <primary><varname>$sender_host_address</varname></primary>
58395 </indexterm>
58396 An empty address field matches an empty item in the host list. If the host name
58397 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
58398 looked up if a host name is required to match an item in the list. The return
58399 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
58400 returns ERROR in the case when it had to look up a host name, but the lookup
58401 failed.
58402 </para>
58403 </listitem></varlistentry>
58404 <varlistentry>
58405 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58406 <listitem>
58407 <para>
58408 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
58409 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
58410 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
58411 them. It specifies to which log or logs the message is written. The remaining
58412 arguments are a format and relevant insertion arguments. The string should not
58413 contain any newlines, not even at the end.
58414 </para>
58415 </listitem></varlistentry>
58416 <varlistentry>
58417 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
58418 <listitem>
58419 <para>
58420 This function adds an additional recipient to the message. The first argument
58421 is the recipient address. If it is unqualified (has no domain), it is qualified
58422 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
58423 </para>
58424 <para>
58425 This function does not allow you to specify a private <option>errors_to</option> address (as
58426 described with the structure of <option>recipient_item</option> above), because it pre-dates
58427 the addition of that field to the structure. However, it is easy to add such a
58428 value afterwards. For example:
58429 </para>
58430 <literallayout class="monospaced">
58431  receive_add_recipient(US"monitor@mydom.example", -1);
58432  recipients_list[recipients_count-1].errors_to =
58433    US"postmaster@mydom.example";
58434 </literallayout>
58435 </listitem></varlistentry>
58436 <varlistentry>
58437 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
58438 <listitem>
58439 <para>
58440 This is a convenience function to remove a named recipient from the list of
58441 recipients. It returns true if a recipient was removed, and false if no
58442 matching recipient could be found. The argument must be a complete email
58443 address.
58444 </para>
58445 </listitem></varlistentry>
58446 </variablelist>
58447 <para>
58448 <indexterm role="concept">
58449 <primary>RFC 2047</primary>
58450 </indexterm>
58451 </para>
58452 <variablelist>
58453 <varlistentry>
58454 <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>
58455 <listitem>
58456 <para>
58457 This function decodes strings that are encoded according to RFC 2047. Typically
58458 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
58459 from the Q or B encoding into a byte-string. Then, if provided with the name of
58460 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
58461 made  to translate the result to the named character set. If this fails, the
58462 binary string is returned with an error message.
58463 </para>
58464 <para>
58465 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
58466 maximum MIME word length is enforced. The third argument is the target
58467 encoding, or NULL if no translation is wanted.
58468 </para>
58469 <para>
58470 <indexterm role="concept">
58471 <primary>binary zero</primary>
58472 <secondary>in RFC 2047 decoding</secondary>
58473 </indexterm>
58474 <indexterm role="concept">
58475 <primary>RFC 2047</primary>
58476 <secondary>binary zero in</secondary>
58477 </indexterm>
58478 If a binary zero is encountered in the decoded string, it is replaced by the
58479 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
58480 not be 0 because header lines are handled as zero-terminated strings.
58481 </para>
58482 <para>
58483 The function returns the result of processing the string, zero-terminated; if
58484 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
58485 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
58486 </para>
58487 <para>
58488 If an error is encountered, the function returns NULL and uses the <option>error</option>
58489 argument to return an error message. The variable pointed to by <option>error</option> is
58490 set to NULL if there is no error; it may be set non-NULL even when the function
58491 returns a non-NULL value if decoding was successful, but there was a problem
58492 with translation.
58493 </para>
58494 </listitem></varlistentry>
58495 <varlistentry>
58496 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
58497 <listitem>
58498 <para>
58499 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
58500 below.
58501 </para>
58502 </listitem></varlistentry>
58503 <varlistentry>
58504 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58505 <listitem>
58506 <para>
58507 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
58508 output stream. You should use this function only when there is an SMTP output
58509 stream, that is, when the incoming message is being received via interactive
58510 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
58511 is FALSE. If you want to test for an incoming message from another host (as
58512 opposed to a local process that used the <option>-bs</option> command line option), you can
58513 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
58514 is involved.
58515 </para>
58516 <para>
58517 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
58518 output function, so it can be used for all forms of SMTP connection.
58519 </para>
58520 <para>
58521 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
58522 must start with an appropriate response code: 550 if you are going to return
58523 LOCAL_SCAN_REJECT, 451 if you are going to return
58524 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
58525 initial lines of a multi-line response, the code must be followed by a hyphen
58526 to indicate that the line is not the final response line. You must also ensure
58527 that the lines you write terminate with CRLF. For example:
58528 </para>
58529 <literallayout class="monospaced">
58530 smtp_printf("550-this is some extra info\r\n");
58531 return LOCAL_SCAN_REJECT;
58532 </literallayout>
58533 <para>
58534 Note that you can also create multi-line responses by including newlines in
58535 the data returned via the <option>return_text</option> argument. The added value of using
58536 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
58537 multiple output lines.
58538 </para>
58539 <para>
58540 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
58541 does not automatically flush pending output, and therefore does not test
58542 the state of the stream. (In the main code of Exim, flushing and error
58543 detection is done when Exim is ready for the next SMTP input command.) If
58544 you want to flush the output and check for an error (for example, the
58545 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
58546 arguments. It flushes the output stream, and returns a non-zero value if there
58547 is an error.
58548 </para>
58549 </listitem></varlistentry>
58550 <varlistentry>
58551 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
58552 <listitem>
58553 <para>
58554 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
58555 chunk of memory whose size is given by the argument. Exim bombs out if it ever
58556 runs out of memory. See the next section for a discussion of memory handling.
58557 </para>
58558 </listitem></varlistentry>
58559 <varlistentry>
58560 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
58561 <listitem>
58562 <para>
58563 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
58564 permanent pool. See the next section for a discussion of memory handling.
58565 </para>
58566 </listitem></varlistentry>
58567 <varlistentry>
58568 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
58569 <listitem>
58570 <para>
58571 See below.
58572 </para>
58573 </listitem></varlistentry>
58574 <varlistentry>
58575 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
58576 <listitem>
58577 <para>
58578 See below.
58579 </para>
58580 </listitem></varlistentry>
58581 <varlistentry>
58582 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
58583 <listitem>
58584 <para>
58585 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
58586 The first makes a copy of an entire string. The second copies up to a maximum
58587 number of characters, indicated by the second argument. The third uses a format
58588 and insertion arguments to create a new string. In each case, the result is a
58589 pointer to a new string in the current memory pool. See the next section for
58590 more discussion.
58591 </para>
58592 </listitem></varlistentry>
58593 </variablelist>
58594 </section>
58595 <section id="SECTmemhanloc">
58596 <title>More about Exim&#x2019;s memory handling</title>
58597 <para>
58598 <indexterm role="concept">
58599 <primary><function>local_scan()</function> function</primary>
58600 <secondary>memory handling</secondary>
58601 </indexterm>
58602 No function is provided for freeing memory, because that is never needed.
58603 The dynamic memory that Exim uses when receiving a message is automatically
58604 recycled if another message is received by the same process (this applies only
58605 to incoming SMTP connections &ndash; other input methods can supply only one
58606 message at a time). After receiving the last message, a reception process
58607 terminates.
58608 </para>
58609 <para>
58610 Because it is recycled, the normal dynamic memory cannot be used for holding
58611 data that must be preserved over a number of incoming messages on the same SMTP
58612 connection. However, Exim in fact uses two pools of dynamic memory; the second
58613 one is not recycled, and can be used for this purpose.
58614 </para>
58615 <para>
58616 If you want to allocate memory that remains available for subsequent messages
58617 in the same SMTP connection, you should set
58618 </para>
58619 <literallayout class="monospaced">
58620 store_pool = POOL_PERM
58621 </literallayout>
58622 <para>
58623 before calling the function that does the allocation. There is no need to
58624 restore the value if you do not need to; however, if you do want to revert to
58625 the normal pool, you can either restore the previous value of <option>store_pool</option> or
58626 set it explicitly to POOL_MAIN.
58627 </para>
58628 <para>
58629 The pool setting applies to all functions that get dynamic memory, including
58630 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
58631 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
58632 block of memory from the permanent pool while preserving the value of
58633 <option>store_pool</option>.
58634 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
58635 </para>
58636 </section>
58637 </chapter>
58638
58639 <chapter id="CHAPsystemfilter">
58640 <title>System-wide message filtering</title>
58641 <para>
58642 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
58643 <primary>filter</primary>
58644 <secondary>system filter</secondary>
58645 </indexterm>
58646 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
58647 <primary>filtering all mail</primary>
58648 </indexterm>
58649 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
58650 <primary>system filter</primary>
58651 </indexterm>
58652 The previous chapters (on ACLs and the local scan function) describe checks
58653 that can be applied to messages before they are accepted by a host. There is
58654 also a mechanism for checking messages once they have been received, but before
58655 they are delivered. This is called the <emphasis>system filter</emphasis>.
58656 </para>
58657 <para>
58658 The system filter operates in a similar manner to users&#x2019; filter files, but it
58659 is run just once per message (however many recipients the message has).
58660 It should not normally be used as a substitute for routing, because <option>deliver</option>
58661 commands in a system router provide new envelope recipient addresses.
58662 The system filter must be an Exim filter. It cannot be a Sieve filter.
58663 </para>
58664 <para>
58665 The system filter is run at the start of a delivery attempt, before any routing
58666 is done. If a message fails to be completely delivered at the first attempt,
58667 the system filter is run again at the start of every retry.
58668 If you want your filter to do something only once per message, you can make use
58669 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
58670 prevent it happening on retries.
58671 </para>
58672 <para>
58673 <indexterm role="variable">
58674 <primary><varname>$domain</varname></primary>
58675 </indexterm>
58676 <indexterm role="variable">
58677 <primary><varname>$local_part</varname></primary>
58678 </indexterm>
58679 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
58680 specific to individual recipient addresses, such as <varname>$local_part</varname> and
58681 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
58682 you want to run a centrally-specified filter for each recipient address
58683 independently, you can do so by setting up a suitable <command>redirect</command> router, as
58684 described in section <xref linkend="SECTperaddfil"/> below.
58685 </para>
58686 <section id="SECID212">
58687 <title>Specifying a system filter</title>
58688 <para>
58689 <indexterm role="concept">
58690 <primary>uid (user id)</primary>
58691 <secondary>system filter</secondary>
58692 </indexterm>
58693 <indexterm role="concept">
58694 <primary>gid (group id)</primary>
58695 <secondary>system filter</secondary>
58696 </indexterm>
58697 The name of the file that contains the system filter must be specified by
58698 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
58699 other than root, you must also set <option>system_filter_user</option> and
58700 <option>system_filter_group</option> as appropriate. For example:
58701 </para>
58702 <literallayout class="monospaced">
58703 system_filter = /etc/mail/exim.filter
58704 system_filter_user = exim
58705 </literallayout>
58706 <para>
58707 If a system filter generates any deliveries directly to files or pipes (via the
58708 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
58709 specified by setting <option>system_filter_file_transport</option> and
58710 <option>system_filter_pipe_transport</option>, respectively. Similarly,
58711 <option>system_filter_reply_transport</option> must be set to handle any messages generated
58712 by the <option>reply</option> command.
58713 </para>
58714 </section>
58715 <section id="SECID213">
58716 <title>Testing a system filter</title>
58717 <para>
58718 You can run simple tests of a system filter in the same way as for a user
58719 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
58720 are permitted only in system filters are recognized.
58721 </para>
58722 <para>
58723 If you want to test the combined effect of a system filter and a user filter,
58724 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
58725 </para>
58726 </section>
58727 <section id="SECID214">
58728 <title>Contents of a system filter</title>
58729 <para>
58730 The language used to specify system filters is the same as for users&#x2019; filter
58731 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
58732 mail filtering</emphasis>. However, there are some additional features that are
58733 available only in system filters; these are described in subsequent sections.
58734 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
58735 they cause errors.
58736 </para>
58737 <para>
58738 <indexterm role="concept">
58739 <primary>frozen messages</primary>
58740 <secondary>manual thaw; testing in filter</secondary>
58741 </indexterm>
58742 There are two special conditions which, though available in users&#x2019; filter
58743 files, are designed for use in system filters. The condition <option>first_delivery</option>
58744 is true only for the first attempt at delivering a message, and
58745 <option>manually_thawed</option> is true only if the message has been frozen, and
58746 subsequently thawed by an admin user. An explicit forced delivery counts as a
58747 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
58748 </para>
58749 <para>
58750 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
58751 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
58752 succeed, it will not be tried again.
58753 If you want Exim to retry an unseen delivery until it succeeds, you should
58754 arrange to set it up every time the filter runs.
58755 </para>
58756 <para>
58757 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
58758 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
58759 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
58760 to which users&#x2019; filter files can refer.
58761 </para>
58762 </section>
58763 <section id="SECID215">
58764 <title>Additional variable for system filters</title>
58765 <para>
58766 <indexterm role="variable">
58767 <primary><varname>$recipients</varname></primary>
58768 </indexterm>
58769 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
58770 of the message (separated by commas and white space), is available in system
58771 filters. It is not available in users&#x2019; filters for privacy reasons.
58772 </para>
58773 </section>
58774 <section id="SECID216">
58775 <title>Defer, freeze, and fail commands for system filters</title>
58776 <para>
58777 <indexterm role="concept">
58778 <primary>freezing messages</primary>
58779 </indexterm>
58780 <indexterm role="concept">
58781 <primary>message</primary>
58782 <secondary>freezing</secondary>
58783 </indexterm>
58784 <indexterm role="concept">
58785 <primary>message</primary>
58786 <secondary>forced failure</secondary>
58787 </indexterm>
58788 <indexterm role="concept">
58789 <primary><option>fail</option></primary>
58790 <secondary>in system filter</secondary>
58791 </indexterm>
58792 <indexterm role="concept">
58793 <primary><option>freeze</option> in system filter</primary>
58794 </indexterm>
58795 <indexterm role="concept">
58796 <primary><option>defer</option> in system filter</primary>
58797 </indexterm>
58798 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
58799 always available in system filters, but are not normally enabled in users&#x2019;
58800 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
58801 for the <command>redirect</command> router.) These commands can optionally be followed by the
58802 word <option>text</option> and a string containing an error message, for example:
58803 </para>
58804 <literallayout class="monospaced">
58805 fail text "this message looks like spam to me"
58806 </literallayout>
58807 <para>
58808 The keyword <option>text</option> is optional if the next character is a double quote.
58809 </para>
58810 <para>
58811 The <option>defer</option> command defers delivery of the original recipients of the
58812 message. The <option>fail</option> command causes all the original recipients to be failed,
58813 and a bounce message to be created. The <option>freeze</option> command suspends all
58814 delivery attempts for the original recipients. In all cases, any new deliveries
58815 that are specified by the filter are attempted as normal after the filter has
58816 run.
58817 </para>
58818 <para>
58819 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
58820 not manually frozen since. This means that automatic freezing by a system
58821 filter can be used as a way of checking out suspicious messages. If a message
58822 is found to be all right, manually unfreezing it allows it to be delivered.
58823 </para>
58824 <para>
58825 <indexterm role="concept">
58826 <primary>log</primary>
58827 <secondary><option>fail</option> command log line</secondary>
58828 </indexterm>
58829 <indexterm role="concept">
58830 <primary><option>fail</option></primary>
58831 <secondary>log line; reducing</secondary>
58832 </indexterm>
58833 The text given with a fail command is used as part of the bounce message as
58834 well as being written to the log. If the message is quite long, this can fill
58835 up a lot of log space when such failures are common. To reduce the size of the
58836 log message, Exim interprets the text in a special way if it starts with the
58837 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
58838 strings is written to the log, and the rest of the text is used in the bounce
58839 message. For example:
58840 </para>
58841 <literallayout class="monospaced">
58842 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
58843      because it contains attachments that we are \
58844      not prepared to receive."
58845 </literallayout>
58846 <para>
58847 <indexterm role="concept">
58848 <primary>loop</primary>
58849 <secondary>caused by <option>fail</option></secondary>
58850 </indexterm>
58851 Take great care with the <option>fail</option> command when basing the decision to fail on
58852 the contents of the message, because the bounce message will of course include
58853 the contents of the original message and will therefore trigger the <option>fail</option>
58854 command again (causing a mail loop) unless steps are taken to prevent this.
58855 Testing the <option>error_message</option> condition is one way to prevent this. You could
58856 use, for example
58857 </para>
58858 <literallayout class="monospaced">
58859 if $message_body contains "this is spam" and not error_message
58860 then fail text "spam is not wanted here" endif
58861 </literallayout>
58862 <para>
58863 though of course that might let through unwanted bounce messages. The
58864 alternative is clever checking of the body and/or headers to detect bounces
58865 generated by the filter.
58866 </para>
58867 <para>
58868 The interpretation of a system filter file ceases after a
58869 <option>defer</option>,
58870 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
58871 set up earlier in the filter file are honoured, so you can use a sequence such
58872 as
58873 </para>
58874 <literallayout class="monospaced">
58875 mail ...
58876 freeze
58877 </literallayout>
58878 <para>
58879 to send a specified message when the system filter is freezing (or deferring or
58880 failing) a message. The normal deliveries for the message do not, of course,
58881 take place.
58882 </para>
58883 </section>
58884 <section id="SECTaddremheasys">
58885 <title>Adding and removing headers in a system filter</title>
58886 <para>
58887 <indexterm role="concept">
58888 <primary>header lines</primary>
58889 <secondary>adding; in system filter</secondary>
58890 </indexterm>
58891 <indexterm role="concept">
58892 <primary>header lines</primary>
58893 <secondary>removing; in system filter</secondary>
58894 </indexterm>
58895 <indexterm role="concept">
58896 <primary>filter</primary>
58897 <secondary>header lines; adding/removing</secondary>
58898 </indexterm>
58899 Two filter commands that are available only in system filters are:
58900 </para>
58901 <literallayout class="monospaced">
58902 headers add &lt;string&gt;
58903 headers remove &lt;string&gt;
58904 </literallayout>
58905 <para>
58906 The argument for the <option>headers add</option> is a string that is expanded and then
58907 added to the end of the message&#x2019;s headers. It is the responsibility of the
58908 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
58909 space is ignored, and if the string is otherwise empty, or if the expansion is
58910 forced to fail, the command has no effect.
58911 </para>
58912 <para>
58913 You can use <quote>\n</quote> within the string, followed by white space, to specify
58914 continued header lines. More than one header may be added in one command by
58915 including <quote>\n</quote> within the string without any following white space. For
58916 example:
58917 </para>
58918 <literallayout class="monospaced">
58919 headers add "X-header-1: ....\n  \
58920              continuation of X-header-1 ...\n\
58921              X-header-2: ...."
58922 </literallayout>
58923 <para>
58924 Note that the header line continuation white space after the first newline must
58925 be placed before the backslash that continues the input string, because white
58926 space after input continuations is ignored.
58927 </para>
58928 <para>
58929 The argument for <option>headers remove</option> is a colon-separated list of header names.
58930 This command applies only to those headers that are stored with the message;
58931 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
58932 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
58933 header with the same name, they are all removed.
58934 </para>
58935 <para>
58936 The <option>headers</option> command in a system filter makes an immediate change to the set
58937 of header lines that was received with the message (with possible additions
58938 from ACL processing). Subsequent commands in the system filter operate on the
58939 modified set, which also forms the basis for subsequent message delivery.
58940 Unless further modified during routing or transporting, this set of headers is
58941 used for all recipients of the message.
58942 </para>
58943 <para>
58944 During routing and transporting, the variables that refer to the contents of
58945 header lines refer only to those lines that are in this set. Thus, header lines
58946 that are added by a system filter are visible to users&#x2019; filter files and to all
58947 routers and transports. This contrasts with the manipulation of header lines by
58948 routers and transports, which is not immediate, but which instead is saved up
58949 until the message is actually being written (see section
58950 <xref linkend="SECTheadersaddrem"/>).
58951 </para>
58952 <para>
58953 If the message is not delivered at the first attempt, header lines that were
58954 added by the system filter are stored with the message, and so are still
58955 present at the next delivery attempt. Header lines that were removed are still
58956 present, but marked <quote>deleted</quote> so that they are not transported with the
58957 message. For this reason, it is usual to make the <option>headers</option> command
58958 conditional on <option>first_delivery</option> so that the set of header lines is not
58959 modified more than once.
58960 </para>
58961 <para>
58962 Because header modification in a system filter acts immediately, you have to
58963 use an indirect approach if you want to modify the contents of a header line.
58964 For example:
58965 </para>
58966 <literallayout class="monospaced">
58967 headers add "Old-Subject: $h_subject:"
58968 headers remove "Subject"
58969 headers add "Subject: new subject (was: $h_old-subject:)"
58970 headers remove "Old-Subject"
58971 </literallayout>
58972 </section>
58973 <section id="SECID217">
58974 <title>Setting an errors address in a system filter</title>
58975 <para>
58976 <indexterm role="concept">
58977 <primary>envelope sender</primary>
58978 </indexterm>
58979 In a system filter, if a <option>deliver</option> command is followed by
58980 </para>
58981 <literallayout class="monospaced">
58982 errors_to &lt;some address&gt;
58983 </literallayout>
58984 <para>
58985 in order to change the envelope sender (and hence the error reporting) for that
58986 delivery, any address may be specified. (In a user filter, only the current
58987 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
58988 might use
58989 </para>
58990 <literallayout class="monospaced">
58991 unseen deliver monitor@spying.example errors_to root@local.example
58992 </literallayout>
58993 <para>
58994 to take a copy which would not be sent back to the normal error reporting
58995 address if its delivery failed.
58996 </para>
58997 </section>
58998 <section id="SECTperaddfil">
58999 <title>Per-address filtering</title>
59000 <para>
59001 <indexterm role="variable">
59002 <primary><varname>$domain</varname></primary>
59003 </indexterm>
59004 <indexterm role="variable">
59005 <primary><varname>$local_part</varname></primary>
59006 </indexterm>
59007 In contrast to the system filter, which is run just once per message for each
59008 delivery attempt, it is also possible to set up a system-wide filtering
59009 operation that runs once for each recipient address. In this case, variables
59010 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
59011 filter file could be made dependent on them. This is an example of a router
59012 which implements such a filter:
59013 </para>
59014 <literallayout class="monospaced">
59015 central_filter:
59016   check_local_user
59017   driver = redirect
59018   domains = +local_domains
59019   file = /central/filters/$local_part
59020   no_verify
59021   allow_filter
59022   allow_freeze
59023 </literallayout>
59024 <para>
59025 The filter is run in a separate process under its own uid. Therefore, either
59026 <option>check_local_user</option> must be set (as above), in which case the filter is run as
59027 the local user, or the <option>user</option> option must be used to specify which user to
59028 use. If both are set, <option>user</option> overrides.
59029 </para>
59030 <para>
59031 Care should be taken to ensure that none of the commands in the filter file
59032 specify a significant delivery if the message is to go on to be delivered to
59033 its intended recipient. The router will not then claim to have dealt with the
59034 address, so it will be passed on to subsequent routers to be delivered in the
59035 normal way.
59036 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
59037 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
59038 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
59039 </para>
59040 </section>
59041 </chapter>
59042
59043 <chapter id="CHAPmsgproc">
59044 <title>Message processing</title>
59045 <para>
59046 <indexterm role="concept" id="IIDmesproc" class="startofrange">
59047 <primary>message</primary>
59048 <secondary>general processing</secondary>
59049 </indexterm>
59050 Exim performs various transformations on the sender and recipient addresses of
59051 all messages that it handles, and also on the messages&#x2019; header lines. Some of
59052 these are optional and configurable, while others always take place. All of
59053 this processing, except rewriting as a result of routing, and the addition or
59054 removal of header lines while delivering, happens when a message is received,
59055 before it is placed on Exim&#x2019;s queue.
59056 </para>
59057 <para>
59058 Some of the automatic processing takes place by default only for
59059 <quote>locally-originated</quote> messages. This adjective is used to describe messages
59060 that are not received over TCP/IP, but instead are passed to an Exim process on
59061 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
59062 set up by the <option>-bs</option> command line option.
59063 </para>
59064 <para>
59065 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
59066 or ::1) are not considered to be locally-originated. Exim does not treat the
59067 loopback interface specially in any way.
59068 </para>
59069 <para>
59070 If you want the loopback interface to be treated specially, you must ensure
59071 that there are appropriate entries in your ACLs.
59072 </para>
59073 <section id="SECTsubmodnon">
59074 <title>Submission mode for non-local messages</title>
59075 <para>
59076 <indexterm role="concept">
59077 <primary>message</primary>
59078 <secondary>submission</secondary>
59079 </indexterm>
59080 <indexterm role="concept">
59081 <primary>submission mode</primary>
59082 </indexterm>
59083 Processing that happens automatically for locally-originated messages (unless
59084 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
59085 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
59086 state. Submission mode is set by the modifier
59087 </para>
59088 <literallayout class="monospaced">
59089 control = submission
59090 </literallayout>
59091 <para>
59092 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
59093 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
59094 a local submission, and is normally used when the source of the message is
59095 known to be an MUA running on a client host (as opposed to an MTA). For
59096 example, to set submission mode for messages originating on the IPv4 loopback
59097 interface, you could include the following in the MAIL ACL:
59098 </para>
59099 <literallayout class="monospaced">
59100 warn  hosts = 127.0.0.1
59101       control = submission
59102 </literallayout>
59103 <para>
59104 <indexterm role="concept">
59105 <primary><option>sender_retain</option> submission option</primary>
59106 </indexterm>
59107 There are some options that can be used when setting submission mode. A slash
59108 is used to separate options. For example:
59109 </para>
59110 <literallayout class="monospaced">
59111 control = submission/sender_retain
59112 </literallayout>
59113 <para>
59114 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
59115 true and <option>local_from_check</option> false for the current incoming message. The first
59116 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
59117 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
59118 authenticated sender. With this setting, Exim still fixes up messages by adding
59119 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
59120 attempt to check sender authenticity in header lines.
59121 </para>
59122 <para>
59123 When <option>sender_retain</option> is not set, a submission mode setting may specify a
59124 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
59125 example:
59126 </para>
59127 <literallayout class="monospaced">
59128 control = submission/domain=some.domain
59129 </literallayout>
59130 <para>
59131 The domain may be empty. How this value is used is described in sections
59132 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
59133 that allows you to specify the user&#x2019;s full name for inclusion in a created
59134 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
59135 </para>
59136 <literallayout class="monospaced">
59137 accept authenticated = *
59138        control = submission/domain=wonderland.example/\
59139                             name=${lookup {$authenticated_id} \
59140                                    lsearch {/etc/exim/namelist}}
59141 </literallayout>
59142 <para>
59143 Because the name may contain any characters, including slashes, the <option>name</option>
59144 option must be given last. The remainder of the string is used as the name. For
59145 the example above, if <filename>/etc/exim/namelist</filename> contains:
59146 </para>
59147 <literallayout class="monospaced">
59148 bigegg:  Humpty Dumpty
59149 </literallayout>
59150 <para>
59151 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
59152 line would be:
59153 </para>
59154 <literallayout class="monospaced">
59155 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
59156 </literallayout>
59157 <para>
59158 <indexterm role="concept">
59159 <primary>return path</primary>
59160 <secondary>in submission mode</secondary>
59161 </indexterm>
59162 By default, submission mode forces the return path to the same address as is
59163 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
59164 specified, the return path is also left unchanged.
59165 </para>
59166 <para>
59167 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
59168 ACL. This means that any sender checks performed before the fix-ups use the
59169 untrusted sender address specified by the user, not the trusted sender address
59170 specified by submission mode. Although this might be slightly unexpected, it
59171 does mean that you can configure ACL checks to spot that a user is trying to
59172 spoof another&#x2019;s address.
59173 </para>
59174 </section>
59175 <section id="SECTlineendings">
59176 <title>Line endings</title>
59177 <para>
59178 <indexterm role="concept">
59179 <primary>line endings</primary>
59180 </indexterm>
59181 <indexterm role="concept">
59182 <primary>carriage return</primary>
59183 </indexterm>
59184 <indexterm role="concept">
59185 <primary>linefeed</primary>
59186 </indexterm>
59187 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
59188 linefeed) is the line ending for messages transmitted over the Internet using
59189 SMTP over TCP/IP. However, within individual operating systems, different
59190 conventions are used. For example, Unix-like systems use just LF, but others
59191 use CRLF or just CR.
59192 </para>
59193 <para>
59194 Exim was designed for Unix-like systems, and internally, it stores messages
59195 using the system&#x2019;s convention of a single LF as a line terminator. When
59196 receiving a message, all line endings are translated to this standard format.
59197 Originally, it was thought that programs that passed messages directly to an
59198 MTA within an operating system would use that system&#x2019;s convention. Experience
59199 has shown that this is not the case; for example, there are Unix applications
59200 that use CRLF in this circumstance. For this reason, and for compatibility with
59201 other MTAs, the way Exim handles line endings for all messages is now as
59202 follows:
59203 </para>
59204 <itemizedlist>
59205 <listitem>
59206 <para>
59207 LF not preceded by CR is treated as a line ending.
59208 </para>
59209 </listitem>
59210 <listitem>
59211 <para>
59212 CR is treated as a line ending; if it is immediately followed by LF, the LF
59213 is ignored.
59214 </para>
59215 </listitem>
59216 <listitem>
59217 <para>
59218 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
59219 nor a local message in the state where a line containing only a dot is a
59220 terminator.
59221 </para>
59222 </listitem>
59223 <listitem>
59224 <para>
59225 If a bare CR is encountered within a header line, an extra space is added after
59226 the line terminator so as not to end the header line. The reasoning behind this
59227 is that bare CRs in header lines are most likely either to be mistakes, or
59228 people trying to play silly games.
59229 </para>
59230 </listitem>
59231 <listitem>
59232 <para>
59233 If the first header line received in a message ends with CRLF, a subsequent
59234 bare LF in a header line is treated in the same way as a bare CR in a header
59235 line.
59236 </para>
59237 </listitem>
59238 </itemizedlist>
59239 </section>
59240 <section id="SECID218">
59241 <title>Unqualified addresses</title>
59242 <para>
59243 <indexterm role="concept">
59244 <primary>unqualified addresses</primary>
59245 </indexterm>
59246 <indexterm role="concept">
59247 <primary>address</primary>
59248 <secondary>qualification</secondary>
59249 </indexterm>
59250 By default, Exim expects every envelope address it receives from an external
59251 host to be fully qualified. Unqualified addresses cause negative responses to
59252 SMTP commands. However, because SMTP is used as a means of transporting
59253 messages from MUAs running on personal workstations, there is sometimes a
59254 requirement to accept unqualified addresses from specific hosts or IP networks.
59255 </para>
59256 <para>
59257 Exim has two options that separately control which hosts may send unqualified
59258 sender or recipient addresses in SMTP commands, namely
59259 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
59260 cases, if an unqualified address is accepted, it is qualified by adding the
59261 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
59262 </para>
59263 <para>
59264 <indexterm role="option">
59265 <primary><option>qualify_domain</option></primary>
59266 </indexterm>
59267 <indexterm role="option">
59268 <primary><option>qualify_recipient</option></primary>
59269 </indexterm>
59270 Unqualified addresses in header lines are automatically qualified for messages
59271 that are locally originated, unless the <option>-bnq</option> option is given on the command
59272 line. For messages received over SMTP, unqualified addresses in header lines
59273 are qualified only if unqualified addresses are permitted in SMTP commands. In
59274 other words, such qualification is also controlled by
59275 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
59276 </para>
59277 </section>
59278 <section id="SECID219">
59279 <title>The UUCP From line</title>
59280 <para>
59281 <indexterm role="concept">
59282 <primary><quote>From</quote> line</primary>
59283 </indexterm>
59284 <indexterm role="concept">
59285 <primary>UUCP</primary>
59286 <secondary><quote>From</quote> line</secondary>
59287 </indexterm>
59288 <indexterm role="concept">
59289 <primary>sender</primary>
59290 <secondary>address</secondary>
59291 </indexterm>
59292 <indexterm role="option">
59293 <primary><option>uucp_from_pattern</option></primary>
59294 </indexterm>
59295 <indexterm role="option">
59296 <primary><option>uucp_from_sender</option></primary>
59297 </indexterm>
59298 <indexterm role="concept">
59299 <primary>envelope sender</primary>
59300 </indexterm>
59301 <indexterm role="concept">
59302 <primary>Sendmail compatibility</primary>
59303 <secondary><quote>From</quote> line</secondary>
59304 </indexterm>
59305 Messages that have come from UUCP (and some other applications) often begin
59306 with a line containing the envelope sender and a timestamp, following the word
59307 <quote>From</quote>. Examples of two common formats are:
59308 </para>
59309 <literallayout class="monospaced">
59310 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
59311 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
59312 </literallayout>
59313 <para>
59314 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
59315 Exim recognizes such lines at the start of messages that are submitted to it
59316 via the command line (that is, on the standard input). It does not recognize
59317 such lines in incoming SMTP messages, unless the sending host matches
59318 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
59319 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
59320 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
59321 default value matches the two common cases shown above and puts the address
59322 that follows <quote>From</quote> into <varname>$1</varname>.
59323 </para>
59324 <para>
59325 <indexterm role="concept">
59326 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
59327 <secondary>in <quote>From </quote> line handling</secondary>
59328 </indexterm>
59329 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
59330 a trusted user, the message&#x2019;s sender address is constructed by expanding the
59331 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
59332 then parsed as an RFC 2822 address. If there is no domain, the local part is
59333 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
59334 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
59335 </para>
59336 <para>
59337 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
59338 sender address is not changed. This is also the case for incoming SMTP messages
59339 that are permitted to contain <quote>From</quote> lines.
59340 </para>
59341 <para>
59342 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
59343 treated as a data line that starts the body of the message, as it is not valid
59344 as a header line. This also happens if a <quote>From</quote> line is present in an
59345 incoming SMTP message from a source that is not permitted to send them.
59346 </para>
59347 </section>
59348 <section id="SECID220">
59349 <title>Resent- header lines</title>
59350 <para>
59351 <indexterm role="concept">
59352 <primary><option>Resent-</option> header lines</primary>
59353 </indexterm>
59354 RFC 2822 makes provision for sets of header lines starting with the string
59355 <literal>Resent-</literal> to be added to a message when it is resent by the original
59356 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
59357 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
59358 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
59359 </para>
59360 <blockquote>
59361 <para>
59362 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
59363 processing of replies or other such automatic actions on messages.</emphasis>
59364 </para>
59365 </blockquote>
59366 <para>
59367 This leaves things a bit vague as far as other processing actions such as
59368 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
59369 follows:
59370 </para>
59371 <itemizedlist>
59372 <listitem>
59373 <para>
59374 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
59375 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
59376 </para>
59377 </listitem>
59378 <listitem>
59379 <para>
59380 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
59381 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
59382 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
59383 </para>
59384 </listitem>
59385 <listitem>
59386 <para>
59387 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
59388 also removed.
59389 </para>
59390 </listitem>
59391 <listitem>
59392 <para>
59393 For a locally-submitted message,
59394 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
59395 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
59396 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
59397 included in log lines in this case.
59398 </para>
59399 </listitem>
59400 <listitem>
59401 <para>
59402 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
59403 <option>Resent-</option> header lines are present.
59404 </para>
59405 </listitem>
59406 </itemizedlist>
59407 </section>
59408 <section id="SECID221">
59409 <title>The Auto-Submitted: header line</title>
59410 <para>
59411 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
59412 includes the header line:
59413 </para>
59414 <literallayout class="monospaced">
59415 Auto-Submitted: auto-replied
59416 </literallayout>
59417 </section>
59418 <section id="SECID222">
59419 <title>The Bcc: header line</title>
59420 <para>
59421 <indexterm role="concept">
59422 <primary><emphasis>Bcc:</emphasis> header line</primary>
59423 </indexterm>
59424 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
59425 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
59426 extracting its addresses). If <option>-t</option> is not present on the command line, any
59427 existing <emphasis>Bcc:</emphasis> is not removed.
59428 </para>
59429 </section>
59430 <section id="SECID223">
59431 <title>The Date: header line</title>
59432 <para>
59433 <indexterm role="concept">
59434 <primary><emphasis>Date:</emphasis> header line</primary>
59435 </indexterm>
59436 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
59437 Exim adds one, using the current date and time, unless the
59438 <option>suppress_local_fixups</option> control has been specified.
59439 </para>
59440 </section>
59441 <section id="SECID224">
59442 <title>The Delivery-date: header line</title>
59443 <para>
59444 <indexterm role="concept">
59445 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
59446 </indexterm>
59447 <indexterm role="option">
59448 <primary><option>delivery_date_remove</option></primary>
59449 </indexterm>
59450 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
59451 set. Exim can be configured to add them to the final delivery of messages. (See
59452 the generic <option>delivery_date_add</option> transport option.) They should not be present
59453 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
59454 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
59455 messages.
59456 </para>
59457 </section>
59458 <section id="SECID225">
59459 <title>The Envelope-to: header line</title>
59460 <para>
59461 <indexterm role="concept">
59462 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
59463 </indexterm>
59464 <indexterm role="option">
59465 <primary><option>envelope_to_remove</option></primary>
59466 </indexterm>
59467 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
59468 Exim can be configured to add them to the final delivery of messages. (See the
59469 generic <option>envelope_to_add</option> transport option.) They should not be present in
59470 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
59471 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
59472 messages.
59473 </para>
59474 </section>
59475 <section id="SECTthefrohea">
59476 <title>The From: header line</title>
59477 <para>
59478 <indexterm role="concept">
59479 <primary><emphasis>From:</emphasis> header line</primary>
59480 </indexterm>
59481 <indexterm role="concept">
59482 <primary>Sendmail compatibility</primary>
59483 <secondary><quote>From</quote> line</secondary>
59484 </indexterm>
59485 <indexterm role="concept">
59486 <primary>message</primary>
59487 <secondary>submission</secondary>
59488 </indexterm>
59489 <indexterm role="concept">
59490 <primary>submission mode</primary>
59491 </indexterm>
59492 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
59493 adds one if either of the following conditions is true:
59494 </para>
59495 <itemizedlist>
59496 <listitem>
59497 <para>
59498 The envelope sender address is not empty (that is, this is not a bounce
59499 message). The added header line copies the envelope sender address.
59500 </para>
59501 </listitem>
59502 <listitem>
59503 <para>
59504 <indexterm role="variable">
59505 <primary><varname>$authenticated_id</varname></primary>
59506 </indexterm>
59507 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
59508 </para>
59509 <orderedlist numeration="arabic">
59510 <listitem>
59511 <para>
59512 <indexterm role="variable">
59513 <primary><varname>$qualify_domain</varname></primary>
59514 </indexterm>
59515 If no domain is specified by the submission control, the local part is
59516 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59517 </para>
59518 </listitem>
59519 <listitem>
59520 <para>
59521 If a non-empty domain is specified by the submission control, the local
59522 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59523 </para>
59524 </listitem>
59525 <listitem>
59526 <para>
59527 If an empty domain is specified by the submission control,
59528 <varname>$authenticated_id</varname> is assumed to be the complete address.
59529 </para>
59530 </listitem>
59531 </orderedlist>
59532 </listitem>
59533 </itemizedlist>
59534 <para>
59535 A non-empty envelope sender takes precedence.
59536 </para>
59537 <para>
59538 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
59539 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
59540 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
59541 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
59542 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
59543 <option>unknown_login</option> configuration option). The address is qualified with
59544 <option>qualify_domain</option>.
59545 </para>
59546 <para>
59547 For compatibility with Sendmail, if an incoming, non-SMTP message has a
59548 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
59549 user, this is replaced by an address containing the user&#x2019;s login name and full
59550 name as described in section <xref linkend="SECTconstr"/>.
59551 </para>
59552 </section>
59553 <section id="SECID226">
59554 <title>The Message-ID: header line</title>
59555 <para>
59556 <indexterm role="concept">
59557 <primary><emphasis>Message-ID:</emphasis> header line</primary>
59558 </indexterm>
59559 <indexterm role="concept">
59560 <primary>message</primary>
59561 <secondary>submission</secondary>
59562 </indexterm>
59563 <indexterm role="option">
59564 <primary><option>message_id_header_text</option></primary>
59565 </indexterm>
59566 If a locally-generated or submission-mode incoming message does not contain a
59567 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
59568 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
59569 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
59570 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
59571 message id, preceded by the letter E to ensure it starts with a letter, and
59572 followed by @ and the primary host name. Additional information can be included
59573 in this header line by setting the <option>message_id_header_text</option> and/or
59574 <option>message_id_header_domain</option> options.
59575 </para>
59576 </section>
59577 <section id="SECID227">
59578 <title>The Received: header line</title>
59579 <para>
59580 <indexterm role="concept">
59581 <primary><emphasis>Received:</emphasis> header line</primary>
59582 </indexterm>
59583 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
59584 contents are defined by the <option>received_header_text</option> configuration option, and
59585 Exim automatically adds a semicolon and a timestamp to the configured string.
59586 </para>
59587 <para>
59588 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
59589 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
59590 line is the time that the message started to be received. This is the value
59591 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
59592 </para>
59593 <para>
59594 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
59595 changed to the time of acceptance, which is (apart from a small delay while the
59596 -H spool file is written) the earliest time at which delivery could start.
59597 </para>
59598 </section>
59599 <section id="SECID228">
59600 <title>The References: header line</title>
59601 <para>
59602 <indexterm role="concept">
59603 <primary><emphasis>References:</emphasis> header line</primary>
59604 </indexterm>
59605 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
59606 header line. This is constructed according to the rules that are described in
59607 section 3.64 of RFC 2822 (which states that replies should contain such a
59608 header line), and section 3.14 of RFC 3834 (which states that automatic
59609 responses are not different in this respect). However, because some mail
59610 processing software does not cope well with very long header lines, no more
59611 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
59612 incoming message. If there are more than 12, the first one and then the final
59613 11 are copied, before adding the message ID of the incoming message.
59614 </para>
59615 </section>
59616 <section id="SECID229">
59617 <title>The Return-path: header line</title>
59618 <para>
59619 <indexterm role="concept">
59620 <primary><emphasis>Return-path:</emphasis> header line</primary>
59621 </indexterm>
59622 <indexterm role="option">
59623 <primary><option>return_path_remove</option></primary>
59624 </indexterm>
59625 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
59626 it does the final delivery of messages. (See the generic <option>return_path_add</option>
59627 transport option.) Therefore, they should not be present in messages in
59628 transit. If the <option>return_path_remove</option> configuration option is set (the
59629 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
59630 </para>
59631 </section>
59632 <section id="SECTthesenhea">
59633 <title>The Sender: header line</title>
59634 <para>
59635 <indexterm role="concept">
59636 <primary><emphasis>Sender:</emphasis> header line</primary>
59637 </indexterm>
59638 <indexterm role="concept">
59639 <primary>message</primary>
59640 <secondary>submission</secondary>
59641 </indexterm>
59642 For a locally-originated message from an untrusted user, Exim may remove an
59643 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
59644 these actions by setting the <option>local_sender_retain</option> option true, the
59645 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
59646 control setting.
59647 </para>
59648 <para>
59649 When a local message is received from an untrusted user and
59650 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
59651 control has not been set, a check is made to see if the address given in the
59652 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
59653 that is expected has the login name as the local part and the value of
59654 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
59655 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
59656 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
59657 line is added to the message.
59658 </para>
59659 <para>
59660 If you set <option>local_from_check</option> false, this checking does not occur. However,
59661 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
59662 <option>local_sender_retain</option> to be true. It is not possible to set both of these
59663 options true at the same time.
59664 </para>
59665 <para>
59666 <indexterm role="concept">
59667 <primary>submission mode</primary>
59668 </indexterm>
59669 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
59670 received over TCP/IP or for messages submitted by trusted users. However, when
59671 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
59672 not specified on the submission control, the following processing takes place:
59673 </para>
59674 <para>
59675 <indexterm role="variable">
59676 <primary><varname>$authenticated_id</varname></primary>
59677 </indexterm>
59678 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
59679 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
59680 created as follows:
59681 </para>
59682 <itemizedlist>
59683 <listitem>
59684 <para>
59685 <indexterm role="variable">
59686 <primary><varname>$qualify_domain</varname></primary>
59687 </indexterm>
59688 If no domain is specified by the submission control, the local part is
59689 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59690 </para>
59691 </listitem>
59692 <listitem>
59693 <para>
59694 If a non-empty domain is specified by the submission control, the local part
59695 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59696 </para>
59697 </listitem>
59698 <listitem>
59699 <para>
59700 If an empty domain is specified by the submission control,
59701 <varname>$authenticated_id</varname> is assumed to be the complete address.
59702 </para>
59703 </listitem>
59704 </itemizedlist>
59705 <para>
59706 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
59707 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
59708 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
59709 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
59710 </para>
59711 <para>
59712 <indexterm role="concept">
59713 <primary>return path</primary>
59714 <secondary>created from <emphasis>Sender:</emphasis></secondary>
59715 </indexterm>
59716 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
59717 the message (the envelope sender address) is changed to be the same address,
59718 except in the case of submission mode when <option>sender_retain</option> is specified.
59719 </para>
59720 </section>
59721 <section id="SECTheadersaddrem">
59722 <title>Adding and removing header lines in routers and transports</title>
59723 <para>
59724 <indexterm role="concept">
59725 <primary>header lines</primary>
59726 <secondary>adding; in router or transport</secondary>
59727 </indexterm>
59728 <indexterm role="concept">
59729 <primary>header lines</primary>
59730 <secondary>removing; in router or transport</secondary>
59731 </indexterm>
59732 When a message is delivered, the addition and removal of header lines can be
59733 specified in a system filter, or on any of the routers and transports that
59734 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
59735 modifying headers in a system filter. Header lines can also be added in an ACL
59736 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
59737 </para>
59738 <para>
59739 In contrast to what happens in a system filter, header modifications that are
59740 specified on routers and transports apply only to the particular recipient
59741 addresses that are being processed by those routers and transports. These
59742 changes do not actually take place until a copy of the message is being
59743 transported. Therefore, they do not affect the basic set of header lines, and
59744 they do not affect the values of the variables that refer to header lines.
59745 </para>
59746 <para>
59747 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
59748 the transport cannot refer to the modified header lines, because such
59749 expansions all occur before the message is actually transported.
59750 </para>
59751 <para>
59752 For both routers and transports, the argument of a <option>headers_add</option>
59753 option must be in the form of one or more RFC 2822 header lines, separated by
59754 newlines (coded as <quote>\n</quote>). For example:
59755 </para>
59756 <literallayout class="monospaced">
59757 headers_add = X-added-header: added by $primary_hostname\n\
59758               X-added-second: another added header line
59759 </literallayout>
59760 <para>
59761 Exim does not check the syntax of these added header lines.
59762 </para>
59763 <para>
59764 Multiple <option>headers_add</option> options for a single router or transport can be
59765 specified; the values will append to a single list of header lines.
59766 Each header-line is separately expanded.
59767 </para>
59768 <para>
59769 The argument of a <option>headers_remove</option> option must consist of a colon-separated
59770 list of header names. This is confusing, because header names themselves are
59771 often terminated by colons. In this case, the colons are the list separators,
59772 not part of the names. For example:
59773 </para>
59774 <literallayout class="monospaced">
59775 headers_remove = return-receipt-to:acknowledge-to
59776 </literallayout>
59777 <para>
59778 Multiple <option>headers_remove</option> options for a single router or transport can be
59779 specified; the arguments will append to a single header-names list.
59780 Each item is separately expanded.
59781 </para>
59782 <para>
59783 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
59784 items are expanded at routing time,
59785 and then associated with all addresses that are
59786 accepted by that router, and also with any new addresses that it generates. If
59787 an address passes through several routers as a result of aliasing or
59788 forwarding, the changes are cumulative.
59789 </para>
59790 <para>
59791 <indexterm role="option">
59792 <primary><option>unseen</option></primary>
59793 </indexterm>
59794 However, this does not apply to multiple routers that result from the use of
59795 the <option>unseen</option> option. Any header modifications that were specified by the
59796 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
59797 </para>
59798 <para>
59799 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
59800 settings cannot be delivered together in a batch, so a transport is always
59801 dealing with a set of addresses that have the same header-processing
59802 requirements.
59803 </para>
59804 <para>
59805 The transport starts by writing the original set of header lines that arrived
59806 with the message, possibly modified by the system filter. As it writes out
59807 these lines, it consults the list of header names that were attached to the
59808 recipient address(es) by <option>headers_remove</option> options in routers, and it also
59809 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
59810 names are on either of these lists are not written out. If there are multiple
59811 instances of any listed header, they are all skipped.
59812 </para>
59813 <para>
59814 After the remaining original header lines have been written, new header
59815 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
59816 the order in which they were attached to the address. These are followed by any
59817 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
59818 </para>
59819 <para>
59820 This way of handling header line modifications in routers and transports has
59821 the following consequences:
59822 </para>
59823 <itemizedlist>
59824 <listitem>
59825 <para>
59826 The original set of header lines, possibly modified by the system filter,
59827 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
59828 to it, at all times.
59829 </para>
59830 </listitem>
59831 <listitem>
59832 <para>
59833 Header lines that are added by a router&#x2019;s
59834 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
59835 expansion syntax in subsequent routers or the transport.
59836 </para>
59837 </listitem>
59838 <listitem>
59839 <para>
59840 Conversely, header lines that are specified for removal by <option>headers_remove</option>
59841 in a router remain visible to subsequent routers and the transport.
59842 </para>
59843 </listitem>
59844 <listitem>
59845 <para>
59846 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
59847 a later router or by a transport.
59848 </para>
59849 </listitem>
59850 <listitem>
59851 <para>
59852 An added header can refer to the contents of an original header that is to be
59853 removed, even it has the same name as the added header. For example:
59854 </para>
59855 <literallayout class="monospaced">
59856 headers_remove = subject
59857 headers_add = Subject: new subject (was: $h_subject:)
59858 </literallayout>
59859 </listitem>
59860 </itemizedlist>
59861 <para>
59862 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
59863 for a <command>redirect</command> router that has the <option>one_time</option> option set.
59864 </para>
59865 </section>
59866 <section id="SECTconstr">
59867 <title>Constructed addresses</title>
59868 <para>
59869 <indexterm role="concept">
59870 <primary>address</primary>
59871 <secondary>constructed</secondary>
59872 </indexterm>
59873 <indexterm role="concept">
59874 <primary>constructed address</primary>
59875 </indexterm>
59876 When Exim constructs a sender address for a locally-generated message, it uses
59877 the form
59878 </para>
59879 <literallayout>
59880 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
59881 </literallayout>
59882 <para>
59883 For example:
59884 </para>
59885 <literallayout class="monospaced">
59886 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
59887 </literallayout>
59888 <para>
59889 The user name is obtained from the <option>-F</option> command line option if set, or
59890 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
59891 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
59892 ampersand character, this is replaced by the login name with the first letter
59893 upper cased, as is conventional in a number of operating systems. See the
59894 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
59895 The <option>unknown_username</option> option can be used to specify user names in cases when
59896 there is no password file entry.
59897 </para>
59898 <para>
59899 <indexterm role="concept">
59900 <primary>RFC 2047</primary>
59901 </indexterm>
59902 In all cases, the user name is made to conform to RFC 2822 by quoting all or
59903 parts of it if necessary. In addition, if it contains any non-printing
59904 characters, it is encoded as described in RFC 2047, which defines a way of
59905 including non-ASCII characters in header lines. The value of the
59906 <option>headers_charset</option> option specifies the name of the encoding that is used (the
59907 characters are assumed to be in this encoding). The setting of
59908 <option>print_topbitchars</option> controls whether characters with the top bit set (that
59909 is, with codes greater than 127) count as printing characters or not.
59910 </para>
59911 </section>
59912 <section id="SECID230">
59913 <title>Case of local parts</title>
59914 <para>
59915 <indexterm role="concept">
59916 <primary>case of local parts</primary>
59917 </indexterm>
59918 <indexterm role="concept">
59919 <primary>local part</primary>
59920 <secondary>case of</secondary>
59921 </indexterm>
59922 RFC 2822 states that the case of letters in the local parts of addresses cannot
59923 be assumed to be non-significant. Exim preserves the case of local parts of
59924 addresses, but by default it uses a lower-cased form when it is routing,
59925 because on most Unix systems, usernames are in lower case and case-insensitive
59926 routing is required. However, any particular router can be made to use the
59927 original case for local parts by setting the <option>caseful_local_part</option> generic
59928 router option.
59929 </para>
59930 <para>
59931 <indexterm role="concept">
59932 <primary>mixed-case login names</primary>
59933 </indexterm>
59934 If you must have mixed-case user names on your system, the best way to proceed,
59935 assuming you want case-independent handling of incoming email, is to set up
59936 your first router to convert incoming local parts in your domains to the
59937 correct case by means of a file lookup. For example:
59938 </para>
59939 <literallayout class="monospaced">
59940 correct_case:
59941   driver = redirect
59942   domains = +local_domains
59943   data = ${lookup{$local_part}cdb\
59944               {/etc/usercased.cdb}{$value}fail}\
59945               @$domain
59946 </literallayout>
59947 <para>
59948 For this router, the local part is forced to lower case by the default action
59949 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
59950 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
59951 on any subsequent routers which process your domains, they will operate on
59952 local parts with the correct case in a case-sensitive manner.
59953 </para>
59954 </section>
59955 <section id="SECID231">
59956 <title>Dots in local parts</title>
59957 <para>
59958 <indexterm role="concept">
59959 <primary>dot</primary>
59960 <secondary>in local part</secondary>
59961 </indexterm>
59962 <indexterm role="concept">
59963 <primary>local part</primary>
59964 <secondary>dots in</secondary>
59965 </indexterm>
59966 RFC 2822 forbids empty components in local parts. That is, an unquoted local
59967 part may not begin or end with a dot, nor have two consecutive dots in the
59968 middle. However, it seems that many MTAs do not enforce this, so Exim permits
59969 empty components for compatibility.
59970 </para>
59971 </section>
59972 <section id="SECID232">
59973 <title>Rewriting addresses</title>
59974 <para>
59975 <indexterm role="concept">
59976 <primary>rewriting</primary>
59977 <secondary>addresses</secondary>
59978 </indexterm>
59979 Rewriting of sender and recipient addresses, and addresses in headers, can
59980 happen automatically, or as the result of configuration options, as described
59981 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
59982 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
59983 </para>
59984 <para>
59985 Automatic rewriting includes qualification, as mentioned above. The other case
59986 in which it can happen is when an incomplete non-local domain is given. The
59987 routing process may cause this to be expanded into the full domain name. For
59988 example, a header such as
59989 </para>
59990 <literallayout class="monospaced">
59991 To: hare@teaparty
59992 </literallayout>
59993 <para>
59994 might get rewritten as
59995 </para>
59996 <literallayout class="monospaced">
59997 To: hare@teaparty.wonderland.fict.example
59998 </literallayout>
59999 <para>
60000 Rewriting as a result of routing is the one kind of message processing that
60001 does not happen at input time, as it cannot be done until the address has
60002 been routed.
60003 </para>
60004 <para>
60005 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
60006 addresses have been routed, in case any of the headers get changed as a
60007 result of routing. However, doing this in practice would hold up many
60008 deliveries for unreasonable amounts of time, just because one address could not
60009 immediately be routed. Exim therefore does not delay other deliveries when
60010 routing of one or more addresses is deferred.
60011 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
60012 </para>
60013 </section>
60014 </chapter>
60015
60016 <chapter id="CHAPSMTP">
60017 <title>SMTP processing</title>
60018 <para>
60019 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
60020 <primary>SMTP</primary>
60021 <secondary>processing details</secondary>
60022 </indexterm>
60023 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
60024 <primary>LMTP</primary>
60025 <secondary>processing details</secondary>
60026 </indexterm>
60027 Exim supports a number of different ways of using the SMTP protocol, and its
60028 LMTP variant, which is an interactive protocol for transferring messages into a
60029 closed mail store application. This chapter contains details of how SMTP is
60030 processed. For incoming mail, the following are available:
60031 </para>
60032 <itemizedlist>
60033 <listitem>
60034 <para>
60035 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
60036 </para>
60037 </listitem>
60038 <listitem>
60039 <para>
60040 SMTP over the standard input and output (the <option>-bs</option> option);
60041 </para>
60042 </listitem>
60043 <listitem>
60044 <para>
60045 Batched SMTP on the standard input (the <option>-bS</option> option).
60046 </para>
60047 </listitem>
60048 </itemizedlist>
60049 <para>
60050 For mail delivery, the following are available:
60051 </para>
60052 <itemizedlist>
60053 <listitem>
60054 <para>
60055 SMTP over TCP/IP (the <command>smtp</command> transport);
60056 </para>
60057 </listitem>
60058 <listitem>
60059 <para>
60060 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
60061 <quote>lmtp</quote>);
60062 </para>
60063 </listitem>
60064 <listitem>
60065 <para>
60066 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
60067 transport);
60068 </para>
60069 </listitem>
60070 <listitem>
60071 <para>
60072 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
60073 the <option>use_bsmtp</option> option set).
60074 </para>
60075 </listitem>
60076 </itemizedlist>
60077 <para>
60078 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
60079 stored in or read from files (or pipes), in a format in which SMTP commands are
60080 used to contain the envelope information.
60081 </para>
60082 <section id="SECToutSMTPTCP">
60083 <title>Outgoing SMTP and LMTP over TCP/IP</title>
60084 <para>
60085 <indexterm role="concept">
60086 <primary>SMTP</primary>
60087 <secondary>outgoing over TCP/IP</secondary>
60088 </indexterm>
60089 <indexterm role="concept">
60090 <primary>outgoing SMTP over TCP/IP</primary>
60091 </indexterm>
60092 <indexterm role="concept">
60093 <primary>LMTP</primary>
60094 <secondary>over TCP/IP</secondary>
60095 </indexterm>
60096 <indexterm role="concept">
60097 <primary>outgoing LMTP over TCP/IP</primary>
60098 </indexterm>
60099 <indexterm role="concept">
60100 <primary>EHLO</primary>
60101 </indexterm>
60102 <indexterm role="concept">
60103 <primary>HELO</primary>
60104 </indexterm>
60105 <indexterm role="concept">
60106 <primary>SIZE option on MAIL command</primary>
60107 </indexterm>
60108 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
60109 The <option>protocol</option> option selects which protocol is to be used, but the actual
60110 processing is the same in both cases.
60111 </para>
60112 <para>
60113 If, in response to its EHLO command, Exim is told that the SIZE
60114 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
60115 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
60116 <option>size_addition</option> option (default 1024) to allow for additions to the message
60117 such as per-transport header lines, or changes made in a
60118 <indexterm role="concept">
60119 <primary>transport</primary>
60120 <secondary>filter</secondary>
60121 </indexterm>
60122 <indexterm role="concept">
60123 <primary>filter</primary>
60124 <secondary>transport filter</secondary>
60125 </indexterm>
60126 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
60127 suppressed.
60128 </para>
60129 <para>
60130 If the remote server advertises support for PIPELINING, Exim uses the
60131 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
60132 required for the transaction.
60133 </para>
60134 <para>
60135 If the remote server advertises support for the STARTTLS command, and Exim
60136 was built to support TLS encryption, it tries to start a TLS session unless the
60137 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
60138 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
60139 is called for verification.
60140 </para>
60141 <para>
60142 If the remote server advertises support for the AUTH command, Exim scans
60143 the authenticators configuration for any suitable client settings, as described
60144 in chapter <xref linkend="CHAPSMTPAUTH"/>.
60145 </para>
60146 <para>
60147 <indexterm role="concept">
60148 <primary>carriage return</primary>
60149 </indexterm>
60150 <indexterm role="concept">
60151 <primary>linefeed</primary>
60152 </indexterm>
60153 Responses from the remote host are supposed to be terminated by CR followed by
60154 LF. However, there are known to be hosts that do not send CR characters, so in
60155 order to be able to interwork with such hosts, Exim treats LF on its own as a
60156 line terminator.
60157 </para>
60158 <para>
60159 If a message contains a number of different addresses, all those with the same
60160 characteristics (for example, the same envelope sender) that resolve to the
60161 same set of hosts, in the same order, are sent in a single SMTP transaction,
60162 even if they are for different domains, unless there are more than the setting
60163 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
60164 they are split into groups containing no more than <option>max_rcpt</option>s addresses
60165 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
60166 in parallel sessions. The order of hosts with identical MX values is not
60167 significant when checking whether addresses can be batched in this way.
60168 </para>
60169 <para>
60170 When the <command>smtp</command> transport suffers a temporary failure that is not
60171 message-related, Exim updates its transport-specific database, which contains
60172 records indexed by host name that remember which messages are waiting for each
60173 particular host. It also updates the retry database with new retry times.
60174 </para>
60175 <para>
60176 <indexterm role="concept">
60177 <primary>hints database</primary>
60178 <secondary>retry keys</secondary>
60179 </indexterm>
60180 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
60181 a multi-homed host is broken, it will soon be skipped most of the time.
60182 See the next section for more detail about error handling.
60183 </para>
60184 <para>
60185 <indexterm role="concept">
60186 <primary>SMTP</primary>
60187 <secondary>passed connection</secondary>
60188 </indexterm>
60189 <indexterm role="concept">
60190 <primary>SMTP</primary>
60191 <secondary>batching over TCP/IP</secondary>
60192 </indexterm>
60193 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
60194 looks in the hints database for the transport to see if there are any queued
60195 messages waiting for the host to which it is connected. If it finds one, it
60196 creates a new Exim process using the <option>-MC</option> option (which can only be used by
60197 a process running as root or the Exim user) and passes the TCP/IP socket to it
60198 so that it can deliver another message using the same socket. The new process
60199 does only those deliveries that are routed to the connected host, and may in
60200 turn pass the socket on to a third process, and so on.
60201 </para>
60202 <para>
60203 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
60204 limit the number of messages sent down a single TCP/IP connection.
60205 </para>
60206 <para>
60207 <indexterm role="concept">
60208 <primary>asterisk</primary>
60209 <secondary>after IP address</secondary>
60210 </indexterm>
60211 The second and subsequent messages delivered down an existing connection are
60212 identified in the main log by the addition of an asterisk after the closing
60213 square bracket of the IP address.
60214 </para>
60215 </section>
60216 <section id="SECToutSMTPerr">
60217 <title>Errors in outgoing SMTP</title>
60218 <para>
60219 <indexterm role="concept">
60220 <primary>error</primary>
60221 <secondary>in outgoing SMTP</secondary>
60222 </indexterm>
60223 <indexterm role="concept">
60224 <primary>SMTP</primary>
60225 <secondary>errors in outgoing</secondary>
60226 </indexterm>
60227 <indexterm role="concept">
60228 <primary>host</primary>
60229 <secondary>error</secondary>
60230 </indexterm>
60231 Three different kinds of error are recognized for outgoing SMTP: host errors,
60232 message errors, and recipient errors.
60233 </para>
60234 <variablelist>
60235 <varlistentry>
60236 <term><emphasis role="bold">Host errors</emphasis></term>
60237 <listitem>
60238 <para>
60239 A host error is not associated with a particular message or with a
60240 particular recipient of a message. The host errors are:
60241 </para>
60242 <itemizedlist>
60243 <listitem>
60244 <para>
60245 Connection refused or timed out,
60246 </para>
60247 </listitem>
60248 <listitem>
60249 <para>
60250 Any error response code on connection,
60251 </para>
60252 </listitem>
60253 <listitem>
60254 <para>
60255 Any error response code to EHLO or HELO,
60256 </para>
60257 </listitem>
60258 <listitem>
60259 <para>
60260 Loss of connection at any time, except after <quote>.</quote>,
60261 </para>
60262 </listitem>
60263 <listitem>
60264 <para>
60265 I/O errors at any time,
60266 </para>
60267 </listitem>
60268 <listitem>
60269 <para>
60270 Timeouts during the session, other than in response to MAIL, RCPT or
60271 the <quote>.</quote> at the end of the data.
60272 </para>
60273 </listitem>
60274 </itemizedlist>
60275 <para>
60276 For a host error, a permanent error response on connection, or in response to
60277 EHLO, causes all addresses routed to the host to be failed. Any other host
60278 error causes all addresses to be deferred, and retry data to be created for the
60279 host. It is not tried again, for any message, until its retry time arrives. If
60280 the current set of addresses are not all delivered in this run (to some
60281 alternative host), the message is added to the list of those waiting for this
60282 host, so if it is still undelivered when a subsequent successful delivery is
60283 made to the host, it will be sent down the same SMTP connection.
60284 </para>
60285 </listitem></varlistentry>
60286 <varlistentry>
60287 <term><emphasis role="bold">Message errors</emphasis></term>
60288 <listitem>
60289 <para>
60290 <indexterm role="concept">
60291 <primary>message</primary>
60292 <secondary>error</secondary>
60293 </indexterm>
60294 A message error is associated with a particular message when sent to a
60295 particular host, but not with a particular recipient of the message. The
60296 message errors are:
60297 </para>
60298 <itemizedlist>
60299 <listitem>
60300 <para>
60301 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
60302 the data,
60303 </para>
60304 </listitem>
60305 <listitem>
60306 <para>
60307 Timeout after MAIL,
60308 </para>
60309 </listitem>
60310 <listitem>
60311 <para>
60312 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
60313 timeout after the DATA command itself is treated as a host error, as is loss of
60314 connection at any other time.
60315 </para>
60316 </listitem>
60317 </itemizedlist>
60318 <para>
60319 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
60320 to be failed, and a delivery error report to be returned to the sender. A
60321 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
60322 addresses to be deferred. Retry data is not created for the host, but instead,
60323 a retry record for the combination of host plus message id is created. The
60324 message is not added to the list of those waiting for this host. This ensures
60325 that the failing message will not be sent to this host again until the retry
60326 time arrives. However, other messages that are routed to the host are not
60327 affected, so if it is some property of the message that is causing the error,
60328 it will not stop the delivery of other mail.
60329 </para>
60330 <para>
60331 If the remote host specified support for the SIZE parameter in its response
60332 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
60333 over-large message will cause a message error because the error arrives as a
60334 response to MAIL.
60335 </para>
60336 </listitem></varlistentry>
60337 <varlistentry>
60338 <term><emphasis role="bold">Recipient errors</emphasis></term>
60339 <listitem>
60340 <para>
60341 <indexterm role="concept">
60342 <primary>recipient</primary>
60343 <secondary>error</secondary>
60344 </indexterm>
60345 A recipient error is associated with a particular recipient of a message. The
60346 recipient errors are:
60347 </para>
60348 <itemizedlist>
60349 <listitem>
60350 <para>
60351 Any error response to RCPT,
60352 </para>
60353 </listitem>
60354 <listitem>
60355 <para>
60356 Timeout after RCPT.
60357 </para>
60358 </listitem>
60359 </itemizedlist>
60360 <para>
60361 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
60362 recipient address to be failed, and a bounce message to be returned to the
60363 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
60364 address to be deferred, and routing retry data to be created for it. This is
60365 used to delay processing of the address in subsequent queue runs, until its
60366 routing retry time arrives. This applies to all messages, but because it
60367 operates only in queue runs, one attempt will be made to deliver a new message
60368 to the failing address before the delay starts to operate. This ensures that,
60369 if the failure is really related to the message rather than the recipient
60370 (<quote>message too big for this recipient</quote> is a possible example), other messages
60371 have a chance of getting delivered. If a delivery to the address does succeed,
60372 the retry information gets cleared, so all stuck messages get tried again, and
60373 the retry clock is reset.
60374 </para>
60375 <para>
60376 The message is not added to the list of those waiting for this host. Use of the
60377 host for other messages is unaffected, and except in the case of a timeout,
60378 other recipients are processed independently, and may be successfully delivered
60379 in the current SMTP session. After a timeout it is of course impossible to
60380 proceed with the session, so all addresses get deferred. However, those other
60381 than the one that failed do not suffer any subsequent retry delays. Therefore,
60382 if one recipient is causing trouble, the others have a chance of getting
60383 through when a subsequent delivery attempt occurs before the failing
60384 recipient&#x2019;s retry time.
60385 </para>
60386 </listitem></varlistentry>
60387 </variablelist>
60388 <para>
60389 In all cases, if there are other hosts (or IP addresses) available for the
60390 current set of addresses (for example, from multiple MX records), they are
60391 tried in this run for any undelivered addresses, subject of course to their
60392 own retry data. In other words, recipient error retry data does not take effect
60393 until the next delivery attempt.
60394 </para>
60395 <para>
60396 Some hosts have been observed to give temporary error responses to every
60397 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
60398 would be nice if such circumstances could be recognized, and defer data for the
60399 host itself created, but this is not possible within the current Exim design.
60400 What actually happens is that retry data for every (host, message) combination
60401 is created.
60402 </para>
60403 <para>
60404 The reason that timeouts after MAIL and RCPT are treated specially is that
60405 these can sometimes arise as a result of the remote host&#x2019;s verification
60406 procedures. Exim makes this assumption, and treats them as if a temporary error
60407 response had been received. A timeout after <quote>.</quote> is treated specially because
60408 it is known that some broken implementations fail to recognize the end of the
60409 message if the last character of the last line is a binary zero. Thus, it is
60410 helpful to treat this case as a message error.
60411 </para>
60412 <para>
60413 Timeouts at other times are treated as host errors, assuming a problem with the
60414 host, or the connection to it. If a timeout after MAIL, RCPT,
60415 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
60416 the timeout is likely to occur at some other point in the dialogue, causing it
60417 then to be treated as a host error.
60418 </para>
60419 <para>
60420 There is experimental evidence that some MTAs drop the connection after the
60421 terminating <quote>.</quote> if they do not like the contents of the message for some
60422 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
60423 should be given. That is why Exim treats this case as a message rather than a
60424 host error, in order not to delay other messages to the same host.
60425 </para>
60426 </section>
60427 <section id="SECID233">
60428 <title>Incoming SMTP messages over TCP/IP</title>
60429 <para>
60430 <indexterm role="concept">
60431 <primary>SMTP</primary>
60432 <secondary>incoming over TCP/IP</secondary>
60433 </indexterm>
60434 <indexterm role="concept">
60435 <primary>incoming SMTP over TCP/IP</primary>
60436 </indexterm>
60437 <indexterm role="concept">
60438 <primary>inetd</primary>
60439 </indexterm>
60440 <indexterm role="concept">
60441 <primary>daemon</primary>
60442 </indexterm>
60443 Incoming SMTP messages can be accepted in one of two ways: by running a
60444 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
60445 <filename>/etc/inetd.conf</filename> should be like this:
60446 </para>
60447 <literallayout class="monospaced">
60448 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
60449 </literallayout>
60450 <para>
60451 Exim distinguishes between this case and the case of a locally running user
60452 agent using the <option>-bs</option> option by checking whether or not the standard input is
60453 a socket. When it is, either the port must be privileged (less than 1024), or
60454 the caller must be root or the Exim user. If any other user passes a socket
60455 with an unprivileged port number, Exim prints a message on the standard error
60456 stream and exits with an error code.
60457 </para>
60458 <para>
60459 By default, Exim does not make a log entry when a remote host connects or
60460 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
60461 unexpected. It can be made to write such log entries by setting the
60462 <option>smtp_connection</option> log selector.
60463 </para>
60464 <para>
60465 <indexterm role="concept">
60466 <primary>carriage return</primary>
60467 </indexterm>
60468 <indexterm role="concept">
60469 <primary>linefeed</primary>
60470 </indexterm>
60471 Commands from the remote host are supposed to be terminated by CR followed by
60472 LF. However, there are known to be hosts that do not send CR characters. In
60473 order to be able to interwork with such hosts, Exim treats LF on its own as a
60474 line terminator.
60475 Furthermore, because common code is used for receiving messages from all
60476 sources, a CR on its own is also interpreted as a line terminator. However, the
60477 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
60478 </para>
60479 <para>
60480 <indexterm role="concept">
60481 <primary>EHLO</primary>
60482 <secondary>invalid data</secondary>
60483 </indexterm>
60484 <indexterm role="concept">
60485 <primary>HELO</primary>
60486 <secondary>invalid data</secondary>
60487 </indexterm>
60488 One area that sometimes gives rise to problems concerns the EHLO or
60489 HELO commands. Some clients send syntactically invalid versions of these
60490 commands, which Exim rejects by default. (This is nothing to do with verifying
60491 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
60492 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
60493 match the broken hosts that send invalid commands.
60494 </para>
60495 <para>
60496 <indexterm role="concept">
60497 <primary>SIZE option on MAIL command</primary>
60498 </indexterm>
60499 <indexterm role="concept">
60500 <primary>MAIL</primary>
60501 <secondary>SIZE option</secondary>
60502 </indexterm>
60503 The amount of disk space available is checked whenever SIZE is received on
60504 a MAIL command, independently of whether <option>message_size_limit</option> or
60505 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
60506 false. A temporary error is given if there is not enough space. If
60507 <option>check_spool_space</option> is set, the check is for that amount of space plus the
60508 value given with SIZE, that is, it checks that the addition of the incoming
60509 message will not reduce the space below the threshold.
60510 </para>
60511 <para>
60512 When a message is successfully received, Exim includes the local message id in
60513 its response to the final <quote>.</quote> that terminates the data. If the remote host
60514 logs this text it can help with tracing what has happened to a message.
60515 </para>
60516 <para>
60517 The Exim daemon can limit the number of simultaneous incoming connections it is
60518 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
60519 number of simultaneous incoming connections from a single remote host (see the
60520 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
60521 rejected using the SMTP temporary error code 421.
60522 </para>
60523 <para>
60524 The Exim daemon does not rely on the SIGCHLD signal to detect when a
60525 subprocess has finished, as this can get lost at busy times. Instead, it looks
60526 for completed subprocesses every time it wakes up. Provided there are other
60527 things happening (new incoming calls, starts of queue runs), completed
60528 processes will be noticed and tidied away. On very quiet systems you may
60529 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
60530 it will be noticed when the daemon next wakes up.
60531 </para>
60532 <para>
60533 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
60534 and can also be set up to reject SMTP calls from non-reserved hosts at times of
60535 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
60536 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
60537 applies in both the daemon and <emphasis>inetd</emphasis> cases.
60538 </para>
60539 <para>
60540 Exim normally starts a delivery process for each message received, though this
60541 can be varied by means of the <option>-odq</option> command line option and the
60542 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
60543 number of simultaneously running delivery processes started in this way from
60544 SMTP input can be limited by the <option>smtp_accept_queue</option> and
60545 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
60546 subsequently received messages are just put on the input queue without starting
60547 a delivery process.
60548 </para>
60549 <para>
60550 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
60551 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
60552 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
60553 handled by an entirely independent Exim process. Control by load average is,
60554 however, available with <emphasis>inetd</emphasis>.
60555 </para>
60556 <para>
60557 Exim can be configured to verify addresses in incoming SMTP commands as they
60558 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
60559 to rewrite addresses at this time &ndash; before any syntax checking is done. See
60560 section <xref linkend="SECTrewriteS"/>.
60561 </para>
60562 <para>
60563 Exim can also be configured to limit the rate at which a client host submits
60564 MAIL and RCPT commands in a single SMTP session. See the
60565 <option>smtp_ratelimit_hosts</option> option.
60566 </para>
60567 </section>
60568 <section id="SECID234">
60569 <title>Unrecognized SMTP commands</title>
60570 <para>
60571 <indexterm role="concept">
60572 <primary>SMTP</primary>
60573 <secondary>unrecognized commands</secondary>
60574 </indexterm>
60575 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
60576 commands during a single SMTP connection, it drops the connection after sending
60577 the error response to the last command. The default value for
60578 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
60579 abuse that subvert web servers into making connections to SMTP ports; in these
60580 circumstances, a number of non-SMTP lines are sent first.
60581 </para>
60582 </section>
60583 <section id="SECID235">
60584 <title>Syntax and protocol errors in SMTP commands</title>
60585 <para>
60586 <indexterm role="concept">
60587 <primary>SMTP</primary>
60588 <secondary>syntax errors</secondary>
60589 </indexterm>
60590 <indexterm role="concept">
60591 <primary>SMTP</primary>
60592 <secondary>protocol errors</secondary>
60593 </indexterm>
60594 A syntax error is detected if an SMTP command is recognized, but there is
60595 something syntactically wrong with its data, for example, a malformed email
60596 address in a RCPT command. Protocol errors include invalid command
60597 sequencing such as RCPT before MAIL. If Exim receives more than
60598 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
60599 drops the connection after sending the error response to the last command. The
60600 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
60601 broken clients that loop sending bad commands (yes, it has been seen).
60602 </para>
60603 </section>
60604 <section id="SECID236">
60605 <title>Use of non-mail SMTP commands</title>
60606 <para>
60607 <indexterm role="concept">
60608 <primary>SMTP</primary>
60609 <secondary>non-mail commands</secondary>
60610 </indexterm>
60611 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
60612 DATA. Exim counts such commands, and drops the connection if there are too
60613 many of them in a single SMTP session. This action catches some
60614 denial-of-service attempts and things like repeated failing AUTHs, or a mad
60615 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
60616 defines what <quote>too many</quote> means. Its default value is 10.
60617 </para>
60618 <para>
60619 When a new message is expected, one occurrence of RSET is not counted. This
60620 allows a client to send one RSET between messages (this is not necessary,
60621 but some clients do it). Exim also allows one uncounted occurrence of HELO
60622 or EHLO, and one occurrence of STARTTLS between messages. After
60623 starting up a TLS session, another EHLO is expected, and so it too is not
60624 counted.
60625 </para>
60626 <para>
60627 The first occurrence of AUTH in a connection, or immediately following
60628 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
60629 RCPT, DATA, and QUIT are counted.
60630 </para>
60631 <para>
60632 You can control which hosts are subject to the limit set by
60633 <option>smtp_accept_max_nonmail</option> by setting
60634 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
60635 the limit apply to all hosts. This option means that you can exclude any
60636 specific badly-behaved hosts that you have to live with.
60637 </para>
60638 </section>
60639 <section id="SECID237">
60640 <title>The VRFY and EXPN commands</title>
60641 <para>
60642 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
60643 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
60644 appropriate) in order to decide whether the command should be accepted or not.
60645 If no ACL is defined, the command is rejected.
60646 </para>
60647 <para>
60648 <indexterm role="concept">
60649 <primary>VRFY</primary>
60650 <secondary>processing</secondary>
60651 </indexterm>
60652 When VRFY is accepted, it runs exactly the same code as when Exim is
60653 called with the <option>-bv</option> option.
60654 </para>
60655 <para>
60656 <indexterm role="concept">
60657 <primary>EXPN</primary>
60658 <secondary>processing</secondary>
60659 </indexterm>
60660 When EXPN is accepted, a single-level expansion of the address is done.
60661 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
60662 than a verification (the <option>-bv</option> option). If an unqualified local part is given
60663 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
60664 of VRFY and EXPN commands are logged on the main and reject logs, and
60665 VRFY verification failures are logged on the main log for consistency with
60666 RCPT failures.
60667 </para>
60668 </section>
60669 <section id="SECTETRN">
60670 <title>The ETRN command</title>
60671 <para>
60672 <indexterm role="concept">
60673 <primary>ETRN</primary>
60674 <secondary>processing</secondary>
60675 </indexterm>
60676 RFC 1985 describes an SMTP command called ETRN that is designed to
60677 overcome the security problems of the TURN command (which has fallen into
60678 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
60679 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
60680 should be accepted or not. If no ACL is defined, the command is rejected.
60681 </para>
60682 <para>
60683 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
60684 delivery to certain hosts. As Exim does not organize its message queue by host,
60685 the only form of ETRN that is supported by default is the one where the
60686 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
60687 specific to the SMTP server. A valid ETRN command causes a run of Exim with
60688 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
60689 argument. For example,
60690 </para>
60691 <literallayout class="monospaced">
60692 ETRN #brigadoon
60693 </literallayout>
60694 <para>
60695 runs the command
60696 </para>
60697 <literallayout class="monospaced">
60698 exim -R brigadoon
60699 </literallayout>
60700 <para>
60701 which causes a delivery attempt on all messages with undelivered addresses
60702 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
60703 default), Exim prevents the simultaneous execution of more than one queue run
60704 for the same argument string as a result of an ETRN command. This stops
60705 a misbehaving client from starting more than one queue runner at once.
60706 </para>
60707 <para>
60708 <indexterm role="concept">
60709 <primary>hints database</primary>
60710 <secondary>ETRN serialization</secondary>
60711 </indexterm>
60712 Exim implements the serialization by means of a hints database in which a
60713 record is written whenever a process is started by ETRN, and deleted when
60714 the process completes. However, Exim does not keep the SMTP session waiting for
60715 the ETRN process to complete. Once ETRN is accepted, the client is sent
60716 a <quote>success</quote> return code. Obviously there is scope for hints records to get
60717 left lying around if there is a system or program crash. To guard against this,
60718 Exim ignores any records that are more than six hours old.
60719 </para>
60720 <para>
60721 <indexterm role="option">
60722 <primary><option>smtp_etrn_command</option></primary>
60723 </indexterm>
60724 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
60725 used. This specifies a command that is run whenever ETRN is received,
60726 whatever the form of its argument. For
60727 example:
60728 </para>
60729 <literallayout class="monospaced">
60730 smtp_etrn_command = /etc/etrn_command $domain \
60731                     $sender_host_address
60732 </literallayout>
60733 <para>
60734 <indexterm role="variable">
60735 <primary><varname>$domain</varname></primary>
60736 </indexterm>
60737 The string is split up into arguments which are independently expanded. The
60738 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
60739 and no syntax checking is done on the contents of this argument. Exim does not
60740 wait for the command to complete, so its status code is not checked. Exim runs
60741 under its own uid and gid when receiving incoming SMTP, so it is not possible
60742 for it to change them before running the command.
60743 </para>
60744 </section>
60745 <section id="SECID238">
60746 <title>Incoming local SMTP</title>
60747 <para>
60748 <indexterm role="concept">
60749 <primary>SMTP</primary>
60750 <secondary>local incoming</secondary>
60751 </indexterm>
60752 Some user agents use SMTP to pass messages to their local MTA using the
60753 standard input and output, as opposed to passing the envelope on the command
60754 line and writing the message to the standard input. This is supported by the
60755 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
60756 messages over TCP/IP (including the use of ACLs), except that the envelope
60757 sender given in a MAIL command is ignored unless the caller is trusted. In
60758 an ACL you can detect this form of SMTP input by testing for an empty host
60759 identification. It is common to have this as the first line in the ACL that
60760 runs for RCPT commands:
60761 </para>
60762 <literallayout class="monospaced">
60763 accept hosts = :
60764 </literallayout>
60765 <para>
60766 This accepts SMTP messages from local processes without doing any other tests.
60767 </para>
60768 </section>
60769 <section id="SECTbatchSMTP">
60770 <title>Outgoing batched SMTP</title>
60771 <para>
60772 <indexterm role="concept">
60773 <primary>SMTP</primary>
60774 <secondary>batched outgoing</secondary>
60775 </indexterm>
60776 <indexterm role="concept">
60777 <primary>batched SMTP output</primary>
60778 </indexterm>
60779 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
60780 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
60781 be output in BSMTP format. No SMTP responses are possible for this form of
60782 delivery. All it is doing is using SMTP commands as a way of transmitting the
60783 envelope along with the message.
60784 </para>
60785 <para>
60786 The message is written to the file or pipe preceded by the SMTP commands
60787 MAIL and RCPT, and followed by a line containing a single dot. Lines in
60788 the message that start with a dot have an extra dot added. The SMTP command
60789 HELO is not normally used. If it is required, the <option>message_prefix</option> option
60790 can be used to specify it.
60791 </para>
60792 <para>
60793 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
60794 one recipient address at a time by default. However, you can arrange for them
60795 to handle several addresses at once by setting the <option>batch_max</option> option. When
60796 this is done for BSMTP, messages may contain multiple RCPT commands. See
60797 chapter <xref linkend="CHAPbatching"/> for more details.
60798 </para>
60799 <para>
60800 <indexterm role="variable">
60801 <primary><varname>$host</varname></primary>
60802 </indexterm>
60803 When one or more addresses are routed to a BSMTP transport by a router that
60804 sets up a host list, the name of the first host on the list is available to the
60805 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
60806 router:
60807 </para>
60808 <literallayout class="monospaced">
60809 begin routers
60810 route_append:
60811   driver = manualroute
60812   transport = smtp_appendfile
60813   route_list = domain.example  batch.host.example
60814
60815 begin transports
60816 smtp_appendfile:
60817   driver = appendfile
60818   directory = /var/bsmtp/$host
60819   batch_max = 1000
60820   use_bsmtp
60821   user = exim
60822 </literallayout>
60823 <para>
60824 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
60825 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
60826 message (unless there are more than 1000 recipients).
60827 </para>
60828 </section>
60829 <section id="SECTincomingbatchedSMTP">
60830 <title>Incoming batched SMTP</title>
60831 <para>
60832 <indexterm role="concept">
60833 <primary>SMTP</primary>
60834 <secondary>batched incoming</secondary>
60835 </indexterm>
60836 <indexterm role="concept">
60837 <primary>batched SMTP input</primary>
60838 </indexterm>
60839 The <option>-bS</option> command line option causes Exim to accept one or more messages by
60840 reading SMTP on the standard input, but to generate no responses. If the caller
60841 is trusted, the senders in the MAIL commands are believed; otherwise the
60842 sender is always the caller of Exim. Unqualified senders and receivers are not
60843 rejected (there seems little point) but instead just get qualified. HELO
60844 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
60845 as NOOP; QUIT quits.
60846 </para>
60847 <para>
60848 Minimal policy checking is done for BSMTP input. Only the non-SMTP
60849 ACL is run in the same way as for non-SMTP local input.
60850 </para>
60851 <para>
60852 If an error is detected while reading a message, including a missing <quote>.</quote> at
60853 the end, Exim gives up immediately. It writes details of the error to the
60854 standard output in a stylized way that the calling program should be able to
60855 make some use of automatically, for example:
60856 </para>
60857 <literallayout class="monospaced">
60858 554 Unexpected end of file
60859 Transaction started in line 10
60860 Error detected in line 14
60861 </literallayout>
60862 <para>
60863 It writes a more verbose version, for human consumption, to the standard error
60864 file, for example:
60865 </para>
60866 <literallayout class="monospaced">
60867 An error was detected while processing a file of BSMTP input.
60868 The error message was:
60869
60870 501 '&gt;' missing at end of address
60871
60872 The SMTP transaction started in line 10.
60873 The error was detected in line 12.
60874 The SMTP command at fault was:
60875
60876 rcpt to:&lt;malformed@in.com.plete
60877
60878 1 previous message was successfully processed.
60879 The rest of the batch was abandoned.
60880 </literallayout>
60881 <para>
60882 The return code from Exim is zero only if there were no errors. It is 1 if some
60883 messages were accepted before an error was detected, and 2 if no messages were
60884 accepted.
60885 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
60886 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
60887 </para>
60888 </section>
60889 </chapter>
60890
60891 <chapter id="CHAPemsgcust">
60892 <title>Customizing bounce and warning messages</title>
60893 <titleabbrev>Customizing messages</titleabbrev>
60894 <para>
60895 When a message fails to be delivered, or remains on the queue for more than a
60896 configured amount of time, Exim sends a message to the original sender, or
60897 to an alternative configured address. The text of these messages is built into
60898 the code of Exim, but it is possible to change it, either by adding a single
60899 string, or by replacing each of the paragraphs by text supplied in a file.
60900 </para>
60901 <para>
60902 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
60903 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
60904 option. Exim also adds the line
60905 </para>
60906 <literallayout class="monospaced">
60907 Auto-Submitted: auto-generated
60908 </literallayout>
60909 <para>
60910 to all warning and bounce messages,
60911 </para>
60912 <section id="SECID239">
60913 <title>Customizing bounce messages</title>
60914 <para>
60915 <indexterm role="concept">
60916 <primary>customizing</primary>
60917 <secondary>bounce message</secondary>
60918 </indexterm>
60919 <indexterm role="concept">
60920 <primary>bounce message</primary>
60921 <secondary>customizing</secondary>
60922 </indexterm>
60923 If <option>bounce_message_text</option> is set, its contents are included in the default
60924 message immediately after <quote>This message was created automatically by mail
60925 delivery software.</quote> The string is not expanded. It is not used if
60926 <option>bounce_message_file</option> is set.
60927 </para>
60928 <para>
60929 When <option>bounce_message_file</option> is set, it must point to a template file for
60930 constructing error messages. The file consists of a series of text items,
60931 separated by lines consisting of exactly four asterisks. If the file cannot be
60932 opened, default text is used and a message is written to the main and panic
60933 logs. If any text item in the file is empty, default text is used for that
60934 item.
60935 </para>
60936 <para>
60937 <indexterm role="variable">
60938 <primary><varname>$bounce_recipient</varname></primary>
60939 </indexterm>
60940 <indexterm role="variable">
60941 <primary><varname>$bounce_return_size_limit</varname></primary>
60942 </indexterm>
60943 Each item of text that is read from the file is expanded, and there are two
60944 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
60945 the recipient of an error message while it is being created, and
60946 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
60947 option, rounded to a whole number.
60948 </para>
60949 <para>
60950 The items must appear in the file in the following order:
60951 </para>
60952 <itemizedlist>
60953 <listitem>
60954 <para>
60955 The first item is included in the headers, and should include at least a
60956 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
60957 </para>
60958 </listitem>
60959 <listitem>
60960 <para>
60961 The second item forms the start of the error message. After it, Exim lists the
60962 failing addresses with their error messages.
60963 </para>
60964 </listitem>
60965 <listitem>
60966 <para>
60967 The third item is used to introduce any text from pipe transports that is to be
60968 returned to the sender. It is omitted if there is no such text.
60969 </para>
60970 </listitem>
60971 <listitem>
60972 <para>
60973 The fourth item is used to introduce the copy of the message that is returned
60974 as part of the error report.
60975 </para>
60976 </listitem>
60977 <listitem>
60978 <para>
60979 The fifth item is added after the fourth one if the returned message is
60980 truncated because it is bigger than <option>return_size_limit</option>.
60981 </para>
60982 </listitem>
60983 <listitem>
60984 <para>
60985 The sixth item is added after the copy of the original message.
60986 </para>
60987 </listitem>
60988 </itemizedlist>
60989 <para>
60990 The default state (<option>bounce_message_file</option> unset) is equivalent to the
60991 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
60992 other lines have been split in order to fit them on the page:
60993 </para>
60994 <literallayout class="monospaced">
60995 Subject: Mail delivery failed
60996   ${if eq{$sender_address}{$bounce_recipient}
60997   {: returning message to sender}}
60998 ****
60999 This message was created automatically by mail delivery software.
61000
61001 A message ${if eq{$sender_address}{$bounce_recipient}
61002   {that you sent }{sent by
61003
61004 &lt;$sender_address&gt;
61005
61006 }}could not be delivered to all of its recipients.
61007 This is a permanent error. The following address(es) failed:
61008 ****
61009 The following text was generated during the delivery attempt(s):
61010 ****
61011 ------ This is a copy of the message, including all the headers.
61012   ------
61013 ****
61014 ------ The body of the message is $message_size characters long;
61015   only the first
61016 ------ $bounce_return_size_limit or so are included here.
61017 ****
61018 </literallayout>
61019 </section>
61020 <section id="SECTcustwarn">
61021 <title>Customizing warning messages</title>
61022 <para>
61023 <indexterm role="concept">
61024 <primary>customizing</primary>
61025 <secondary>warning message</secondary>
61026 </indexterm>
61027 <indexterm role="concept">
61028 <primary>warning of delay</primary>
61029 <secondary>customizing the message</secondary>
61030 </indexterm>
61031 The option <option>warn_message_file</option> can be pointed at a template file for use when
61032 warnings about message delays are created. In this case there are only three
61033 text sections:
61034 </para>
61035 <itemizedlist>
61036 <listitem>
61037 <para>
61038 The first item is included in the headers, and should include at least a
61039 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
61040 </para>
61041 </listitem>
61042 <listitem>
61043 <para>
61044 The second item forms the start of the warning message. After it, Exim lists
61045 the delayed addresses.
61046 </para>
61047 </listitem>
61048 <listitem>
61049 <para>
61050 The third item then ends the message.
61051 </para>
61052 </listitem>
61053 </itemizedlist>
61054 <para>
61055 The default state is equivalent to the following file, except that some lines
61056 have been split here, in order to fit them on the page:
61057 </para>
61058 <literallayout class="monospaced">
61059 Subject: Warning: message $message_exim_id delayed
61060   $warn_message_delay
61061 ****
61062 This message was created automatically by mail delivery software.
61063
61064 A message ${if eq{$sender_address}{$warn_message_recipients}
61065 {that you sent }{sent by
61066
61067 &lt;$sender_address&gt;
61068
61069 }}has not been delivered to all of its recipients after
61070 more than $warn_message_delay on the queue on $primary_hostname.
61071
61072 The message identifier is:     $message_exim_id
61073 The subject of the message is: $h_subject
61074 The date of the message is:    $h_date
61075
61076 The following address(es) have not yet been delivered:
61077 ****
61078 No action is required on your part. Delivery attempts will
61079 continue for some time, and this warning may be repeated at
61080 intervals if the message remains undelivered. Eventually the
61081 mail delivery software will give up, and when that happens,
61082 the message will be returned to you.
61083 </literallayout>
61084 <para>
61085 <indexterm role="variable">
61086 <primary><varname>$warn_message_delay</varname></primary>
61087 </indexterm>
61088 <indexterm role="variable">
61089 <primary><varname>$warn_message_recipients</varname></primary>
61090 </indexterm>
61091 However, in the default state the subject and date lines are omitted if no
61092 appropriate headers exist. During the expansion of this file,
61093 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
61094 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
61095 of recipients for the warning message. There may be more than one if there are
61096 multiple addresses with different <option>errors_to</option> settings on the routers that
61097 handled them.
61098 </para>
61099 </section>
61100 </chapter>
61101
61102 <chapter id="CHAPcomconreq">
61103 <title>Some common configuration settings</title>
61104 <para>
61105 This chapter discusses some configuration settings that seem to be fairly
61106 common. More examples and discussion can be found in the Exim book.
61107 </para>
61108 <section id="SECID240">
61109 <title>Sending mail to a smart host</title>
61110 <para>
61111 <indexterm role="concept">
61112 <primary>smart host</primary>
61113 <secondary>example router</secondary>
61114 </indexterm>
61115 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
61116 should replace the default <command>dnslookup</command> router with a router which does the
61117 routing explicitly:
61118 </para>
61119 <literallayout class="monospaced">
61120 send_to_smart_host:
61121   driver = manualroute
61122   route_list = !+local_domains smart.host.name
61123   transport = remote_smtp
61124 </literallayout>
61125 <para>
61126 You can use the smart host&#x2019;s IP address instead of the name if you wish.
61127 If you are using Exim only to submit messages to a smart host, and not for
61128 receiving incoming messages, you can arrange for it to do the submission
61129 synchronously by setting the <option>mua_wrapper</option> option (see chapter
61130 <xref linkend="CHAPnonqueueing"/>).
61131 </para>
61132 </section>
61133 <section id="SECTmailinglists">
61134 <title>Using Exim to handle mailing lists</title>
61135 <para>
61136 <indexterm role="concept">
61137 <primary>mailing lists</primary>
61138 </indexterm>
61139 Exim can be used to run simple mailing lists, but for large and/or complicated
61140 requirements, the use of additional specialized mailing list software such as
61141 Majordomo or Mailman is recommended.
61142 </para>
61143 <para>
61144 The <command>redirect</command> router can be used to handle mailing lists where each list
61145 is maintained in a separate file, which can therefore be managed by an
61146 independent manager. The <option>domains</option> router option can be used to run these
61147 lists in a separate domain from normal mail. For example:
61148 </para>
61149 <literallayout class="monospaced">
61150 lists:
61151   driver = redirect
61152   domains = lists.example
61153   file = /usr/lists/$local_part
61154   forbid_pipe
61155   forbid_file
61156   errors_to = $local_part-request@lists.example
61157   no_more
61158 </literallayout>
61159 <para>
61160 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
61161 in that domain, it looks for a file that matches the local part. If there is no
61162 such file, the router declines, but because <option>no_more</option> is set, no subsequent
61163 routers are tried, and so the whole delivery fails.
61164 </para>
61165 <para>
61166 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
61167 expanded into a file name or a pipe delivery, which is usually inappropriate in
61168 a mailing list.
61169 </para>
61170 <para>
61171 <indexterm role="option">
61172 <primary><option>errors_to</option></primary>
61173 </indexterm>
61174 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
61175 taken from a mailing list are to be sent to the given address rather than the
61176 original sender of the message. However, before acting on this, Exim verifies
61177 the error address, and ignores it if verification fails.
61178 </para>
61179 <para>
61180 For example, using the configuration above, mail sent to
61181 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
61182 <filename>/usr/lists/dicts</filename>, with error reports directed to
61183 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
61184 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
61185 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
61186 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
61187 or <option>local_part_suffix</option> options) to handle addresses of the form
61188 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
61189 </para>
61190 </section>
61191 <section id="SECID241">
61192 <title>Syntax errors in mailing lists</title>
61193 <para>
61194 <indexterm role="concept">
61195 <primary>mailing lists</primary>
61196 <secondary>syntax errors in</secondary>
61197 </indexterm>
61198 If an entry in redirection data contains a syntax error, Exim normally defers
61199 delivery of the original address. That means that a syntax error in a mailing
61200 list holds up all deliveries to the list. This may not be appropriate when a
61201 list is being maintained automatically from data supplied by users, and the
61202 addresses are not rigorously checked.
61203 </para>
61204 <para>
61205 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
61206 entries that fail to parse, noting the incident in the log. If in addition
61207 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
61208 whenever a broken address is skipped. It is usually appropriate to set
61209 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
61210 </para>
61211 </section>
61212 <section id="SECID242">
61213 <title>Re-expansion of mailing lists</title>
61214 <para>
61215 <indexterm role="concept">
61216 <primary>mailing lists</primary>
61217 <secondary>re-expansion of</secondary>
61218 </indexterm>
61219 Exim remembers every individual address to which a message has been delivered,
61220 in order to avoid duplication, but it normally stores only the original
61221 recipient addresses with a message. If all the deliveries to a mailing list
61222 cannot be done at the first attempt, the mailing list is re-expanded when the
61223 delivery is next tried. This means that alterations to the list are taken into
61224 account at each delivery attempt, so addresses that have been added to
61225 the list since the message arrived will therefore receive a copy of the
61226 message, even though it pre-dates their subscription.
61227 </para>
61228 <para>
61229 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
61230 on the <command>redirect</command> router. If this is done, any addresses generated by the
61231 router that fail to deliver at the first attempt are added to the message as
61232 <quote>top level</quote> addresses, and the parent address that generated them is marked
61233 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
61234 subsequent delivery attempts. The disadvantage of this is that if any of the
61235 failing addresses are incorrect, correcting them in the file has no effect on
61236 pre-existing messages.
61237 </para>
61238 <para>
61239 The original top-level address is remembered with each of the generated
61240 addresses, and is output in any log messages. However, any intermediate parent
61241 addresses are not recorded. This makes a difference to the log only if the
61242 <option>all_parents</option> selector is set, but for mailing lists there is normally only
61243 one level of expansion anyway.
61244 </para>
61245 </section>
61246 <section id="SECID243">
61247 <title>Closed mailing lists</title>
61248 <para>
61249 <indexterm role="concept">
61250 <primary>mailing lists</primary>
61251 <secondary>closed</secondary>
61252 </indexterm>
61253 The examples so far have assumed open mailing lists, to which anybody may
61254 send mail. It is also possible to set up closed lists, where mail is accepted
61255 from specified senders only. This is done by making use of the generic
61256 <option>senders</option> option to restrict the router that handles the list.
61257 </para>
61258 <para>
61259 The following example uses the same file as a list of recipients and as a list
61260 of permitted senders. It requires three routers:
61261 </para>
61262 <literallayout class="monospaced">
61263 lists_request:
61264   driver = redirect
61265   domains = lists.example
61266   local_part_suffix = -request
61267   file = /usr/lists/$local_part$local_part_suffix
61268   no_more
61269
61270 lists_post:
61271   driver = redirect
61272   domains = lists.example
61273   senders = ${if exists {/usr/lists/$local_part}\
61274              {lsearch;/usr/lists/$local_part}{*}}
61275   file = /usr/lists/$local_part
61276   forbid_pipe
61277   forbid_file
61278   errors_to = $local_part-request@lists.example
61279   no_more
61280
61281 lists_closed:
61282   driver = redirect
61283   domains = lists.example
61284   allow_fail
61285   data = :fail: $local_part@lists.example is a closed mailing list
61286 </literallayout>
61287 <para>
61288 All three routers have the same <option>domains</option> setting, so for any other domains,
61289 they are all skipped. The first router runs only if the local part ends in
61290 <option>-request</option>. It handles messages to the list manager(s) by means of an open
61291 mailing list.
61292 </para>
61293 <para>
61294 The second router runs only if the <option>senders</option> precondition is satisfied. It
61295 checks for the existence of a list that corresponds to the local part, and then
61296 checks that the sender is on the list by means of a linear search. It is
61297 necessary to check for the existence of the file before trying to search it,
61298 because otherwise Exim thinks there is a configuration error. If the file does
61299 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
61300 means that the router runs, but because there is no list, declines, and
61301 <option>no_more</option> ensures that no further routers are run. The address fails with an
61302 <quote>unrouteable address</quote> error.
61303 </para>
61304 <para>
61305 The third router runs only if the second router is skipped, which happens when
61306 a mailing list exists, but the sender is not on it. This router forcibly fails
61307 the address, giving a suitable error message.
61308 </para>
61309 </section>
61310 <section id="SECTverp">
61311 <title>Variable Envelope Return Paths (VERP)</title>
61312 <para>
61313 <indexterm role="concept">
61314 <primary>VERP</primary>
61315 </indexterm>
61316 <indexterm role="concept">
61317 <primary>Variable Envelope Return Paths</primary>
61318 </indexterm>
61319 <indexterm role="concept">
61320 <primary>envelope sender</primary>
61321 </indexterm>
61322 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;
61323 are a way of helping mailing list administrators discover which subscription
61324 address is the cause of a particular delivery failure. The idea is to encode
61325 the original recipient address in the outgoing envelope sender address, so that
61326 if the message is forwarded by another host and then subsequently bounces, the
61327 original recipient can be extracted from the recipient address of the bounce.
61328 </para>
61329 <para>
61330 <indexterm role="option">
61331 <primary><option>errors_to</option></primary>
61332 </indexterm>
61333 <indexterm role="option">
61334 <primary><option>return_path</option></primary>
61335 </indexterm>
61336 Envelope sender addresses can be modified by Exim using two different
61337 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
61338 list examples), or the <option>return_path</option> option on a transport. The second of
61339 these is effective only if the message is successfully delivered to another
61340 host; it is not used for errors detected on the local host (see the description
61341 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
61342 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
61343 </para>
61344 <literallayout class="monospaced">
61345 verp_smtp:
61346   driver = smtp
61347   max_rcpt = 1
61348   return_path = \
61349     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61350       {$1-request+$local_part=$domain@your.dom.example}fail}
61351 </literallayout>
61352 <para>
61353 This has the effect of rewriting the return path (envelope sender) on outgoing
61354 SMTP messages, if the local part of the original return path ends in
61355 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
61356 local part and domain of the recipient into the return path. Suppose, for
61357 example, that a message whose return path has been set to
61358 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
61359 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
61360 rewritten as
61361 </para>
61362 <literallayout class="monospaced">
61363 somelist-request+subscriber=other.dom.example@your.dom.example
61364 </literallayout>
61365 <para>
61366 <indexterm role="variable">
61367 <primary><varname>$local_part</varname></primary>
61368 </indexterm>
61369 For this to work, you must tell Exim to send multiple copies of messages that
61370 have more than one recipient, so that each copy has just one recipient. This is
61371 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
61372 might be sent to several different recipients in the same domain, in which case
61373 <varname>$local_part</varname> is not available in the transport, because it is not unique.
61374 </para>
61375 <para>
61376 Unless your host is doing nothing but mailing list deliveries, you should
61377 probably use a separate transport for the VERP deliveries, so as not to use
61378 extra resources in making one-per-recipient copies for other deliveries. This
61379 can easily be done by expanding the <option>transport</option> option in the router:
61380 </para>
61381 <literallayout class="monospaced">
61382 dnslookup:
61383   driver = dnslookup
61384   domains = ! +local_domains
61385   transport = \
61386     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61387       {verp_smtp}{remote_smtp}}
61388   no_more
61389 </literallayout>
61390 <para>
61391 If you want to change the return path using <option>errors_to</option> in a router instead
61392 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
61393 routers that handle mailing list addresses. This will ensure that all delivery
61394 errors, including those detected on the local host, are sent to the VERP
61395 address.
61396 </para>
61397 <para>
61398 On a host that does no local deliveries and has no manual routing, only the
61399 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
61400 SMTP deliveries. Every mailing list recipient has its own return path value,
61401 and so Exim must hand them to the transport one at a time. Here is an example
61402 of a <command>dnslookup</command> router that implements VERP:
61403 </para>
61404 <literallayout class="monospaced">
61405 verp_dnslookup:
61406   driver = dnslookup
61407   domains = ! +local_domains
61408   transport = remote_smtp
61409   errors_to = \
61410     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
61411      {$1-request+$local_part=$domain@your.dom.example}fail}
61412   no_more
61413 </literallayout>
61414 <para>
61415 Before you start sending out messages with VERPed return paths, you must also
61416 configure Exim to accept the bounce messages that come back to those paths.
61417 Typically this is done by setting a <option>local_part_suffix</option> option for a
61418 router, and using this to route the messages to wherever you want to handle
61419 them.
61420 </para>
61421 <para>
61422 The overhead incurred in using VERP depends very much on the size of the
61423 message, the number of recipient addresses that resolve to the same remote
61424 host, and the speed of the connection over which the message is being sent. If
61425 a lot of addresses resolve to the same host and the connection is slow, sending
61426 a separate copy of the message for each address may take substantially longer
61427 than sending a single copy with many recipients (for which VERP cannot be
61428 used).
61429 </para>
61430 </section>
61431 <section id="SECTvirtualdomains">
61432 <title>Virtual domains</title>
61433 <para>
61434 <indexterm role="concept">
61435 <primary>virtual domains</primary>
61436 </indexterm>
61437 <indexterm role="concept">
61438 <primary>domain</primary>
61439 <secondary>virtual</secondary>
61440 </indexterm>
61441 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
61442 meanings:
61443 </para>
61444 <itemizedlist>
61445 <listitem>
61446 <para>
61447 A domain for which there are no real mailboxes; all valid local parts are
61448 aliases for other email addresses. Common examples are organizational
61449 top-level domains and <quote>vanity</quote> domains.
61450 </para>
61451 </listitem>
61452 <listitem>
61453 <para>
61454 One of a number of independent domains that are all handled by the same host,
61455 with mailboxes on that host, but where the mailbox owners do not necessarily
61456 have login accounts on that host.
61457 </para>
61458 </listitem>
61459 </itemizedlist>
61460 <para>
61461 The first usage is probably more common, and does seem more <quote>virtual</quote> than
61462 the second. This kind of domain can be handled in Exim with a straightforward
61463 aliasing router. One approach is to create a separate alias file for each
61464 virtual domain. Exim can test for the existence of the alias file to determine
61465 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
61466 to a router of this form:
61467 </para>
61468 <literallayout class="monospaced">
61469 virtual:
61470   driver = redirect
61471   domains = dsearch;/etc/mail/virtual
61472   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
61473   no_more
61474 </literallayout>
61475 <para>
61476 The <option>domains</option> option specifies that the router is to be skipped, unless there
61477 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
61478 domain that is being processed. When the router runs, it looks up the local
61479 part in the file to find a new address (or list of addresses). The <option>no_more</option>
61480 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
61481 string), Exim gives up on the address without trying any subsequent routers.
61482 </para>
61483 <para>
61484 This one router can handle all the virtual domains because the alias file names
61485 follow a fixed pattern. Permissions can be arranged so that appropriate people
61486 can edit the different alias files. A successful aliasing operation results in
61487 a new envelope recipient address, which is then routed from scratch.
61488 </para>
61489 <para>
61490 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
61491 way. One approach is to create a file for each domain containing a list of
61492 valid local parts, and use it in a router like this:
61493 </para>
61494 <literallayout class="monospaced">
61495 my_domains:
61496   driver = accept
61497   domains = dsearch;/etc/mail/domains
61498   local_parts = lsearch;/etc/mail/domains/$domain
61499   transport = my_mailboxes
61500 </literallayout>
61501 <para>
61502 The address is accepted if there is a file for the domain, and the local part
61503 can be found in the file. The <option>domains</option> option is used to check for the
61504 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
61505 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
61506 because that option is tested after <option>local_parts</option>. The transport is as
61507 follows:
61508 </para>
61509 <literallayout class="monospaced">
61510 my_mailboxes:
61511   driver = appendfile
61512   file = /var/mail/$domain/$local_part
61513   user = mail
61514 </literallayout>
61515 <para>
61516 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
61517 required, to specify which uid is to be used for writing to the mailboxes.
61518 </para>
61519 <para>
61520 The configuration shown here is just one example of how you might support this
61521 requirement. There are many other ways this kind of configuration can be set
61522 up, for example, by using a database instead of separate files to hold all the
61523 information about the domains.
61524 </para>
61525 </section>
61526 <section id="SECTmulbox">
61527 <title>Multiple user mailboxes</title>
61528 <para>
61529 <indexterm role="concept">
61530 <primary>multiple mailboxes</primary>
61531 </indexterm>
61532 <indexterm role="concept">
61533 <primary>mailbox</primary>
61534 <secondary>multiple</secondary>
61535 </indexterm>
61536 <indexterm role="concept">
61537 <primary>local part</primary>
61538 <secondary>prefix</secondary>
61539 </indexterm>
61540 <indexterm role="concept">
61541 <primary>local part</primary>
61542 <secondary>suffix</secondary>
61543 </indexterm>
61544 Heavy email users often want to operate with multiple mailboxes, into which
61545 incoming mail is automatically sorted. A popular way of handling this is to
61546 allow users to use multiple sender addresses, so that replies can easily be
61547 identified. Users are permitted to add prefixes or suffixes to their local
61548 parts for this purpose. The wildcard facility of the generic router options
61549 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
61550 example, consider this router:
61551 </para>
61552 <literallayout class="monospaced">
61553 userforward:
61554   driver = redirect
61555   check_local_user
61556   file = $home/.forward
61557   local_part_suffix = -*
61558   local_part_suffix_optional
61559   allow_filter
61560 </literallayout>
61561 <para>
61562 <indexterm role="variable">
61563 <primary><varname>$local_part_suffix</varname></primary>
61564 </indexterm>
61565 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
61566 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
61567 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
61568 </para>
61569 <literallayout class="monospaced">
61570 if $local_part_suffix contains -special then
61571 save /home/$local_part/Mail/special
61572 endif
61573 </literallayout>
61574 <para>
61575 If the filter file does not exist, or does not deal with such addresses, they
61576 fall through to subsequent routers, and, assuming no subsequent use of the
61577 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
61578 control over which suffixes are valid.
61579 </para>
61580 <para>
61581 Alternatively, a suffix can be used to trigger the use of a different
61582 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
61583 another MTA:
61584 </para>
61585 <literallayout class="monospaced">
61586 userforward:
61587   driver = redirect
61588   check_local_user
61589   file = $home/.forward$local_part_suffix
61590   local_part_suffix = -*
61591   local_part_suffix_optional
61592   allow_filter
61593 </literallayout>
61594 <para>
61595 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
61596 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
61597 does not exist, or does not deal with the address, it is passed on to
61598 subsequent routers, which could, if required, look for an unqualified
61599 <filename>.forward</filename> file to use as a default.
61600 </para>
61601 </section>
61602 <section id="SECID244">
61603 <title>Simplified vacation processing</title>
61604 <para>
61605 <indexterm role="concept">
61606 <primary>vacation processing</primary>
61607 </indexterm>
61608 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
61609 a pipe command in a <filename>.forward</filename> file
61610 (see section <xref linkend="SECTspecitredli"/> for syntax details).
61611 This is prone to error by inexperienced users. There are two features of Exim
61612 that can be used to make this process simpler for users:
61613 </para>
61614 <itemizedlist>
61615 <listitem>
61616 <para>
61617 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
61618 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
61619 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
61620 <filename>.forward</filename> file are then much simpler. For example:
61621 </para>
61622 <literallayout class="monospaced">
61623 spqr, vacation-spqr
61624 </literallayout>
61625 </listitem>
61626 <listitem>
61627 <para>
61628 The <option>require_files</option> generic router option can be used to trigger a
61629 vacation delivery by checking for the existence of a certain file in the
61630 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
61631 ensure that the original delivery also proceeds. In this case, all the user has
61632 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
61633 message.
61634 </para>
61635 </listitem>
61636 </itemizedlist>
61637 <para>
61638 Another advantage of both these methods is that they both work even when the
61639 use of arbitrary pipes by users is locked out.
61640 </para>
61641 </section>
61642 <section id="SECID245">
61643 <title>Taking copies of mail</title>
61644 <para>
61645 <indexterm role="concept">
61646 <primary>message</primary>
61647 <secondary>copying every</secondary>
61648 </indexterm>
61649 Some installations have policies that require archive copies of all messages to
61650 be made. A single copy of each message can easily be taken by an appropriate
61651 command in a system filter, which could, for example, use a different file for
61652 each day&#x2019;s messages.
61653 </para>
61654 <para>
61655 There is also a shadow transport mechanism that can be used to take copies of
61656 messages that are successfully delivered by local transports, one copy per
61657 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
61658 notification of delivery by sites that insist on doing such things.
61659 </para>
61660 </section>
61661 <section id="SECID246">
61662 <title>Intermittently connected hosts</title>
61663 <para>
61664 <indexterm role="concept">
61665 <primary>intermittently connected hosts</primary>
61666 </indexterm>
61667 It has become quite common (because it is cheaper) for hosts to connect to the
61668 Internet periodically rather than remain connected all the time. The normal
61669 arrangement is that mail for such hosts accumulates on a system that is
61670 permanently connected.
61671 </para>
61672 <para>
61673 Exim was designed for use on permanently connected hosts, and so it is not
61674 particularly well-suited to use in an intermittently connected environment.
61675 Nevertheless there are some features that can be used.
61676 </para>
61677 </section>
61678 <section id="SECID247">
61679 <title>Exim on the upstream server host</title>
61680 <para>
61681 It is tempting to arrange for incoming mail for the intermittently connected
61682 host to remain on Exim&#x2019;s queue until the client connects. However, this
61683 approach does not scale very well. Two different kinds of waiting message are
61684 being mixed up in the same queue &ndash; those that cannot be delivered because of
61685 some temporary problem, and those that are waiting for their destination host
61686 to connect. This makes it hard to manage the queue, as well as wasting
61687 resources, because each queue runner scans the entire queue.
61688 </para>
61689 <para>
61690 A better approach is to separate off those messages that are waiting for an
61691 intermittently connected host. This can be done by delivering these messages
61692 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
61693 format, from where they are transmitted by other software when their
61694 destination connects. This makes it easy to collect all the mail for one host
61695 in a single directory, and to apply local timeout rules on a per-message basis
61696 if required.
61697 </para>
61698 <para>
61699 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
61700 you are doing this, you should configure Exim with a long retry period for the
61701 intermittent host. For example:
61702 </para>
61703 <literallayout class="monospaced">
61704 cheshire.wonderland.fict.example    *   F,5d,24h
61705 </literallayout>
61706 <para>
61707 This stops a lot of failed delivery attempts from occurring, but Exim remembers
61708 which messages it has queued up for that host. Once the intermittent host comes
61709 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
61710 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
61711 causes all the queued up messages to be delivered, often down a single SMTP
61712 connection. While the host remains connected, any new messages get delivered
61713 immediately.
61714 </para>
61715 <para>
61716 If the connecting hosts do not have fixed IP addresses, that is, if a host is
61717 issued with a different IP address each time it connects, Exim&#x2019;s retry
61718 mechanisms on the holding host get confused, because the IP address is normally
61719 used as part of the key string for holding retry information. This can be
61720 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
61721 Since this has disadvantages for permanently connected hosts, it is best to
61722 arrange a separate transport for the intermittently connected ones.
61723 </para>
61724 </section>
61725 <section id="SECID248">
61726 <title>Exim on the intermittently connected client host</title>
61727 <para>
61728 The value of <option>smtp_accept_queue_per_connection</option> should probably be
61729 increased, or even set to zero (that is, disabled) on the intermittently
61730 connected host, so that all incoming messages down a single connection get
61731 delivered immediately.
61732 </para>
61733 <para>
61734 <indexterm role="concept">
61735 <primary>SMTP</primary>
61736 <secondary>passed connection</secondary>
61737 </indexterm>
61738 <indexterm role="concept">
61739 <primary>SMTP</primary>
61740 <secondary>multiple deliveries</secondary>
61741 </indexterm>
61742 <indexterm role="concept">
61743 <primary>multiple SMTP deliveries</primary>
61744 </indexterm>
61745 Mail waiting to be sent from an intermittently connected host will probably
61746 not have been routed, because without a connection DNS lookups are not
61747 possible. This means that if a normal queue run is done at connection time,
61748 each message is likely to be sent in a separate SMTP session. This can be
61749 avoided by starting the queue run with a command line option beginning with
61750 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
61751 first pass, routing is done but no deliveries take place. The second pass is a
61752 normal queue run; since all the messages have been previously routed, those
61753 destined for the same host are likely to get sent as multiple deliveries in a
61754 single SMTP connection.
61755 </para>
61756 </section>
61757 </chapter>
61758
61759 <chapter id="CHAPnonqueueing">
61760 <title>Using Exim as a non-queueing client</title>
61761 <titleabbrev>Exim as a non-queueing client</titleabbrev>
61762 <para>
61763 <indexterm role="concept">
61764 <primary>client, non-queueing</primary>
61765 </indexterm>
61766 <indexterm role="concept">
61767 <primary>smart host</primary>
61768 <secondary>suppressing queueing</secondary>
61769 </indexterm>
61770 On a personal computer, it is a common requirement for all
61771 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
61772 configured to operate that way, for all the popular operating systems.
61773 However, there are some MUAs for Unix-like systems that cannot be so
61774 configured: they submit messages using the command line interface of
61775 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
61776 messages this way.
61777 </para>
61778 <para>
61779 If the personal computer runs continuously, there is no problem, because it can
61780 run a conventional MTA that handles delivery to the smart host, and deal with
61781 any delays via its queueing mechanism. However, if the computer does not run
61782 continuously or runs different operating systems at different times, queueing
61783 email is not desirable.
61784 </para>
61785 <para>
61786 There is therefore a requirement for something that can provide the
61787 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
61788 any queueing or retrying facilities. Furthermore, the delivery to the smart
61789 host should be synchronous, so that if it fails, the sending MUA is immediately
61790 informed. In other words, we want something that extends an MUA that submits
61791 to a local MTA via the command line so that it behaves like one that submits
61792 to a remote smart host using TCP/SMTP.
61793 </para>
61794 <para>
61795 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
61796 that do this job. However, people have found them to be lacking in various
61797 ways. For instance, you might want to allow aliasing and forwarding to be done
61798 before sending a message to the smart host.
61799 </para>
61800 <para>
61801 Exim already had the necessary infrastructure for doing this job. Just a few
61802 tweaks were needed to make it behave as required, though it is somewhat of an
61803 overkill to use a fully-featured MTA for this purpose.
61804 </para>
61805 <para>
61806 <indexterm role="option">
61807 <primary><option>mua_wrapper</option></primary>
61808 </indexterm>
61809 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
61810 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
61811 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
61812 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
61813 compatible router and transport configuration. Typically there will be just one
61814 router and one transport, sending everything to a smart host.
61815 </para>
61816 <para>
61817 When run in MUA wrapping mode, the behaviour of Exim changes in the
61818 following ways:
61819 </para>
61820 <itemizedlist>
61821 <listitem>
61822 <para>
61823 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
61824 In other words, the only way to submit messages is via the command line.
61825 </para>
61826 </listitem>
61827 <listitem>
61828 <para>
61829 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
61830 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
61831 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
61832 does not finish until the delivery attempt is complete. If the delivery is
61833 successful, a zero return code is given.
61834 </para>
61835 </listitem>
61836 <listitem>
61837 <para>
61838 Address redirection is permitted, but the final routing for all addresses must
61839 be to the same remote transport, and to the same list of hosts. Furthermore,
61840 the return address (envelope sender) must be the same for all recipients, as
61841 must any added or deleted header lines. In other words, it must be possible to
61842 deliver the message in a single SMTP transaction, however many recipients there
61843 are.
61844 </para>
61845 </listitem>
61846 <listitem>
61847 <para>
61848 If these conditions are not met, or if routing any address results in a
61849 failure or defer status, or if Exim is unable to deliver all the recipients
61850 successfully to one of the smart hosts, delivery of the entire message fails.
61851 </para>
61852 </listitem>
61853 <listitem>
61854 <para>
61855 Because no queueing is allowed, all failures are treated as permanent; there
61856 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
61857 smart host. Furthermore, because only a single yes/no response can be given to
61858 the caller, it is not possible to deliver to some recipients and not others. If
61859 there is an error (temporary or permanent) for any recipient, all are failed.
61860 </para>
61861 </listitem>
61862 <listitem>
61863 <para>
61864 If more than one smart host is listed, Exim will try another host after a
61865 connection failure or a timeout, in the normal way. However, if this kind of
61866 failure happens for all the hosts, the delivery fails.
61867 </para>
61868 </listitem>
61869 <listitem>
61870 <para>
61871 When delivery fails, an error message is written to the standard error stream
61872 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
61873 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
61874 are ever generated.
61875 </para>
61876 </listitem>
61877 <listitem>
61878 <para>
61879 No retry data is maintained, and any retry rules are ignored.
61880 </para>
61881 </listitem>
61882 <listitem>
61883 <para>
61884 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
61885 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
61886 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
61887 </para>
61888 </listitem>
61889 </itemizedlist>
61890 <para>
61891 The overall effect is that Exim makes a single synchronous attempt to deliver
61892 the message, failing if there is any kind of problem. Because no local
61893 deliveries are done and no daemon can be run, Exim does not need root
61894 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
61895 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
61896 the advantages and disadvantages of running without root privilege.
61897 </para>
61898 </chapter>
61899
61900 <chapter id="CHAPlog">
61901 <title>Log files</title>
61902 <para>
61903 <indexterm role="concept" id="IIDloggen" class="startofrange">
61904 <primary>log</primary>
61905 <secondary>general description</secondary>
61906 </indexterm>
61907 <indexterm role="concept">
61908 <primary>log</primary>
61909 <secondary>types of</secondary>
61910 </indexterm>
61911 Exim writes three different logs, referred to as the main log, the reject log,
61912 and the panic log:
61913 </para>
61914 <itemizedlist>
61915 <listitem>
61916 <para>
61917 <indexterm role="concept">
61918 <primary>main log</primary>
61919 </indexterm>
61920 The main log records the arrival of each message and each delivery in a single
61921 line in each case. The format is as compact as possible, in an attempt to keep
61922 down the size of log files. Two-character flag sequences make it easy to pick
61923 out these lines. A number of other events are recorded in the main log. Some of
61924 them are optional, in which case the <option>log_selector</option> option controls whether
61925 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
61926 analysis of main log files, is provided in the Exim distribution (see section
61927 <xref linkend="SECTmailstat"/>).
61928 </para>
61929 </listitem>
61930 <listitem>
61931 <para>
61932 <indexterm role="concept">
61933 <primary>reject log</primary>
61934 </indexterm>
61935 The reject log records information from messages that are rejected as a result
61936 of a configuration option (that is, for policy reasons).
61937 The first line of each rejection is a copy of the line that is also written to
61938 the main log. Then, if the message&#x2019;s header has been read at the time the log
61939 is written, its contents are written to this log. Only the original header
61940 lines are available; header lines added by ACLs are not logged. You can use the
61941 reject log to check that your policy controls are working correctly; on a busy
61942 host this may be easier than scanning the main log for rejection messages. You
61943 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
61944 false.
61945 </para>
61946 </listitem>
61947 <listitem>
61948 <para>
61949 <indexterm role="concept">
61950 <primary>panic log</primary>
61951 </indexterm>
61952 <indexterm role="concept">
61953 <primary>system log</primary>
61954 </indexterm>
61955 When certain serious errors occur, Exim writes entries to its panic log. If the
61956 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
61957 are usually written to the main log as well, but can get lost amid the mass of
61958 other entries. The panic log should be empty under normal circumstances. It is
61959 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
61960 regularly, in order to become aware of any problems. When Exim cannot open its
61961 panic log, it tries as a last resort to write to the system log (syslog). This
61962 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
61963 message itself is written at priority LOG_CRIT.
61964 </para>
61965 </listitem>
61966 </itemizedlist>
61967 <para>
61968 Every log line starts with a timestamp, in the format shown in the following
61969 example. Note that many of the examples shown in this chapter are line-wrapped.
61970 In the log file, this would be all on one line:
61971 </para>
61972 <literallayout class="monospaced">
61973 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
61974   by QUIT
61975 </literallayout>
61976 <para>
61977 By default, the timestamps are in the local timezone. There are two
61978 ways of changing this:
61979 </para>
61980 <itemizedlist>
61981 <listitem>
61982 <para>
61983 You can set the <option>timezone</option> option to a different time zone; in particular, if
61984 you set
61985 </para>
61986 <literallayout class="monospaced">
61987 timezone = UTC
61988 </literallayout>
61989 <para>
61990 the timestamps will be in UTC (aka GMT).
61991 </para>
61992 </listitem>
61993 <listitem>
61994 <para>
61995 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
61996 example:
61997 </para>
61998 <literallayout class="monospaced">
61999 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
62000 </literallayout>
62001 </listitem>
62002 </itemizedlist>
62003 <para>
62004 <indexterm role="concept">
62005 <primary>log</primary>
62006 <secondary>process ids in</secondary>
62007 </indexterm>
62008 <indexterm role="concept">
62009 <primary>pid (process id)</primary>
62010 <secondary>in log lines</secondary>
62011 </indexterm>
62012 Exim does not include its process id in log lines by default, but you can
62013 request that it does so by specifying the <literal>pid</literal> log selector (see section
62014 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
62015 brackets, immediately after the time and date.
62016 </para>
62017 <section id="SECTwhelogwri">
62018 <title>Where the logs are written</title>
62019 <para>
62020 <indexterm role="concept">
62021 <primary>log</primary>
62022 <secondary>destination</secondary>
62023 </indexterm>
62024 <indexterm role="concept">
62025 <primary>log</primary>
62026 <secondary>to file</secondary>
62027 </indexterm>
62028 <indexterm role="concept">
62029 <primary>log</primary>
62030 <secondary>to syslog</secondary>
62031 </indexterm>
62032 <indexterm role="concept">
62033 <primary>syslog</primary>
62034 </indexterm>
62035 The logs may be written to local files, or to syslog, or both. However, it
62036 should be noted that many syslog implementations use UDP as a transport, and
62037 are therefore unreliable in the sense that messages are not guaranteed to
62038 arrive at the loghost, nor is the ordering of messages necessarily maintained.
62039 It has also been reported that on large log files (tens of megabytes) you may
62040 need to tweak syslog to prevent it syncing the file with each write &ndash; on
62041 Linux this has been seen to make syslog take 90% plus of CPU time.
62042 </para>
62043 <para>
62044 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
62045 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
62046 configuration. This latter string is expanded, so it can contain, for example,
62047 references to the host name:
62048 </para>
62049 <literallayout class="monospaced">
62050 log_file_path = /var/log/$primary_hostname/exim_%slog
62051 </literallayout>
62052 <para>
62053 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
62054 rather than at run time, because then the setting is available right from the
62055 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
62056 before it has read the configuration file (for example, an error in the
62057 configuration file) it will not use the path you want, and may not be able to
62058 log at all.
62059 </para>
62060 <para>
62061 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
62062 list, currently limited to at most two items. This is one option where the
62063 facility for changing a list separator may not be used. The list must always be
62064 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
62065 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
62066 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
62067 implying the use of a default path.
62068 </para>
62069 <para>
62070 When Exim encounters an empty item in the list, it searches the list defined by
62071 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
62072 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
62073 mean <quote>use the path specified at build time</quote>. It no such item exists, log
62074 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
62075 equivalent to the setting:
62076 </para>
62077 <literallayout class="monospaced">
62078 log_file_path = $spool_directory/log/%slog
62079 </literallayout>
62080 <para>
62081 If you do not specify anything at build time or run time, that is where the
62082 logs are written.
62083 </para>
62084 <para>
62085 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
62086 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
62087 </para>
62088 <para>
62089 Here are some examples of possible settings:
62090 </para>
62091 <literallayout>
62092 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
62093 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
62094 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
62095 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
62096 </literallayout>
62097 <para>
62098 If there are more than two paths in the list, the first is used and a panic
62099 error is logged.
62100 </para>
62101 </section>
62102 <section id="SECID285">
62103 <title>Logging to local files that are periodically <quote>cycled</quote></title>
62104 <para>
62105 <indexterm role="concept">
62106 <primary>log</primary>
62107 <secondary>cycling local files</secondary>
62108 </indexterm>
62109 <indexterm role="concept">
62110 <primary>cycling logs</primary>
62111 </indexterm>
62112 <indexterm role="concept">
62113 <primary><emphasis>exicyclog</emphasis></primary>
62114 </indexterm>
62115 <indexterm role="concept">
62116 <primary>log</primary>
62117 <secondary>local files; writing to</secondary>
62118 </indexterm>
62119 Some operating systems provide centralized and standardized methods for cycling
62120 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
62121 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
62122 main and reject logs each time it is called. The maximum number of old logs to
62123 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
62124 </para>
62125 <para>
62126 An Exim delivery process opens the main log when it first needs to write to it,
62127 and it keeps the file open in case subsequent entries are required &ndash; for
62128 example, if a number of different deliveries are being done for the same
62129 message. However, remote SMTP deliveries can take a long time, and this means
62130 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
62131 something similar is being used to rename log files on a regular basis. To
62132 ensure that a switch of log files is noticed as soon as possible, Exim calls
62133 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
62134 does not exist, or its inode has changed, the old file is closed and Exim
62135 tries to open the main log from scratch. Thus, an old log file may remain open
62136 for quite some time, but no Exim processes should write to it once it has been
62137 renamed.
62138 </para>
62139 </section>
62140 <section id="SECTdatlogfil">
62141 <title>Datestamped log files</title>
62142 <para>
62143 <indexterm role="concept">
62144 <primary>log</primary>
62145 <secondary>datestamped files</secondary>
62146 </indexterm>
62147 Instead of cycling the main and reject log files by renaming them
62148 periodically, some sites like to use files whose names contain a datestamp,
62149 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
62150 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
62151 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
62152 point where the datestamp is required. For example:
62153 </para>
62154 <literallayout class="monospaced">
62155 log_file_path = /var/spool/exim/log/%slog-%D
62156 log_file_path = /var/log/exim-%s-%D.log
62157 log_file_path = /var/spool/exim/log/%D-%slog
62158 log_file_path = /var/log/exim/%s.%M
62159 </literallayout>
62160 <para>
62161 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
62162 examples of names generated by the above examples:
62163 </para>
62164 <literallayout class="monospaced">
62165 /var/spool/exim/log/mainlog-20021225
62166 /var/log/exim-reject-20021225.log
62167 /var/spool/exim/log/20021225-mainlog
62168 /var/log/exim/main.200212
62169 </literallayout>
62170 <para>
62171 When this form of log file is specified, Exim automatically switches to new
62172 files at midnight. It does not make any attempt to compress old logs; you
62173 will need to write your own script if you require this. You should not
62174 run <emphasis>exicyclog</emphasis> with this form of logging.
62175 </para>
62176 <para>
62177 The location of the panic log is also determined by <option>log_file_path</option>, but it
62178 is not datestamped, because rotation of the panic log does not make sense.
62179 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
62180 the string. In addition, if it immediately follows a slash, a following
62181 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
62182 character is removed. Thus, the four examples above would give these panic
62183 log names:
62184 </para>
62185 <literallayout class="monospaced">
62186 /var/spool/exim/log/paniclog
62187 /var/log/exim-panic.log
62188 /var/spool/exim/log/paniclog
62189 /var/log/exim/panic
62190 </literallayout>
62191 </section>
62192 <section id="SECID249">
62193 <title>Logging to syslog</title>
62194 <para>
62195 <indexterm role="concept">
62196 <primary>log</primary>
62197 <secondary>syslog; writing to</secondary>
62198 </indexterm>
62199 The use of syslog does not change what Exim logs or the format of its messages,
62200 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
62201 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
62202 that, the same strings are written to syslog as to log files. The syslog
62203 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
62204 by default, but you can change these by setting the <option>syslog_facility</option> and
62205 <option>syslog_processname</option> options, respectively. If Exim was compiled with
62206 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
62207 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
62208 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
62209 the time and host name to each line.
62210 The three log streams are mapped onto syslog priorities as follows:
62211 </para>
62212 <itemizedlist>
62213 <listitem>
62214 <para>
62215 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
62216 </para>
62217 </listitem>
62218 <listitem>
62219 <para>
62220 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
62221 </para>
62222 </listitem>
62223 <listitem>
62224 <para>
62225 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
62226 </para>
62227 </listitem>
62228 </itemizedlist>
62229 <para>
62230 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
62231 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
62232 these are routed by syslog to the same place. You can suppress this duplication
62233 by setting <option>syslog_duplication</option> false.
62234 </para>
62235 <para>
62236 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
62237 entries contain multiple lines when headers are included. To cope with both
62238 these cases, entries written to syslog are split into separate <function>syslog()</function>
62239 calls at each internal newline, and also after a maximum of
62240 870 data characters. (This allows for a total syslog line length of 1024, when
62241 additions such as timestamps are added.) If you are running a syslog
62242 replacement that can handle lines longer than the 1024 characters allowed by
62243 RFC 3164, you should set
62244 </para>
62245 <literallayout class="monospaced">
62246 SYSLOG_LONG_LINES=yes
62247 </literallayout>
62248 <para>
62249 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
62250 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
62251 </para>
62252 <para>
62253 To make it easy to re-assemble split lines later, each component of a split
62254 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;]
62255 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
62256 components in the entry. The / delimiter is used when the line was split
62257 because it was too long; if it was split because of an internal newline, the \
62258 delimiter is used. For example, supposing the length limit to be 50 instead of
62259 870, the following would be the result of a typical rejection message to
62260 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
62261 name, and pid as added by syslog:
62262 </para>
62263 <literallayout class="monospaced">
62264 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
62265 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
62266 [3/5]  when scanning for sender: missing or malformed lo
62267 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
62268 [5/5] mple&gt;)
62269 </literallayout>
62270 <para>
62271 The same error might cause the following lines to be written to <quote>rejectlog</quote>
62272 (LOG_NOTICE):
62273 </para>
62274 <literallayout class="monospaced">
62275 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
62276 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
62277 [3/18] er when scanning for sender: missing or malformed
62278 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
62279 [5\18] .example&gt;)
62280 [6\18] Recipients: ph10@some.domain.cam.example
62281 [7\18] P Received: from [127.0.0.1] (ident=ph10)
62282 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
62283 [9\18]        id 16RdAL-0006pc-00
62284 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
62285 [11\18] 09:43 +0100
62286 [12\18] F From: &lt;&gt;
62287 [13\18]   Subject: this is a test header
62288 [18\18]   X-something: this is another header
62289 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
62290 [16\18] le&gt;
62291 [17\18] B Bcc:
62292 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
62293 </literallayout>
62294 <para>
62295 Log lines that are neither too long nor contain newlines are written to syslog
62296 without modification.
62297 </para>
62298 <para>
62299 If only syslog is being used, the Exim monitor is unable to provide a log tail
62300 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
62301 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
62302 where it is.
62303 </para>
62304 </section>
62305 <section id="SECID250">
62306 <title>Log line flags</title>
62307 <para>
62308 One line is written to the main log for each message received, and for each
62309 successful, unsuccessful, and delayed delivery. These lines can readily be
62310 picked out by the distinctive two-character flags that immediately follow the
62311 timestamp. The flags are:
62312 </para>
62313 <literallayout>
62314 <literal>&lt;=</literal>     message arrival
62315 <literal>=&gt;</literal>     normal message delivery
62316 <literal>-&gt;</literal>     additional address in same delivery
62317 <literal>&gt;&gt;</literal>     cutthrough message delivery
62318 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
62319 <literal>**</literal>     delivery failed; address bounced
62320 <literal>==</literal>     delivery deferred; temporary problem
62321 </literallayout>
62322 </section>
62323 <section id="SECID251">
62324 <title>Logging message reception</title>
62325 <para>
62326 <indexterm role="concept">
62327 <primary>log</primary>
62328 <secondary>reception line</secondary>
62329 </indexterm>
62330 The format of the single-line entry in the main log that is written for every
62331 message received is shown in the basic example below, which is split over
62332 several lines in order to fit it on the page:
62333 </para>
62334 <literallayout class="monospaced">
62335 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
62336   H=mailer.fict.example [192.168.123.123] U=exim
62337   P=smtp S=5678 id=&lt;incoming message id&gt;
62338 </literallayout>
62339 <para>
62340 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
62341 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
62342 generated, this is followed by an item of the form
62343 </para>
62344 <literallayout class="monospaced">
62345 R=&lt;message id&gt;
62346 </literallayout>
62347 <para>
62348 which is a reference to the message that caused the bounce to be sent.
62349 </para>
62350 <para>
62351 <indexterm role="concept">
62352 <primary>HELO</primary>
62353 </indexterm>
62354 <indexterm role="concept">
62355 <primary>EHLO</primary>
62356 </indexterm>
62357 For messages from other hosts, the H and U fields identify the remote host and
62358 record the RFC 1413 identity of the user that sent the message, if one was
62359 received. The number given in square brackets is the IP address of the sending
62360 host. If there is a single, unparenthesized  host name in the H field, as
62361 above, it has been verified to correspond to the IP address (see the
62362 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
62363 by the remote host in the SMTP HELO or EHLO command, and has not been
62364 verified. If verification yields a different name to that given for HELO or
62365 EHLO, the verified name appears first, followed by the HELO or EHLO
62366 name in parentheses.
62367 </para>
62368 <para>
62369 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
62370 without brackets, in the HELO or EHLO command, leading to entries in
62371 the log containing text like these examples:
62372 </para>
62373 <literallayout class="monospaced">
62374 H=(10.21.32.43) [192.168.8.34]
62375 H=([10.21.32.43]) [192.168.8.34]
62376 </literallayout>
62377 <para>
62378 This can be confusing. Only the final address in square brackets can be relied
62379 on.
62380 </para>
62381 <para>
62382 For locally generated messages (that is, messages not received over TCP/IP),
62383 the H field is omitted, and the U field contains the login name of the caller
62384 of Exim.
62385 </para>
62386 <para>
62387 <indexterm role="concept">
62388 <primary>authentication</primary>
62389 <secondary>logging</secondary>
62390 </indexterm>
62391 <indexterm role="concept">
62392 <primary>AUTH</primary>
62393 <secondary>logging</secondary>
62394 </indexterm>
62395 For all messages, the P field specifies the protocol used to receive the
62396 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
62397 of incoming SMTP messages, the value indicates whether or not any SMTP
62398 extensions (ESMTP), encryption, or authentication were used. If the SMTP
62399 session was encrypted, there is an additional X field that records the cipher
62400 suite that was used.
62401 </para>
62402 <para>
62403 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
62404 hosts that have authenticated themselves using the SMTP AUTH command. The first
62405 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
62406 there is an additional item A= followed by the name of the authenticator that
62407 was used. If an authenticated identification was set up by the authenticator&#x2019;s
62408 <option>server_set_id</option> option, this is logged too, separated by a colon from the
62409 authenticator name.
62410 </para>
62411 <para>
62412 <indexterm role="concept">
62413 <primary>size</primary>
62414 <secondary>of message</secondary>
62415 </indexterm>
62416 The id field records the existing message id, if present. The size of the
62417 received message is given by the S field. When the message is delivered,
62418 headers may be removed or added, so that the size of delivered copies of the
62419 message may not correspond with this value (and indeed may be different to each
62420 other).
62421 </para>
62422 <para>
62423 The <option>log_selector</option> option can be used to request the logging of additional
62424 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
62425 </para>
62426 </section>
62427 <section id="SECID252">
62428 <title>Logging deliveries</title>
62429 <para>
62430 <indexterm role="concept">
62431 <primary>log</primary>
62432 <secondary>delivery line</secondary>
62433 </indexterm>
62434 The format of the single-line entry in the main log that is written for every
62435 delivery is shown in one of the examples below, for local and remote
62436 deliveries, respectively. Each example has been split into two lines in order
62437 to fit it on the page:
62438 </para>
62439 <literallayout class="monospaced">
62440 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
62441   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
62442 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
62443   monk@holistic.fict.example R=dnslookup T=remote_smtp
62444   H=holistic.fict.example [192.168.234.234]
62445 </literallayout>
62446 <para>
62447 For ordinary local deliveries, the original address is given in angle brackets
62448 after the final delivery address, which might be a pipe or a file. If
62449 intermediate address(es) exist between the original and the final address, the
62450 last of these is given in parentheses after the final address. The R and T
62451 fields record the router and transport that were used to process the address.
62452 </para>
62453 <para>
62454 If SMTP AUTH was used for the delivery there is an additional item A=
62455 followed by the name of the authenticator that was used.
62456 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
62457 option, this is logged too, separated by a colon from the authenticator name.
62458 </para>
62459 <para>
62460 If a shadow transport was run after a successful local delivery, the log line
62461 for the successful delivery has an item added on the end, of the form
62462 </para>
62463 <literallayout>
62464 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
62465 </literallayout>
62466 <para>
62467 If the shadow transport did not succeed, the error message is put in
62468 parentheses afterwards.
62469 </para>
62470 <para>
62471 <indexterm role="concept">
62472 <primary>asterisk</primary>
62473 <secondary>after IP address</secondary>
62474 </indexterm>
62475 When more than one address is included in a single delivery (for example, two
62476 SMTP RCPT commands in one transaction) the second and subsequent addresses are
62477 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
62478 down a single SMTP connection, an asterisk follows the IP address in the log
62479 lines for the second and subsequent messages.
62480 </para>
62481 <para>
62482 <indexterm role="concept">
62483 <primary>delivery</primary>
62484 <secondary>cutthrough; logging</secondary>
62485 </indexterm>
62486 <indexterm role="concept">
62487 <primary>cutthrough</primary>
62488 <secondary>logging</secondary>
62489 </indexterm>
62490 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
62491 line precedes the reception line, since cutthrough waits for a possible
62492 rejection from the destination in case it can reject the sourced item.
62493 </para>
62494 <para>
62495 The generation of a reply message by a filter file gets logged as a
62496 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
62497 </para>
62498 <para>
62499 The <option>log_selector</option> option can be used to request the logging of additional
62500 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
62501 </para>
62502 </section>
62503 <section id="SECID253">
62504 <title>Discarded deliveries</title>
62505 <para>
62506 <indexterm role="concept">
62507 <primary>discarded messages</primary>
62508 </indexterm>
62509 <indexterm role="concept">
62510 <primary>message</primary>
62511 <secondary>discarded</secondary>
62512 </indexterm>
62513 <indexterm role="concept">
62514 <primary>delivery</primary>
62515 <secondary>discarded; logging</secondary>
62516 </indexterm>
62517 When a message is discarded as a result of the command <quote>seen finish</quote> being
62518 obeyed in a filter file which generates no deliveries, a log entry of the form
62519 </para>
62520 <literallayout class="monospaced">
62521 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
62522   &lt;low.club@bridge.example&gt; R=userforward
62523 </literallayout>
62524 <para>
62525 is written, to record why no deliveries are logged. When a message is discarded
62526 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
62527 </para>
62528 <literallayout class="monospaced">
62529 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
62530   &lt;hole@nowhere.example&gt; R=blackhole_router
62531 </literallayout>
62532 </section>
62533 <section id="SECID254">
62534 <title>Deferred deliveries</title>
62535 <para>
62536 When a delivery is deferred, a line of the following form is logged:
62537 </para>
62538 <literallayout class="monospaced">
62539 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
62540   R=dnslookup T=smtp defer (146): Connection refused
62541 </literallayout>
62542 <para>
62543 In the case of remote deliveries, the error is the one that was given for the
62544 last IP address that was tried. Details of individual SMTP failures are also
62545 written to the log, so the above line would be preceded by something like
62546 </para>
62547 <literallayout class="monospaced">
62548 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
62549   mail1.endrest.example [192.168.239.239]: Connection refused
62550 </literallayout>
62551 <para>
62552 When a deferred address is skipped because its retry time has not been reached,
62553 a message is written to the log, but this can be suppressed by setting an
62554 appropriate value in <option>log_selector</option>.
62555 </para>
62556 </section>
62557 <section id="SECID255">
62558 <title>Delivery failures</title>
62559 <para>
62560 <indexterm role="concept">
62561 <primary>delivery</primary>
62562 <secondary>failure; logging</secondary>
62563 </indexterm>
62564 If a delivery fails because an address cannot be routed, a line of the
62565 following form is logged:
62566 </para>
62567 <literallayout class="monospaced">
62568 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
62569   &lt;jim@trek99.example&gt;: unknown mail domain
62570 </literallayout>
62571 <para>
62572 If a delivery fails at transport time, the router and transport are shown, and
62573 the response from the remote host is included, as in this example:
62574 </para>
62575 <literallayout class="monospaced">
62576 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
62577   R=dnslookup T=remote_smtp: SMTP error from remote mailer
62578   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
62579   pbmail3.py.example [192.168.63.111]: 553 5.3.0
62580   &lt;ace400@pb.example&gt;...Addressee unknown
62581 </literallayout>
62582 <para>
62583 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
62584 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
62585 disabling PIPELINING. The log lines for all forms of delivery failure are
62586 flagged with <literal>**</literal>.
62587 </para>
62588 </section>
62589 <section id="SECID256">
62590 <title>Fake deliveries</title>
62591 <para>
62592 <indexterm role="concept">
62593 <primary>delivery</primary>
62594 <secondary>fake; logging</secondary>
62595 </indexterm>
62596 If a delivery does not actually take place because the <option>-N</option> option has been
62597 used to suppress it, a normal delivery line is written to the log, except that
62598 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
62599 </para>
62600 </section>
62601 <section id="SECID257">
62602 <title>Completion</title>
62603 <para>
62604 A line of the form
62605 </para>
62606 <literallayout class="monospaced">
62607 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
62608 </literallayout>
62609 <para>
62610 is written to the main log when a message is about to be removed from the spool
62611 at the end of its processing.
62612 </para>
62613 </section>
62614 <section id="SECID258">
62615 <title>Summary of Fields in Log Lines</title>
62616 <para>
62617 <indexterm role="concept">
62618 <primary>log</primary>
62619 <secondary>summary of fields</secondary>
62620 </indexterm>
62621 A summary of the field identifiers that are used in log lines is shown in
62622 the following table:
62623 </para>
62624 <literallayout>
62625 <literal>A   </literal>        authenticator name (and optional id and sender)
62626 <literal>C   </literal>        SMTP confirmation on delivery
62627 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
62628 <literal>CV  </literal>        certificate verification status
62629 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
62630 <literal>DN  </literal>        distinguished name from peer certificate
62631 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
62632 <literal>F   </literal>        sender address (on delivery lines)
62633 <literal>H   </literal>        host name and IP address
62634 <literal>I   </literal>        local interface used
62635 <literal>id  </literal>        message id for incoming message
62636 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
62637 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
62638 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
62639 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
62640 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
62641 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
62642 <literal>S   </literal>        size of message
62643 <literal>SNI </literal>        server name indication from TLS client hello
62644 <literal>ST  </literal>        shadow transport name
62645 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
62646 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
62647 <literal>U   </literal>        local user or RFC 1413 identity
62648 <literal>X   </literal>        TLS cipher suite
62649 </literallayout>
62650 </section>
62651 <section id="SECID259">
62652 <title>Other log entries</title>
62653 <para>
62654 Various other types of log entry are written from time to time. Most should be
62655 self-explanatory. Among the more common are:
62656 </para>
62657 <itemizedlist>
62658 <listitem>
62659 <para>
62660 <indexterm role="concept">
62661 <primary>retry</primary>
62662 <secondary>time not reached</secondary>
62663 </indexterm>
62664 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
62665 during routing or local delivery, and the time to retry has not yet arrived.
62666 This message is not written to an individual message log file unless it happens
62667 during the first delivery attempt.
62668 </para>
62669 </listitem>
62670 <listitem>
62671 <para>
62672 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
62673 temporary errors during remote delivery, and the retry time has not yet arrived
62674 for any of the hosts to which it is routed.
62675 </para>
62676 </listitem>
62677 <listitem>
62678 <para>
62679 <indexterm role="concept">
62680 <primary>spool directory</primary>
62681 <secondary>file locked</secondary>
62682 </indexterm>
62683 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
62684 some other Exim process is already working on the message. This can be quite
62685 common if queue running processes are started at frequent intervals. The
62686 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
62687 doing.
62688 </para>
62689 </listitem>
62690 <listitem>
62691 <para>
62692 <indexterm role="concept">
62693 <primary>error</primary>
62694 <secondary>ignored</secondary>
62695 </indexterm>
62696 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
62697 message:
62698 </para>
62699 <orderedlist numeration="arabic">
62700 <listitem>
62701 <para>
62702 Exim failed to deliver a bounce message whose age was greater than
62703 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
62704 </para>
62705 </listitem>
62706 <listitem>
62707 <para>
62708 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
62709 failed. The delivery was discarded.
62710 </para>
62711 </listitem>
62712 <listitem>
62713 <para>
62714 A delivery set up by a router configured with
62715 </para>
62716 <literallayout class="monospaced">
62717     errors_to = &lt;&gt;
62718 </literallayout>
62719 <para>
62720 failed. The delivery was discarded.
62721 </para>
62722 </listitem>
62723 </orderedlist>
62724 </listitem>
62725 </itemizedlist>
62726 </section>
62727 <section id="SECTlogselector">
62728 <title>Reducing or increasing what is logged</title>
62729 <para>
62730 <indexterm role="concept">
62731 <primary>log</primary>
62732 <secondary>selectors</secondary>
62733 </indexterm>
62734 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
62735 default logging, or you can request additional logging. The value of
62736 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
62737 example:
62738 </para>
62739 <literallayout class="monospaced">
62740 log_selector = +arguments -retry_defer
62741 </literallayout>
62742 <para>
62743 The list of optional log items is in the following table, with the default
62744 selection marked by asterisks:
62745 </para>
62746 <literallayout>
62747 <literal> 8bitmime                   </literal>  received 8BITMIME status
62748 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
62749 <literal> address_rewrite            </literal>  address rewriting
62750 <literal> all_parents                </literal>  all parents in =&gt; lines
62751 <literal> arguments                  </literal>  command line arguments
62752 <literal>*connection_reject          </literal>  connection rejections
62753 <literal>*delay_delivery             </literal>  immediate delivery delayed
62754 <literal> deliver_time               </literal>  time taken to perform delivery
62755 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
62756 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
62757 <literal>*etrn                       </literal>  ETRN commands
62758 <literal>*host_lookup_failed         </literal>  as it says
62759 <literal> ident_timeout              </literal>  timeout for ident connection
62760 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
62761 <literal> incoming_port              </literal>  incoming port on &lt;= lines
62762 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
62763 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
62764 <literal>*queue_run                  </literal>  start and end queue runs
62765 <literal> queue_time                 </literal>  time on queue for one recipient
62766 <literal> queue_time_overall         </literal>  time on queue for whole message
62767 <literal> pid                        </literal>  Exim process id
62768 <literal> received_recipients        </literal>  recipients on &lt;= lines
62769 <literal> received_sender            </literal>  sender on &lt;= lines
62770 <literal>*rejected_header            </literal>  header contents on reject log
62771 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
62772 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
62773 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
62774 <literal>*sender_verify_fail         </literal>  sender verification failures
62775 <literal>*size_reject                </literal>  rejection because too big
62776 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
62777 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
62778 <literal> smtp_connection            </literal>  SMTP connections
62779 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
62780 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
62781 <literal> smtp_no_mail               </literal>  session with no MAIL commands
62782 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
62783 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
62784 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
62785 <literal> tls_certificate_verified   </literal>  certificate verification status
62786 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
62787 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
62788 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
62789 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
62790
62791 <literal> all                        </literal>  all of the above
62792 </literallayout>
62793 <para>
62794 More details on each of these items follows:
62795 </para>
62796 <itemizedlist>
62797 <listitem>
62798 <para>
62799 <indexterm role="concept">
62800 <primary>8BITMIME</primary>
62801 </indexterm>
62802 <indexterm role="concept">
62803 <primary>log</primary>
62804 <secondary>8BITMIME</secondary>
62805 </indexterm>
62806 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
62807 which may help in tracking down interoperability issues with ancient MTAs
62808 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
62809 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
62810 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
62811 </para>
62812 </listitem>
62813 <listitem>
62814 <para>
62815 <indexterm role="concept">
62816 <primary><option>warn</option> ACL verb</primary>
62817 <secondary>log when skipping</secondary>
62818 </indexterm>
62819 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
62820 its conditions cannot be evaluated, a log line to this effect is written if
62821 this log selector is set.
62822 </para>
62823 </listitem>
62824 <listitem>
62825 <para>
62826 <indexterm role="concept">
62827 <primary>log</primary>
62828 <secondary>rewriting</secondary>
62829 </indexterm>
62830 <indexterm role="concept">
62831 <primary>rewriting</primary>
62832 <secondary>logging</secondary>
62833 </indexterm>
62834 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
62835 rewrites, but not to rewrites in filters run as an unprivileged user (because
62836 such users cannot access the log).
62837 </para>
62838 </listitem>
62839 <listitem>
62840 <para>
62841 <indexterm role="concept">
62842 <primary>log</primary>
62843 <secondary>full parentage</secondary>
62844 </indexterm>
62845 <option>all_parents</option>: Normally only the original and final addresses are logged on
62846 delivery lines; with this selector, intermediate parents are given in
62847 parentheses between them.
62848 </para>
62849 </listitem>
62850 <listitem>
62851 <para>
62852 <indexterm role="concept">
62853 <primary>log</primary>
62854 <secondary>Exim arguments</secondary>
62855 </indexterm>
62856 <indexterm role="concept">
62857 <primary>Exim arguments, logging</primary>
62858 </indexterm>
62859 <option>arguments</option>: This causes Exim to write the arguments with which it was called
62860 to the main log, preceded by the current working directory. This is a debugging
62861 feature, added to make it easier to find out how certain MUAs call
62862 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
62863 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
62864 that are empty or that contain white space are quoted. Non-printing characters
62865 are shown as escape sequences. This facility cannot log unrecognized arguments,
62866 because the arguments are checked before the configuration file is read. The
62867 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
62868 between the caller and Exim.
62869 </para>
62870 </listitem>
62871 <listitem>
62872 <para>
62873 <indexterm role="concept">
62874 <primary>log</primary>
62875 <secondary>connection rejections</secondary>
62876 </indexterm>
62877 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
62878 connection is rejected, for whatever reason.
62879 </para>
62880 </listitem>
62881 <listitem>
62882 <para>
62883 <indexterm role="concept">
62884 <primary>log</primary>
62885 <secondary>delayed delivery</secondary>
62886 </indexterm>
62887 <indexterm role="concept">
62888 <primary>delayed delivery, logging</primary>
62889 </indexterm>
62890 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
62891 started for an incoming message because the load is too high or too many
62892 messages were received on one connection. Logging does not occur if no delivery
62893 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
62894 </para>
62895 </listitem>
62896 <listitem>
62897 <para>
62898 <indexterm role="concept">
62899 <primary>log</primary>
62900 <secondary>delivery duration</secondary>
62901 </indexterm>
62902 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
62903 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
62904 </para>
62905 </listitem>
62906 <listitem>
62907 <para>
62908 <indexterm role="concept">
62909 <primary>log</primary>
62910 <secondary>message size on delivery</secondary>
62911 </indexterm>
62912 <indexterm role="concept">
62913 <primary>size</primary>
62914 <secondary>of message</secondary>
62915 </indexterm>
62916 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
62917 the <quote>=&gt;</quote> line, tagged with S=.
62918 </para>
62919 </listitem>
62920 <listitem>
62921 <para>
62922 <indexterm role="concept">
62923 <primary>log</primary>
62924 <secondary>dnslist defer</secondary>
62925 </indexterm>
62926 <indexterm role="concept">
62927 <primary>DNS list</primary>
62928 <secondary>logging defer</secondary>
62929 </indexterm>
62930 <indexterm role="concept">
62931 <primary>black list (DNS)</primary>
62932 </indexterm>
62933 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
62934 DNS black list suffers a temporary error.
62935 </para>
62936 </listitem>
62937 <listitem>
62938 <para>
62939 <indexterm role="concept">
62940 <primary>log</primary>
62941 <secondary>ETRN commands</secondary>
62942 </indexterm>
62943 <indexterm role="concept">
62944 <primary>ETRN</primary>
62945 <secondary>logging</secondary>
62946 </indexterm>
62947 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
62948 is run to determine whether or not it is actually accepted. An invalid ETRN
62949 command, or one received within a message transaction is not logged by this
62950 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
62951 </para>
62952 </listitem>
62953 <listitem>
62954 <para>
62955 <indexterm role="concept">
62956 <primary>log</primary>
62957 <secondary>host lookup failure</secondary>
62958 </indexterm>
62959 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
62960 any addresses, or when a lookup of an IP address fails to find a host name, a
62961 log line is written. This logging does not apply to direct DNS lookups when
62962 routing email addresses, but it does apply to <quote>byname</quote> lookups.
62963 </para>
62964 </listitem>
62965 <listitem>
62966 <para>
62967 <indexterm role="concept">
62968 <primary>log</primary>
62969 <secondary>ident timeout</secondary>
62970 </indexterm>
62971 <indexterm role="concept">
62972 <primary>RFC 1413</primary>
62973 <secondary>logging timeout</secondary>
62974 </indexterm>
62975 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
62976 client&#x2019;s ident port times out.
62977 </para>
62978 </listitem>
62979 <listitem>
62980 <para>
62981 <indexterm role="concept">
62982 <primary>log</primary>
62983 <secondary>incoming interface</secondary>
62984 </indexterm>
62985 <indexterm role="concept">
62986 <primary>interface</primary>
62987 <secondary>logging</secondary>
62988 </indexterm>
62989 <option>incoming_interface</option>: The interface on which a message was received is added
62990 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
62991 followed by a colon and the port number. The local interface and port are also
62992 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
62993 rejection lines.
62994 </para>
62995 </listitem>
62996 <listitem>
62997 <para>
62998 <indexterm role="concept">
62999 <primary>log</primary>
63000 <secondary>incoming remote port</secondary>
63001 </indexterm>
63002 <indexterm role="concept">
63003 <primary>port</primary>
63004 <secondary>logging remote</secondary>
63005 </indexterm>
63006 <indexterm role="concept">
63007 <primary>TCP/IP</primary>
63008 <secondary>logging incoming remote port</secondary>
63009 </indexterm>
63010 <indexterm role="variable">
63011 <primary><varname>$sender_fullhost</varname></primary>
63012 </indexterm>
63013 <indexterm role="variable">
63014 <primary><varname>$sender_rcvhost</varname></primary>
63015 </indexterm>
63016 <option>incoming_port</option>: The remote port number from which a message was received is
63017 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
63018 in square brackets, and separated from it by a colon. This is implemented by
63019 changing the value that is put in the <varname>$sender_fullhost</varname> and
63020 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
63021 important with the widening use of NAT (see RFC 2505).
63022 </para>
63023 </listitem>
63024 <listitem>
63025 <para>
63026 <indexterm role="concept">
63027 <primary>log</primary>
63028 <secondary>dropped connection</secondary>
63029 </indexterm>
63030 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
63031 connection is unexpectedly dropped.
63032 </para>
63033 </listitem>
63034 <listitem>
63035 <para>
63036 <indexterm role="concept">
63037 <primary>log</primary>
63038 <secondary>outgoing remote port</secondary>
63039 </indexterm>
63040 <indexterm role="concept">
63041 <primary>port</primary>
63042 <secondary>logging outgoint remote</secondary>
63043 </indexterm>
63044 <indexterm role="concept">
63045 <primary>TCP/IP</primary>
63046 <secondary>logging ougtoing remote port</secondary>
63047 </indexterm>
63048 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
63049 containing =&gt; tags) following the IP address. This option is not included in
63050 the default setting, because for most ordinary configurations, the remote port
63051 number is always 25 (the SMTP port).
63052 </para>
63053 </listitem>
63054 <listitem>
63055 <para>
63056 <indexterm role="concept">
63057 <primary>log</primary>
63058 <secondary>process ids in</secondary>
63059 </indexterm>
63060 <indexterm role="concept">
63061 <primary>pid (process id)</primary>
63062 <secondary>in log lines</secondary>
63063 </indexterm>
63064 <option>pid</option>: The current process id is added to every log line, in square brackets,
63065 immediately after the time and date.
63066 </para>
63067 </listitem>
63068 <listitem>
63069 <para>
63070 <indexterm role="concept">
63071 <primary>log</primary>
63072 <secondary>queue run</secondary>
63073 </indexterm>
63074 <indexterm role="concept">
63075 <primary>queue runner</primary>
63076 <secondary>logging</secondary>
63077 </indexterm>
63078 <option>queue_run</option>: The start and end of every queue run are logged.
63079 </para>
63080 </listitem>
63081 <listitem>
63082 <para>
63083 <indexterm role="concept">
63084 <primary>log</primary>
63085 <secondary>queue time</secondary>
63086 </indexterm>
63087 <option>queue_time</option>: The amount of time the message has been in the queue on the
63088 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
63089 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
63090 includes reception time as well as the delivery time for the current address.
63091 This means that it may be longer than the difference between the arrival and
63092 delivery log line times, because the arrival log line is not written until the
63093 message has been successfully received.
63094 </para>
63095 </listitem>
63096 <listitem>
63097 <para>
63098 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
63099 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
63100 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
63101 message, so it includes reception time as well as the total delivery time.
63102 </para>
63103 </listitem>
63104 <listitem>
63105 <para>
63106 <indexterm role="concept">
63107 <primary>log</primary>
63108 <secondary>recipients</secondary>
63109 </indexterm>
63110 <option>received_recipients</option>: The recipients of a message are listed in the main log
63111 as soon as the message is received. The list appears at the end of the log line
63112 that is written when a message is received, preceded by the word <quote>for</quote>. The
63113 addresses are listed after they have been qualified, but before any rewriting
63114 has taken place.
63115 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
63116 in the list.
63117 </para>
63118 </listitem>
63119 <listitem>
63120 <para>
63121 <indexterm role="concept">
63122 <primary>log</primary>
63123 <secondary>sender reception</secondary>
63124 </indexterm>
63125 <option>received_sender</option>: The unrewritten original sender of a message is added to
63126 the end of the log line that records the message&#x2019;s arrival, after the word
63127 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
63128 </para>
63129 </listitem>
63130 <listitem>
63131 <para>
63132 <indexterm role="concept">
63133 <primary>log</primary>
63134 <secondary>header lines for rejection</secondary>
63135 </indexterm>
63136 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
63137 rejection is written to the reject log, the complete header is added to the
63138 log. Header logging can be turned off individually for messages that are
63139 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
63140 </para>
63141 </listitem>
63142 <listitem>
63143 <para>
63144 <indexterm role="concept">
63145 <primary>log</primary>
63146 <secondary>retry defer</secondary>
63147 </indexterm>
63148 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
63149 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
63150 message is always omitted from individual message logs after the first delivery
63151 attempt.
63152 </para>
63153 </listitem>
63154 <listitem>
63155 <para>
63156 <indexterm role="concept">
63157 <primary>log</primary>
63158 <secondary>return path</secondary>
63159 </indexterm>
63160 <option>return_path_on_delivery</option>: The return path that is being transmitted with
63161 the message is included in delivery and bounce lines, using the tag P=.
63162 This is omitted if no delivery actually happens, for example, if routing fails,
63163 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
63164 </para>
63165 </listitem>
63166 <listitem>
63167 <para>
63168 <indexterm role="concept">
63169 <primary>log</primary>
63170 <secondary>sender on delivery</secondary>
63171 </indexterm>
63172 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
63173 and bounce line, tagged by F= (for <quote>from</quote>).
63174 This is the original sender that was received with the message; it is not
63175 necessarily the same as the outgoing return path.
63176 </para>
63177 </listitem>
63178 <listitem>
63179 <para>
63180 <indexterm role="concept">
63181 <primary>log</primary>
63182 <secondary>sender verify failure</secondary>
63183 </indexterm>
63184 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
63185 gives details of a sender verification failure is not written. Log lines for
63186 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
63187 detail is lost.
63188 </para>
63189 </listitem>
63190 <listitem>
63191 <para>
63192 <indexterm role="concept">
63193 <primary>log</primary>
63194 <secondary>size rejection</secondary>
63195 </indexterm>
63196 <option>size_reject</option>: A log line is written whenever a message is rejected because
63197 it is too big.
63198 </para>
63199 </listitem>
63200 <listitem>
63201 <para>
63202 <indexterm role="concept">
63203 <primary>log</primary>
63204 <secondary>frozen messages; skipped</secondary>
63205 </indexterm>
63206 <indexterm role="concept">
63207 <primary>frozen messages</primary>
63208 <secondary>logging skipping</secondary>
63209 </indexterm>
63210 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
63211 queue run because it is frozen or because another process is already delivering
63212 it.
63213 <indexterm role="concept">
63214 <primary><quote>spool file is locked</quote></primary>
63215 </indexterm>
63216 The message that is written is <quote>spool file is locked</quote>.
63217 </para>
63218 </listitem>
63219 <listitem>
63220 <para>
63221 <indexterm role="concept">
63222 <primary>log</primary>
63223 <secondary>smtp confirmation</secondary>
63224 </indexterm>
63225 <indexterm role="concept">
63226 <primary>SMTP</primary>
63227 <secondary>logging confirmation</secondary>
63228 </indexterm>
63229 <indexterm role="concept">
63230 <primary>LMTP</primary>
63231 <secondary>logging confirmation</secondary>
63232 </indexterm>
63233 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
63234 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
63235 A number of MTAs (including Exim) return an identifying string in this
63236 response.
63237 </para>
63238 </listitem>
63239 <listitem>
63240 <para>
63241 <indexterm role="concept">
63242 <primary>log</primary>
63243 <secondary>SMTP connections</secondary>
63244 </indexterm>
63245 <indexterm role="concept">
63246 <primary>SMTP</primary>
63247 <secondary>logging connections</secondary>
63248 </indexterm>
63249 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
63250 established or closed, unless the connection is from a host that matches
63251 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
63252 only when the closure is unexpected.) This applies to connections from local
63253 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
63254 dropped in the middle of a message, a log line is always written, whether or
63255 not this selector is set, but otherwise nothing is written at the start and end
63256 of connections unless this selector is enabled.
63257 </para>
63258 <para>
63259 For TCP/IP connections to an Exim daemon, the current number of connections is
63260 included in the log message for each new connection, but note that the count is
63261 reset if the daemon is restarted.
63262 Also, because connections are closed (and the closure is logged) in
63263 subprocesses, the count may not include connections that have been closed but
63264 whose termination the daemon has not yet noticed. Thus, while it is possible to
63265 match up the opening and closing of connections in the log, the value of the
63266 logged counts may not be entirely accurate.
63267 </para>
63268 </listitem>
63269 <listitem>
63270 <para>
63271 <indexterm role="concept">
63272 <primary>log</primary>
63273 <secondary>SMTP transaction; incomplete</secondary>
63274 </indexterm>
63275 <indexterm role="concept">
63276 <primary>SMTP</primary>
63277 <secondary>logging incomplete transactions</secondary>
63278 </indexterm>
63279 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
63280 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
63281 and the message sender plus any accepted recipients are included in the log
63282 line. This can provide evidence of dictionary attacks.
63283 </para>
63284 </listitem>
63285 <listitem>
63286 <para>
63287 <indexterm role="concept">
63288 <primary>log</primary>
63289 <secondary>non-MAIL SMTP sessions</secondary>
63290 </indexterm>
63291 <indexterm role="concept">
63292 <primary>MAIL</primary>
63293 <secondary>logging session without</secondary>
63294 </indexterm>
63295 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
63296 connection terminates without having issued a MAIL command. This includes both
63297 the case when the connection is dropped, and the case when QUIT is used. It
63298 does not include cases where the connection is rejected right at the start (by
63299 an ACL, or because there are too many connections, or whatever). These cases
63300 already have their own log lines.
63301 </para>
63302 <para>
63303 The log line that is written contains the identity of the client in the usual
63304 way, followed by D= and a time, which records the duration of the connection.
63305 If the connection was authenticated, this fact is logged exactly as it is for
63306 an incoming message, with an A= item. If the connection was encrypted, CV=,
63307 DN=, and X= items may appear as they do for an incoming message, controlled by
63308 the same logging options.
63309 </para>
63310 <para>
63311 Finally, if any SMTP commands were issued during the connection, a C= item
63312 is added to the line, listing the commands that were used. For example,
63313 </para>
63314 <literallayout class="monospaced">
63315 C=EHLO,QUIT
63316 </literallayout>
63317 <para>
63318 shows that the client issued QUIT straight after EHLO. If there were fewer
63319 than 20 commands, they are all listed. If there were more than 20 commands,
63320 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
63321 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
63322 have been aborted before 20 non-mail commands are processed.
63323 </para>
63324 </listitem>
63325 <listitem>
63326 <para>
63327 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
63328 colon-separated, is appended to the A= item for a message arrival or delivery
63329 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
63330 was accepted or used.
63331 </para>
63332 </listitem>
63333 <listitem>
63334 <para>
63335 <indexterm role="concept">
63336 <primary>log</primary>
63337 <secondary>SMTP protocol error</secondary>
63338 </indexterm>
63339 <indexterm role="concept">
63340 <primary>SMTP</primary>
63341 <secondary>logging protocol error</secondary>
63342 </indexterm>
63343 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
63344 encountered. Exim does not have perfect detection of all protocol errors
63345 because of transmission delays and the use of pipelining. If PIPELINING has
63346 been advertised to a client, an Exim server assumes that the client will use
63347 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
63348 received after rejecting MAIL) as protocol errors.
63349 </para>
63350 </listitem>
63351 <listitem>
63352 <para>
63353 <indexterm role="concept">
63354 <primary>SMTP</primary>
63355 <secondary>logging syntax errors</secondary>
63356 </indexterm>
63357 <indexterm role="concept">
63358 <primary>SMTP</primary>
63359 <secondary>syntax errors; logging</secondary>
63360 </indexterm>
63361 <indexterm role="concept">
63362 <primary>SMTP</primary>
63363 <secondary>unknown command; logging</secondary>
63364 </indexterm>
63365 <indexterm role="concept">
63366 <primary>log</primary>
63367 <secondary>unknown SMTP command</secondary>
63368 </indexterm>
63369 <indexterm role="concept">
63370 <primary>log</primary>
63371 <secondary>SMTP syntax error</secondary>
63372 </indexterm>
63373 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
63374 encountered. An unrecognized command is treated as a syntax error. For an
63375 external connection, the host identity is given; for an internal connection
63376 using <option>-bs</option> the sender identification (normally the calling user) is given.
63377 </para>
63378 </listitem>
63379 <listitem>
63380 <para>
63381 <indexterm role="concept">
63382 <primary>log</primary>
63383 <secondary>subject</secondary>
63384 </indexterm>
63385 <indexterm role="concept">
63386 <primary>subject, logging</primary>
63387 </indexterm>
63388 <option>subject</option>: The subject of the message is added to the arrival log line,
63389 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
63390 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
63391 specifies whether characters with values greater than 127 should be logged
63392 unchanged, or whether they should be rendered as escape sequences.
63393 </para>
63394 </listitem>
63395 <listitem>
63396 <para>
63397 <indexterm role="concept">
63398 <primary>log</primary>
63399 <secondary>certificate verification</secondary>
63400 </indexterm>
63401 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
63402 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
63403 verified, and <literal>CV=no</literal> if not.
63404 </para>
63405 </listitem>
63406 <listitem>
63407 <para>
63408 <indexterm role="concept">
63409 <primary>log</primary>
63410 <secondary>TLS cipher</secondary>
63411 </indexterm>
63412 <indexterm role="concept">
63413 <primary>TLS</primary>
63414 <secondary>logging cipher</secondary>
63415 </indexterm>
63416 <option>tls_cipher</option>: When a message is sent or received over an encrypted
63417 connection, the cipher suite used is added to the log line, preceded by X=.
63418 </para>
63419 </listitem>
63420 <listitem>
63421 <para>
63422 <indexterm role="concept">
63423 <primary>log</primary>
63424 <secondary>TLS peer DN</secondary>
63425 </indexterm>
63426 <indexterm role="concept">
63427 <primary>TLS</primary>
63428 <secondary>logging peer DN</secondary>
63429 </indexterm>
63430 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
63431 connection, and a certificate is supplied by the remote host, the peer DN is
63432 added to the log line, preceded by DN=.
63433 </para>
63434 </listitem>
63435 <listitem>
63436 <para>
63437 <indexterm role="concept">
63438 <primary>log</primary>
63439 <secondary>TLS SNI</secondary>
63440 </indexterm>
63441 <indexterm role="concept">
63442 <primary>TLS</primary>
63443 <secondary>logging SNI</secondary>
63444 </indexterm>
63445 <option>tls_sni</option>: When a message is received over an encrypted connection, and
63446 the remote host provided the Server Name Indication extension, the SNI is
63447 added to the log line, preceded by SNI=.
63448 </para>
63449 </listitem>
63450 <listitem>
63451 <para>
63452 <indexterm role="concept">
63453 <primary>log</primary>
63454 <secondary>DNS failure in list</secondary>
63455 </indexterm>
63456 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
63457 result of a list match is failure because a DNS lookup failed.
63458 </para>
63459 </listitem>
63460 </itemizedlist>
63461 </section>
63462 <section id="SECID260">
63463 <title>Message log</title>
63464 <para>
63465 <indexterm role="concept">
63466 <primary>message</primary>
63467 <secondary>log file for</secondary>
63468 </indexterm>
63469 <indexterm role="concept">
63470 <primary>log</primary>
63471 <secondary>message log; description of</secondary>
63472 </indexterm>
63473 <indexterm role="concept">
63474 <primary><filename>msglog</filename> directory</primary>
63475 </indexterm>
63476 <indexterm role="option">
63477 <primary><option>preserve_message_logs</option></primary>
63478 </indexterm>
63479 In addition to the general log files, Exim writes a log file for each message
63480 that it handles. The names of these per-message logs are the message ids, and
63481 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
63482 message log contains copies of the log lines that apply to the message. This
63483 makes it easier to inspect the status of an individual message without having
63484 to search the main log. A message log is deleted when processing of the message
63485 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
63486 only with great care because they can fill up your disk very quickly.
63487 </para>
63488 <para>
63489 On a heavily loaded system, it may be desirable to disable the use of
63490 per-message logs, in order to reduce disk I/O. This can be done by setting the
63491 <option>message_logs</option> option false.
63492 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
63493 </para>
63494 </section>
63495 </chapter>
63496
63497 <chapter id="CHAPutils">
63498 <title>Exim utilities</title>
63499 <para>
63500 <indexterm role="concept" id="IIDutils" class="startofrange">
63501 <primary>utilities</primary>
63502 </indexterm>
63503 A number of utility scripts and programs are supplied with Exim and are
63504 described in this chapter. There is also the Exim Monitor, which is covered in
63505 the next chapter. The utilities described here are:
63506 </para>
63507 <informaltable frame="none">
63508 <tgroup cols="3" colsep="0" rowsep="0">
63509 <colspec colwidth="7*" align="left"/>
63510 <colspec colwidth="15*" align="left"/>
63511 <colspec colwidth="40*" align="left"/>
63512 <tbody>
63513 <row>
63514 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
63515 <entry><emphasis>exiwhat</emphasis></entry>
63516 <entry>list what Exim processes are doing</entry>
63517 </row>
63518 <row>
63519 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
63520 <entry><emphasis>exiqgrep</emphasis></entry>
63521 <entry>grep the queue</entry>
63522 </row>
63523 <row>
63524 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
63525 <entry><emphasis>exiqsumm</emphasis></entry>
63526 <entry>summarize the queue</entry>
63527 </row>
63528 <row>
63529 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
63530 <entry><emphasis>exigrep</emphasis></entry>
63531 <entry>search the main log</entry>
63532 </row>
63533 <row>
63534 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
63535 <entry><emphasis>exipick</emphasis></entry>
63536 <entry>select messages on various criteria</entry>
63537 </row>
63538 <row>
63539 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
63540 <entry><emphasis>exicyclog</emphasis></entry>
63541 <entry>cycle (rotate) log files</entry>
63542 </row>
63543 <row>
63544 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
63545 <entry><emphasis>eximstats</emphasis></entry>
63546 <entry>extract statistics from the log</entry>
63547 </row>
63548 <row>
63549 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
63550 <entry><emphasis>exim_checkaccess</emphasis></entry>
63551 <entry>check address acceptance from given IP</entry>
63552 </row>
63553 <row>
63554 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
63555 <entry><emphasis>exim_dbmbuild</emphasis></entry>
63556 <entry>build a DBM file</entry>
63557 </row>
63558 <row>
63559 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
63560 <entry><emphasis>exinext</emphasis></entry>
63561 <entry>extract retry information</entry>
63562 </row>
63563 <row>
63564 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63565 <entry><emphasis>exim_dumpdb</emphasis></entry>
63566 <entry>dump a hints database</entry>
63567 </row>
63568 <row>
63569 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63570 <entry><emphasis>exim_tidydb</emphasis></entry>
63571 <entry>clean up a hints database</entry>
63572 </row>
63573 <row>
63574 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63575 <entry><emphasis>exim_fixdb</emphasis></entry>
63576 <entry>patch a hints database</entry>
63577 </row>
63578 <row>
63579 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
63580 <entry><emphasis>exim_lock</emphasis></entry>
63581 <entry>lock a mailbox file</entry>
63582 </row>
63583 </tbody>
63584 </tgroup>
63585 </informaltable>
63586 <para>
63587 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
63588 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
63589 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
63590 </para>
63591 <section id="SECTfinoutwha">
63592 <title>Finding out what Exim processes are doing (exiwhat)</title>
63593 <para>
63594 <indexterm role="concept">
63595 <primary><emphasis>exiwhat</emphasis></primary>
63596 </indexterm>
63597 <indexterm role="concept">
63598 <primary>process, querying</primary>
63599 </indexterm>
63600 <indexterm role="concept">
63601 <primary>SIGUSR1</primary>
63602 </indexterm>
63603 On operating systems that can restart a system call after receiving a signal
63604 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
63605 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
63606 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
63607 processes it can find, having first emptied the file. It then waits for one
63608 second to allow the Exim processes to react before displaying the results. In
63609 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
63610 send the signal to the Exim processes, so it is normally run as root.
63611 </para>
63612 <para>
63613 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
63614 use by system administrators. It is not sensible, for example, to set up a
63615 script that sends SIGUSR1 signals to Exim processes at short intervals.
63616 </para>
63617 <para>
63618 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
63619 varies in different operating systems. Not only are different options used,
63620 but the format of the output is different. For this reason, there are some
63621 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
63622 it doesn&#x2019;t seem to be working for you, check the following compile-time
63623 options:
63624 </para>
63625 <literallayout>
63626 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
63627 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
63628 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
63629 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
63630 </literallayout>
63631 <para>
63632 An example of typical output from <emphasis>exiwhat</emphasis> is
63633 </para>
63634 <literallayout class="monospaced">
63635 164 daemon: -q1h, listening on port 25
63636 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
63637 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
63638   [10.19.42.42] (editor@ref.example)
63639 10592 handling incoming call from [192.168.243.242]
63640 10628 accepting a local non-SMTP message
63641 </literallayout>
63642 <para>
63643 The first number in the output line is the process number. The third line has
63644 been split here, in order to fit it on the page.
63645 </para>
63646 </section>
63647 <section id="SECTgreptheque">
63648 <title>Selective queue listing (exiqgrep)</title>
63649 <para>
63650 <indexterm role="concept">
63651 <primary><emphasis>exiqgrep</emphasis></primary>
63652 </indexterm>
63653 <indexterm role="concept">
63654 <primary>queue</primary>
63655 <secondary>grepping</secondary>
63656 </indexterm>
63657 This utility is a Perl script contributed by Matt Hubbard. It runs
63658 </para>
63659 <literallayout class="monospaced">
63660 exim -bpu
63661 </literallayout>
63662 <para>
63663 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
63664 </para>
63665 <literallayout class="monospaced">
63666 exim -bp
63667 </literallayout>
63668 <para>
63669 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
63670 contain alternate exim configuration the queue management might be using.
63671 </para>
63672 <para>
63673 to obtain a queue listing, and then greps the output to select messages 
63674 that match given criteria. The following selection options are available:
63675 </para>
63676 <variablelist>
63677 <varlistentry>
63678 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63679 <listitem>
63680 <para>
63681 Match the sender address using a case-insensitive search. The field that is
63682 tested is enclosed in angle brackets, so you can test for bounce messages with
63683 </para>
63684 <literallayout class="monospaced">
63685 exiqgrep -f '^&lt;&gt;$'
63686 </literallayout>
63687 </listitem></varlistentry>
63688 <varlistentry>
63689 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63690 <listitem>
63691 <para>
63692 Match a recipient address using a case-insensitve search. The field that is
63693 tested is not enclosed in angle brackets.
63694 </para>
63695 </listitem></varlistentry>
63696 <varlistentry>
63697 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63698 <listitem>
63699 <para>
63700 Match against the size field.
63701 </para>
63702 </listitem></varlistentry>
63703 <varlistentry>
63704 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63705 <listitem>
63706 <para>
63707 Match messages that are younger than the given time.
63708 </para>
63709 </listitem></varlistentry>
63710 <varlistentry>
63711 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63712 <listitem>
63713 <para>
63714 Match messages that are older than the given time.
63715 </para>
63716 </listitem></varlistentry>
63717 <varlistentry>
63718 <term><emphasis role="bold">-z</emphasis></term>
63719 <listitem>
63720 <para>
63721 Match only frozen messages.
63722 </para>
63723 </listitem></varlistentry>
63724 <varlistentry>
63725 <term><emphasis role="bold">-x</emphasis></term>
63726 <listitem>
63727 <para>
63728 Match only non-frozen messages.
63729 </para>
63730 </listitem></varlistentry>
63731 </variablelist>
63732 <para>
63733 The following options control the format of the output:
63734 </para>
63735 <variablelist>
63736 <varlistentry>
63737 <term><emphasis role="bold">-c</emphasis></term>
63738 <listitem>
63739 <para>
63740 Display only the count of matching messages.
63741 </para>
63742 </listitem></varlistentry>
63743 <varlistentry>
63744 <term><emphasis role="bold">-l</emphasis></term>
63745 <listitem>
63746 <para>
63747 Long format &ndash; display the full message information as output by Exim. This is
63748 the default.
63749 </para>
63750 </listitem></varlistentry>
63751 <varlistentry>
63752 <term><emphasis role="bold">-i</emphasis></term>
63753 <listitem>
63754 <para>
63755 Display message ids only.
63756 </para>
63757 </listitem></varlistentry>
63758 <varlistentry>
63759 <term><emphasis role="bold">-b</emphasis></term>
63760 <listitem>
63761 <para>
63762 Brief format &ndash; one line per message.
63763 </para>
63764 </listitem></varlistentry>
63765 <varlistentry>
63766 <term><emphasis role="bold">-R</emphasis></term>
63767 <listitem>
63768 <para>
63769 Display messages in reverse order.
63770 </para>
63771 </listitem></varlistentry>
63772 <varlistentry>
63773 <term><emphasis role="bold">-a</emphasis></term>
63774 <listitem>
63775 <para>
63776 Include delivered recipients in queue listing.
63777 </para>
63778 </listitem></varlistentry>
63779 </variablelist>
63780 <para>
63781 There is one more option, <option>-h</option>, which outputs a list of options.
63782 </para>
63783 </section>
63784 <section id="SECTsumtheque">
63785 <title>Summarizing the queue (exiqsumm)</title>
63786 <para>
63787 <indexterm role="concept">
63788 <primary><emphasis>exiqsumm</emphasis></primary>
63789 </indexterm>
63790 <indexterm role="concept">
63791 <primary>queue</primary>
63792 <secondary>summary</secondary>
63793 </indexterm>
63794 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
63795 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
63796 running a command such as
63797 </para>
63798 <literallayout class="monospaced">
63799 exim -bp | exiqsumm
63800 </literallayout>
63801 <para>
63802 The output consists of one line for each domain that has messages waiting for
63803 it, as in the following example:
63804 </para>
63805 <literallayout class="monospaced">
63806 3   2322   74m   66m  msn.com.example
63807 </literallayout>
63808 <para>
63809 Each line lists the number of pending deliveries for a domain, their total
63810 volume, and the length of time that the oldest and the newest messages have
63811 been waiting. Note that the number of pending deliveries is greater than the
63812 number of messages when messages have more than one recipient.
63813 </para>
63814 <para>
63815 A summary line is output at the end. By default the output is sorted on the
63816 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
63817 the output to be sorted by oldest message and by count of messages,
63818 respectively. There are also three options that split the messages for each
63819 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
63820 separates frozen messages, and <option>-s</option> separates messages according to their
63821 sender.
63822 </para>
63823 <para>
63824 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
63825 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
63826 generated by aliasing or forwarding are included (unless the <option>one_time</option>
63827 option of the <command>redirect</command> router has been used to convert them into <quote>top
63828 level</quote> addresses).
63829 </para>
63830 </section>
63831 <section id="SECTextspeinf">
63832 <title>Extracting specific information from the log (exigrep)</title>
63833 <para>
63834 <indexterm role="concept">
63835 <primary><emphasis>exigrep</emphasis></primary>
63836 </indexterm>
63837 <indexterm role="concept">
63838 <primary>log</primary>
63839 <secondary>extracts; grepping for</secondary>
63840 </indexterm>
63841 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
63842 files for entries that match a given pattern. When it finds a match, it
63843 extracts all the log entries for the relevant message, not just those that
63844 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
63845 given message, or all mail for a given user, or for a given host, for example.
63846 The input files can be in Exim log format or syslog format.
63847 If a matching log line is not associated with a specific message, it is
63848 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
63849 </para>
63850 <literallayout>
63851 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
63852 </literallayout>
63853 <para>
63854 If no log file names are given on the command line, the standard input is read.
63855 </para>
63856 <para>
63857 The <option>-t</option> argument specifies a number of seconds. It adds an additional
63858 condition for message selection. Messages that are complete are shown only if
63859 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
63860 </para>
63861 <para>
63862 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
63863 makes it case-sensitive. This may give a performance improvement when searching
63864 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
63865 option; with <option>-I</option> they do not. In both cases it is possible to change the
63866 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
63867 </para>
63868 <para>
63869 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
63870 pattern as standing for themselves. Otherwise the pattern must be a Perl
63871 regular expression.
63872 </para>
63873 <para>
63874 The <option>-v</option> option inverts the matching condition. That is, a line is selected
63875 if it does <emphasis>not</emphasis> match the pattern.
63876 </para>
63877 <para>
63878 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
63879 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
63880 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
63881 </para>
63882 </section>
63883 <section id="SECTexipick">
63884 <title>Selecting messages by various criteria (exipick)</title>
63885 <para>
63886 <indexterm role="concept">
63887 <primary><emphasis>exipick</emphasis></primary>
63888 </indexterm>
63889 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
63890 lists messages from the queue according to a variety of criteria. For details
63891 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
63892 <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
63893 the <option>--help</option> option.
63894 </para>
63895 </section>
63896 <section id="SECTcyclogfil">
63897 <title>Cycling log files (exicyclog)</title>
63898 <para>
63899 <indexterm role="concept">
63900 <primary>log</primary>
63901 <secondary>cycling local files</secondary>
63902 </indexterm>
63903 <indexterm role="concept">
63904 <primary>cycling logs</primary>
63905 </indexterm>
63906 <indexterm role="concept">
63907 <primary><emphasis>exicyclog</emphasis></primary>
63908 </indexterm>
63909 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
63910 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
63911 you are using log files with datestamps in their names (see section
63912 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
63913 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
63914 There are two command line options for <emphasis>exicyclog</emphasis>:
63915 </para>
63916 <itemizedlist>
63917 <listitem>
63918 <para>
63919 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
63920 default that is set when Exim is built. The default default is 10.
63921 </para>
63922 </listitem>
63923 <listitem>
63924 <para>
63925 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
63926 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
63927 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
63928 configuration.
63929 </para>
63930 </listitem>
63931 </itemizedlist>
63932 <para>
63933 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
63934 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
63935 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
63936 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
63937 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
63938 logs are handled similarly.
63939 </para>
63940 <para>
63941 If the limit is greater than 99, the script uses 3-digit numbers such as
63942 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
63943 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
63944 any existing log files.
63945 </para>
63946 <para>
63947 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
63948 the end are deleted. All files with numbers greater than 01 are compressed,
63949 using a compression command which is configured by the COMPRESS_COMMAND
63950 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
63951 root <option>crontab</option> entry of the form
63952 </para>
63953 <literallayout class="monospaced">
63954 1 0 * * * su exim -c /usr/exim/bin/exicyclog
63955 </literallayout>
63956 <para>
63957 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
63958 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
63959 </para>
63960 </section>
63961 <section id="SECTmailstat">
63962 <title>Mail statistics (eximstats)</title>
63963 <para>
63964 <indexterm role="concept">
63965 <primary>statistics</primary>
63966 </indexterm>
63967 <indexterm role="concept">
63968 <primary><emphasis>eximstats</emphasis></primary>
63969 </indexterm>
63970 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
63971 information from log files. The output is either plain text, or HTML.
63972 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
63973 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
63974 </para>
63975 <para>
63976 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
63977 latest version is the result of some extensive revision by Steve Campbell. A
63978 lot of information is given by default, but there are options for suppressing
63979 various parts of it. Following any options, the arguments to the script are a
63980 list of files, which should be main log files. For example:
63981 </para>
63982 <literallayout class="monospaced">
63983 eximstats -nr /var/spool/exim/log/mainlog.01
63984 </literallayout>
63985 <para>
63986 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
63987 messages received from or delivered to various hosts. The information is sorted
63988 both by message count and by volume, and the top fifty hosts in each category
63989 are listed on the standard output. Similar information, based on email
63990 addresses or domains instead of hosts can be requested by means of various
63991 options. For messages delivered and received locally, similar statistics are
63992 also produced per user.
63993 </para>
63994 <para>
63995 The output also includes total counts and statistics about delivery errors, and
63996 histograms showing the number of messages received and deliveries made in each
63997 hour of the day. A delivery with more than one address in its envelope (for
63998 example, an SMTP transaction with more than one RCPT command) is counted
63999 as a single delivery by <emphasis>eximstats</emphasis>.
64000 </para>
64001 <para>
64002 Though normally more deliveries than receipts are reported (as messages may
64003 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
64004 messages received than delivered, even though the queue is empty at the start
64005 and end of the period in question. If an incoming message contains no valid
64006 recipients, no deliveries are recorded for it. A bounce message is handled as
64007 an entirely separate message.
64008 </para>
64009 <para>
64010 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
64011 of messages received and deliveries made, and the number of hosts involved in
64012 each case. It also outputs the number of messages that were delayed (that is,
64013 not completely delivered at the first attempt), and the number that had at
64014 least one address that failed.
64015 </para>
64016 <para>
64017 The remainder of the output is in sections that can be independently disabled
64018 or modified by various options. It consists of a summary of deliveries by
64019 transport, histograms of messages received and delivered per time interval
64020 (default per hour), information about the time messages spent on the queue,
64021 a list of relayed messages, lists of the top fifty sending hosts, local
64022 senders, destination hosts, and destination local users by count and by volume,
64023 and a list of delivery errors that occurred.
64024 </para>
64025 <para>
64026 The relay information lists messages that were actually relayed, that is, they
64027 came from a remote host and were directly delivered to some other remote host,
64028 without being processed (for example, for aliasing or forwarding) locally.
64029 </para>
64030 <para>
64031 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
64032 outputs. These are documented in the Perl script itself, and can be extracted
64033 by running the command <command>perldoc</command> on the script. For example:
64034 </para>
64035 <literallayout class="monospaced">
64036 perldoc /usr/exim/bin/eximstats
64037 </literallayout>
64038 </section>
64039 <section id="SECTcheckaccess">
64040 <title>Checking access policy (exim_checkaccess)</title>
64041 <para>
64042 <indexterm role="concept">
64043 <primary><emphasis>exim_checkaccess</emphasis></primary>
64044 </indexterm>
64045 <indexterm role="concept">
64046 <primary>policy control</primary>
64047 <secondary>checking access</secondary>
64048 </indexterm>
64049 <indexterm role="concept">
64050 <primary>checking access</primary>
64051 </indexterm>
64052 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
64053 debugging output, in order to check what Exim is doing when it is applying
64054 policy controls to incoming SMTP mail. However, not everybody is sufficiently
64055 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
64056 sometimes you just want to answer the question <quote>Does this address have
64057 access?</quote> without bothering with any further details.
64058 </para>
64059 <para>
64060 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
64061 two arguments, an IP address and an email address:
64062 </para>
64063 <literallayout class="monospaced">
64064 exim_checkaccess 10.9.8.7 A.User@a.domain.example
64065 </literallayout>
64066 <para>
64067 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
64068 given email address would be accepted in a RCPT command in a TCP/IP
64069 connection from the host with the given IP address. The output of the utility
64070 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
64071 </para>
64072 <literallayout class="monospaced">
64073 Rejected:
64074 550 Relay not permitted
64075 </literallayout>
64076 <para>
64077 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
64078 for the MAIL command, but you can change this by providing additional
64079 options. These are passed directly to the Exim command. For example, to specify
64080 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
64081 you can use:
64082 </para>
64083 <literallayout class="monospaced">
64084 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
64085                  -f himself@there.example
64086 </literallayout>
64087 <para>
64088 Note that these additional Exim command line items must be given after the two
64089 mandatory arguments.
64090 </para>
64091 <para>
64092 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
64093 while running its checks. You can run checks that include callouts by using
64094 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
64095 </para>
64096 </section>
64097 <section id="SECTdbmbuild">
64098 <title>Making DBM files (exim_dbmbuild)</title>
64099 <para>
64100 <indexterm role="concept">
64101 <primary>DBM</primary>
64102 <secondary>building dbm files</secondary>
64103 </indexterm>
64104 <indexterm role="concept">
64105 <primary>building DBM files</primary>
64106 </indexterm>
64107 <indexterm role="concept">
64108 <primary><emphasis>exim_dbmbuild</emphasis></primary>
64109 </indexterm>
64110 <indexterm role="concept">
64111 <primary>lower casing</primary>
64112 </indexterm>
64113 <indexterm role="concept">
64114 <primary>binary zero</primary>
64115 <secondary>in lookup key</secondary>
64116 </indexterm>
64117 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
64118 the format used by the <command>lsearch</command> lookup (see section
64119 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
64120 names as keys and the remainder of the information as data. The lower-casing
64121 can be prevented by calling the program with the <option>-nolc</option> option.
64122 </para>
64123 <para>
64124 A terminating zero is included as part of the key string. This is expected by
64125 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
64126 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
64127 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
64128 files.
64129 </para>
64130 <para>
64131 The program requires two arguments: the name of the input file (which can be a
64132 single hyphen to indicate the standard input), and the name of the output file.
64133 It creates the output under a temporary name, and then renames it if all went
64134 well.
64135 </para>
64136 <para>
64137 <indexterm role="concept">
64138 <primary>USE_DB</primary>
64139 </indexterm>
64140 If the native DB interface is in use (USE_DB is set in a compile-time
64141 configuration file &ndash; this is common in free versions of Unix) the two file
64142 names must be different, because in this mode the Berkeley DB functions create
64143 a single output file using exactly the name given. For example,
64144 </para>
64145 <literallayout class="monospaced">
64146 exim_dbmbuild /etc/aliases /etc/aliases.db
64147 </literallayout>
64148 <para>
64149 reads the system alias file and creates a DBM version of it in
64150 <filename>/etc/aliases.db</filename>.
64151 </para>
64152 <para>
64153 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
64154 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
64155 environment, the suffixes are added to the second argument of
64156 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
64157 when the Berkeley functions are used in compatibility mode (though this is not
64158 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
64159 </para>
64160 <para>
64161 If a duplicate key is encountered, the program outputs a warning, and when it
64162 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
64163 option is used. By default, only the first of a set of duplicates is used &ndash;
64164 this makes it compatible with <command>lsearch</command> lookups. There is an option
64165 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
64166 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
64167 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
64168 return code is 2.
64169 </para>
64170 </section>
64171 <section id="SECTfinindret">
64172 <title>Finding individual retry times (exinext)</title>
64173 <para>
64174 <indexterm role="concept">
64175 <primary>retry</primary>
64176 <secondary>times</secondary>
64177 </indexterm>
64178 <indexterm role="concept">
64179 <primary><emphasis>exinext</emphasis></primary>
64180 </indexterm>
64181 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
64182 fish specific information out of the retry database. Given a mail domain (or a
64183 complete address), it looks up the hosts for that domain, and outputs any retry
64184 information for the hosts or for the domain. At present, the retry information
64185 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
64186 output. For example:
64187 </para>
64188 <literallayout class="monospaced">
64189 $ exinext piglet@milne.fict.example
64190 kanga.milne.example:192.168.8.1 error 146: Connection refused
64191   first failed: 21-Feb-1996 14:57:34
64192   last tried:   21-Feb-1996 14:57:34
64193   next try at:  21-Feb-1996 15:02:34
64194 roo.milne.example:192.168.8.3 error 146: Connection refused
64195   first failed: 20-Jan-1996 13:12:08
64196   last tried:   21-Feb-1996 11:42:03
64197   next try at:  21-Feb-1996 19:42:03
64198   past final cutoff time
64199 </literallayout>
64200 <para>
64201 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
64202 will give any retry information for that local part in your default domain.
64203 A message id can be used to obtain retry information pertaining to a specific
64204 message. This exists only when an attempt to deliver a message to a remote host
64205 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
64206 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
64207 run very often.
64208 </para>
64209 <para>
64210 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
64211 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
64212 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
64213 configuration file, and the second sets macros for use within the configuration
64214 file. These features are mainly to help in testing, but might also be useful in
64215 environments where more than one configuration file is in use.
64216 </para>
64217 </section>
64218 <section id="SECThindatmai">
64219 <title>Hints database maintenance</title>
64220 <para>
64221 <indexterm role="concept">
64222 <primary>hints database</primary>
64223 <secondary>maintenance</secondary>
64224 </indexterm>
64225 <indexterm role="concept">
64226 <primary>maintaining Exim&#x2019;s hints database</primary>
64227 </indexterm>
64228 Three utility programs are provided for maintaining the DBM files that Exim
64229 uses to contain its delivery hint information. Each program requires two
64230 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
64231 second is the name of the database it is to operate on. These are as follows:
64232 </para>
64233 <itemizedlist>
64234 <listitem>
64235 <para>
64236 <emphasis>retry</emphasis>: the database of retry information
64237 </para>
64238 </listitem>
64239 <listitem>
64240 <para>
64241 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
64242 for remote hosts
64243 </para>
64244 </listitem>
64245 <listitem>
64246 <para>
64247 <emphasis>callout</emphasis>: the callout cache
64248 </para>
64249 </listitem>
64250 <listitem>
64251 <para>
64252 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
64253 </para>
64254 </listitem>
64255 <listitem>
64256 <para>
64257 <emphasis>misc</emphasis>: other hints data
64258 </para>
64259 </listitem>
64260 </itemizedlist>
64261 <para>
64262 The <emphasis>misc</emphasis> database is used for
64263 </para>
64264 <itemizedlist>
64265 <listitem>
64266 <para>
64267 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
64268 </para>
64269 </listitem>
64270 <listitem>
64271 <para>
64272 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
64273 <command>smtp</command> transport)
64274 </para>
64275 </listitem>
64276 </itemizedlist>
64277 </section>
64278 <section id="SECID261">
64279 <title>exim_dumpdb</title>
64280 <para>
64281 <indexterm role="concept">
64282 <primary><emphasis>exim_dumpdb</emphasis></primary>
64283 </indexterm>
64284 The entire contents of a database are written to the standard output by the
64285 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
64286 spool and database names. For example, to dump the retry database:
64287 </para>
64288 <literallayout class="monospaced">
64289 exim_dumpdb /var/spool/exim retry
64290 </literallayout>
64291 <para>
64292 Two lines of output are produced for each entry:
64293 </para>
64294 <literallayout class="monospaced">
64295 T:mail.ref.example:192.168.242.242 146 77 Connection refused
64296 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
64297 </literallayout>
64298 <para>
64299 The first item on the first line is the key of the record. It starts with one
64300 of the letters R, or T, depending on whether it refers to a routing or
64301 transport retry. For a local delivery, the next part is the local address; for
64302 a remote delivery it is the name of the remote host, followed by its failing IP
64303 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
64304 transport). If the remote port is not the standard one (port 25), it is added
64305 to the IP address. Then there follows an error code, an additional error code,
64306 and a textual description of the error.
64307 </para>
64308 <para>
64309 The three times on the second line are the time of first failure, the time of
64310 the last delivery attempt, and the computed time for the next attempt. The line
64311 ends with an asterisk if the cutoff time for the last retry rule has been
64312 exceeded.
64313 </para>
64314 <para>
64315 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
64316 consists of a host name followed by a list of ids for messages that are or were
64317 waiting to be delivered to that host. If there are a very large number for any
64318 one host, continuation records, with a sequence number added to the host name,
64319 may be seen. The data in these records is often out of date, because a message
64320 may be routed to several alternative hosts, and Exim makes no effort to keep
64321 cross-references.
64322 </para>
64323 </section>
64324 <section id="SECID262">
64325 <title>exim_tidydb</title>
64326 <para>
64327 <indexterm role="concept">
64328 <primary><emphasis>exim_tidydb</emphasis></primary>
64329 </indexterm>
64330 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
64331 database. If run with no options, it removes all records that are more than 30
64332 days old. The age is calculated from the date and time that the record was last
64333 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
64334 since the first delivery failure. Information about a host that has been down
64335 for more than 30 days will remain in the database, provided that the record is
64336 updated sufficiently often.
64337 </para>
64338 <para>
64339 The cutoff date can be altered by means of the <option>-t</option> option, which must be
64340 followed by a time. For example, to remove all records older than a week from
64341 the retry database:
64342 </para>
64343 <literallayout class="monospaced">
64344 exim_tidydb -t 7d /var/spool/exim retry
64345 </literallayout>
64346 <para>
64347 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
64348 message ids. In the former these appear as data in records keyed by host &ndash;
64349 they were messages that were waiting for that host &ndash; and in the latter they
64350 are the keys for retry information for messages that have suffered certain
64351 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
64352 message ids in database records are those of messages that are still on the
64353 queue. Message ids for messages that no longer exist are removed from
64354 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
64355 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
64356 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
64357 whenever it removes information from the database.
64358 </para>
64359 <para>
64360 Certain records are automatically removed by Exim when they are no longer
64361 needed, but others are not. For example, if all the MX hosts for a domain are
64362 down, a retry record is created for each one. If the primary MX host comes back
64363 first, its record is removed when Exim successfully delivers to it, but the
64364 records for the others remain because Exim has not tried to use those hosts.
64365 </para>
64366 <para>
64367 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
64368 hints databases. You should do this at a quiet time of day, because it requires
64369 a database to be locked (and therefore inaccessible to Exim) while it does its
64370 work. Removing records from a DBM file does not normally make the file smaller,
64371 but all the common DBM libraries are able to re-use the space that is released.
64372 After an initial phase of increasing in size, the databases normally reach a
64373 point at which they no longer get any bigger, as long as they are regularly
64374 tidied.
64375 </para>
64376 <para>
64377 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
64378 databases is likely to keep on increasing.
64379 </para>
64380 </section>
64381 <section id="SECID263">
64382 <title>exim_fixdb</title>
64383 <para>
64384 <indexterm role="concept">
64385 <primary><emphasis>exim_fixdb</emphasis></primary>
64386 </indexterm>
64387 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
64388 Its main use is for testing Exim, but it might also be occasionally useful for
64389 getting round problems in a live system. It has no options, and its interface
64390 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
64391 key of a database record can then be entered, and the data for that record is
64392 displayed.
64393 </para>
64394 <para>
64395 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
64396 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
64397 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
64398 data for individual fields can be changed by typing the field number followed
64399 by new data, for example:
64400 </para>
64401 <literallayout class="monospaced">
64402 &gt; 4 951102:1000
64403 </literallayout>
64404 <para>
64405 resets the time of the next delivery attempt. Time values are given as a
64406 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
64407 used as optional separators.
64408 </para>
64409 </section>
64410 <section id="SECTmailboxmaint">
64411 <title>Mailbox maintenance (exim_lock)</title>
64412 <para>
64413 <indexterm role="concept">
64414 <primary>mailbox</primary>
64415 <secondary>maintenance</secondary>
64416 </indexterm>
64417 <indexterm role="concept">
64418 <primary><emphasis>exim_lock</emphasis></primary>
64419 </indexterm>
64420 <indexterm role="concept">
64421 <primary>locking mailboxes</primary>
64422 </indexterm>
64423 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
64424 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
64425 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
64426 a user agent while investigating a problem. The utility requires the name of
64427 the file as its first argument. If the locking is successful, the second
64428 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
64429 second argument, the value of the SHELL environment variable is used; if this
64430 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
64431 is unlocked and the utility ends. The following options are available:
64432 </para>
64433 <variablelist>
64434 <varlistentry>
64435 <term><option>-fcntl</option></term>
64436 <listitem>
64437 <para>
64438 Use <function>fcntl()</function> locking on the open mailbox.
64439 </para>
64440 </listitem></varlistentry>
64441 <varlistentry>
64442 <term><option>-flock</option></term>
64443 <listitem>
64444 <para>
64445 Use <function>flock()</function> locking on the open mailbox, provided the operating system
64446 supports it.
64447 </para>
64448 </listitem></varlistentry>
64449 <varlistentry>
64450 <term><option>-interval</option></term>
64451 <listitem>
64452 <para>
64453 This must be followed by a number, which is a number of seconds; it sets the
64454 interval to sleep between retries (default 3).
64455 </para>
64456 </listitem></varlistentry>
64457 <varlistentry>
64458 <term><option>-lockfile</option></term>
64459 <listitem>
64460 <para>
64461 Create a lock file before opening the mailbox.
64462 </para>
64463 </listitem></varlistentry>
64464 <varlistentry>
64465 <term><option>-mbx</option></term>
64466 <listitem>
64467 <para>
64468 Lock the mailbox using MBX rules.
64469 </para>
64470 </listitem></varlistentry>
64471 <varlistentry>
64472 <term><option>-q</option></term>
64473 <listitem>
64474 <para>
64475 Suppress verification output.
64476 </para>
64477 </listitem></varlistentry>
64478 <varlistentry>
64479 <term><option>-retries</option></term>
64480 <listitem>
64481 <para>
64482 This must be followed by a number; it sets the number of times to try to get
64483 the lock (default 10).
64484 </para>
64485 </listitem></varlistentry>
64486 <varlistentry>
64487 <term><option>-restore_time</option></term>
64488 <listitem>
64489 <para>
64490 This option causes <option>exim_lock</option> to restore the modified and read times to the
64491 locked file before exiting. This allows you to access a locked mailbox (for
64492 example, to take a backup copy) without disturbing the times that the user
64493 subsequently sees.
64494 </para>
64495 </listitem></varlistentry>
64496 <varlistentry>
64497 <term><option>-timeout</option></term>
64498 <listitem>
64499 <para>
64500 This must be followed by a number, which is a number of seconds; it sets a
64501 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
64502 default), a non-blocking call is used.
64503 </para>
64504 </listitem></varlistentry>
64505 <varlistentry>
64506 <term><option>-v</option></term>
64507 <listitem>
64508 <para>
64509 Generate verbose output.
64510 </para>
64511 </listitem></varlistentry>
64512 </variablelist>
64513 <para>
64514 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
64515 default is to create a lock file and also to use <function>fcntl()</function> locking on the
64516 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
64517 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
64518 requires that the directory containing the file be writeable. Locking by lock
64519 file does not last for ever; Exim assumes that a lock file is expired if it is
64520 more than 30 minutes old.
64521 </para>
64522 <para>
64523 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
64524 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
64525 to be taken out on the open mailbox, and an exclusive lock on the file
64526 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
64527 number of the mailbox file. When the locking is released, if an exclusive lock
64528 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
64529 </para>
64530 <para>
64531 The default output contains verification of the locking that takes place. The
64532 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
64533 suppresses all output except error messages.
64534 </para>
64535 <para>
64536 A command such as
64537 </para>
64538 <literallayout class="monospaced">
64539 exim_lock /var/spool/mail/spqr
64540 </literallayout>
64541 <para>
64542 runs an interactive shell while the file is locked, whereas
64543 </para>
64544 <literallayout>
64545 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
64546 &lt;<emphasis>some commands</emphasis>&gt;
64547 <literal>End</literal>
64548 </literallayout>
64549 <para>
64550 runs a specific non-interactive sequence of commands while the file is locked,
64551 suppressing all verification output. A single command can be run by a command
64552 such as
64553 </para>
64554 <literallayout class="monospaced">
64555 exim_lock -q /var/spool/mail/spqr \
64556   "cp /var/spool/mail/spqr /some/where"
64557 </literallayout>
64558 <para>
64559 Note that if a command is supplied, it must be entirely contained within the
64560 second argument &ndash; hence the quotes.
64561 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
64562 </para>
64563 </section>
64564 </chapter>
64565
64566 <chapter id="CHAPeximon">
64567 <title>The Exim monitor</title>
64568 <para>
64569 <indexterm role="concept" id="IIDeximon" class="startofrange">
64570 <primary>Exim monitor</primary>
64571 <secondary>description</secondary>
64572 </indexterm>
64573 <indexterm role="concept">
64574 <primary>X-windows</primary>
64575 </indexterm>
64576 <indexterm role="concept">
64577 <primary><emphasis>eximon</emphasis></primary>
64578 </indexterm>
64579 <indexterm role="concept">
64580 <primary>Local/eximon.conf</primary>
64581 </indexterm>
64582 <indexterm role="concept">
64583 <primary><filename>exim_monitor/EDITME</filename></primary>
64584 </indexterm>
64585 The Exim monitor is an application which displays in an X window information
64586 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
64587 perform certain operations on messages from this GUI interface; however all
64588 such facilities are also available from the command line, and indeed, the
64589 monitor itself makes use of the command line to perform any actions requested.
64590 </para>
64591 <section id="SECID264">
64592 <title>Running the monitor</title>
64593 <para>
64594 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
64595 script that sets up a number of environment variables, and then runs the
64596 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
64597 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
64598 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
64599 parameters are for.
64600 </para>
64601 <para>
64602 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
64603 a particular invocation by setting up environment variables of the same names,
64604 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
64605 </para>
64606 <literallayout class="monospaced">
64607 EXIMON_LOG_DEPTH=400 eximon
64608 </literallayout>
64609 <para>
64610 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
64611 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
64612 overrides the Exim log file configuration. This makes it possible to have
64613 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
64614 syslog messages are routed to a file on the local host.
64615 </para>
64616 <para>
64617 X resources can be used to change the appearance of the window in the normal
64618 way. For example, a resource setting of the form
64619 </para>
64620 <literallayout class="monospaced">
64621 Eximon*background: gray94
64622 </literallayout>
64623 <para>
64624 changes the colour of the background to light grey rather than white. The
64625 stripcharts are drawn with both the data lines and the reference lines in
64626 black. This means that the reference lines are not visible when on top of the
64627 data. However, their colour can be changed by setting a resource called
64628 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
64629 For example, if your X server is running Unix, you could set up lighter
64630 reference lines in the stripcharts by obeying
64631 </para>
64632 <literallayout class="monospaced">
64633 xrdb -merge &lt;&lt;End
64634 Eximon*highlight: gray
64635 End
64636 </literallayout>
64637 <para>
64638 <indexterm role="concept">
64639 <primary>admin user</primary>
64640 </indexterm>
64641 In order to see the contents of messages on the queue, and to operate on them,
64642 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
64643 </para>
64644 <para>
64645 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
64646 contain X11 resource parameters interpreted by the X11 library.  In addition,
64647 if the first parameter starts with the string "gdb" then it is removed and the
64648 binary is invoked under gdb (the parameter is used as the gdb command-name, so
64649 versioned variants of gdb can be invoked).
64650 </para>
64651 <para>
64652 The monitor&#x2019;s window is divided into three parts. The first contains one or
64653 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
64654 main log file, and the third is a display of the queue of messages awaiting
64655 delivery, with two more action buttons. The following sections describe these
64656 different parts of the display.
64657 </para>
64658 </section>
64659 <section id="SECID265">
64660 <title>The stripcharts</title>
64661 <para>
64662 <indexterm role="concept">
64663 <primary>stripchart</primary>
64664 </indexterm>
64665 The first stripchart is always a count of messages on the queue. Its name can
64666 be configured by setting QUEUE_STRIPCHART_NAME in the
64667 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
64668 configuration script by regular expression matches on log file entries, making
64669 it possible to display, for example, counts of messages delivered to certain
64670 hosts or using certain transports. The supplied defaults display counts of
64671 received and delivered messages, and of local and SMTP deliveries. The default
64672 period between stripchart updates is one minute; this can be adjusted by a
64673 parameter in the <filename>Local/eximon.conf</filename> file.
64674 </para>
64675 <para>
64676 The stripchart displays rescale themselves automatically as the value they are
64677 displaying changes. There are always 10 horizontal lines in each chart; the
64678 title string indicates the value of each division when it is greater than one.
64679 For example, <quote>x2</quote> means that each division represents a value of 2.
64680 </para>
64681 <para>
64682 It is also possible to have a stripchart which shows the percentage fullness of
64683 a particular disk partition, which is useful when local deliveries are confined
64684 to a single partition.
64685 </para>
64686 <para>
64687 <indexterm role="concept">
64688 <primary><option>statvfs</option> function</primary>
64689 </indexterm>
64690 This relies on the availability of the <function>statvfs()</function> function or equivalent in
64691 the operating system. Most, but not all versions of Unix that support Exim have
64692 this. For this particular stripchart, the top of the chart always represents
64693 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
64694 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
64695 <filename>Local/eximon.conf</filename> file.
64696 </para>
64697 </section>
64698 <section id="SECID266">
64699 <title>Main action buttons</title>
64700 <para>
64701 <indexterm role="concept">
64702 <primary>size</primary>
64703 <secondary>of monitor window</secondary>
64704 </indexterm>
64705 <indexterm role="concept">
64706 <primary>Exim monitor</primary>
64707 <secondary>window size</secondary>
64708 </indexterm>
64709 <indexterm role="concept">
64710 <primary>window size</primary>
64711 </indexterm>
64712 Below the stripcharts there is an action button for quitting the monitor. Next
64713 to this is another button marked <quote>Size</quote>. They are placed here so that
64714 shrinking the window to its default minimum size leaves just the queue count
64715 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
64716 the window to expand to its maximum size, unless it is already at the maximum,
64717 in which case it is reduced to its minimum.
64718 </para>
64719 <para>
64720 When expanding to the maximum, if the window cannot be fully seen where it
64721 currently is, it is moved back to where it was the last time it was at full
64722 size. When it is expanding from its minimum size, the old position is
64723 remembered, and next time it is reduced to the minimum it is moved back there.
64724 </para>
64725 <para>
64726 The idea is that you can keep a reduced window just showing one or two
64727 stripcharts at a convenient place on your screen, easily expand it to show
64728 the full window when required, and just as easily put it back to what it was.
64729 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
64730 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
64731 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
64732 </para>
64733 <para>
64734 Normally, the monitor starts up with the window at its full size, but it can be
64735 built so that it starts up with the window at its smallest size, by setting
64736 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
64737 </para>
64738 </section>
64739 <section id="SECID267">
64740 <title>The log display</title>
64741 <para>
64742 <indexterm role="concept">
64743 <primary>log</primary>
64744 <secondary>tail of; in monitor</secondary>
64745 </indexterm>
64746 The second section of the window is an area in which a display of the tail of
64747 the main log is maintained.
64748 To save space on the screen, the timestamp on each log line is shortened by
64749 removing the date and, if <option>log_timezone</option> is set, the timezone.
64750 The log tail is not available when the only destination for logging data is
64751 syslog, unless the syslog lines are routed to a local file whose name is passed
64752 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
64753 </para>
64754 <para>
64755 The log sub-window has a scroll bar at its lefthand side which can be used to
64756 move back to look at earlier text, and the up and down arrow keys also have a
64757 scrolling effect. The amount of log that is kept depends on the setting of
64758 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
64759 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
64760 much more efficient than throwing it away line by line. The sub-window also has
64761 a horizontal scroll bar for accessing the ends of long log lines. This is the
64762 only means of horizontal scrolling; the right and left arrow keys are not
64763 available. Text can be cut from this part of the window using the mouse in the
64764 normal way. The size of this subwindow is controlled by parameters in the
64765 configuration file <filename>Local/eximon.conf</filename>.
64766 </para>
64767 <para>
64768 Searches of the text in the log window can be carried out by means of the ^R
64769 and ^S keystrokes, which default to a reverse and a forward search,
64770 respectively. The search covers only the text that is displayed in the window.
64771 It cannot go further back up the log.
64772 </para>
64773 <para>
64774 The point from which the search starts is indicated by a caret marker. This is
64775 normally at the end of the text in the window, but can be positioned explicitly
64776 by pointing and clicking with the left mouse button, and is moved automatically
64777 by a successful search. If new text arrives in the window when it is scrolled
64778 back, the caret remains where it is, but if the window is not scrolled back,
64779 the caret is moved to the end of the new text.
64780 </para>
64781 <para>
64782 Pressing ^R or ^S pops up a window into which the search text can be typed.
64783 There are buttons for selecting forward or reverse searching, for carrying out
64784 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
64785 happens and the window remains so that further searches can be done. If the
64786 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
64787 ^C is typed the search is cancelled.
64788 </para>
64789 <para>
64790 The searching facility is implemented using the facilities of the Athena text
64791 widget. By default this pops up a window containing both <quote>search</quote> and
64792 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
64793 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
64794 However, the linkers in BSDI and HP-UX seem unable to handle an externally
64795 provided version of <option>TextPop</option> when the remaining parts of the text widget
64796 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
64797 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
64798 on these systems, at the expense of having unwanted items in the search popup
64799 window.
64800 </para>
64801 </section>
64802 <section id="SECID268">
64803 <title>The queue display</title>
64804 <para>
64805 <indexterm role="concept">
64806 <primary>queue</primary>
64807 <secondary>display in monitor</secondary>
64808 </indexterm>
64809 The bottom section of the monitor window contains a list of all messages that
64810 are on the queue, which includes those currently being received or delivered,
64811 as well as those awaiting delivery. The size of this subwindow is controlled by
64812 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
64813 at which it is updated is controlled by another parameter in the same file &ndash;
64814 the default is 5 minutes, since queue scans can be quite expensive. However,
64815 there is an <quote>Update</quote> action button just above the display which can be used
64816 to force an update of the queue display at any time.
64817 </para>
64818 <para>
64819 When a host is down for some time, a lot of pending mail can build up for it,
64820 and this can make it hard to deal with other messages on the queue. To help
64821 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
64822 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
64823 type anything in here and press <quote>Return</quote>, the text is added to a chain of
64824 such texts, and if every undelivered address in a message matches at least one
64825 of the texts, the message is not displayed.
64826 </para>
64827 <para>
64828 If there is an address that does not match any of the texts, all the addresses
64829 are displayed as normal. The matching happens on the ends of addresses so, for
64830 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
64831 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
64832 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
64833 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
64834 a hide request is automatically cancelled after one hour.
64835 </para>
64836 <para>
64837 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
64838 else to the monitor window. For this reason, if you want to cut text from the
64839 queue display to use in the dialogue box, you have to do the cutting before
64840 pressing the <quote>Hide</quote> button.
64841 </para>
64842 <para>
64843 The queue display contains, for each unhidden queued message, the length of
64844 time it has been on the queue, the size of the message, the message id, the
64845 message sender, and the first undelivered recipient, all on one line. If it is
64846 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
64847 recipient to which the message has not yet been delivered, subsequent ones are
64848 listed on additional lines, up to a maximum configured number, following which
64849 an ellipsis is displayed. Recipients that have already received the message are
64850 not shown.
64851 </para>
64852 <para>
64853 <indexterm role="concept">
64854 <primary>frozen messages</primary>
64855 <secondary>display</secondary>
64856 </indexterm>
64857 If a message is frozen, an asterisk is displayed at the left-hand side.
64858 </para>
64859 <para>
64860 The queue display has a vertical scroll bar, and can also be scrolled by means
64861 of the arrow keys. Text can be cut from it using the mouse in the normal way.
64862 The text searching facilities, as described above for the log window, are also
64863 available, but the caret is always moved to the end of the text when the queue
64864 display is updated.
64865 </para>
64866 </section>
64867 <section id="SECID269">
64868 <title>The queue menu</title>
64869 <para>
64870 <indexterm role="concept">
64871 <primary>queue</primary>
64872 <secondary>menu in monitor</secondary>
64873 </indexterm>
64874 If the <option>shift</option> key is held down and the left button is clicked when the mouse
64875 pointer is over the text for any message, an action menu pops up, and the first
64876 line of the queue display for the message is highlighted. This does not affect
64877 any selected text.
64878 </para>
64879 <para>
64880 If you want to use some other event for popping up the menu, you can set the
64881 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
64882 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
64883 value set in this parameter is a standard X event description. For example, to
64884 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
64885 </para>
64886 <literallayout class="monospaced">
64887 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
64888 </literallayout>
64889 <para>
64890 The title of the menu is the message id, and it contains entries which act as
64891 follows:
64892 </para>
64893 <itemizedlist>
64894 <listitem>
64895 <para>
64896 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
64897 in a new text window.
64898 </para>
64899 </listitem>
64900 <listitem>
64901 <para>
64902 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
64903 information and headers is displayed in a new text window. See chapter
64904 <xref linkend="CHAPspool"/> for a description of the format of spool files.
64905 </para>
64906 </listitem>
64907 <listitem>
64908 <para>
64909 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
64910 displayed in a new text window. There is a default limit of 20,000 bytes to the
64911 amount of data displayed. This can be changed by setting the BODY_MAX
64912 option at compile time, or the EXIMON_BODY_MAX option at run time.
64913 </para>
64914 </listitem>
64915 <listitem>
64916 <para>
64917 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
64918 delivery of the message. This causes an automatic thaw if the message is
64919 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
64920 a new text window. The delivery is run in a separate process, to avoid holding
64921 up the monitor while the delivery proceeds.
64922 </para>
64923 </listitem>
64924 <listitem>
64925 <para>
64926 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
64927 that the message be frozen.
64928 </para>
64929 </listitem>
64930 <listitem>
64931 <para>
64932 <indexterm role="concept">
64933 <primary>thawing messages</primary>
64934 </indexterm>
64935 <indexterm role="concept">
64936 <primary>unfreezing messages</primary>
64937 </indexterm>
64938 <indexterm role="concept">
64939 <primary>frozen messages</primary>
64940 <secondary>thawing</secondary>
64941 </indexterm>
64942 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
64943 that the message be thawed.
64944 </para>
64945 </listitem>
64946 <listitem>
64947 <para>
64948 <indexterm role="concept">
64949 <primary>delivery</primary>
64950 <secondary>forcing failure</secondary>
64951 </indexterm>
64952 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
64953 that Exim gives up trying to deliver the message. A bounce message is generated
64954 for any remaining undelivered addresses.
64955 </para>
64956 </listitem>
64957 <listitem>
64958 <para>
64959 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
64960 that the message be deleted from the system without generating a bounce
64961 message.
64962 </para>
64963 </listitem>
64964 <listitem>
64965 <para>
64966 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
64967 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
64968 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
64969 Otherwise it must be entered as a fully qualified address. Pressing RETURN
64970 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
64971 additional recipient be added to the message, unless the entry box is empty, in
64972 which case no action is taken.
64973 </para>
64974 </listitem>
64975 <listitem>
64976 <para>
64977 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
64978 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
64979 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
64980 Otherwise it must be entered as a fully qualified address. Pressing RETURN
64981 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
64982 recipient address as already delivered, unless the entry box is empty, in which
64983 case no action is taken.
64984 </para>
64985 </listitem>
64986 <listitem>
64987 <para>
64988 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
64989 mark all recipient addresses as already delivered.
64990 </para>
64991 </listitem>
64992 <listitem>
64993 <para>
64994 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
64995 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
64996 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
64997 in which case no action is taken. If you want to set an empty sender (as in
64998 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
64999 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
65000 the address is qualified with that domain.
65001 </para>
65002 </listitem>
65003 </itemizedlist>
65004 <para>
65005 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
65006 other cases when a call to Exim is made, if there is any output from Exim (in
65007 particular, if the command fails) a window containing the command and the
65008 output is displayed. Otherwise, the results of the action are normally apparent
65009 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
65010 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
65011 if no output is generated.
65012 </para>
65013 <para>
65014 The queue display is automatically updated for actions such as freezing and
65015 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
65016 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
65017 force an update of the display after one of these actions.
65018 </para>
65019 <para>
65020 In any text window that is displayed as result of a menu action, the normal
65021 cut-and-paste facility is available, and searching can be carried out using ^R
65022 and ^S, as described above for the log tail window.
65023 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
65024 </para>
65025 </section>
65026 </chapter>
65027
65028 <chapter id="CHAPsecurity">
65029 <title>Security considerations</title>
65030 <para>
65031 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
65032 <primary>security</primary>
65033 <secondary>discussion of</secondary>
65034 </indexterm>
65035 This chapter discusses a number of issues concerned with security, some of
65036 which are also covered in other parts of this manual.
65037 </para>
65038 <para>
65039 For reasons that this author does not understand, some people have promoted
65040 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
65041 existence of this chapter in the documentation. However, the intent of the
65042 chapter is simply to describe the way Exim works in relation to certain
65043 security concerns, not to make any specific claims about the effectiveness of
65044 its security as compared with other MTAs.
65045 </para>
65046 <para>
65047 What follows is a description of the way Exim is supposed to be. Best efforts
65048 have been made to try to ensure that the code agrees with the theory, but an
65049 absence of bugs can never be guaranteed. Any that are reported will get fixed
65050 as soon as possible.
65051 </para>
65052 <section id="SECID286">
65053 <title>Building a more <quote>hardened</quote> Exim</title>
65054 <para>
65055 <indexterm role="concept">
65056 <primary>security</primary>
65057 <secondary>build-time features</secondary>
65058 </indexterm>
65059 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
65060 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
65061 Exim administrator who does not have the root password, or by someone who has
65062 penetrated the Exim (but not the root) account. These options are as follows:
65063 </para>
65064 <itemizedlist>
65065 <listitem>
65066 <para>
65067 ALT_CONFIG_PREFIX can be set to a string that is required to match the
65068 start of any file names used with the <option>-C</option> option. When it is set, these file
65069 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
65070 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
65071 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
65072 default setting for <option>ALT_CONFIG_PREFIX</option>.
65073 </para>
65074 <para>
65075 If the permitted configuration files are confined to a directory to
65076 which only root has access, this guards against someone who has broken
65077 into the Exim account from running a privileged Exim with an arbitrary
65078 configuration file, and using it to break into other accounts.
65079 </para>
65080 </listitem>
65081 <listitem>
65082 <para>
65083 If a non-trusted configuration file (i.e. not the default configuration file
65084 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
65085 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
65086 the next item), then root privilege is retained only if the caller of Exim is
65087 root. This locks out the possibility of testing a configuration using <option>-C</option>
65088 right through message reception and delivery, even if the caller is root. The
65089 reception works, but by that time, Exim is running as the Exim user, so when
65090 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
65091 privilege to be lost. However, root can test reception and delivery using two
65092 separate commands.
65093 </para>
65094 </listitem>
65095 <listitem>
65096 <para>
65097 The WHITELIST_D_MACROS build option declares some macros to be safe to override
65098 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
65099 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
65100 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
65101 the restrictive side.  Requiring build-time selection of safe macros is onerous
65102 but this option is intended solely as a transition mechanism to permit
65103 previously-working configurations to continue to work after release 4.73.
65104 </para>
65105 </listitem>
65106 <listitem>
65107 <para>
65108 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
65109 is disabled.
65110 </para>
65111 </listitem>
65112 <listitem>
65113 <para>
65114 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
65115 never to be used for any deliveries. This is like the <option>never_users</option> runtime
65116 option, but it cannot be overridden; the runtime option adds additional users
65117 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
65118 is permitted to modify the runtime file from using Exim as a way to get root.
65119 </para>
65120 </listitem>
65121 </itemizedlist>
65122 </section>
65123 <section id="SECID270">
65124 <title>Root privilege</title>
65125 <para>
65126 <indexterm role="concept">
65127 <primary>setuid</primary>
65128 </indexterm>
65129 <indexterm role="concept">
65130 <primary>root privilege</primary>
65131 </indexterm>
65132 The Exim binary is normally setuid to root, which means that it gains root
65133 privilege (runs as root) when it starts execution. In some special cases (for
65134 example, when the daemon is not in use and there are no local deliveries), it
65135 may be possible to run Exim setuid to some user other than root. This is
65136 discussed in the next section. However, in most installations, root privilege
65137 is required for two things:
65138 </para>
65139 <itemizedlist>
65140 <listitem>
65141 <para>
65142 To set up a socket connected to the standard SMTP port (25) when initialising
65143 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
65144 not required.
65145 </para>
65146 </listitem>
65147 <listitem>
65148 <para>
65149 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
65150 perform local deliveries as the receiving user or as specified in the
65151 configuration.
65152 </para>
65153 </listitem>
65154 </itemizedlist>
65155 <para>
65156 It is not necessary to be root to do any of the other things Exim does, such as
65157 receiving messages and delivering them externally over SMTP, and it is
65158 obviously more secure if Exim does not run as root except when necessary.
65159 For this reason, a user and group for Exim to use must be defined in
65160 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
65161 group</quote>. Their values can be changed by the run time configuration, though this
65162 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
65163 <emphasis>mail</emphasis> or another user name altogether.
65164 </para>
65165 <para>
65166 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
65167 abdication; the process cannot regain root afterwards. Prior to release 4.00,
65168 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
65169 </para>
65170 <para>
65171 After a new Exim process has interpreted its command line options, it changes
65172 uid and gid in the following cases:
65173 </para>
65174 <itemizedlist>
65175 <listitem>
65176 <para>
65177 <indexterm role="option">
65178 <primary><option>-C</option></primary>
65179 </indexterm>
65180 <indexterm role="option">
65181 <primary><option>-D</option></primary>
65182 </indexterm>
65183 If the <option>-C</option> option is used to specify an alternate configuration file, or if
65184 the <option>-D</option> option is used to define macro values for the configuration, and the
65185 calling process is not running as root, the uid and gid are changed to those of
65186 the calling process.
65187 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
65188 option may not be used at all.
65189 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
65190 can be supplied if the calling process is running as root, the Exim run-time
65191 user or CONFIGURE_OWNER, if defined.
65192 </para>
65193 </listitem>
65194 <listitem>
65195 <para>
65196 <indexterm role="option">
65197 <primary><option>-be</option></primary>
65198 </indexterm>
65199 <indexterm role="option">
65200 <primary><option>-bf</option></primary>
65201 </indexterm>
65202 <indexterm role="option">
65203 <primary><option>-bF</option></primary>
65204 </indexterm>
65205 If the expansion test option (<option>-be</option>) or one of the filter testing options
65206 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
65207 calling process.
65208 </para>
65209 </listitem>
65210 <listitem>
65211 <para>
65212 If the process is not a daemon process or a queue runner process or a delivery
65213 process or a process for testing address routing (started with <option>-bt</option>), the
65214 uid and gid are changed to the Exim user and group. This means that Exim always
65215 runs under its own uid and gid when receiving messages. This also applies when
65216 testing address verification
65217 <indexterm role="option">
65218 <primary><option>-bv</option></primary>
65219 </indexterm>
65220 <indexterm role="option">
65221 <primary><option>-bh</option></primary>
65222 </indexterm>
65223 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
65224 option).
65225 </para>
65226 </listitem>
65227 <listitem>
65228 <para>
65229 For a daemon, queue runner, delivery, or address testing process, the uid
65230 remains as root at this stage, but the gid is changed to the Exim group.
65231 </para>
65232 </listitem>
65233 </itemizedlist>
65234 <para>
65235 The processes that initially retain root privilege behave as follows:
65236 </para>
65237 <itemizedlist>
65238 <listitem>
65239 <para>
65240 A daemon process changes the gid to the Exim group and the uid to the Exim
65241 user after setting up one or more listening sockets. The <function>initgroups()</function>
65242 function is called, so that if the Exim user is in any additional groups, they
65243 will be used during message reception.
65244 </para>
65245 </listitem>
65246 <listitem>
65247 <para>
65248 A queue runner process retains root privilege throughout its execution. Its
65249 job is to fork a controlled sequence of delivery processes.
65250 </para>
65251 </listitem>
65252 <listitem>
65253 <para>
65254 A delivery process retains root privilege throughout most of its execution,
65255 but any actual deliveries (that is, the transports themselves) are run in
65256 subprocesses which always change to a non-root uid and gid. For local
65257 deliveries this is typically the uid and gid of the owner of the mailbox; for
65258 remote deliveries, the Exim uid and gid are used. Once all the delivery
65259 subprocesses have been run, a delivery process changes to the Exim uid and gid
65260 while doing post-delivery tidying up such as updating the retry database and
65261 generating bounce and warning messages.
65262 </para>
65263 <para>
65264 While the recipient addresses in a message are being routed, the delivery
65265 process runs as root. However, if a user&#x2019;s filter file has to be processed,
65266 this is done in a subprocess that runs under the individual user&#x2019;s uid and
65267 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
65268 </para>
65269 </listitem>
65270 <listitem>
65271 <para>
65272 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
65273 the routing is done in the same environment as a message delivery.
65274 </para>
65275 </listitem>
65276 </itemizedlist>
65277 </section>
65278 <section id="SECTrunexiwitpri">
65279 <title>Running Exim without privilege</title>
65280 <para>
65281 <indexterm role="concept">
65282 <primary>privilege, running without</primary>
65283 </indexterm>
65284 <indexterm role="concept">
65285 <primary>unprivileged running</primary>
65286 </indexterm>
65287 <indexterm role="concept">
65288 <primary>root privilege</primary>
65289 <secondary>running without</secondary>
65290 </indexterm>
65291 Some installations like to run Exim in an unprivileged state for more of its
65292 operation, for added security. Support for this mode of operation is provided
65293 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
65294 gid are changed to the Exim user and group at the start of a delivery process
65295 (and also queue runner and address testing processes). This means that address
65296 routing is no longer run as root, and the deliveries themselves cannot change
65297 to any other uid.
65298 </para>
65299 <para>
65300 <indexterm role="concept">
65301 <primary>SIGHUP</primary>
65302 </indexterm>
65303 <indexterm role="concept">
65304 <primary>daemon</primary>
65305 <secondary>restarting</secondary>
65306 </indexterm>
65307 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
65308 that the daemon can still be started in the usual way, and it can respond
65309 correctly to SIGHUP because the re-invocation regains root privilege.
65310 </para>
65311 <para>
65312 An alternative approach is to make Exim setuid to the Exim user and also setgid
65313 to the Exim group. If you do this, the daemon must be started from a root
65314 process. (Calling Exim from a root process makes it behave in the way it does
65315 when it is setuid root.) However, the daemon cannot restart itself after a
65316 SIGHUP signal because it cannot regain privilege.
65317 </para>
65318 <para>
65319 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
65320 stops Exim from trying to re-invoke itself to do a delivery after a message has
65321 been received. Such a re-invocation is a waste of resources because it has no
65322 effect.
65323 </para>
65324 <para>
65325 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
65326 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
65327 to the Exim user seems a clean approach, but there is one complication:
65328 </para>
65329 <para>
65330 In this style of operation, Exim is running with the real uid and gid set to
65331 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
65332 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
65333 that is, the real uid/gid should be reset to the effective values so as to
65334 discard any privileges that the caller may have. While some operating systems
65335 have a function that permits this action for a non-root effective uid, quite a
65336 number of them do not. Because of this lack of standardization, Exim does not
65337 address this problem at this time.
65338 </para>
65339 <para>
65340 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
65341 is to keep the Exim binary setuid to root, and to set
65342 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
65343 be used in the most straightforward way.
65344 </para>
65345 <para>
65346 If you configure Exim not to run delivery processes as root, there are a
65347 number of restrictions on what you can do:
65348 </para>
65349 <itemizedlist>
65350 <listitem>
65351 <para>
65352 You can deliver only as the Exim user/group. You should  explicitly use the
65353 <option>user</option> and <option>group</option> options to override routers or local transports that
65354 normally deliver as the recipient. This makes sure that configurations that
65355 work in this mode function the same way in normal mode. Any implicit or
65356 explicit specification of another user causes an error.
65357 </para>
65358 </listitem>
65359 <listitem>
65360 <para>
65361 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
65362 not worthwhile to include them in the configuration.
65363 </para>
65364 </listitem>
65365 <listitem>
65366 <para>
65367 Users who wish to use <filename>.forward</filename> would have to make their home directory and
65368 the file itself accessible to the Exim user. Pipe and append-to-file entries,
65369 and their equivalents in Exim filters, cannot be used. While they could be
65370 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
65371 </para>
65372 </listitem>
65373 <listitem>
65374 <para>
65375 Unless the local user mailboxes are all owned by the Exim user (possible in
65376 some POP3 or IMAP-only environments):
65377 </para>
65378 <orderedlist numeration="arabic">
65379 <listitem>
65380 <para>
65381 They must be owned by the Exim group and be writeable by that group. This
65382 implies you must set <option>mode</option> in the appendfile configuration, as well as the
65383 mode of the mailbox files themselves.
65384 </para>
65385 </listitem>
65386 <listitem>
65387 <para>
65388 You must set <option>no_check_owner</option>, since most or all of the files will not be
65389 owned by the Exim user.
65390 </para>
65391 </listitem>
65392 <listitem>
65393 <para>
65394 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
65395 on a newly created mailbox when unprivileged. This also implies that new
65396 mailboxes need to be created manually.
65397 </para>
65398 </listitem>
65399 </orderedlist>
65400 </listitem>
65401 </itemizedlist>
65402 <para>
65403 These restrictions severely restrict what can be done in local deliveries.
65404 However, there are no restrictions on remote deliveries. If you are running a
65405 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
65406 gives more security at essentially no cost.
65407 </para>
65408 <para>
65409 If you are using the <option>mua_wrapper</option> facility (see chapter
65410 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
65411 </para>
65412 </section>
65413 <section id="SECID271">
65414 <title>Delivering to local files</title>
65415 <para>
65416 Full details of the checks applied by <command>appendfile</command> before it writes to a file
65417 are given in chapter <xref linkend="CHAPappendfile"/>.
65418 </para>
65419 </section>
65420 <section id="SECTsecconslocalcmds">
65421 <title>Running local commands</title>
65422 <para>
65423 <indexterm role="concept">
65424 <primary>security</primary>
65425 <secondary>local commands</secondary>
65426 </indexterm>
65427 <indexterm role="concept">
65428 <primary>security</primary>
65429 <secondary>command injection attacks</secondary>
65430 </indexterm>
65431 There are a number of ways in which an administrator can configure Exim to run
65432 commands based upon received, untrustworthy, data. Further, in some
65433 configurations a user who can control a <filename>.forward</filename> file can also arrange to
65434 run commands. Configuration to check includes, but is not limited to:
65435 </para>
65436 <itemizedlist>
65437 <listitem>
65438 <para>
65439 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
65440 injection may be possible with this option present. It is dangerous and should
65441 be used only with considerable caution. Consider constraints which whitelist
65442 allowed characters in a variable which is to be used in a pipe transport that
65443 has <option>use_shell</option> enabled.
65444 </para>
65445 </listitem>
65446 <listitem>
65447 <para>
65448 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
65449 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
65450 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
65451 hub to which ordinary users do not have shell access, but home directories are
65452 NFS mounted (for instance) then administrators should review the list of these
65453 forbid options available, and should bear in mind that the options that may
65454 need forbidding can change as new features are added between releases.
65455 </para>
65456 </listitem>
65457 <listitem>
65458 <para>
65459 The <option>${run...}</option> expansion item does not use a shell by default, but
65460 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
65461 Such invocations should be viewed with prejudicial suspicion.
65462 </para>
65463 </listitem>
65464 <listitem>
65465 <para>
65466 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
65467 taint checking might apply to their usage.
65468 </para>
65469 </listitem>
65470 <listitem>
65471 <para>
65472 Use of <option>${expand...}</option> is somewhat analagous to shell&#x2019;s eval builtin and
65473 administrators are well advised to view its use with suspicion, in case (for
65474 instance) it allows a local-part to contain embedded Exim directives.
65475 </para>
65476 </listitem>
65477 <listitem>
65478 <para>
65479 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
65480 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
65481 each can reference arbitrary lists and files, rather than just being a list
65482 of opaque strings.
65483 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
65484 real-world security vulnerabilities caused by its use with untrustworthy data
65485 injected in, for SQL injection attacks.
65486 Consider the use of the <option>inlisti</option> expansion condition instead.
65487 </para>
65488 </listitem>
65489 </itemizedlist>
65490 </section>
65491 <section id="SECTsecconfdata">
65492 <title>Trust in configuration data</title>
65493 <para>
65494 <indexterm role="concept">
65495 <primary>security</primary>
65496 <secondary>data sources</secondary>
65497 </indexterm>
65498 <indexterm role="concept">
65499 <primary>security</primary>
65500 <secondary>regular expressions</secondary>
65501 </indexterm>
65502 <indexterm role="concept">
65503 <primary>regular expressions</primary>
65504 <secondary>security</secondary>
65505 </indexterm>
65506 <indexterm role="concept">
65507 <primary>PCRE</primary>
65508 <secondary>security</secondary>
65509 </indexterm>
65510 If configuration data for Exim can come from untrustworthy sources, there
65511 are some issues to be aware of:
65512 </para>
65513 <itemizedlist>
65514 <listitem>
65515 <para>
65516 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
65517 </para>
65518 </listitem>
65519 <listitem>
65520 <para>
65521 Letting untrusted data provide a regular expression is unwise.
65522 </para>
65523 </listitem>
65524 <listitem>
65525 <para>
65526 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
65527 data may result in pathological behaviour within PCRE.  Be aware of what
65528 "backtracking" means and consider options for being more strict with a regular
65529 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
65530 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
65531 possessive quantifiers or just not using regular expressions against untrusted
65532 data.
65533 </para>
65534 </listitem>
65535 <listitem>
65536 <para>
65537 It can be important to correctly use <option>${quote:...}</option>,
65538 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
65539 items to ensure that data is correctly constructed.
65540 </para>
65541 </listitem>
65542 <listitem>
65543 <para>
65544 Some lookups might return multiple results, even though normal usage is only
65545 expected to yield one result.
65546 </para>
65547 </listitem>
65548 </itemizedlist>
65549 </section>
65550 <section id="SECID272">
65551 <title>IPv4 source routing</title>
65552 <para>
65553 <indexterm role="concept">
65554 <primary>source routing</primary>
65555 <secondary>in IP packets</secondary>
65556 </indexterm>
65557 <indexterm role="concept">
65558 <primary>IP source routing</primary>
65559 </indexterm>
65560 Many operating systems suppress IP source-routed packets in the kernel, but
65561 some cannot be made to do this, so Exim does its own check. It logs incoming
65562 IPv4 source-routed TCP calls, and then drops them. Things are all different in
65563 IPv6. No special checking is currently done.
65564 </para>
65565 </section>
65566 <section id="SECID273">
65567 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
65568 <para>
65569 Support for these SMTP commands is disabled by default. If required, they can
65570 be enabled by defining suitable ACLs.
65571 </para>
65572 </section>
65573 <section id="SECID274">
65574 <title>Privileged users</title>
65575 <para>
65576 <indexterm role="concept">
65577 <primary>trusted users</primary>
65578 </indexterm>
65579 <indexterm role="concept">
65580 <primary>admin user</primary>
65581 </indexterm>
65582 <indexterm role="concept">
65583 <primary>privileged user</primary>
65584 </indexterm>
65585 <indexterm role="concept">
65586 <primary>user</primary>
65587 <secondary>trusted</secondary>
65588 </indexterm>
65589 <indexterm role="concept">
65590 <primary>user</primary>
65591 <secondary>admin</secondary>
65592 </indexterm>
65593 Exim recognizes two sets of users with special privileges. Trusted users are
65594 able to submit new messages to Exim locally, but supply their own sender
65595 addresses and information about a sending host. For other users submitting
65596 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
65597 permit a remote host to be specified.
65598 </para>
65599 <para>
65600 <indexterm role="option">
65601 <primary><option>-f</option></primary>
65602 </indexterm>
65603 However, an untrusted user is permitted to use the <option>-f</option> command line option
65604 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
65605 message should not cause an error report. This affects the message&#x2019;s envelope,
65606 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
65607 permitted to use specific forms of address with the <option>-f</option> option by setting
65608 the <option>untrusted_set_sender</option> option.
65609 </para>
65610 <para>
65611 Trusted users are used to run processes that receive mail messages from some
65612 other mail domain and pass them on to Exim for delivery either locally, or over
65613 the Internet. Exim trusts a caller that is running as root, as the Exim user,
65614 as any user listed in the <option>trusted_users</option> configuration option, or under any
65615 group listed in the <option>trusted_groups</option> option.
65616 </para>
65617 <para>
65618 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
65619 can freeze or thaw messages, cause them to be returned to their senders, remove
65620 them entirely, or modify them in various ways. In addition, admin users can run
65621 the Exim monitor and see all the information it is capable of providing, which
65622 includes the contents of files on the spool.
65623 </para>
65624 <para>
65625 <indexterm role="option">
65626 <primary><option>-M</option></primary>
65627 </indexterm>
65628 <indexterm role="option">
65629 <primary><option>-q</option></primary>
65630 </indexterm>
65631 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
65632 delivery of messages on its queue is restricted to admin users. This
65633 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
65634 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
65635 queue is also restricted to admin users. This restriction can be relaxed by
65636 setting <option>no_queue_list_requires_admin</option>.
65637 </para>
65638 <para>
65639 Exim recognizes an admin user if the calling process is running as root or as
65640 the Exim user or if any of the groups associated with the calling process is
65641 the Exim group. It is not necessary actually to be running under the Exim
65642 group. However, if admin users who are not root or the Exim user are to access
65643 the contents of files on the spool via the Exim monitor (which runs
65644 unprivileged), Exim must be built to allow group read access to its spool
65645 files.
65646 </para>
65647 </section>
65648 <section id="SECID275">
65649 <title>Spool files</title>
65650 <para>
65651 <indexterm role="concept">
65652 <primary>spool directory</primary>
65653 <secondary>files</secondary>
65654 </indexterm>
65655 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
65656 set to the Exim group. The mode for spool files is defined in the
65657 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
65658 any user who is a member of the Exim group can access these files.
65659 </para>
65660 </section>
65661 <section id="SECID276">
65662 <title>Use of argv[0]</title>
65663 <para>
65664 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
65665 of specific strings, Exim assumes certain options. For example, calling Exim
65666 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
65667 to calling it with the option <option>-bS</option>. There are no security implications in
65668 this.
65669 </para>
65670 </section>
65671 <section id="SECID277">
65672 <title>Use of %f formatting</title>
65673 <para>
65674 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
65675 are actually stored in integer variables as 1000 times the load average.
65676 Consequently, their range is limited and so therefore is the length of the
65677 converted output.
65678 </para>
65679 </section>
65680 <section id="SECID278">
65681 <title>Embedded Exim path</title>
65682 <para>
65683 Exim uses its own path name, which is embedded in the code, only when it needs
65684 to re-exec in order to regain root privilege. Therefore, it is not root when it
65685 does so. If some bug allowed the path to get overwritten, it would lead to an
65686 arbitrary program&#x2019;s being run as exim, not as root.
65687 </para>
65688 </section>
65689 <section id="SECTdynmoddir">
65690 <title>Dynamic module directory</title>
65691 <para>
65692 Any dynamically loadable modules must be installed into the directory
65693 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
65694 loading it.
65695 </para>
65696 </section>
65697 <section id="SECID279">
65698 <title>Use of sprintf()</title>
65699 <para>
65700 <indexterm role="concept">
65701 <primary><function>sprintf()</function></primary>
65702 </indexterm>
65703 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
65704 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
65705 The intermediate formatting is done into a large fixed buffer by a function
65706 that runs through the format string itself, and checks the length of each
65707 conversion before performing it, thus preventing buffer overruns.
65708 </para>
65709 <para>
65710 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
65711 the output buffer is known to be sufficiently long to contain the converted
65712 string.
65713 </para>
65714 </section>
65715 <section id="SECID280">
65716 <title>Use of debug_printf() and log_write()</title>
65717 <para>
65718 Arbitrary strings are passed to both these functions, but they do their
65719 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
65720 the format string itself, and checks the length of each conversion.
65721 </para>
65722 </section>
65723 <section id="SECID281">
65724 <title>Use of strcat() and strcpy()</title>
65725 <para>
65726 These are used only in cases where the output buffer is known to be large
65727 enough to hold the result.
65728 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
65729 </para>
65730 </section>
65731 </chapter>
65732
65733 <chapter id="CHAPspool">
65734 <title>Format of spool files</title>
65735 <para>
65736 <indexterm role="concept" id="IIDforspo1" class="startofrange">
65737 <primary>format</primary>
65738 <secondary>spool files</secondary>
65739 </indexterm>
65740 <indexterm role="concept" id="IIDforspo2" class="startofrange">
65741 <primary>spool directory</primary>
65742 <secondary>format of files</secondary>
65743 </indexterm>
65744 <indexterm role="concept" id="IIDforspo3" class="startofrange">
65745 <primary>spool files</primary>
65746 <secondary>format of</secondary>
65747 </indexterm>
65748 <indexterm role="concept">
65749 <primary>spool files</primary>
65750 <secondary>editing</secondary>
65751 </indexterm>
65752 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
65753 followed by -D and -H, respectively. The data portion of the message is kept in
65754 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
65755 kept in the -H file, whose format is described in this chapter. Each of these
65756 two files contains the final component of its own name as its first line. This
65757 is insurance against disk crashes where the directory is lost but the files
65758 themselves are recoverable.
65759 </para>
65760 <para>
65761 Some people are tempted into editing -D files in order to modify messages. You
65762 need to be extremely careful if you do this; it is not recommended and you are
65763 on your own if you do it. Here are some of the pitfalls:
65764 </para>
65765 <itemizedlist>
65766 <listitem>
65767 <para>
65768 You must ensure that Exim does not try to deliver the message while you are
65769 fiddling with it. The safest way is to take out a write lock on the -D file,
65770 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
65771 place, the lock will be retained. If you write a new file and rename it, the
65772 lock will be lost at the instant of rename.
65773 </para>
65774 </listitem>
65775 <listitem>
65776 <para>
65777 <indexterm role="variable">
65778 <primary><varname>$body_linecount</varname></primary>
65779 </indexterm>
65780 If you change the number of lines in the file, the value of
65781 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
65782 present, this value is not used by Exim, but there is no guarantee that this
65783 will always be the case.
65784 </para>
65785 </listitem>
65786 <listitem>
65787 <para>
65788 If the message is in MIME format, you must take care not to break it.
65789 </para>
65790 </listitem>
65791 <listitem>
65792 <para>
65793 If the message is cryptographically signed, any change will invalidate the
65794 signature.
65795 </para>
65796 </listitem>
65797 </itemizedlist>
65798 <para>
65799 All in all, modifying -D files is fraught with danger.
65800 </para>
65801 <para>
65802 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
65803 its subdirectories when <option>split_spool_directory</option> is set). These are journal
65804 files, used to record addresses to which the message has been delivered during
65805 the course of a delivery attempt. If there are still undelivered recipients at
65806 the end, the -H file is updated, and the -J file is deleted. If, however, there
65807 is some kind of crash (for example, a power outage) before this happens, the -J
65808 file remains in existence. When Exim next processes the message, it notices the
65809 -J file and uses it to update the -H file before starting the next delivery
65810 attempt.
65811 </para>
65812 <section id="SECID282">
65813 <title>Format of the -H file</title>
65814 <para>
65815 <indexterm role="concept">
65816 <primary>uid (user id)</primary>
65817 <secondary>in spool file</secondary>
65818 </indexterm>
65819 <indexterm role="concept">
65820 <primary>gid (group id)</primary>
65821 <secondary>in spool file</secondary>
65822 </indexterm>
65823 The second line of the -H file contains the login name for the uid of the
65824 process that called Exim to read the message, followed by the numerical uid and
65825 gid. For a locally generated message, this is normally the user who sent the
65826 message. For a message received over TCP/IP via the daemon, it is
65827 normally the Exim user.
65828 </para>
65829 <para>
65830 The third line of the file contains the address of the message&#x2019;s sender as
65831 transmitted in the envelope, contained in angle brackets. The sender address is
65832 empty for bounce messages. For incoming SMTP mail, the sender address is given
65833 in the MAIL command. For locally generated mail, the sender address is
65834 created by Exim from the login name of the current user and the configured
65835 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
65836 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
65837 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
65838 </para>
65839 <para>
65840 The fourth line contains two numbers. The first is the time that the message
65841 was received, in the conventional Unix form &ndash; the number of seconds since the
65842 start of the epoch. The second number is a count of the number of messages
65843 warning of delayed delivery that have been sent to the sender.
65844 </para>
65845 <para>
65846 There follow a number of lines starting with a hyphen. These can appear in any
65847 order, and are omitted when not relevant:
65848 </para>
65849 <variablelist>
65850 <varlistentry>
65851 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65852 <listitem>
65853 <para>
65854 This item is obsolete, and is not generated from Exim release 4.61 onwards;
65855 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
65856 recognized, to provide backward compatibility. In the old format, a line of
65857 this form is present for every ACL variable that is not empty. The number
65858 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
65859 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
65860 the data string for the variable. The string itself starts at the beginning of
65861 the next line, and is followed by a newline character. It may contain internal
65862 newlines.
65863 </para>
65864 </listitem></varlistentry>
65865 <varlistentry>
65866 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65867 <listitem>
65868 <para>
65869 A line of this form is present for every ACL connection variable that is
65870 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
65871 The length is the length of the data string for the variable. The string itself
65872 starts at the beginning of the next line, and is followed by a newline
65873 character. It may contain internal newlines.
65874 </para>
65875 </listitem></varlistentry>
65876 <varlistentry>
65877 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65878 <listitem>
65879 <para>
65880 A line of this form is present for every ACL message variable that is defined.
65881 Note that there is a space between <option>-aclm</option> and the rest of the name. The
65882 length is the length of the data string for the variable. The string itself
65883 starts at the beginning of the next line, and is followed by a newline
65884 character. It may contain internal newlines.
65885 </para>
65886 </listitem></varlistentry>
65887 <varlistentry>
65888 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
65889 <listitem>
65890 <para>
65891 This is present if, when the message was received over SMTP, the value of
65892 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
65893 </para>
65894 </listitem></varlistentry>
65895 <varlistentry>
65896 <term><option>-allow_unqualified_recipient</option></term>
65897 <listitem>
65898 <para>
65899 This is present if unqualified recipient addresses are permitted in header
65900 lines (to stop such addresses from being qualified if rewriting occurs at
65901 transport time). Local messages that were input using <option>-bnq</option> and remote
65902 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
65903 </para>
65904 </listitem></varlistentry>
65905 <varlistentry>
65906 <term><option>-allow_unqualified_sender</option></term>
65907 <listitem>
65908 <para>
65909 This is present if unqualified sender addresses are permitted in header lines
65910 (to stop such addresses from being qualified if rewriting occurs at transport
65911 time). Local messages that were input using <option>-bnq</option> and remote messages from
65912 hosts that match <option>sender_unqualified_hosts</option> set this flag.
65913 </para>
65914 </listitem></varlistentry>
65915 <varlistentry>
65916 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65917 <listitem>
65918 <para>
65919 The id information for a message received on an authenticated SMTP connection
65920 &ndash; the value of the <varname>$authenticated_id</varname> variable.
65921 </para>
65922 </listitem></varlistentry>
65923 <varlistentry>
65924 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
65925 <listitem>
65926 <para>
65927 The address of an authenticated sender &ndash; the value of the
65928 <varname>$authenticated_sender</varname> variable.
65929 </para>
65930 </listitem></varlistentry>
65931 <varlistentry>
65932 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
65933 <listitem>
65934 <para>
65935 This records the number of lines in the body of the message, and is always
65936 present.
65937 </para>
65938 </listitem></varlistentry>
65939 <varlistentry>
65940 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
65941 <listitem>
65942 <para>
65943 This records the number of binary zero bytes in the body of the message, and is
65944 present if the number is greater than zero.
65945 </para>
65946 </listitem></varlistentry>
65947 <varlistentry>
65948 <term><option>-deliver_firsttime</option></term>
65949 <listitem>
65950 <para>
65951 This is written when a new message is first added to the spool. When the spool
65952 file is updated after a deferral, it is omitted.
65953 </para>
65954 </listitem></varlistentry>
65955 <varlistentry>
65956 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
65957 <listitem>
65958 <para>
65959 <indexterm role="concept">
65960 <primary>frozen messages</primary>
65961 <secondary>spool data</secondary>
65962 </indexterm>
65963 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
65964 </para>
65965 </listitem></varlistentry>
65966 <varlistentry>
65967 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65968 <listitem>
65969 <para>
65970 This records the host name as specified by a remote host in a HELO or EHLO
65971 command.
65972 </para>
65973 </listitem></varlistentry>
65974 <varlistentry>
65975 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
65976 <listitem>
65977 <para>
65978 This records the IP address of the host from which the message was received and
65979 the remote port number that was used. It is omitted for locally generated
65980 messages.
65981 </para>
65982 </listitem></varlistentry>
65983 <varlistentry>
65984 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65985 <listitem>
65986 <para>
65987 If the message was received on an authenticated SMTP connection, this records
65988 the name of the authenticator &ndash; the value of the
65989 <varname>$sender_host_authenticated</varname> variable.
65990 </para>
65991 </listitem></varlistentry>
65992 <varlistentry>
65993 <term><option>-host_lookup_failed</option></term>
65994 <listitem>
65995 <para>
65996 This is present if an attempt to look up the sending host&#x2019;s name from its IP
65997 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
65998 </para>
65999 </listitem></varlistentry>
66000 <varlistentry>
66001 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66002 <listitem>
66003 <para>
66004 <indexterm role="concept">
66005 <primary>reverse DNS lookup</primary>
66006 </indexterm>
66007 <indexterm role="concept">
66008 <primary>DNS</primary>
66009 <secondary>reverse lookup</secondary>
66010 </indexterm>
66011 This records the name of the remote host from which the message was received,
66012 if the host name was looked up from the IP address when the message was being
66013 received. It is not present if no reverse lookup was done.
66014 </para>
66015 </listitem></varlistentry>
66016 <varlistentry>
66017 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66018 <listitem>
66019 <para>
66020 For locally submitted messages, this records the login of the originating user,
66021 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
66022 ident value. For messages received over TCP/IP, this records the ident string
66023 supplied by the remote host, if any.
66024 </para>
66025 </listitem></varlistentry>
66026 <varlistentry>
66027 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
66028 <listitem>
66029 <para>
66030 This records the IP address of the local interface and the port number through
66031 which a message was received from a remote host. It is omitted for locally
66032 generated messages.
66033 </para>
66034 </listitem></varlistentry>
66035 <varlistentry>
66036 <term><option>-local</option></term>
66037 <listitem>
66038 <para>
66039 The message is from a local sender.
66040 </para>
66041 </listitem></varlistentry>
66042 <varlistentry>
66043 <term><option>-localerror</option></term>
66044 <listitem>
66045 <para>
66046 The message is a locally-generated bounce message.
66047 </para>
66048 </listitem></varlistentry>
66049 <varlistentry>
66050 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
66051 <listitem>
66052 <para>
66053 This records the data string that was returned by the <function>local_scan()</function> function
66054 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
66055 variable. It is omitted if no data was returned.
66056 </para>
66057 </listitem></varlistentry>
66058 <varlistentry>
66059 <term><option>-manual_thaw</option></term>
66060 <listitem>
66061 <para>
66062 The message was frozen but has been thawed manually, that is, by an explicit
66063 Exim command rather than via the auto-thaw process.
66064 </para>
66065 </listitem></varlistentry>
66066 <varlistentry>
66067 <term><option>-N</option></term>
66068 <listitem>
66069 <para>
66070 A testing delivery process was started using the <option>-N</option> option to suppress any
66071 actual deliveries, but delivery was deferred. At any further delivery attempts,
66072 <option>-N</option> is assumed.
66073 </para>
66074 </listitem></varlistentry>
66075 <varlistentry>
66076 <term><option>-received_protocol</option></term>
66077 <listitem>
66078 <para>
66079 This records the value of the <varname>$received_protocol</varname> variable, which contains
66080 the name of the protocol by which the message was received.
66081 </para>
66082 </listitem></varlistentry>
66083 <varlistentry>
66084 <term><option>-sender_set_untrusted</option></term>
66085 <listitem>
66086 <para>
66087 The envelope sender of this message was set by an untrusted local caller (used
66088 to ensure that the caller is displayed in queue listings).
66089 </para>
66090 </listitem></varlistentry>
66091 <varlistentry>
66092 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66093 <listitem>
66094 <para>
66095 If a message was scanned by SpamAssassin, this is present. It records the value
66096 of <varname>$spam_score_int</varname>.
66097 </para>
66098 </listitem></varlistentry>
66099 <varlistentry>
66100 <term><option>-tls_certificate_verified</option></term>
66101 <listitem>
66102 <para>
66103 A TLS certificate was received from the client that sent this message, and the
66104 certificate was verified by the server.
66105 </para>
66106 </listitem></varlistentry>
66107 <varlistentry>
66108 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
66109 <listitem>
66110 <para>
66111 When the message was received over an encrypted connection, this records the
66112 name of the cipher suite that was used.
66113 </para>
66114 </listitem></varlistentry>
66115 <varlistentry>
66116 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
66117 <listitem>
66118 <para>
66119 When the message was received over an encrypted connection, and a certificate
66120 was received from the client, this records the Distinguished Name from that
66121 certificate.
66122 </para>
66123 </listitem></varlistentry>
66124 </variablelist>
66125 <para>
66126 Following the options there is a list of those addresses to which the message
66127 is not to be delivered. This set of addresses is initialized from the command
66128 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
66129 is set; otherwise it starts out empty. Whenever a successful delivery is made,
66130 the address is added to this set. The addresses are kept internally as a
66131 balanced binary tree, and it is a representation of that tree which is written
66132 to the spool file. If an address is expanded via an alias or forward file, the
66133 original address is added to the tree when deliveries to all its child
66134 addresses are complete.
66135 </para>
66136 <para>
66137 If the tree is empty, there is a single line in the spool file containing just
66138 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
66139 Y or N, followed by an address. The address is the value for the node of the
66140 tree, and the letters indicate whether the node has a left branch and/or a
66141 right branch attached to it, respectively. If branches exist, they immediately
66142 follow. Here is an example of a three-node tree:
66143 </para>
66144 <literallayout class="monospaced">
66145 YY darcy@austen.fict.example
66146 NN alice@wonderland.fict.example
66147 NN editor@thesaurus.ref.example
66148 </literallayout>
66149 <para>
66150 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
66151 This is a simple list, preceded by a count. It includes all the original
66152 recipients of the message, including those to whom the message has already been
66153 delivered. In the simplest case, the list contains one address per line. For
66154 example:
66155 </para>
66156 <literallayout class="monospaced">
66157 4
66158 editor@thesaurus.ref.example
66159 darcy@austen.fict.example
66160 rdo@foundation
66161 alice@wonderland.fict.example
66162 </literallayout>
66163 <para>
66164 However, when a child address has been added to the top-level addresses as a
66165 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
66166 line is of the following form:
66167 </para>
66168 <literallayout>
66169 &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;
66170 </literallayout>
66171 <para>
66172 The 01 flag bit indicates the presence of the three other fields that follow
66173 the top-level address. Other bits may be used in future to support additional
66174 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
66175 original parent of the <quote>one time</quote> address. The first two fields are the
66176 envelope sender that is associated with this address and its length. If the
66177 length is zero, there is no special envelope sender (there are then two space
66178 characters in the line). A non-empty field can arise from a <command>redirect</command> router
66179 that has an <option>errors_to</option> setting.
66180 </para>
66181 <para>
66182 A blank line separates the envelope and status information from the headers
66183 which follow. A header may occupy several lines of the file, and to save effort
66184 when reading it in, each header is preceded by a number and an identifying
66185 character. The number is the number of characters in the header, including any
66186 embedded newlines and the terminating newline. The character is one of the
66187 following:
66188 </para>
66189 <informaltable frame="none">
66190 <tgroup cols="2" colsep="0" rowsep="0">
66191 <colspec colwidth="50pt" align="left"/>
66192 <colspec colwidth="254pt" align="left"/>
66193 <tbody>
66194 <row>
66195 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
66196 <entry>header in which Exim has no special interest</entry>
66197 </row>
66198 <row>
66199 <entry><literal>B</literal></entry>
66200 <entry><emphasis>Bcc:</emphasis> header</entry>
66201 </row>
66202 <row>
66203 <entry><literal>C</literal></entry>
66204 <entry><emphasis>Cc:</emphasis> header</entry>
66205 </row>
66206 <row>
66207 <entry><literal>F</literal></entry>
66208 <entry><emphasis>From:</emphasis> header</entry>
66209 </row>
66210 <row>
66211 <entry><literal>I</literal></entry>
66212 <entry><emphasis>Message-id:</emphasis> header</entry>
66213 </row>
66214 <row>
66215 <entry><literal>P</literal></entry>
66216 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
66217 </row>
66218 <row>
66219 <entry><literal>R</literal></entry>
66220 <entry><emphasis>Reply-To:</emphasis> header</entry>
66221 </row>
66222 <row>
66223 <entry><literal>S</literal></entry>
66224 <entry><emphasis>Sender:</emphasis> header</entry>
66225 </row>
66226 <row>
66227 <entry><literal>T</literal></entry>
66228 <entry><emphasis>To:</emphasis> header</entry>
66229 </row>
66230 <row>
66231 <entry><literal>*</literal></entry>
66232 <entry>replaced or deleted header</entry>
66233 </row>
66234 </tbody>
66235 </tgroup>
66236 </informaltable>
66237 <para>
66238 Deleted or replaced (rewritten) headers remain in the spool file for debugging
66239 purposes. They are not transmitted when the message is delivered. Here is a
66240 typical set of headers:
66241 </para>
66242 <literallayout class="monospaced">
66243 111P Received: by hobbit.fict.example with local (Exim 4.00)
66244 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
66245 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
66246 038* X-rewrote-sender: bb@hobbit.fict.example
66247 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
66248 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
66249 099* To: alice@wonderland.fict.example, rdo@foundation,
66250 darcy@austen.fict.example, editor@thesaurus.ref.example
66251 104T To: alice@wonderland.fict.example, rdo@foundation.example,
66252 darcy@austen.fict.example, editor@thesaurus.ref.example
66253 038  Date: Fri, 11 May 2001 10:28:59 +0100
66254 </literallayout>
66255 <para>
66256 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
66257 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
66258 unqualified domain <emphasis>foundation</emphasis>.
66259 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
66260 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
66261 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
66262 </para>
66263 </section>
66264 </chapter>
66265
66266 <chapter id="CHAPdkim">
66267 <title>Support for DKIM (DomainKeys Identified Mail)</title>
66268 <titleabbrev>DKIM Support</titleabbrev>
66269 <para>
66270 <indexterm role="concept">
66271 <primary>DKIM</primary>
66272 </indexterm>
66273 </para>
66274 <para>
66275 DKIM is a mechanism by which messages sent by some entity can be provably
66276 linked to a domain which that entity controls.  It permits reputation to
66277 be tracked on a per-domain basis, rather than merely upon source IP address.
66278 DKIM is documented in RFC 4871.
66279 </para>
66280 <para>
66281 Since version 4.70, DKIM support is compiled into Exim by default. It can be
66282 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
66283 </para>
66284 <para>
66285 Exim&#x2019;s DKIM implementation allows to
66286 </para>
66287 <orderedlist numeration="arabic">
66288 <listitem>
66289 <para>
66290 Sign outgoing messages: This function is implemented in the SMTP transport.
66291 It can co-exist with all other Exim features
66292 (including transport filters)
66293 except cutthrough delivery.
66294 </para>
66295 </listitem>
66296 <listitem>
66297 <para>
66298 Verify signatures in incoming messages: This is implemented by an additional
66299 ACL (acl_smtp_dkim), which can be called several times per message, with
66300 different signature contexts.
66301 </para>
66302 </listitem>
66303 </orderedlist>
66304 <para>
66305 In typical Exim style, the verification implementation does not include any
66306 default "policy". Instead it enables you to build your own policy using
66307 Exim&#x2019;s standard controls.
66308 </para>
66309 <para>
66310 Please note that verification of DKIM signatures in incoming mail is turned
66311 on by default for logging purposes. For each signature in incoming email,
66312 exim will log a line displaying the most important signature details, and the
66313 signature status. Here is an example (with line-breaks added for clarity):
66314 </para>
66315 <literallayout class="monospaced">
66316 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
66317     d=facebookmail.com s=q1-2009b
66318     c=relaxed/relaxed a=rsa-sha1
66319     i=@facebookmail.com t=1252484542 [verification succeeded]
66320 </literallayout>
66321 <para>
66322 You might want to turn off DKIM verification processing entirely for internal
66323 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
66324 control modifier. This should typically be done in the RCPT ACL, at points
66325 where you accept mail from relay sources (internal hosts or authenticated
66326 senders).
66327 </para>
66328 <section id="SECID513">
66329 <title>Signing outgoing messages</title>
66330 <para>
66331 <indexterm role="concept">
66332 <primary>DKIM</primary>
66333 <secondary>signing</secondary>
66334 </indexterm>
66335 </para>
66336 <para>
66337 Signing is implemented by setting private options on the SMTP transport.
66338 These options take (expandable) strings as arguments.
66339 </para>
66340 <para>
66341 <indexterm role="option">
66342 <primary><option>dkim_domain</option></primary>
66343 </indexterm>
66344 </para>
66345 <informaltable frame="all">
66346 <tgroup cols="4" colsep="0" rowsep="0">
66347 <colspec colwidth="8*" align="left"/>
66348 <colspec colwidth="6*" align="center"/>
66349 <colspec colwidth="6*" align="center"/>
66350 <colspec colwidth="6*" align="right"/>
66351 <tbody>
66352 <row>
66353 <entry><option>dkim_domain</option></entry>
66354 <entry>Use: <emphasis>smtp</emphasis></entry>
66355 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66356 <entry>Default: <emphasis>unset</emphasis></entry>
66357 </row>
66358 </tbody>
66359 </tgroup>
66360 </informaltable>
66361 <para>
66362 MANDATORY:
66363 The domain you want to sign with. The result of this expanded
66364 option is put into the <option>$dkim_domain</option> expansion variable.
66365 </para>
66366 <para>
66367 <indexterm role="option">
66368 <primary><option>dkim_selector</option></primary>
66369 </indexterm>
66370 </para>
66371 <informaltable frame="all">
66372 <tgroup cols="4" colsep="0" rowsep="0">
66373 <colspec colwidth="8*" align="left"/>
66374 <colspec colwidth="6*" align="center"/>
66375 <colspec colwidth="6*" align="center"/>
66376 <colspec colwidth="6*" align="right"/>
66377 <tbody>
66378 <row>
66379 <entry><option>dkim_selector</option></entry>
66380 <entry>Use: <emphasis>smtp</emphasis></entry>
66381 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66382 <entry>Default: <emphasis>unset</emphasis></entry>
66383 </row>
66384 </tbody>
66385 </tgroup>
66386 </informaltable>
66387 <para>
66388 MANDATORY:
66389 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
66390 variable to look up a matching selector. The result is put in the expansion
66391 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
66392 option along with <option>$dkim_domain</option>.
66393 </para>
66394 <para>
66395 <indexterm role="option">
66396 <primary><option>dkim_private_key</option></primary>
66397 </indexterm>
66398 </para>
66399 <informaltable frame="all">
66400 <tgroup cols="4" colsep="0" rowsep="0">
66401 <colspec colwidth="8*" align="left"/>
66402 <colspec colwidth="6*" align="center"/>
66403 <colspec colwidth="6*" align="center"/>
66404 <colspec colwidth="6*" align="right"/>
66405 <tbody>
66406 <row>
66407 <entry><option>dkim_private_key</option></entry>
66408 <entry>Use: <emphasis>smtp</emphasis></entry>
66409 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66410 <entry>Default: <emphasis>unset</emphasis></entry>
66411 </row>
66412 </tbody>
66413 </tgroup>
66414 </informaltable>
66415 <para>
66416 MANDATORY:
66417 This sets the private key to use. You can use the <option>$dkim_domain</option> and
66418 <option>$dkim_selector</option> expansion variables to determine the private key to use.
66419 The result can either
66420 </para>
66421 <itemizedlist>
66422 <listitem>
66423 <para>
66424 be a valid RSA private key in ASCII armor, including line breaks.
66425 </para>
66426 </listitem>
66427 <listitem>
66428 <para>
66429 start with a slash, in which case it is treated as a file that contains
66430 the private key.
66431 </para>
66432 </listitem>
66433 <listitem>
66434 <para>
66435 be "0", "false" or the empty string, in which case the message will not
66436 be signed. This case will not result in an error, even if <option>dkim_strict</option>
66437 is set.
66438 </para>
66439 </listitem>
66440 </itemizedlist>
66441 <para>
66442 <indexterm role="option">
66443 <primary><option>dkim_canon</option></primary>
66444 </indexterm>
66445 </para>
66446 <informaltable frame="all">
66447 <tgroup cols="4" colsep="0" rowsep="0">
66448 <colspec colwidth="8*" align="left"/>
66449 <colspec colwidth="6*" align="center"/>
66450 <colspec colwidth="6*" align="center"/>
66451 <colspec colwidth="6*" align="right"/>
66452 <tbody>
66453 <row>
66454 <entry><option>dkim_canon</option></entry>
66455 <entry>Use: <emphasis>smtp</emphasis></entry>
66456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66457 <entry>Default: <emphasis>unset</emphasis></entry>
66458 </row>
66459 </tbody>
66460 </tgroup>
66461 </informaltable>
66462 <para>
66463 OPTIONAL:
66464 This option sets the canonicalization method used when signing a message.
66465 The DKIM RFC currently supports two methods: "simple" and "relaxed".
66466 The option defaults to "relaxed" when unset. Note: the current implementation
66467 only supports using the same canonicalization method for both headers and body.
66468 </para>
66469 <para>
66470 <indexterm role="option">
66471 <primary><option>dkim_strict</option></primary>
66472 </indexterm>
66473 </para>
66474 <informaltable frame="all">
66475 <tgroup cols="4" colsep="0" rowsep="0">
66476 <colspec colwidth="8*" align="left"/>
66477 <colspec colwidth="6*" align="center"/>
66478 <colspec colwidth="6*" align="center"/>
66479 <colspec colwidth="6*" align="right"/>
66480 <tbody>
66481 <row>
66482 <entry><option>dkim_strict</option></entry>
66483 <entry>Use: <emphasis>smtp</emphasis></entry>
66484 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66485 <entry>Default: <emphasis>unset</emphasis></entry>
66486 </row>
66487 </tbody>
66488 </tgroup>
66489 </informaltable>
66490 <para>
66491 OPTIONAL:
66492 This  option  defines  how  Exim  behaves  when  signing a message that
66493 should be signed fails for some reason.  When the expansion evaluates to
66494 either "1" or "true", Exim will defer. Otherwise Exim will send the message
66495 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
66496 variables here.
66497 </para>
66498 <para>
66499 <indexterm role="option">
66500 <primary><option>dkim_sign_headers</option></primary>
66501 </indexterm>
66502 </para>
66503 <informaltable frame="all">
66504 <tgroup cols="4" colsep="0" rowsep="0">
66505 <colspec colwidth="8*" align="left"/>
66506 <colspec colwidth="6*" align="center"/>
66507 <colspec colwidth="6*" align="center"/>
66508 <colspec colwidth="6*" align="right"/>
66509 <tbody>
66510 <row>
66511 <entry><option>dkim_sign_headers</option></entry>
66512 <entry>Use: <emphasis>smtp</emphasis></entry>
66513 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66514 <entry>Default: <emphasis>unset</emphasis></entry>
66515 </row>
66516 </tbody>
66517 </tgroup>
66518 </informaltable>
66519 <para>
66520 OPTIONAL:
66521 When set, this option must expand to (or be specified as) a colon-separated
66522 list of header names. Headers with these names will be included in the message
66523 signature. When unspecified, the header names recommended in RFC4871 will be
66524 used.
66525 </para>
66526 </section>
66527 <section id="SECID514">
66528 <title>Verifying DKIM signatures in incoming mail</title>
66529 <para>
66530 <indexterm role="concept">
66531 <primary>DKIM</primary>
66532 <secondary>verification</secondary>
66533 </indexterm>
66534 </para>
66535 <para>
66536 Verification of DKIM signatures in incoming email is implemented via the
66537 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
66538 syntactically(!) correct signature in the incoming message.
66539 A missing ACL definition defaults to accept.
66540 If any ACL call does not acccept, the message is not accepted.
66541 If a cutthrough delivery was in progress for the message it is
66542 summarily dropped (having wasted the transmission effort).
66543 </para>
66544 <para>
66545 To evaluate the signature in the ACL a large number of expansion variables
66546 containing the signature status and its details are set up during the
66547 runtime of the ACL.
66548 </para>
66549 <para>
66550 Calling the ACL only for existing signatures is not sufficient to build
66551 more advanced policies. For that reason, the global option
66552 <option>dkim_verify_signers</option>, and a global expansion variable
66553 <option>$dkim_signers</option> exist.
66554 </para>
66555 <para>
66556 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
66557 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
66558 called. It is expanded when the message has been received. At this point,
66559 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
66560 list of signer domains and identities for the message. When
66561 <option>dkim_verify_signers</option> is not specified in the main configuration,
66562 it defaults as:
66563 </para>
66564 <literallayout class="monospaced">
66565 dkim_verify_signers = $dkim_signers
66566 </literallayout>
66567 <para>
66568 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
66569 DKIM signature in the message. Current DKIM verifiers may want to explicitly
66570 call the ACL for known domains or identities. This would be achieved as follows:
66571 </para>
66572 <literallayout class="monospaced">
66573 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
66574 </literallayout>
66575 <para>
66576 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
66577 and "ebay.com", plus all domains and identities that have signatures in the message.
66578 You can also be more creative in constructing your policy. For example:
66579 </para>
66580 <literallayout class="monospaced">
66581 dkim_verify_signers = $sender_address_domain:$dkim_signers
66582 </literallayout>
66583 <para>
66584 If a domain or identity is listed several times in the (expanded) value of
66585 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
66586 </para>
66587 <para>
66588 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
66589 available (from most to least important):
66590 </para>
66591 <variablelist>
66592 <varlistentry>
66593 <term><option>$dkim_cur_signer</option></term>
66594 <listitem>
66595 <para>
66596 The signer that is being evaluated in this ACL run. This can be a domain or
66597 an identity. This is one of the list items from the expanded main option
66598 <option>dkim_verify_signers</option> (see above).
66599 </para>
66600 </listitem></varlistentry>
66601 <varlistentry>
66602 <term><option>$dkim_verify_status</option></term>
66603 <listitem>
66604 <para>
66605 A string describing the general status of the signature. One of
66606 </para>
66607 <itemizedlist>
66608 <listitem>
66609 <para>
66610 <option>none</option>: There is no signature in the message for the current domain or
66611 identity (as reflected by <option>$dkim_cur_signer</option>).
66612 </para>
66613 </listitem>
66614 <listitem>
66615 <para>
66616 <option>invalid</option>: The signature could not be verified due to a processing error.
66617 More detail is available in <option>$dkim_verify_reason</option>.
66618 </para>
66619 </listitem>
66620 <listitem>
66621 <para>
66622 <option>fail</option>: Verification of the signature failed.  More detail is
66623 available in <option>$dkim_verify_reason</option>.
66624 </para>
66625 </listitem>
66626 <listitem>
66627 <para>
66628 <option>pass</option>: The signature passed verification. It is valid.
66629 </para>
66630 </listitem>
66631 </itemizedlist>
66632 </listitem></varlistentry>
66633 <varlistentry>
66634 <term><option>$dkim_verify_reason</option></term>
66635 <listitem>
66636 <para>
66637 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
66638 "fail" or "invalid". One of
66639 </para>
66640 <itemizedlist>
66641 <listitem>
66642 <para>
66643 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
66644 key for the domain could not be retrieved. This may be a temporary problem.
66645 </para>
66646 </listitem>
66647 <listitem>
66648 <para>
66649 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
66650 record for the domain is syntactically invalid.
66651 </para>
66652 </listitem>
66653 <listitem>
66654 <para>
66655 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
66656 body hash does not match the one specified in the signature header. This
66657 means that the message body was modified in transit.
66658 </para>
66659 </listitem>
66660 <listitem>
66661 <para>
66662 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
66663 could not be verified. This may mean that headers were modified,
66664 re-written or otherwise changed in a way which is incompatible with
66665 DKIM verification. It may of course also mean that the signature is forged.
66666 </para>
66667 </listitem>
66668 </itemizedlist>
66669 </listitem></varlistentry>
66670 <varlistentry>
66671 <term><option>$dkim_domain</option></term>
66672 <listitem>
66673 <para>
66674 The signing domain. IMPORTANT: This variable is only populated if there is
66675 an actual signature in the message for the current domain or identity (as
66676 reflected by <option>$dkim_cur_signer</option>).
66677 </para>
66678 </listitem></varlistentry>
66679 <varlistentry>
66680 <term><option>$dkim_identity</option></term>
66681 <listitem>
66682 <para>
66683 The signing identity, if present. IMPORTANT: This variable is only populated
66684 if there is an actual signature in the message for the current domain or
66685 identity (as reflected by <option>$dkim_cur_signer</option>).
66686 </para>
66687 </listitem></varlistentry>
66688 <varlistentry>
66689 <term><option>$dkim_selector</option></term>
66690 <listitem>
66691 <para>
66692 The key record selector string.
66693 </para>
66694 </listitem></varlistentry>
66695 <varlistentry>
66696 <term><option>$dkim_algo</option></term>
66697 <listitem>
66698 <para>
66699 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
66700 </para>
66701 </listitem></varlistentry>
66702 <varlistentry>
66703 <term><option>$dkim_canon_body</option></term>
66704 <listitem>
66705 <para>
66706 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66707 </para>
66708 </listitem></varlistentry>
66709 <varlistentry>
66710 <term><option>dkim_canon_headers</option></term>
66711 <listitem>
66712 <para>
66713 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66714 </para>
66715 </listitem></varlistentry>
66716 <varlistentry>
66717 <term><option>$dkim_copiedheaders</option></term>
66718 <listitem>
66719 <para>
66720 A transcript of headers and their values which are included in the signature
66721 (copied from the &#x2019;z=&#x2019; tag of the signature).
66722 </para>
66723 </listitem></varlistentry>
66724 <varlistentry>
66725 <term><option>$dkim_bodylength</option></term>
66726 <listitem>
66727 <para>
66728 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
66729 limit was set by the signer, "9999999999999" is returned. This makes sure
66730 that this variable always expands to an integer value.
66731 </para>
66732 </listitem></varlistentry>
66733 <varlistentry>
66734 <term><option>$dkim_created</option></term>
66735 <listitem>
66736 <para>
66737 UNIX timestamp reflecting the date and time when the signature was created.
66738 When this was not specified by the signer, "0" is returned.
66739 </para>
66740 </listitem></varlistentry>
66741 <varlistentry>
66742 <term><option>$dkim_expires</option></term>
66743 <listitem>
66744 <para>
66745 UNIX timestamp reflecting the date and time when the signer wants the
66746 signature to be treated as "expired". When this was not specified by the
66747 signer, "9999999999999" is returned. This makes it possible to do useful
66748 integer size comparisons against this value.
66749 </para>
66750 </listitem></varlistentry>
66751 <varlistentry>
66752 <term><option>$dkim_headernames</option></term>
66753 <listitem>
66754 <para>
66755 A colon-separated list of names of headers included in the signature.
66756 </para>
66757 </listitem></varlistentry>
66758 <varlistentry>
66759 <term><option>$dkim_key_testing</option></term>
66760 <listitem>
66761 <para>
66762 "1" if the key record has the "testing" flag set, "0" if not.
66763 </para>
66764 </listitem></varlistentry>
66765 <varlistentry>
66766 <term><option>$dkim_key_nosubdomains</option></term>
66767 <listitem>
66768 <para>
66769 "1" if the key record forbids subdomaining, "0" otherwise.
66770 </para>
66771 </listitem></varlistentry>
66772 <varlistentry>
66773 <term><option>$dkim_key_srvtype</option></term>
66774 <listitem>
66775 <para>
66776 Service type (tag s=) from the key record. Defaults to "*" if not specified
66777 in the key record.
66778 </para>
66779 </listitem></varlistentry>
66780 <varlistentry>
66781 <term><option>$dkim_key_granularity</option></term>
66782 <listitem>
66783 <para>
66784 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
66785 in the key record.
66786 </para>
66787 </listitem></varlistentry>
66788 <varlistentry>
66789 <term><option>$dkim_key_notes</option></term>
66790 <listitem>
66791 <para>
66792 Notes from the key record (tag n=).
66793 </para>
66794 </listitem></varlistentry>
66795 </variablelist>
66796 <para>
66797 In addition, two ACL conditions are provided:
66798 </para>
66799 <variablelist>
66800 <varlistentry>
66801 <term><option>dkim_signers</option></term>
66802 <listitem>
66803 <para>
66804 ACL condition that checks a colon-separated list of domains or identities
66805 for a match against the domain or identity that the ACL is currently verifying
66806 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
66807 verb to a group of domains or identities. For example:
66808 </para>
66809 <literallayout class="monospaced">
66810 # Warn when Mail purportedly from GMail has no signature at all
66811 warn log_message = GMail sender without DKIM signature
66812      sender_domains = gmail.com
66813      dkim_signers = gmail.com
66814      dkim_status = none
66815 </literallayout>
66816 </listitem></varlistentry>
66817 <varlistentry>
66818 <term><option>dkim_status</option></term>
66819 <listitem>
66820 <para>
66821 ACL condition that checks a colon-separated list of possible DKIM verification
66822 results against the actual result of verification. This is typically used
66823 to restrict an ACL verb to a list of verification outcomes, for example:
66824 </para>
66825 <literallayout class="monospaced">
66826 deny message = Mail from Paypal with invalid/missing signature
66827      sender_domains = paypal.com:paypal.de
66828      dkim_signers = paypal.com:paypal.de
66829      dkim_status = none:invalid:fail
66830 </literallayout>
66831 <para>
66832 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
66833 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
66834 for more information of what they mean.
66835 </para>
66836 </listitem></varlistentry>
66837 </variablelist>
66838 </section>
66839 </chapter>
66840
66841 <chapter id="CHID13">
66842 <title>Adding new drivers or lookup types</title>
66843 <titleabbrev>Adding drivers or lookups</titleabbrev>
66844 <para>
66845 <indexterm role="concept">
66846 <primary>adding drivers</primary>
66847 </indexterm>
66848 <indexterm role="concept">
66849 <primary>new drivers, adding</primary>
66850 </indexterm>
66851 <indexterm role="concept">
66852 <primary>drivers</primary>
66853 <secondary>adding new</secondary>
66854 </indexterm>
66855 The following actions have to be taken in order to add a new router, transport,
66856 authenticator, or lookup type to Exim:
66857 </para>
66858 <orderedlist numeration="arabic">
66859 <listitem>
66860 <para>
66861 Choose a name for the driver or lookup type that does not conflict with any
66862 existing name; I will use <quote>newdriver</quote> in what follows.
66863 </para>
66864 </listitem>
66865 <listitem>
66866 <para>
66867 Add to <filename>src/EDITME</filename> the line:
66868 </para>
66869 <literallayout>
66870 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
66871 </literallayout>
66872 <para>
66873 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
66874 code is not to be included in the binary by default, comment this line out. You
66875 should also add any relevant comments about the driver or lookup type.
66876 </para>
66877 </listitem>
66878 <listitem>
66879 <para>
66880 Add to <filename>src/config.h.defaults</filename> the line:
66881 </para>
66882 <literallayout class="monospaced">
66883 #define &lt;type&gt;_NEWDRIVER
66884 </literallayout>
66885 </listitem>
66886 <listitem>
66887 <para>
66888 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
66889 and create a table entry as is done for all the other drivers and lookup types.
66890 </para>
66891 </listitem>
66892 <listitem>
66893 <para>
66894 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
66895 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
66896 Add your <literal>NEWDRIVER</literal> to that list.
66897 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
66898 simple form that most lookups have.
66899 </para>
66900 </listitem>
66901 <listitem>
66902 <para>
66903 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
66904 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
66905 driver or lookup type and add it to the definition of OBJ.
66906 </para>
66907 </listitem>
66908 <listitem>
66909 <para>
66910 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
66911 <filename>src</filename>.
66912 </para>
66913 </listitem>
66914 <listitem>
66915 <para>
66916 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
66917 as for other drivers and lookups.
66918 </para>
66919 </listitem>
66920 </orderedlist>
66921 <para>
66922 Then all you need to do is write the code! A good way to start is to make a
66923 proforma by copying an existing module of the same type, globally changing all
66924 occurrences of the name, and cutting out most of the code. Note that any
66925 options you create must be listed in alphabetical order, because the tables are
66926 searched using a binary chop procedure.
66927 </para>
66928 <para>
66929 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
66930 the interface that is expected.
66931 </para>
66932 <?sdop
66933   format="newpage"
66934   foot_right_recto="&chaptertitle;"
66935   foot_right_verso="&chaptertitle;"
66936 ?>
66937 </chapter>
66938
66939 <index role="option">
66940 <title>Options index</title>
66941 </index>
66942
66943 <index role="variable">
66944 <title>Variables index</title>
66945 </index>
66946
66947 <index role="concept">
66948 <title>Concept index</title>
66949 </index>
66950
66951 </book>