mark the current release as a security release
[exim-website.git] / docbook / 4.86.2 / spec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>
16 02 Mar 2016
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.86.2</revnumber>
22 <date>02 Mar 2016</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2015
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.86.2 of Exim.
206 Substantive changes from the 4.85 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.86.2</filename>) into which the following files are placed:
2132 </para>
2133 <informaltable frame="none">
2134 <tgroup cols="2" colsep="0" rowsep="0">
2135 <colspec colwidth="140pt" align="left"/>
2136 <colspec colwidth="254pt" align="left"/>
2137 <tbody>
2138 <row>
2139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2140 <entry>contains some acknowledgments</entry>
2141 </row>
2142 <row>
2143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2144 <entry>contains a reference to where changes are documented</entry>
2145 </row>
2146 <row>
2147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2148 <entry>the GNU General Public Licence</entry>
2149 </row>
2150 <row>
2151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2152 <entry>top-level make file</entry>
2153 </row>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2156 <entry>conditions for the use of Exim</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2160 <entry>list of files, directories and simple build instructions</entry>
2161 </row>
2162 </tbody>
2163 </tgroup>
2164 </informaltable>
2165 <para>
2166 Other files whose names begin with <filename>README</filename> may also be present. The
2167 following subdirectories are created:
2168 </para>
2169 <informaltable frame="none">
2170 <tgroup cols="2" colsep="0" rowsep="0">
2171 <colspec colwidth="140pt" align="left"/>
2172 <colspec colwidth="254pt" align="left"/>
2173 <tbody>
2174 <row>
2175 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2176 <entry>an empty directory for local configuration files</entry>
2177 </row>
2178 <row>
2179 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2180 <entry>OS-specific files</entry>
2181 </row>
2182 <row>
2183 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2184 <entry>documentation files</entry>
2185 </row>
2186 <row>
2187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2188 <entry>source files for the Exim monitor</entry>
2189 </row>
2190 <row>
2191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2192 <entry>scripts used in the build process</entry>
2193 </row>
2194 <row>
2195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2196 <entry>remaining source files</entry>
2197 </row>
2198 <row>
2199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2200 <entry>independent utilities</entry>
2201 </row>
2202 </tbody>
2203 </tgroup>
2204 </informaltable>
2205 <para>
2206 The main utility programs are contained in the <filename>src</filename> directory, and are built
2207 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2208 that may be useful to some sites.
2209 </para>
2210 </section>
2211 <section id="SECID24">
2212 <title>Multiple machine architectures and operating systems</title>
2213 <para>
2214 <indexterm role="concept">
2215 <primary>building Exim</primary>
2216 <secondary>multiple OS/architectures</secondary>
2217 </indexterm>
2218 The building process for Exim is arranged to make it easy to build binaries for
2219 a number of different architectures and operating systems from the same set of
2220 source files. Compilation does not take place in the <filename>src</filename> directory.
2221 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2222 system.
2223 <indexterm role="concept">
2224 <primary>symbolic link</primary>
2225 <secondary>to build directory</secondary>
2226 </indexterm>
2227 Symbolic links to the sources are installed in this directory, which is where
2228 the actual building takes place. In most cases, Exim can discover the machine
2229 architecture and operating system for itself, but the defaults can be
2230 overridden if necessary.
2231 </para>
2232 </section>
2233 <section id="SECTpcre">
2234 <title>PCRE library</title>
2235 <para>
2236 <indexterm role="concept">
2237 <primary>PCRE library</primary>
2238 </indexterm>
2239 Exim no longer has an embedded PCRE library as the vast majority of
2240 modern systems include PCRE as a system library, although you may need
2241 to install the PCRE or PCRE development package for your operating
2242 system. If your system has a normal PCRE installation the Exim build
2243 process will need no further configuration. If the library or the
2244 headers are in an unusual location you will need to either set the PCRE_LIBS
2245 and INCLUDE directives appropriately,
2246 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2247 If your operating system has no
2248 PCRE support then you will need to obtain and build the current PCRE
2249 from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</ulink></emphasis>.
2250 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2251 </para>
2252 </section>
2253 <section id="SECTdb">
2254 <title>DBM libraries</title>
2255 <para>
2256 <indexterm role="concept">
2257 <primary>DBM libraries</primary>
2258 <secondary>discussion of</secondary>
2259 </indexterm>
2260 <indexterm role="concept">
2261 <primary>hints database</primary>
2262 <secondary>DBM files used for</secondary>
2263 </indexterm>
2264 Even if you do not use any DBM files in your configuration, Exim still needs a
2265 DBM library in order to operate, because it uses indexed files for its hints
2266 databases. Unfortunately, there are a number of DBM libraries in existence, and
2267 different operating systems often have different ones installed.
2268 </para>
2269 <para>
2270 <indexterm role="concept">
2271 <primary>Solaris</primary>
2272 <secondary>DBM library for</secondary>
2273 </indexterm>
2274 <indexterm role="concept">
2275 <primary>IRIX, DBM library for</primary>
2276 </indexterm>
2277 <indexterm role="concept">
2278 <primary>BSD, DBM library for</primary>
2279 </indexterm>
2280 <indexterm role="concept">
2281 <primary>Linux, DBM library for</primary>
2282 </indexterm>
2283 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2284 Linux distribution, the DBM configuration should happen automatically, and you
2285 may be able to ignore this section. Otherwise, you may have to learn more than
2286 you would like about DBM libraries from what follows.
2287 </para>
2288 <para>
2289 <indexterm role="concept">
2290 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2291 </indexterm>
2292 Licensed versions of Unix normally contain a library of DBM functions operating
2293 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2294 versions of Unix seem to vary in what they contain as standard. In particular,
2295 some early versions of Linux have no default DBM library, and different
2296 distributors have chosen to bundle different libraries with their packaged
2297 versions. However, the more recent releases seem to have standardized on the
2298 Berkeley DB library.
2299 </para>
2300 <para>
2301 Different DBM libraries have different conventions for naming the files they
2302 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2303 possibilities:
2304 </para>
2305 <orderedlist numeration="arabic">
2306 <listitem>
2307 <para>
2308 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2309 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2310 </para>
2311 </listitem>
2312 <listitem>
2313 <para>
2314 <indexterm role="concept">
2315 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2316 </indexterm>
2317 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2318 compatibility interface it makes two different hard links to it with names
2319 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2320 file name is used unmodified.
2321 </para>
2322 </listitem>
2323 <listitem>
2324 <para>
2325 <indexterm role="concept">
2326 <primary>Berkeley DB library</primary>
2327 </indexterm>
2328 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2329 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2330 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2331 </para>
2332 </listitem>
2333 <listitem>
2334 <para>
2335 If the Berkeley package is used in its native mode, it operates on a single
2336 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2337 the traditional <emphasis>ndbm</emphasis> interface.
2338 </para>
2339 </listitem>
2340 <listitem>
2341 <para>
2342 To complicate things further, there are several very different versions of the
2343 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2344 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2345 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2346 versions of Berkeley DB can be obtained from
2347 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2348 </para>
2349 </listitem>
2350 <listitem>
2351 <para>
2352 <indexterm role="concept">
2353 <primary><emphasis>tdb</emphasis> DBM library</primary>
2354 </indexterm>
2355 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2356 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2357 operates on a single file.
2358 </para>
2359 </listitem>
2360 </orderedlist>
2361 <para>
2362 <indexterm role="concept">
2363 <primary>USE_DB</primary>
2364 </indexterm>
2365 <indexterm role="concept">
2366 <primary>DBM libraries</primary>
2367 <secondary>configuration for building</secondary>
2368 </indexterm>
2369 Exim and its utilities can be compiled to use any of these interfaces. In order
2370 to use any version of the Berkeley DB package in native mode, you must set
2371 USE_DB in an appropriate configuration file (typically
2372 <filename>Local/Makefile</filename>). For example:
2373 </para>
2374 <literallayout class="monospaced">
2375 USE_DB=yes
2376 </literallayout>
2377 <para>
2378 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2379 error is diagnosed if you set more than one of these.
2380 </para>
2381 <para>
2382 At the lowest level, the build-time configuration sets none of these options,
2383 thereby assuming an interface of type (1). However, some operating system
2384 configuration files (for example, those for the BSD operating systems and
2385 Linux) assume type (4) by setting USE_DB as their default, and the
2386 configuration files for Cygwin set USE_GDBM. Anything you set in
2387 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2388 </para>
2389 <para>
2390 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2391 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2392 in one of these lines:
2393 </para>
2394 <literallayout class="monospaced">
2395 DBMLIB = -ldb
2396 DBMLIB = -ltdb
2397 </literallayout>
2398 <para>
2399 Settings like that will work if the DBM library is installed in the standard
2400 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2401 the default path. You may need to set INCLUDE to specify where the header
2402 file is, and to specify the path to the library more fully in DBMLIB, as in
2403 this example:
2404 </para>
2405 <literallayout class="monospaced">
2406 INCLUDE=-I/usr/local/include/db-4.1
2407 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2408 </literallayout>
2409 <para>
2410 There is further detailed discussion about the various DBM libraries in the
2411 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2412 </para>
2413 </section>
2414 <section id="SECID25">
2415 <title>Pre-building configuration</title>
2416 <para>
2417 <indexterm role="concept">
2418 <primary>building Exim</primary>
2419 <secondary>pre-building configuration</secondary>
2420 </indexterm>
2421 <indexterm role="concept">
2422 <primary>configuration for building Exim</primary>
2423 </indexterm>
2424 <indexterm role="concept">
2425 <primary><filename>Local/Makefile</filename></primary>
2426 </indexterm>
2427 <indexterm role="concept">
2428 <primary><filename>src/EDITME</filename></primary>
2429 </indexterm>
2430 Before building Exim, a local configuration file that specifies options
2431 independent of any operating system has to be created with the name
2432 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2433 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2434 therein. These descriptions are therefore not repeated here. If you are
2435 building Exim for the first time, the simplest thing to do is to copy
2436 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2437 </para>
2438 <para>
2439 There are three settings that you must supply, because Exim will not build
2440 without them. They are the location of the run time configuration file
2441 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2442 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2443 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2444 a colon-separated list of file names; Exim uses the first of them that exists.
2445 </para>
2446 <para>
2447 There are a few other parameters that can be specified either at build time or
2448 at run time, to enable the same binary to be used on a number of different
2449 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2450 directory (if not within the spool directory) are fixed, it is recommended that
2451 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2452 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2453 be logged.
2454 </para>
2455 <para>
2456 <indexterm role="concept">
2457 <primary>content scanning</primary>
2458 <secondary>specifying at build time</secondary>
2459 </indexterm>
2460 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2461 access control lists are not compiled by default. If you want to include these
2462 facilities, you need to set
2463 </para>
2464 <literallayout class="monospaced">
2465 WITH_CONTENT_SCAN=yes
2466 </literallayout>
2467 <para>
2468 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2469 chapter <xref linkend="CHAPexiscan"/>.
2470 </para>
2471 <para>
2472 <indexterm role="concept">
2473 <primary><filename>Local/eximon.conf</filename></primary>
2474 </indexterm>
2475 <indexterm role="concept">
2476 <primary><filename>exim_monitor/EDITME</filename></primary>
2477 </indexterm>
2478 If you are going to build the Exim monitor, a similar configuration process is
2479 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2480 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2481 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2482 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2483 </para>
2484 <para>
2485 This is all the configuration that is needed in straightforward cases for known
2486 operating systems. However, the building process is set up so that it is easy
2487 to override options that are set by default or by operating-system-specific
2488 configuration files, for example to change the name of the C compiler, which
2489 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2490 do this.
2491 </para>
2492 </section>
2493 <section id="SECID26">
2494 <title>Support for iconv()</title>
2495 <para>
2496 <indexterm role="concept">
2497 <primary><function>iconv()</function> support</primary>
2498 </indexterm>
2499 <indexterm role="concept">
2500 <primary>RFC 2047</primary>
2501 </indexterm>
2502 The contents of header lines in messages may be encoded according to the rules
2503 described RFC 2047. This makes it possible to transmit characters that are not
2504 in the ASCII character set, and to label them as being in a particular
2505 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2506 mechanism, it decodes them, and translates them into a specified character set
2507 (default ISO-8859-1). The translation is possible only if the operating system
2508 supports the <function>iconv()</function> function.
2509 </para>
2510 <para>
2511 However, some of the operating systems that supply <function>iconv()</function> do not support
2512 very many conversions. The GNU <option>libiconv</option> library (available from
2513 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2514 systems to remedy this deficiency, as well as on systems that do not supply
2515 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2516 </para>
2517 <literallayout class="monospaced">
2518 HAVE_ICONV=yes
2519 </literallayout>
2520 <para>
2521 to your <filename>Local/Makefile</filename> and rebuild Exim.
2522 </para>
2523 </section>
2524 <section id="SECTinctlsssl">
2525 <title>Including TLS/SSL encryption support</title>
2526 <para>
2527 <indexterm role="concept">
2528 <primary>TLS</primary>
2529 <secondary>including support for TLS</secondary>
2530 </indexterm>
2531 <indexterm role="concept">
2532 <primary>encryption</primary>
2533 <secondary>including support for</secondary>
2534 </indexterm>
2535 <indexterm role="concept">
2536 <primary>SUPPORT_TLS</primary>
2537 </indexterm>
2538 <indexterm role="concept">
2539 <primary>OpenSSL</primary>
2540 <secondary>building Exim with</secondary>
2541 </indexterm>
2542 <indexterm role="concept">
2543 <primary>GnuTLS</primary>
2544 <secondary>building Exim with</secondary>
2545 </indexterm>
2546 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2547 command as per RFC 2487. It can also support legacy clients that expect to
2548 start a TLS session immediately on connection to a non-standard port (see the
2549 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2550 line option).
2551 </para>
2552 <para>
2553 If you want to build Exim with TLS support, you must first install either the
2554 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2555 implementing SSL.
2556 </para>
2557 <para>
2558 If OpenSSL is installed, you should set
2559 </para>
2560 <literallayout class="monospaced">
2561 SUPPORT_TLS=yes
2562 TLS_LIBS=-lssl -lcrypto
2563 </literallayout>
2564 <para>
2565 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2566 OpenSSL library and include files. For example:
2567 </para>
2568 <literallayout class="monospaced">
2569 SUPPORT_TLS=yes
2570 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2571 TLS_INCLUDE=-I/usr/local/openssl/include/
2572 </literallayout>
2573 <para>
2574 <indexterm role="concept">
2575 <primary>pkg-config</primary>
2576 <secondary>OpenSSL</secondary>
2577 </indexterm>
2578 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2579 </para>
2580 <literallayout class="monospaced">
2581 SUPPORT_TLS=yes
2582 USE_OPENSSL_PC=openssl
2583 </literallayout>
2584 <para>
2585 <indexterm role="concept">
2586 <primary>USE_GNUTLS</primary>
2587 </indexterm>
2588 If GnuTLS is installed, you should set
2589 </para>
2590 <literallayout class="monospaced">
2591 SUPPORT_TLS=yes
2592 USE_GNUTLS=yes
2593 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2594 </literallayout>
2595 <para>
2596 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2597 library and include files. For example:
2598 </para>
2599 <literallayout class="monospaced">
2600 SUPPORT_TLS=yes
2601 USE_GNUTLS=yes
2602 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2603 TLS_INCLUDE=-I/usr/gnu/include
2604 </literallayout>
2605 <para>
2606 <indexterm role="concept">
2607 <primary>pkg-config</primary>
2608 <secondary>GnuTLS</secondary>
2609 </indexterm>
2610 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2611 </para>
2612 <literallayout class="monospaced">
2613 SUPPORT_TLS=yes
2614 USE_GNUTLS=yes
2615 USE_GNUTLS_PC=gnutls
2616 </literallayout>
2617 <para>
2618 You do not need to set TLS_INCLUDE if the relevant directory is already
2619 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2620 given in chapter <xref linkend="CHAPTLS"/>.
2621 </para>
2622 </section>
2623 <section id="SECID27">
2624 <title>Use of tcpwrappers</title>
2625 <para>
2626 <indexterm role="concept">
2627 <primary>tcpwrappers, building Exim to support</primary>
2628 </indexterm>
2629 <indexterm role="concept">
2630 <primary>USE_TCP_WRAPPERS</primary>
2631 </indexterm>
2632 <indexterm role="concept">
2633 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2634 </indexterm>
2635 <indexterm role="concept">
2636 <primary>tcp_wrappers_daemon_name</primary>
2637 </indexterm>
2638 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2639 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2640 alternative to Exim&#x2019;s own checking facilities for installations that are
2641 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2642 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2643 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2644 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2645 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2646 you might have
2647 </para>
2648 <literallayout class="monospaced">
2649 USE_TCP_WRAPPERS=yes
2650 CFLAGS=-O -I/usr/local/include
2651 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2652 </literallayout>
2653 <para>
2654 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2655 files is <quote>exim</quote>. For example, the line
2656 </para>
2657 <literallayout class="monospaced">
2658 exim : LOCAL  192.168.1.  .friendly.domain.example
2659 </literallayout>
2660 <para>
2661 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2662 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2663 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2664 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2665 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2666 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2667 further details.
2668 </para>
2669 </section>
2670 <section id="SECID28">
2671 <title>Including support for IPv6</title>
2672 <para>
2673 <indexterm role="concept">
2674 <primary>IPv6</primary>
2675 <secondary>including support for</secondary>
2676 </indexterm>
2677 Exim contains code for use on systems that have IPv6 support. Setting
2678 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2679 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2680 where the IPv6 support is not fully integrated into the normal include and
2681 library files.
2682 </para>
2683 <para>
2684 Two different types of DNS record for handling IPv6 addresses have been
2685 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2686 currently seen as the mainstream. Another record type called A6 was proposed
2687 as better than AAAA because it had more flexibility. However, it was felt to be
2688 over-complex, and its status was reduced to <quote>experimental</quote>.
2689 </para>
2690 <para revisionflag="changed">
2691 Exim used to
2692 have a compile option for including A6 record support but this has now been
2693 withdrawn.
2694 </para>
2695 </section>
2696 <section id="SECTdynamicmodules">
2697 <title>Dynamically loaded lookup module support</title>
2698 <para>
2699 <indexterm role="concept">
2700 <primary>lookup modules</primary>
2701 </indexterm>
2702 <indexterm role="concept">
2703 <primary>dynamic modules</primary>
2704 </indexterm>
2705 <indexterm role="concept">
2706 <primary>.so building</primary>
2707 </indexterm>
2708 On some platforms, Exim supports not compiling all lookup types directly into
2709 the main binary, instead putting some into external modules which can be loaded
2710 on demand.
2711 This permits packagers to build Exim with support for lookups with extensive
2712 library dependencies without requiring all users to install all of those
2713 dependencies.
2714 Most, but not all, lookup types can be built this way.
2715 </para>
2716 <para>
2717 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2718 installed; Exim will only load modules from that directory, as a security
2719 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2720 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2721 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2722 see <filename>src/EDITME</filename> for details.
2723 </para>
2724 <para>
2725 Then, for each module to be loaded dynamically, define the relevant
2726 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2727 For example, this will build in lsearch but load sqlite and mysql support
2728 on demand:
2729 </para>
2730 <literallayout class="monospaced">
2731 LOOKUP_LSEARCH=yes
2732 LOOKUP_SQLITE=2
2733 LOOKUP_MYSQL=2
2734 </literallayout>
2735 </section>
2736 <section id="SECID29">
2737 <title>The building process</title>
2738 <para>
2739 <indexterm role="concept">
2740 <primary>build directory</primary>
2741 </indexterm>
2742 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2743 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2744 operating system types, and creates a build directory if one does not exist.
2745 For example, on a Sun system running Solaris 8, the directory
2746 <filename>build-SunOS5-5.8-sparc</filename> is created.
2747 <indexterm role="concept">
2748 <primary>symbolic link</primary>
2749 <secondary>to source files</secondary>
2750 </indexterm>
2751 Symbolic links to relevant source files are installed in the build directory.
2752 </para>
2753 <para>
2754 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2755 a make file inside the build directory, using the configuration files from the
2756 <filename>Local</filename> directory. The new make file is then passed to another instance of
2757 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2758 then compiling and linking the binaries for the Exim monitor (if configured), a
2759 number of utility programs, and finally Exim itself. The command <literal>make
2760 makefile</literal> can be used to force a rebuild of the make file in the build
2761 directory, should this ever be necessary.
2762 </para>
2763 <para>
2764 If you have problems building Exim, check for any comments there may be in the
2765 <filename>README</filename> file concerning your operating system, and also take a look at the
2766 FAQ, where some common problems are covered.
2767 </para>
2768 </section>
2769 <section id="SECID283">
2770 <title>Output from <quote>make</quote></title>
2771 <para>
2772 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2773 unreadable, because these lines can be very long. For this reason, the normal
2774 output is suppressed by default, and instead output similar to that which
2775 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2776 each module that is being compiled or linked. However, it is still possible to
2777 get the full output, by calling <emphasis>make</emphasis> like this:
2778 </para>
2779 <literallayout class="monospaced">
2780 FULLECHO='' make -e
2781 </literallayout>
2782 <para>
2783 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2784 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2785 given in addition to the short output.
2786 </para>
2787 </section>
2788 <section id="SECToverride">
2789 <title>Overriding build-time options for Exim</title>
2790 <para>
2791 <indexterm role="concept">
2792 <primary>build-time options, overriding</primary>
2793 </indexterm>
2794 The main make file that is created at the beginning of the building process
2795 consists of the concatenation of a number of files which set configuration
2796 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2797 more than once, the last setting overrides any previous ones. This provides a
2798 convenient way of overriding defaults. The files that are concatenated are, in
2799 order:
2800 </para>
2801 <literallayout>
2802 <filename>OS/Makefile-Default</filename>
2803 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2804 <filename>Local/Makefile</filename>
2805 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2806 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2807 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2808 <filename>OS/Makefile-Base</filename>
2809 </literallayout>
2810 <para>
2811 <indexterm role="concept">
2812 <primary><filename>Local/Makefile</filename></primary>
2813 </indexterm>
2814 <indexterm role="concept">
2815 <primary>building Exim</primary>
2816 <secondary>operating system type</secondary>
2817 </indexterm>
2818 <indexterm role="concept">
2819 <primary>building Exim</primary>
2820 <secondary>architecture type</secondary>
2821 </indexterm>
2822 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2823 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2824 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2825 and are often not needed.
2826 </para>
2827 <para>
2828 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2829 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2830 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2831 values are used, thereby providing a means of forcing particular settings.
2832 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2833 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2834 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2835 that Exim expects. You can run these scripts directly from the shell in order
2836 to find out what values are being used on your system.
2837 </para>
2838 <para>
2839 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2840 therein. Some (but not all) are mentioned below. If there is something that
2841 needs changing, review the contents of this file and the contents of the make
2842 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2843 default values are.
2844 </para>
2845 <para>
2846 <indexterm role="concept">
2847 <primary>building Exim</primary>
2848 <secondary>overriding default settings</secondary>
2849 </indexterm>
2850 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2851 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2852 need to change the original files. Instead, you should make the changes by
2853 putting the new values in an appropriate <filename>Local</filename> file. For example,
2854 <indexterm role="concept">
2855 <primary>Tru64-Unix build-time settings</primary>
2856 </indexterm>
2857 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2858 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2859 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2860 called with the option <option>-std1</option>, to make it recognize some of the features of
2861 Standard C that Exim uses. (Most other compilers recognize Standard C by
2862 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2863 containing the lines
2864 </para>
2865 <literallayout class="monospaced">
2866 CC=cc
2867 CFLAGS=-std1
2868 </literallayout>
2869 <para>
2870 If you are compiling for just one operating system, it may be easier to put
2871 these lines directly into <filename>Local/Makefile</filename>.
2872 </para>
2873 <para>
2874 Keeping all your local configuration settings separate from the distributed
2875 files makes it easy to transfer them to new versions of Exim simply by copying
2876 the contents of the <filename>Local</filename> directory.
2877 </para>
2878 <para>
2879 <indexterm role="concept">
2880 <primary>NIS lookup type</primary>
2881 <secondary>including support for</secondary>
2882 </indexterm>
2883 <indexterm role="concept">
2884 <primary>NIS+ lookup type</primary>
2885 <secondary>including support for</secondary>
2886 </indexterm>
2887 <indexterm role="concept">
2888 <primary>LDAP</primary>
2889 <secondary>including support for</secondary>
2890 </indexterm>
2891 <indexterm role="concept">
2892 <primary>lookup</primary>
2893 <secondary>inclusion in binary</secondary>
2894 </indexterm>
2895 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2896 lookup, but not all systems have these components installed, so the default is
2897 not to include the relevant code in the binary. All the different kinds of file
2898 and database lookup that Exim supports are implemented as separate code modules
2899 which are included only if the relevant compile-time options are set. In the
2900 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2901 </para>
2902 <literallayout class="monospaced">
2903 LOOKUP_LDAP=yes
2904 LOOKUP_NIS=yes
2905 LOOKUP_NISPLUS=yes
2906 </literallayout>
2907 <para>
2908 and similar settings apply to the other lookup types. They are all listed in
2909 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2910 libraries need to be installed before compiling Exim.
2911 <indexterm role="concept">
2912 <primary>cdb</primary>
2913 <secondary>including support for</secondary>
2914 </indexterm>
2915 However, there are some optional lookup types (such as cdb) for which
2916 the code is entirely contained within Exim, and no external include
2917 files or libraries are required. When a lookup type is not included in the
2918 binary, attempts to configure Exim to use it cause run time configuration
2919 errors.
2920 </para>
2921 <para>
2922 <indexterm role="concept">
2923 <primary>pkg-config</primary>
2924 <secondary>lookups</secondary>
2925 </indexterm>
2926 <indexterm role="concept">
2927 <primary>pkg-config</primary>
2928 <secondary>authenticators</secondary>
2929 </indexterm>
2930 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2931 about how to compile against a library; Exim has some initial support for
2932 being able to use pkg-config for lookups and authenticators.  For any given
2933 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2934 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2935 name of the package to be queried.  The results of querying via the
2936 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2937 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2938 syntax.  For instance:
2939 </para>
2940 <literallayout class="monospaced">
2941 LOOKUP_SQLITE=yes
2942 LOOKUP_SQLITE_PC=sqlite3
2943 AUTH_GSASL=yes
2944 AUTH_GSASL_PC=libgsasl
2945 AUTH_HEIMDAL_GSSAPI=yes
2946 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2947 </literallayout>
2948 <para>
2949 <indexterm role="concept">
2950 <primary>Perl</primary>
2951 <secondary>including support for</secondary>
2952 </indexterm>
2953 Exim can be linked with an embedded Perl interpreter, allowing Perl
2954 subroutines to be called during string expansion. To enable this facility,
2955 </para>
2956 <literallayout class="monospaced">
2957 EXIM_PERL=perl.o
2958 </literallayout>
2959 <para>
2960 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2961 chapter <xref linkend="CHAPperl"/>.
2962 </para>
2963 <para>
2964 <indexterm role="concept">
2965 <primary>X11 libraries, location of</primary>
2966 </indexterm>
2967 The location of the X11 libraries is something that varies a lot between
2968 operating systems, and there may be different versions of X11 to cope
2969 with. Exim itself makes no use of X11, but if you are compiling the Exim
2970 monitor, the X11 libraries must be available.
2971 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2972 </para>
2973 <literallayout class="monospaced">
2974 X11=/usr/X11R6
2975 XINCLUDE=-I$(X11)/include
2976 XLFLAGS=-L$(X11)/lib
2977 </literallayout>
2978 <para>
2979 These are overridden in some of the operating-system configuration files. For
2980 example, in <filename>OS/Makefile-SunOS5</filename> there is
2981 </para>
2982 <literallayout class="monospaced">
2983 X11=/usr/openwin
2984 XINCLUDE=-I$(X11)/include
2985 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2986 </literallayout>
2987 <para>
2988 If you need to override the default setting for your operating system, place a
2989 definition of all three of these variables into your
2990 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2991 </para>
2992 <para>
2993 <indexterm role="concept">
2994 <primary>EXTRALIBS</primary>
2995 </indexterm>
2996 If you need to add any extra libraries to the link steps, these can be put in a
2997 variable called EXTRALIBS, which appears in all the link commands, but by
2998 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2999 command for linking the main Exim binary, and not for any associated utilities.
3000 </para>
3001 <para>
3002 <indexterm role="concept">
3003 <primary>DBM libraries</primary>
3004 <secondary>configuration for building</secondary>
3005 </indexterm>
3006 There is also DBMLIB, which appears in the link commands for binaries that
3007 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3008 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3009 binary, and which can be used, for example, to include additional X11
3010 libraries.
3011 </para>
3012 <para>
3013 <indexterm role="concept">
3014 <primary>configuration file</primary>
3015 <secondary>editing</secondary>
3016 </indexterm>
3017 The make file copes with rebuilding Exim correctly if any of the configuration
3018 files are edited. However, if an optional configuration file is deleted, it is
3019 necessary to touch the associated non-optional file (that is,
3020 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3021 </para>
3022 </section>
3023 <section id="SECID30">
3024 <title>OS-specific header files</title>
3025 <para>
3026 <indexterm role="concept">
3027 <primary><filename>os.h</filename></primary>
3028 </indexterm>
3029 <indexterm role="concept">
3030 <primary>building Exim</primary>
3031 <secondary>OS-specific C header files</secondary>
3032 </indexterm>
3033 The <filename>OS</filename> directory contains a number of files with names of the form
3034 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3035 normally need to be changed. There is a list of macro settings that are
3036 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3037 are porting Exim to a new operating system.
3038 </para>
3039 </section>
3040 <section id="SECID31">
3041 <title>Overriding build-time options for the monitor</title>
3042 <para>
3043 <indexterm role="concept">
3044 <primary>building Eximon</primary>
3045 </indexterm>
3046 A similar process is used for overriding things when building the Exim monitor,
3047 where the files that are involved are
3048 </para>
3049 <literallayout>
3050 <filename>OS/eximon.conf-Default</filename>
3051 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3052 <filename>Local/eximon.conf</filename>
3053 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3054 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3055 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3056 </literallayout>
3057 <para>
3058 <indexterm role="concept">
3059 <primary><filename>Local/eximon.conf</filename></primary>
3060 </indexterm>
3061 As with Exim itself, the final three files need not exist, and in this case the
3062 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3063 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3064 variables of the same name, preceded by EXIMON_. For example, setting
3065 EXIMON_LOG_DEPTH in the environment overrides the value of
3066 LOG_DEPTH at run time.
3067 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3068 </para>
3069 </section>
3070 <section id="SECID32">
3071 <title>Installing Exim binaries and scripts</title>
3072 <para>
3073 <indexterm role="concept">
3074 <primary>installing Exim</primary>
3075 </indexterm>
3076 <indexterm role="concept">
3077 <primary>BIN_DIRECTORY</primary>
3078 </indexterm>
3079 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3080 arguments. The script copies binaries and utility scripts into the directory
3081 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3082 <indexterm role="concept">
3083 <primary>setuid</primary>
3084 <secondary>installing Exim with</secondary>
3085 </indexterm>
3086 The install script copies files only if they are newer than the files they are
3087 going to replace. The Exim binary is required to be owned by root and have the
3088 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3089 install</literal> as root so that it can set up the Exim binary in this way. However, in
3090 some special situations (for example, if a host is doing no local deliveries)
3091 it may be possible to run Exim without making the binary setuid root (see
3092 chapter <xref linkend="CHAPsecurity"/> for details).
3093 </para>
3094 <para>
3095 <indexterm role="concept">
3096 <primary>CONFIGURE_FILE</primary>
3097 </indexterm>
3098 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3099 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3100 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3101 by the installation script. If a run time configuration file already exists, it
3102 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3103 alternative files, no default is installed.
3104 </para>
3105 <para>
3106 <indexterm role="concept">
3107 <primary>system aliases file</primary>
3108 </indexterm>
3109 <indexterm role="concept">
3110 <primary><filename>/etc/aliases</filename></primary>
3111 </indexterm>
3112 One change is made to the default configuration file when it is installed: the
3113 default configuration contains a router that references a system aliases file.
3114 The path to this file is set to the value specified by
3115 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3116 If the system aliases file does not exist, the installation script creates it,
3117 and outputs a comment to the user.
3118 </para>
3119 <para>
3120 The created file contains no aliases, but it does contain comments about the
3121 aliases a site should normally have. Mail aliases have traditionally been
3122 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3123 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3124 Exim&#x2019;s configuration if necessary.
3125 </para>
3126 <para>
3127 The default configuration uses the local host&#x2019;s name as the only local domain,
3128 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3129 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3130 directories are supported, but no NIS or NIS+ support is configured. Domains
3131 other than the name of the local host are routed using the DNS, with delivery
3132 over SMTP.
3133 </para>
3134 <para>
3135 It is possible to install Exim for special purposes (such as building a binary
3136 distribution) in a private part of the file system. You can do this by a
3137 command such as
3138 </para>
3139 <literallayout class="monospaced">
3140 make DESTDIR=/some/directory/ install
3141 </literallayout>
3142 <para>
3143 This has the effect of pre-pending the specified directory to all the file
3144 paths, except the name of the system aliases file that appears in the default
3145 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3146 For backwards compatibility, ROOT is used if DESTDIR is not set,
3147 but this usage is deprecated.
3148 </para>
3149 <para>
3150 <indexterm role="concept">
3151 <primary>installing Exim</primary>
3152 <secondary>what is not installed</secondary>
3153 </indexterm>
3154 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3155 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3156 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3157 directory are copied, except for the info files when you have set
3158 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3159 </para>
3160 <para>
3161 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3162 to their names. The Exim binary itself, however, is handled differently. It is
3163 installed under a name that includes the version number and the compile number,
3164 for example <filename>exim-4.86.2-1</filename>. The script then arranges for a symbolic link
3165 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3166 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3167 from the directory (as seen by other processes).
3168 </para>
3169 <para>
3170 <indexterm role="concept">
3171 <primary>installing Exim</primary>
3172 <secondary>testing the script</secondary>
3173 </indexterm>
3174 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3175 real, you can pass the <option>-n</option> option to the installation script by this
3176 command:
3177 </para>
3178 <literallayout class="monospaced">
3179 make INSTALL_ARG=-n install
3180 </literallayout>
3181 <para>
3182 The contents of the variable INSTALL_ARG are passed to the installation
3183 script. You do not need to be root to run this test. Alternatively, you can run
3184 the installation script directly, but this must be from within the build
3185 directory. For example, from the top-level Exim directory you could use this
3186 command:
3187 </para>
3188 <literallayout class="monospaced">
3189 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3190 </literallayout>
3191 <para>
3192 <indexterm role="concept">
3193 <primary>installing Exim</primary>
3194 <secondary>install script options</secondary>
3195 </indexterm>
3196 There are two other options that can be supplied to the installation script.
3197 </para>
3198 <itemizedlist>
3199 <listitem>
3200 <para>
3201 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3202 to root, and the call to make it a setuid binary.
3203 </para>
3204 </listitem>
3205 <listitem>
3206 <para>
3207 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3208 installed binary.
3209 </para>
3210 </listitem>
3211 </itemizedlist>
3212 <para>
3213 INSTALL_ARG can be used to pass these options to the script. For example:
3214 </para>
3215 <literallayout class="monospaced">
3216 make INSTALL_ARG=-no_symlink install
3217 </literallayout>
3218 <para>
3219 The installation script can also be given arguments specifying which files are
3220 to be copied. For example, to install just the Exim binary, and nothing else,
3221 without creating the symbolic link, you could use:
3222 </para>
3223 <literallayout class="monospaced">
3224 make INSTALL_ARG='-no_symlink exim' install
3225 </literallayout>
3226 </section>
3227 <section id="SECTinsinfdoc">
3228 <title>Installing info documentation</title>
3229 <para>
3230 <indexterm role="concept">
3231 <primary>installing Exim</primary>
3232 <secondary><emphasis>info</emphasis> documentation</secondary>
3233 </indexterm>
3234 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3235 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3236 distribution. Instead it is available separately from the ftp site (see section
3237 <xref linkend="SECTavail"/>).
3238 </para>
3239 <para>
3240 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3241 source of the documentation is found in the source tree, running <literal>make
3242 install</literal> automatically builds the info files and installs them.
3243 </para>
3244 </section>
3245 <section id="SECID33">
3246 <title>Setting up the spool directory</title>
3247 <para>
3248 <indexterm role="concept">
3249 <primary>spool directory</primary>
3250 <secondary>creating</secondary>
3251 </indexterm>
3252 When it starts up, Exim tries to create its spool directory if it does not
3253 exist. The Exim uid and gid are used for the owner and group of the spool
3254 directory. Sub-directories are automatically created in the spool directory as
3255 necessary.
3256 </para>
3257 </section>
3258 <section id="SECID34">
3259 <title>Testing</title>
3260 <para>
3261 <indexterm role="concept">
3262 <primary>testing</primary>
3263 <secondary>installation</secondary>
3264 </indexterm>
3265 Having installed Exim, you can check that the run time configuration file is
3266 syntactically valid by running the following command, which assumes that the
3267 Exim binary directory is within your PATH environment variable:
3268 </para>
3269 <literallayout class="monospaced">
3270 exim -bV
3271 </literallayout>
3272 <para>
3273 If there are any errors in the configuration file, Exim outputs error messages.
3274 Otherwise it outputs the version number and build date,
3275 the DBM library that is being used, and information about which drivers and
3276 other optional code modules are included in the binary.
3277 Some simple routing tests can be done by using the address testing option. For
3278 example,
3279 </para>
3280 <literallayout>
3281 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3282 </literallayout>
3283 <para>
3284 should verify that it recognizes a local mailbox, and
3285 </para>
3286 <literallayout>
3287 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3288 </literallayout>
3289 <para>
3290 a remote one. Then try getting it to deliver mail, both locally and remotely.
3291 This can be done by passing messages directly to Exim, without going through a
3292 user agent. For example:
3293 </para>
3294 <literallayout class="monospaced">
3295 exim -v postmaster@your.domain.example
3296 From: user@your.domain.example
3297 To: postmaster@your.domain.example
3298 Subject: Testing Exim
3299
3300 This is a test message.
3301 ^D
3302 </literallayout>
3303 <para>
3304 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3305 In this case you should see copies of three log lines, one for the message&#x2019;s
3306 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3307 </para>
3308 <para>
3309 <indexterm role="concept">
3310 <primary>delivery</primary>
3311 <secondary>problems with</secondary>
3312 </indexterm>
3313 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3314 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3315 of information is running Exim with debugging turned on, by specifying the
3316 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3317 with debugging turned on by a command of the form
3318 </para>
3319 <literallayout>
3320 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3321 </literallayout>
3322 <para>
3323 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3324 produces rather a lot of output, but you can cut this down to specific areas.
3325 For example, if you use <option>-d-all+route</option> only the debugging information
3326 relevant to routing is included. (See the <option>-d</option> option in chapter
3327 <xref linkend="CHAPcommandline"/> for more details.)
3328 </para>
3329 <para>
3330 <indexterm role="concept">
3331 <primary><quote>sticky</quote> bit</primary>
3332 </indexterm>
3333 <indexterm role="concept">
3334 <primary>lock files</primary>
3335 </indexterm>
3336 One specific problem that has shown up on some sites is the inability to do
3337 local deliveries into a shared mailbox directory, because it does not have the
3338 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3339 writing to a mailbox file, and if it cannot create the lock file, the delivery
3340 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3341 directory, or by setting a specific group for local deliveries and allowing
3342 that group to create files in the directory (see the comments above the
3343 <command>local_delivery</command> transport in the default configuration file). Another
3344 approach is to configure Exim not to use lock files, but just to rely on
3345 <function>fcntl()</function> locking instead. However, you should do this only if all user
3346 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3347 see chapter <xref linkend="CHAPappendfile"/>.
3348 </para>
3349 <para>
3350 One thing that cannot be tested on a system that is already running an MTA is
3351 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3352 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3353 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3354 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3355 incoming SMTP mail.
3356 </para>
3357 <para>
3358 Testing a new version on a system that is already running Exim can most easily
3359 be done by building a binary with a different CONFIGURE_FILE setting. From
3360 within the run time configuration, all other file and directory names
3361 that Exim uses can be altered, in order to keep it entirely clear of the
3362 production version.
3363 </para>
3364 </section>
3365 <section id="SECID35">
3366 <title>Replacing another MTA with Exim</title>
3367 <para>
3368 <indexterm role="concept">
3369 <primary>replacing another MTA</primary>
3370 </indexterm>
3371 Building and installing Exim for the first time does not of itself put it in
3372 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3373 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3374 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3375 binary in order to get the user agents to pass messages to Exim. This is
3376 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3377 or <filename>/usr/lib/sendmail</filename>
3378 <indexterm role="concept">
3379 <primary>symbolic link</primary>
3380 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3381 </indexterm>
3382 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3383 privilege and executable status from the old MTA. It is then necessary to stop
3384 and restart the mailer daemon, if one is running.
3385 </para>
3386 <para>
3387 <indexterm role="concept">
3388 <primary>FreeBSD, MTA indirection</primary>
3389 </indexterm>
3390 <indexterm role="concept">
3391 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3392 </indexterm>
3393 Some operating systems have introduced alternative ways of switching MTAs. For
3394 example, if you are running FreeBSD, you need to edit the file
3395 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3396 described. A typical example of the contents of this file for running Exim is
3397 as follows:
3398 </para>
3399 <literallayout class="monospaced">
3400 sendmail            /usr/exim/bin/exim
3401 send-mail           /usr/exim/bin/exim
3402 mailq               /usr/exim/bin/exim -bp
3403 newaliases          /usr/bin/true
3404 </literallayout>
3405 <para>
3406 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3407 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3408 favourite user agent.
3409 </para>
3410 <para>
3411 You should consider what to tell your users about the change of MTA. Exim may
3412 have different capabilities to what was previously running, and there are
3413 various operational differences such as the text of messages produced by
3414 command line options and in bounce messages. If you allow your users to make
3415 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3416 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3417 </para>
3418 </section>
3419 <section id="SECID36">
3420 <title>Upgrading Exim</title>
3421 <para>
3422 <indexterm role="concept">
3423 <primary>upgrading Exim</primary>
3424 </indexterm>
3425 If you are already running Exim on your host, building and installing a new
3426 version automatically makes it available to MUAs, or any other programs that
3427 call the MTA directly. However, if you are running an Exim daemon, you do need
3428 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3429 new binary. You do not need to stop processing mail in order to install a new
3430 version of Exim. The install script does not modify an existing runtime
3431 configuration file.
3432 </para>
3433 </section>
3434 <section id="SECID37">
3435 <title>Stopping the Exim daemon on Solaris</title>
3436 <para>
3437 <indexterm role="concept">
3438 <primary>Solaris</primary>
3439 <secondary>stopping Exim on</secondary>
3440 </indexterm>
3441 The standard command for stopping the mailer daemon on Solaris is
3442 </para>
3443 <literallayout class="monospaced">
3444 /etc/init.d/sendmail stop
3445 </literallayout>
3446 <para>
3447 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3448 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3449 for the text <quote>sendmail</quote>; this is not present because the actual program name
3450 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3451 solution is to replace the line that finds the process id with something like
3452 </para>
3453 <literallayout class="monospaced">
3454 pid=`cat /var/spool/exim/exim-daemon.pid`
3455 </literallayout>
3456 <para>
3457 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3458 </para>
3459 <para>
3460 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3461 still be received from local processes, and if automatic delivery is configured
3462 (the normal case), deliveries will still occur.
3463 </para>
3464 </section>
3465 </chapter>
3466
3467 <chapter id="CHAPcommandline">
3468 <title>The Exim command line</title>
3469 <para>
3470 <indexterm role="concept" id="IIDclo1" class="startofrange">
3471 <primary>command line</primary>
3472 <secondary>options</secondary>
3473 </indexterm>
3474 <indexterm role="concept" id="IIDclo2" class="startofrange">
3475 <primary>options</primary>
3476 <secondary>command line</secondary>
3477 </indexterm>
3478 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3479 each starting with a hyphen character, followed by a number of arguments. The
3480 options are compatible with the main options of Sendmail, and there are also
3481 some additional options, some of which are compatible with Smail 3. Certain
3482 combinations of options do not make sense, and provoke an error if used.
3483 The form of the arguments depends on which options are set.
3484 </para>
3485 <section id="SECID38">
3486 <title>Setting options by program name</title>
3487 <para>
3488 <indexterm role="concept">
3489 <primary><emphasis>mailq</emphasis></primary>
3490 </indexterm>
3491 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3492 were present before any other options.
3493 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3494 standard output.
3495 This feature is for compatibility with some systems that contain a command of
3496 that name in one of the standard libraries, symbolically linked to
3497 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3498 </para>
3499 <para>
3500 <indexterm role="concept">
3501 <primary><emphasis>rsmtp</emphasis></primary>
3502 </indexterm>
3503 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3504 were present before any other options, for compatibility with Smail. The
3505 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3506 format.
3507 </para>
3508 <para>
3509 <indexterm role="concept">
3510 <primary><emphasis>rmail</emphasis></primary>
3511 </indexterm>
3512 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3513 <option>-oee</option> options were present before any other options, for compatibility with
3514 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3515 </para>
3516 <para>
3517 <indexterm role="concept">
3518 <primary><emphasis>runq</emphasis></primary>
3519 </indexterm>
3520 <indexterm role="concept">
3521 <primary>queue runner</primary>
3522 </indexterm>
3523 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3524 were present before any other options, for compatibility with Smail. The <option>-q</option>
3525 option causes a single queue runner process to be started.
3526 </para>
3527 <para>
3528 <indexterm role="concept">
3529 <primary><emphasis>newaliases</emphasis></primary>
3530 </indexterm>
3531 <indexterm role="concept">
3532 <primary>alias file</primary>
3533 <secondary>building</secondary>
3534 </indexterm>
3535 <indexterm role="concept">
3536 <primary>Sendmail compatibility</primary>
3537 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3538 </indexterm>
3539 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3540 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3541 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3542 the concept of a single alias file, but can be configured to run a given
3543 command if called with the <option>-bi</option> option.
3544 </para>
3545 </section>
3546 <section id="SECTtrustedadmin">
3547 <title>Trusted and admin users</title>
3548 <para>
3549 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3550 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3551 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3552 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3553 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3554 </para>
3555 <itemizedlist>
3556 <listitem>
3557 <para>
3558 <indexterm role="concept">
3559 <primary>trusted users</primary>
3560 <secondary>definition of</secondary>
3561 </indexterm>
3562 <indexterm role="concept">
3563 <primary>user</primary>
3564 <secondary>trusted definition of</secondary>
3565 </indexterm>
3566 The trusted users are root, the Exim user, any user listed in the
3567 <option>trusted_users</option> configuration option, and any user whose current group or any
3568 supplementary group is one of those listed in the <option>trusted_groups</option>
3569 configuration option. Note that the Exim group is not automatically trusted.
3570 </para>
3571 <para>
3572 <indexterm role="concept">
3573 <primary><quote>From</quote> line</primary>
3574 </indexterm>
3575 <indexterm role="concept">
3576 <primary>envelope sender</primary>
3577 </indexterm>
3578 Trusted users are always permitted to use the <option>-f</option> option or a leading
3579 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3580 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3581 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3582 users to set envelope senders.
3583 </para>
3584 <para>
3585 <indexterm role="concept">
3586 <primary><emphasis>From:</emphasis> header line</primary>
3587 </indexterm>
3588 <indexterm role="concept">
3589 <primary><emphasis>Sender:</emphasis> header line</primary>
3590 </indexterm>
3591 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3592 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3593 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3594 </para>
3595 <para>
3596 Trusted users may also specify a host name, host address, interface address,
3597 protocol name, ident value, and authentication data when submitting a message
3598 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3599 have the characteristics of messages received from a remote host. Untrusted
3600 users may in some circumstances use <option>-f</option>, but can never set the other values
3601 that are available to trusted users.
3602 </para>
3603 </listitem>
3604 <listitem>
3605 <para>
3606 <indexterm role="concept">
3607 <primary>user</primary>
3608 <secondary>admin definition of</secondary>
3609 </indexterm>
3610 <indexterm role="concept">
3611 <primary>admin user</primary>
3612 <secondary>definition of</secondary>
3613 </indexterm>
3614 The admin users are root, the Exim user, and any user that is a member of the
3615 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3616 The current group does not have to be one of these groups.
3617 </para>
3618 <para>
3619 Admin users are permitted to list the queue, and to carry out certain
3620 operations on messages, for example, to force delivery failures. It is also
3621 necessary to be an admin user in order to see the full information provided by
3622 the Exim monitor, and full debugging output.
3623 </para>
3624 <para>
3625 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3626 Exim to attempt delivery of messages on its queue is restricted to admin users.
3627 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3628 option false (that is, specifying <option>no_prod_requires_admin</option>).
3629 </para>
3630 <para>
3631 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3632 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3633 false.
3634 </para>
3635 </listitem>
3636 </itemizedlist>
3637 <para>
3638 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3639 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3640 getting root. There is further discussion of this issue at the start of chapter
3641 <xref linkend="CHAPconf"/>.
3642 </para>
3643 </section>
3644 <section id="SECID39">
3645 <title>Command line options</title>
3646 <para>
3647 Exim&#x2019;s command line options are described in alphabetical order below. If none
3648 of the options that specifies a specific action (such as starting the daemon or
3649 a queue runner, or testing an address, or receiving a message in a specific
3650 format, or listing the queue) are present, and there is at least one argument
3651 on the command line, <option>-bm</option> (accept a local message on the standard input,
3652 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3653 outputs a brief message about itself and exits.
3654 </para>
3655 <!-- === Start of command line options === -->
3656 <variablelist>
3657 <varlistentry>
3658 <term><option>--</option></term>
3659 <listitem>
3660 <para>
3661 <indexterm role="option">
3662 <primary>--</primary>
3663 </indexterm>
3664 <indexterm role="concept">
3665 <primary>options</primary>
3666 <secondary>command line; terminating</secondary>
3667 </indexterm>
3668 This is a pseudo-option whose only purpose is to terminate the options and
3669 therefore to cause subsequent command line items to be treated as arguments
3670 rather than options, even if they begin with hyphens.
3671 </para>
3672 </listitem></varlistentry>
3673 <varlistentry>
3674 <term><option>--help</option></term>
3675 <listitem>
3676 <para>
3677 <indexterm role="option">
3678 <primary><option>--help</option></primary>
3679 </indexterm>
3680 This option causes Exim to output a few sentences stating what it is.
3681 The same output is generated if the Exim binary is called with no options and
3682 no arguments.
3683 </para>
3684 </listitem></varlistentry>
3685 <varlistentry>
3686 <term><option>--version</option></term>
3687 <listitem>
3688 <para>
3689 <indexterm role="option">
3690 <primary><option>--version</option></primary>
3691 </indexterm>
3692 This option is an alias for <option>-bV</option> and causes version information to be
3693 displayed.
3694 </para>
3695 </listitem></varlistentry>
3696 <varlistentry>
3697 <term><option>-Ac</option></term>
3698 <term><option>-Am</option></term>
3699 <listitem>
3700 <para>
3701 <indexterm role="option">
3702 <primary><option>-Ac</option></primary>
3703 </indexterm>
3704 <indexterm role="option">
3705 <primary><option>-Am</option></primary>
3706 </indexterm>
3707 These options are used by Sendmail for selecting configuration files and are
3708 ignored by Exim.
3709 </para>
3710 </listitem></varlistentry>
3711 <varlistentry>
3712 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3713 <listitem>
3714 <para>
3715 <indexterm role="option">
3716 <primary><option>-B</option></primary>
3717 </indexterm>
3718 <indexterm role="concept">
3719 <primary>8-bit characters</primary>
3720 </indexterm>
3721 <indexterm role="concept">
3722 <primary>Sendmail compatibility</primary>
3723 <secondary>8-bit characters</secondary>
3724 </indexterm>
3725 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3726 clean; it ignores this option.
3727 </para>
3728 </listitem></varlistentry>
3729 <varlistentry>
3730 <term><option>-bd</option></term>
3731 <listitem>
3732 <para>
3733 <indexterm role="option">
3734 <primary><option>-bd</option></primary>
3735 </indexterm>
3736 <indexterm role="concept">
3737 <primary>daemon</primary>
3738 </indexterm>
3739 <indexterm role="concept">
3740 <primary>SMTP</primary>
3741 <secondary>listener</secondary>
3742 </indexterm>
3743 <indexterm role="concept">
3744 <primary>queue runner</primary>
3745 </indexterm>
3746 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3747 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3748 that the daemon should also initiate periodic queue runs.
3749 </para>
3750 <para>
3751 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3752 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3753 disconnect from the controlling terminal. When running this way, it can be
3754 stopped by pressing ctrl-C.
3755 </para>
3756 <para>
3757 By default, Exim listens for incoming connections to the standard SMTP port on
3758 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3759 ports, on multiple ports, and only on specific interfaces. Chapter
3760 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3761 </para>
3762 <para>
3763 When a listening daemon
3764 <indexterm role="concept">
3765 <primary>daemon</primary>
3766 <secondary>process id (pid)</secondary>
3767 </indexterm>
3768 <indexterm role="concept">
3769 <primary>pid (process id)</primary>
3770 <secondary>of daemon</secondary>
3771 </indexterm>
3772 is started without the use of <option>-oX</option> (that is, without overriding the normal
3773 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3774 in Exim&#x2019;s spool directory. This location can be overridden by setting
3775 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3776 running as root.
3777 </para>
3778 <para>
3779 When <option>-oX</option> is used on the command line to start a listening daemon, the
3780 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3781 used to specify a path on the command line if a pid file is required.
3782 </para>
3783 <para>
3784 The SIGHUP signal
3785 <indexterm role="concept">
3786 <primary>SIGHUP</primary>
3787 </indexterm>
3788 <indexterm role="concept">
3789 <primary>daemon</primary>
3790 <secondary>restarting</secondary>
3791 </indexterm>
3792 can be used to cause the daemon to re-execute itself. This should be done
3793 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3794 means of the <option>.include</option> facility, is changed, and also whenever a new version
3795 of Exim is installed. It is not necessary to do this when other files that are
3796 referenced from the configuration (for example, alias files) are changed,
3797 because these are reread each time they are used.
3798 </para>
3799 </listitem></varlistentry>
3800 <varlistentry>
3801 <term><option>-bdf</option></term>
3802 <listitem>
3803 <para>
3804 <indexterm role="option">
3805 <primary><option>-bdf</option></primary>
3806 </indexterm>
3807 This option has the same effect as <option>-bd</option> except that it never disconnects
3808 from the controlling terminal, even when no debugging is specified.
3809 </para>
3810 </listitem></varlistentry>
3811 <varlistentry>
3812 <term><option>-be</option></term>
3813 <listitem>
3814 <para>
3815 <indexterm role="option">
3816 <primary><option>-be</option></primary>
3817 </indexterm>
3818 <indexterm role="concept">
3819 <primary>testing</primary>
3820 <secondary>string expansion</secondary>
3821 </indexterm>
3822 <indexterm role="concept">
3823 <primary>expansion</primary>
3824 <secondary>testing</secondary>
3825 </indexterm>
3826 Run Exim in expansion testing mode. Exim discards its root privilege, to
3827 prevent ordinary users from using this mode to read otherwise inaccessible
3828 files. If no arguments are given, Exim runs interactively, prompting for lines
3829 of data. Otherwise, it processes each argument in turn.
3830 </para>
3831 <para>
3832 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3833 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3834 used without command line arguments. If successful, it uses the <function>readline()</function>
3835 function, which provides extensive line-editing facilities, for reading the
3836 test data. A line history is supported.
3837 </para>
3838 <para>
3839 Long expansion expressions can be split over several lines by using backslash
3840 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3841 continuation lines is ignored. Each argument or data line is passed through the
3842 string expansion mechanism, and the result is output. Variable values from the
3843 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3844 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3845 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3846 </para>
3847 <para>
3848 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3849 files or databases you are using, you must exit and restart Exim before trying
3850 the same lookup again. Otherwise, because each Exim process caches the results
3851 of lookups, you will just get the same result as before.
3852 </para>
3853 </listitem></varlistentry>
3854 <varlistentry>
3855 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3856 <listitem>
3857 <para>
3858 <indexterm role="option">
3859 <primary><option>-bem</option></primary>
3860 </indexterm>
3861 <indexterm role="concept">
3862 <primary>testing</primary>
3863 <secondary>string expansion</secondary>
3864 </indexterm>
3865 <indexterm role="concept">
3866 <primary>expansion</primary>
3867 <secondary>testing</secondary>
3868 </indexterm>
3869 This option operates like <option>-be</option> except that it must be followed by the name
3870 of a file. For example:
3871 </para>
3872 <literallayout class="monospaced">
3873 exim -bem /tmp/testmessage
3874 </literallayout>
3875 <para>
3876 The file is read as a message (as if receiving a locally-submitted non-SMTP
3877 message) before any of the test expansions are done. Thus, message-specific
3878 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3879 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3880 recipients are read from the headers in the normal way, and are shown in the
3881 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3882 line, because further arguments are taken as strings to expand (just like
3883 <option>-be</option>).
3884 </para>
3885 </listitem></varlistentry>
3886 <varlistentry>
3887 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3888 <listitem>
3889 <para>
3890 <indexterm role="option">
3891 <primary><option>-bF</option></primary>
3892 </indexterm>
3893 <indexterm role="concept">
3894 <primary>system filter</primary>
3895 <secondary>testing</secondary>
3896 </indexterm>
3897 <indexterm role="concept">
3898 <primary>testing</primary>
3899 <secondary>system filter</secondary>
3900 </indexterm>
3901 This option is the same as <option>-bf</option> except that it assumes that the filter being
3902 tested is a system filter. The additional commands that are available only in
3903 system filters are recognized.
3904 </para>
3905 </listitem></varlistentry>
3906 <varlistentry>
3907 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3908 <listitem>
3909 <para>
3910 <indexterm role="option">
3911 <primary><option>-bf</option></primary>
3912 </indexterm>
3913 <indexterm role="concept">
3914 <primary>filter</primary>
3915 <secondary>testing</secondary>
3916 </indexterm>
3917 <indexterm role="concept">
3918 <primary>testing</primary>
3919 <secondary>filter file</secondary>
3920 </indexterm>
3921 <indexterm role="concept">
3922 <primary>forward file</primary>
3923 <secondary>testing</secondary>
3924 </indexterm>
3925 <indexterm role="concept">
3926 <primary>testing</primary>
3927 <secondary>forward file</secondary>
3928 </indexterm>
3929 <indexterm role="concept">
3930 <primary>Sieve filter</primary>
3931 <secondary>testing</secondary>
3932 </indexterm>
3933 This option runs Exim in user filter testing mode; the file is the filter file
3934 to be tested, and a test message must be supplied on the standard input. If
3935 there are no message-dependent tests in the filter, an empty file can be
3936 supplied.
3937 </para>
3938 <para>
3939 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3940 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3941 filter and a user filter in the same run. For example:
3942 </para>
3943 <literallayout class="monospaced">
3944 exim -bF /system/filter -bf /user/filter &lt;/test/message
3945 </literallayout>
3946 <para>
3947 This is helpful when the system filter adds header lines or sets filter
3948 variables that are used by the user filter.
3949 </para>
3950 <para>
3951 If the test filter file does not begin with one of the special lines
3952 </para>
3953 <literallayout class="monospaced">
3954 # Exim filter
3955 # Sieve filter
3956 </literallayout>
3957 <para>
3958 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3959 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3960 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3961 redirection lists.
3962 </para>
3963 <para>
3964 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3965 detected, is a list of the actions that Exim would try to take if presented
3966 with the message for real. More details of filter testing are given in the
3967 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3968 </para>
3969 <para>
3970 When testing a filter file,
3971 <indexterm role="concept">
3972 <primary><quote>From</quote> line</primary>
3973 </indexterm>
3974 <indexterm role="concept">
3975 <primary>envelope sender</primary>
3976 </indexterm>
3977 <indexterm role="option">
3978 <primary><option>-f</option></primary>
3979 <secondary>for filter testing</secondary>
3980 </indexterm>
3981 the envelope sender can be set by the <option>-f</option> option,
3982 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3983 that would normally be taken from the envelope recipient address of the message
3984 can be set by means of additional command line options (see the next four
3985 options).
3986 </para>
3987 </listitem></varlistentry>
3988 <varlistentry>
3989 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3990 <listitem>
3991 <para>
3992 <indexterm role="option">
3993 <primary><option>-bfd</option></primary>
3994 </indexterm>
3995 <indexterm role="variable">
3996 <primary><varname>$qualify_domain</varname></primary>
3997 </indexterm>
3998 This sets the domain of the recipient address when a filter file is being
3999 tested by means of the <option>-bf</option> option. The default is the value of
4000 <varname>$qualify_domain</varname>.
4001 </para>
4002 </listitem></varlistentry>
4003 <varlistentry>
4004 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4005 <listitem>
4006 <para>
4007 <indexterm role="option">
4008 <primary><option>-bfl</option></primary>
4009 </indexterm>
4010 This sets the local part of the recipient address when a filter file is being
4011 tested by means of the <option>-bf</option> option. The default is the username of the
4012 process that calls Exim. A local part should be specified with any prefix or
4013 suffix stripped, because that is how it appears to the filter when a message is
4014 actually being delivered.
4015 </para>
4016 </listitem></varlistentry>
4017 <varlistentry>
4018 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4019 <listitem>
4020 <para>
4021 <indexterm role="option">
4022 <primary><option>-bfp</option></primary>
4023 </indexterm>
4024 This sets the prefix of the local part of the recipient address when a filter
4025 file is being tested by means of the <option>-bf</option> option. The default is an empty
4026 prefix.
4027 </para>
4028 </listitem></varlistentry>
4029 <varlistentry>
4030 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4031 <listitem>
4032 <para>
4033 <indexterm role="option">
4034 <primary><option>-bfs</option></primary>
4035 </indexterm>
4036 This sets the suffix of the local part of the recipient address when a filter
4037 file is being tested by means of the <option>-bf</option> option. The default is an empty
4038 suffix.
4039 </para>
4040 </listitem></varlistentry>
4041 <varlistentry>
4042 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4043 <listitem>
4044 <para>
4045 <indexterm role="option">
4046 <primary><option>-bh</option></primary>
4047 </indexterm>
4048 <indexterm role="concept">
4049 <primary>testing</primary>
4050 <secondary>incoming SMTP</secondary>
4051 </indexterm>
4052 <indexterm role="concept">
4053 <primary>SMTP</primary>
4054 <secondary>testing incoming</secondary>
4055 </indexterm>
4056 <indexterm role="concept">
4057 <primary>testing</primary>
4058 <secondary>relay control</secondary>
4059 </indexterm>
4060 <indexterm role="concept">
4061 <primary>relaying</primary>
4062 <secondary>testing configuration</secondary>
4063 </indexterm>
4064 <indexterm role="concept">
4065 <primary>policy control</primary>
4066 <secondary>testing</secondary>
4067 </indexterm>
4068 <indexterm role="concept">
4069 <primary>debugging</primary>
4070 <secondary><option>-bh</option> option</secondary>
4071 </indexterm>
4072 This option runs a fake SMTP session as if from the given IP address, using the
4073 standard input and output. The IP address may include a port number at the end,
4074 after a full stop. For example:
4075 </para>
4076 <literallayout class="monospaced">
4077 exim -bh 10.9.8.7.1234
4078 exim -bh fe80::a00:20ff:fe86:a061.5678
4079 </literallayout>
4080 <para>
4081 When an IPv6 address is given, it is converted into canonical form. In the case
4082 of the second example above, the value of <varname>$sender_host_address</varname> after
4083 conversion to the canonical form is
4084 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4085 </para>
4086 <para>
4087 Comments as to what is going on are written to the standard error file. These
4088 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4089 This facility is provided for testing configuration options for incoming
4090 messages, to make sure they implement the required policy. For example, you can
4091 test your relay controls using <option>-bh</option>.
4092 </para>
4093 <para>
4094 <emphasis role="bold">Warning 1</emphasis>:
4095 <indexterm role="concept">
4096 <primary>RFC 1413</primary>
4097 </indexterm>
4098 You can test features of the configuration that rely on ident (RFC 1413)
4099 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4100 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4101 connection.
4102 </para>
4103 <para>
4104 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4105 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4106 occur, use <option>-bhc</option> instead.
4107 </para>
4108 <para>
4109 Messages supplied during the testing session are discarded, and nothing is
4110 written to any of the real log files. There may be pauses when DNS (and other)
4111 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4112 can be used to specify a specific IP interface and port if this is important,
4113 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4114 session were authenticated.
4115 </para>
4116 <para>
4117 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4118 output just states whether a given recipient address from a given host is
4119 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4120 </para>
4121 <para>
4122 Features such as authentication and encryption, where the client input is not
4123 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4124 specialized SMTP test program such as
4125 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4126 </para>
4127 </listitem></varlistentry>
4128 <varlistentry>
4129 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4130 <listitem>
4131 <para>
4132 <indexterm role="option">
4133 <primary><option>-bhc</option></primary>
4134 </indexterm>
4135 This option operates in the same way as <option>-bh</option>, except that address
4136 verification callouts are performed if required. This includes consulting and
4137 updating the callout cache database.
4138 </para>
4139 </listitem></varlistentry>
4140 <varlistentry>
4141 <term><option>-bi</option></term>
4142 <listitem>
4143 <para>
4144 <indexterm role="option">
4145 <primary><option>-bi</option></primary>
4146 </indexterm>
4147 <indexterm role="concept">
4148 <primary>alias file</primary>
4149 <secondary>building</secondary>
4150 </indexterm>
4151 <indexterm role="concept">
4152 <primary>building alias file</primary>
4153 </indexterm>
4154 <indexterm role="concept">
4155 <primary>Sendmail compatibility</primary>
4156 <secondary><option>-bi</option> option</secondary>
4157 </indexterm>
4158 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4159 Exim does not have the concept of a single alias file, and so it cannot mimic
4160 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4161 tend to appear in various scripts such as NIS make files, so the option must be
4162 recognized.
4163 </para>
4164 <para>
4165 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4166 configuration option is run, under the uid and gid of the caller of Exim. If
4167 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4168 The command set by <option>bi_command</option> may not contain arguments. The command can
4169 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4170 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4171 <option>-bi</option> is a no-op.
4172 </para>
4173 </listitem></varlistentry>
4174 <varlistentry>
4175 <term><option>-bI:help</option></term>
4176 <listitem>
4177 <para>
4178 <indexterm role="option">
4179 <primary><option>-bI:help</option></primary>
4180 </indexterm>
4181 <indexterm role="concept">
4182 <primary>querying exim information</primary>
4183 </indexterm>
4184 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4185 information.  The output of many of these will be intended for machine
4186 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4187 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4188 options shall cause Exim to exit after producing the requested output.
4189 </para>
4190 </listitem></varlistentry>
4191 <varlistentry>
4192 <term><option>-bI:dscp</option></term>
4193 <listitem>
4194 <para>
4195 <indexterm role="option">
4196 <primary><option>-bI:dscp</option></primary>
4197 </indexterm>
4198 <indexterm role="concept">
4199 <primary>DSCP</primary>
4200 <secondary>values</secondary>
4201 </indexterm>
4202 This option causes Exim to emit an alphabetically sorted list of all
4203 recognised DSCP names.
4204 </para>
4205 </listitem></varlistentry>
4206 <varlistentry>
4207 <term><option>-bI:sieve</option></term>
4208 <listitem>
4209 <para>
4210 <indexterm role="option">
4211 <primary><option>-bI:sieve</option></primary>
4212 </indexterm>
4213 <indexterm role="concept">
4214 <primary>Sieve filter</primary>
4215 <secondary>capabilities</secondary>
4216 </indexterm>
4217 This option causes Exim to emit an alphabetically sorted list of all supported
4218 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4219 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4220 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4221 compile-time build options, which this option will adapt to, this is the only
4222 way to guarantee a correct response.
4223 </para>
4224 </listitem></varlistentry>
4225 <varlistentry>
4226 <term><option>-bm</option></term>
4227 <listitem>
4228 <para>
4229 <indexterm role="option">
4230 <primary><option>-bm</option></primary>
4231 </indexterm>
4232 <indexterm role="concept">
4233 <primary>local message reception</primary>
4234 </indexterm>
4235 This option runs an Exim receiving process that accepts an incoming,
4236 locally-generated message on the standard input. The recipients are given as the
4237 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4238 argument can be a comma-separated list of RFC 2822 addresses. This is the
4239 default option for selecting the overall action of an Exim call; it is assumed
4240 if no other conflicting option is present.
4241 </para>
4242 <para>
4243 If any addresses in the message are unqualified (have no domain), they are
4244 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4245 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4246 suppressing this for special cases.
4247 </para>
4248 <para>
4249 Policy checks on the contents of local messages can be enforced by means of
4250 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4251 </para>
4252 <para>
4253 <indexterm role="concept">
4254 <primary>return code</primary>
4255 <secondary>for <option>-bm</option></secondary>
4256 </indexterm>
4257 The return code is zero if the message is successfully accepted. Otherwise, the
4258 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4259 </para>
4260 <para>
4261 The format
4262 <indexterm role="concept">
4263 <primary>message</primary>
4264 <secondary>format</secondary>
4265 </indexterm>
4266 <indexterm role="concept">
4267 <primary>format</primary>
4268 <secondary>message</secondary>
4269 </indexterm>
4270 <indexterm role="concept">
4271 <primary><quote>From</quote> line</primary>
4272 </indexterm>
4273 <indexterm role="concept">
4274 <primary>UUCP</primary>
4275 <secondary><quote>From</quote> line</secondary>
4276 </indexterm>
4277 <indexterm role="concept">
4278 <primary>Sendmail compatibility</primary>
4279 <secondary><quote>From</quote> line</secondary>
4280 </indexterm>
4281 of the message must be as defined in RFC 2822, except that, for
4282 compatibility with Sendmail and Smail, a line in one of the forms
4283 </para>
4284 <literallayout class="monospaced">
4285 From sender Fri Jan  5 12:55 GMT 1997
4286 From sender Fri, 5 Jan 97 12:55:01
4287 </literallayout>
4288 <para>
4289 (with the weekday optional, and possibly with additional text after the date)
4290 is permitted to appear at the start of the message. There appears to be no
4291 authoritative specification of the format of this line. Exim recognizes it by
4292 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4293 option, which can be changed if necessary.
4294 </para>
4295 <para>
4296 <indexterm role="option">
4297 <primary><option>-f</option></primary>
4298 <secondary>overriding <quote>From</quote> line</secondary>
4299 </indexterm>
4300 The specified sender is treated as if it were given as the argument to the
4301 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4302 preference to the address taken from the message. The caller of Exim must be a
4303 trusted user for the sender of a message to be set in this way.
4304 </para>
4305 </listitem></varlistentry>
4306 <varlistentry>
4307 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4308 <listitem>
4309 <para>
4310 <indexterm role="option">
4311 <primary><option>-bmalware</option></primary>
4312 </indexterm>
4313 <indexterm role="concept">
4314 <primary>testing</primary>
4315 <secondary>,</secondary>
4316 </indexterm>
4317 <indexterm role="concept">
4318 <primary>malware scan test</primary>
4319 </indexterm>
4320 This debugging option causes Exim to scan the given file,
4321 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4322 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4323 the expansion should have defaults which apply to this invocation.  ACLs are
4324 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4325 will never be populated and <option>-bmalware</option> will fail.
4326 </para>
4327 <para>
4328 Exim will have changed working directory before resolving the filename, so
4329 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4330 user when it tries to open the file, rather than as the invoking user.
4331 This option requires admin privileges.
4332 </para>
4333 <para>
4334 The <option>-bmalware</option> option will not be extended to be more generally useful,
4335 there are better tools for file-scanning.  This option exists to help
4336 administrators verify their Exim and AV scanner configuration.
4337 </para>
4338 </listitem></varlistentry>
4339 <varlistentry>
4340 <term><option>-bnq</option></term>
4341 <listitem>
4342 <para>
4343 <indexterm role="option">
4344 <primary><option>-bnq</option></primary>
4345 </indexterm>
4346 <indexterm role="concept">
4347 <primary>address qualification, suppressing</primary>
4348 </indexterm>
4349 By default, Exim automatically qualifies unqualified addresses (those
4350 without domains) that appear in messages that are submitted locally (that
4351 is, not over TCP/IP). This qualification applies both to addresses in
4352 envelopes, and addresses in header lines. Sender addresses are qualified using
4353 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4354 defaults to the value of <option>qualify_domain</option>).
4355 </para>
4356 <para>
4357 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4358 being used to re-submit messages that originally came from remote hosts after
4359 content scanning, you probably do not want to qualify unqualified addresses in
4360 header lines. (Such lines will be present only if you have not enabled a header
4361 syntax check in the appropriate ACL.)
4362 </para>
4363 <para>
4364 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4365 messages that originate on the local host. When this is used, unqualified
4366 addresses in the envelope provoke errors (causing message rejection) and
4367 unqualified addresses in header lines are left alone.
4368 </para>
4369 </listitem></varlistentry>
4370 <varlistentry>
4371 <term><option>-bP</option></term>
4372 <listitem>
4373 <para>
4374 <indexterm role="option">
4375 <primary><option>-bP</option></primary>
4376 </indexterm>
4377 <indexterm role="concept">
4378 <primary>configuration options</primary>
4379 <secondary>extracting</secondary>
4380 </indexterm>
4381 <indexterm role="concept">
4382 <primary>options</primary>
4383 <secondary>configuration &ndash; extracting</secondary>
4384 </indexterm>
4385 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4386 main configuration options to be written to the standard output. The values
4387 of one or more specific options can be requested by giving their names as
4388 arguments, for example:
4389 </para>
4390 <literallayout class="monospaced">
4391 exim -bP qualify_domain hold_domains
4392 </literallayout>
4393 <para>
4394 <indexterm role="concept">
4395 <primary>hiding configuration option values</primary>
4396 </indexterm>
4397 <indexterm role="concept">
4398 <primary>configuration options</primary>
4399 <secondary>hiding value of</secondary>
4400 </indexterm>
4401 <indexterm role="concept">
4402 <primary>options</primary>
4403 <secondary>hiding value of</secondary>
4404 </indexterm>
4405 However, any option setting that is preceded by the word <quote>hide</quote> in the
4406 configuration file is not shown in full, except to an admin user. For other
4407 users, the output is as in this example:
4408 </para>
4409 <literallayout class="monospaced">
4410 mysql_servers = &lt;value not displayable&gt;
4411 </literallayout>
4412 <para>
4413 If <option>configure_file</option> is given as an argument, the name of the run time
4414 configuration file is output.
4415 If a list of configuration files was supplied, the value that is output here
4416 is the name of the file that was actually used.
4417 </para>
4418 <para>
4419 <indexterm role="concept">
4420 <primary>options</primary>
4421 <secondary>hiding name of</secondary>
4422 </indexterm>
4423 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4424 name will not be output.
4425 </para>
4426 <para>
4427 <indexterm role="concept">
4428 <primary>daemon</primary>
4429 <secondary>process id (pid)</secondary>
4430 </indexterm>
4431 <indexterm role="concept">
4432 <primary>pid (process id)</primary>
4433 <secondary>of daemon</secondary>
4434 </indexterm>
4435 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4436 directories where log files and daemon pid files are written are output,
4437 respectively. If these values are unset, log files are written in a
4438 sub-directory of the spool directory called <option>log</option>, and the pid file is
4439 written directly into the spool directory.
4440 </para>
4441 <para>
4442 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4443 </para>
4444 <literallayout class="monospaced">
4445 exim -bP +local_domains
4446 </literallayout>
4447 <para>
4448 it searches for a matching named list of any type (domain, host, address, or
4449 local part) and outputs what it finds.
4450 </para>
4451 <para>
4452 <indexterm role="concept">
4453 <primary>options</primary>
4454 <secondary>router &ndash; extracting</secondary>
4455 </indexterm>
4456 <indexterm role="concept">
4457 <primary>options</primary>
4458 <secondary>transport &ndash; extracting</secondary>
4459 </indexterm>
4460 <indexterm role="concept">
4461 <primary>options</primary>
4462 <secondary>authenticator &ndash; extracting</secondary>
4463 </indexterm>
4464 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4465 followed by the name of an appropriate driver instance, the option settings for
4466 that driver are output. For example:
4467 </para>
4468 <literallayout class="monospaced">
4469 exim -bP transport local_delivery
4470 </literallayout>
4471 <para>
4472 The generic driver options are output first, followed by the driver&#x2019;s private
4473 options. A list of the names of drivers of a particular type can be obtained by
4474 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4475 <option>authenticator_list</option>, and a complete list of all drivers with their option
4476 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4477 <option>authenticators</option>.
4478 </para>
4479 <para>
4480 <indexterm role="concept">
4481 <primary>environment</primary>
4482 </indexterm>
4483 If <option>environment</option> is given as an argument, the set of environment
4484 variables is output, line by line. Using the <option>-n</option> flag supresses the value of the
4485 variables.
4486 </para>
4487 <para>
4488 <indexterm role="concept">
4489 <primary>options</primary>
4490 <secondary>macro &ndash; extracting</secondary>
4491 </indexterm>
4492 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4493 are available, similarly to the drivers.  Because macros are sometimes used
4494 for storing passwords, this option is restricted.
4495 The output format is one item per line.
4496 </para>
4497 </listitem></varlistentry>
4498 <varlistentry>
4499 <term><option>-bp</option></term>
4500 <listitem>
4501 <para>
4502 <indexterm role="option">
4503 <primary><option>-bp</option></primary>
4504 </indexterm>
4505 <indexterm role="concept">
4506 <primary>queue</primary>
4507 <secondary>listing messages on</secondary>
4508 </indexterm>
4509 <indexterm role="concept">
4510 <primary>listing</primary>
4511 <secondary>messages on the queue</secondary>
4512 </indexterm>
4513 This option requests a listing of the contents of the mail queue on the
4514 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4515 just those messages are listed. By default, this option can be used only by an
4516 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4517 to allow any user to see the queue.
4518 </para>
4519 <para>
4520 Each message on the queue is displayed as in the following example:
4521 </para>
4522 <literallayout class="monospaced">
4523 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4524           red.king@looking-glass.fict.example
4525           &lt;other addresses&gt;
4526 </literallayout>
4527 <para>
4528 <indexterm role="concept">
4529 <primary>message</primary>
4530 <secondary>size in queue listing</secondary>
4531 </indexterm>
4532 <indexterm role="concept">
4533 <primary>size</primary>
4534 <secondary>of message</secondary>
4535 </indexterm>
4536 The first line contains the length of time the message has been on the queue
4537 (in this case 25 minutes), the size of the message (2.9K), the unique local
4538 identifier for the message, and the message sender, as contained in the
4539 envelope. For bounce messages, the sender address is empty, and appears as
4540 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4541 the default sender address, the user&#x2019;s login name is shown in parentheses
4542 before the sender address.
4543 </para>
4544 <para>
4545 <indexterm role="concept">
4546 <primary>frozen messages</primary>
4547 <secondary>in queue listing</secondary>
4548 </indexterm>
4549 If the message is frozen (attempts to deliver it are suspended) then the text
4550 <quote>*** frozen ***</quote> is displayed at the end of this line.
4551 </para>
4552 <para>
4553 The recipients of the message (taken from the envelope, not the headers) are
4554 displayed on subsequent lines. Those addresses to which the message has already
4555 been delivered are marked with the letter D. If an original address gets
4556 expanded into several addresses via an alias or forward file, the original is
4557 displayed with a D only when deliveries for all of its child addresses are
4558 complete.
4559 </para>
4560 </listitem></varlistentry>
4561 <varlistentry>
4562 <term><option>-bpa</option></term>
4563 <listitem>
4564 <para>
4565 <indexterm role="option">
4566 <primary><option>-bpa</option></primary>
4567 </indexterm>
4568 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4569 that were generated from the original top level address(es) in each message by
4570 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4571 of just <quote>D</quote>.
4572 </para>
4573 </listitem></varlistentry>
4574 <varlistentry>
4575 <term><option>-bpc</option></term>
4576 <listitem>
4577 <para>
4578 <indexterm role="option">
4579 <primary><option>-bpc</option></primary>
4580 </indexterm>
4581 <indexterm role="concept">
4582 <primary>queue</primary>
4583 <secondary>count of messages on</secondary>
4584 </indexterm>
4585 This option counts the number of messages on the queue, and writes the total
4586 to the standard output. It is restricted to admin users, unless
4587 <option>queue_list_requires_admin</option> is set false.
4588 </para>
4589 </listitem></varlistentry>
4590 <varlistentry>
4591 <term><option>-bpr</option></term>
4592 <listitem>
4593 <para>
4594 <indexterm role="option">
4595 <primary><option>-bpr</option></primary>
4596 </indexterm>
4597 This option operates like <option>-bp</option>, but the output is not sorted into
4598 chronological order of message arrival. This can speed it up when there are
4599 lots of messages on the queue, and is particularly useful if the output is
4600 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4601 </para>
4602 </listitem></varlistentry>
4603 <varlistentry>
4604 <term><option>-bpra</option></term>
4605 <listitem>
4606 <para>
4607 <indexterm role="option">
4608 <primary><option>-bpra</option></primary>
4609 </indexterm>
4610 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4611 </para>
4612 </listitem></varlistentry>
4613 <varlistentry>
4614 <term><option>-bpru</option></term>
4615 <listitem>
4616 <para>
4617 <indexterm role="option">
4618 <primary><option>-bpru</option></primary>
4619 </indexterm>
4620 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4621 </para>
4622 </listitem></varlistentry>
4623 <varlistentry>
4624 <term><option>-bpu</option></term>
4625 <listitem>
4626 <para>
4627 <indexterm role="option">
4628 <primary><option>-bpu</option></primary>
4629 </indexterm>
4630 This option operates like <option>-bp</option> but shows only undelivered top-level
4631 addresses for each message displayed. Addresses generated by aliasing or
4632 forwarding are not shown, unless the message was deferred after processing by a
4633 router with the <option>one_time</option> option set.
4634 </para>
4635 </listitem></varlistentry>
4636 <varlistentry>
4637 <term><option>-brt</option></term>
4638 <listitem>
4639 <para>
4640 <indexterm role="option">
4641 <primary><option>-brt</option></primary>
4642 </indexterm>
4643 <indexterm role="concept">
4644 <primary>testing</primary>
4645 <secondary>retry configuration</secondary>
4646 </indexterm>
4647 <indexterm role="concept">
4648 <primary>retry</primary>
4649 <secondary>configuration testing</secondary>
4650 </indexterm>
4651 This option is for testing retry rules, and it must be followed by up to three
4652 arguments. It causes Exim to look for a retry rule that matches the values
4653 and to write it to the standard output. For example:
4654 </para>
4655 <literallayout class="monospaced">
4656 exim -brt bach.comp.mus.example
4657 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4658 </literallayout>
4659 <para>
4660 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4661 argument, which is required, can be a complete address in the form
4662 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4663 contains a dot, it is interpreted as an optional second domain name; if no
4664 retry rule is found for the first argument, the second is tried. This ties in
4665 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4666 rule is found that matches the host, one that matches the mail domain is
4667 sought. Finally, an argument that is the name of a specific delivery error, as
4668 used in setting up retry rules, can be given. For example:
4669 </para>
4670 <literallayout class="monospaced">
4671 exim -brt haydn.comp.mus.example quota_3d
4672 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4673 </literallayout>
4674 </listitem></varlistentry>
4675 <varlistentry>
4676 <term><option>-brw</option></term>
4677 <listitem>
4678 <para>
4679 <indexterm role="option">
4680 <primary><option>-brw</option></primary>
4681 </indexterm>
4682 <indexterm role="concept">
4683 <primary>testing</primary>
4684 <secondary>rewriting</secondary>
4685 </indexterm>
4686 <indexterm role="concept">
4687 <primary>rewriting</primary>
4688 <secondary>testing</secondary>
4689 </indexterm>
4690 This option is for testing address rewriting rules, and it must be followed by
4691 a single argument, consisting of either a local part without a domain, or a
4692 complete address with a fully qualified domain. Exim outputs how this address
4693 would be rewritten for each possible place it might appear. See chapter
4694 <xref linkend="CHAPrewrite"/> for further details.
4695 </para>
4696 </listitem></varlistentry>
4697 <varlistentry>
4698 <term><option>-bS</option></term>
4699 <listitem>
4700 <para>
4701 <indexterm role="option">
4702 <primary><option>-bS</option></primary>
4703 </indexterm>
4704 <indexterm role="concept">
4705 <primary>SMTP</primary>
4706 <secondary>batched incoming</secondary>
4707 </indexterm>
4708 <indexterm role="concept">
4709 <primary>batched SMTP input</primary>
4710 </indexterm>
4711 This option is used for batched SMTP input, which is an alternative interface
4712 for non-interactive local message submission. A number of messages can be
4713 submitted in a single run. However, despite its name, this is not really SMTP
4714 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4715 input, but generates no responses. If the caller is trusted, or
4716 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4717 believed; otherwise the sender is always the caller of Exim.
4718 </para>
4719 <para>
4720 The message itself is read from the standard input, in SMTP format (leading
4721 dots doubled), terminated by a line containing just a single dot. An error is
4722 provoked if the terminating dot is missing. A further message may then follow.
4723 </para>
4724 <para>
4725 As for other local message submissions, the contents of incoming batch SMTP
4726 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4727 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4728 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4729 </para>
4730 <para>
4731 Some other SMTP commands are recognized in the input. HELO and EHLO act
4732 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4733 QUIT quits, ignoring the rest of the standard input.
4734 </para>
4735 <para>
4736 <indexterm role="concept">
4737 <primary>return code</primary>
4738 <secondary>for <option>-bS</option></secondary>
4739 </indexterm>
4740 If any error is encountered, reports are written to the standard output and
4741 error streams, and Exim gives up immediately. The return code is 0 if no error
4742 was detected; it is 1 if one or more messages were accepted before the error
4743 was detected; otherwise it is 2.
4744 </para>
4745 <para>
4746 More details of input using batched SMTP are given in section
4747 <xref linkend="SECTincomingbatchedSMTP"/>.
4748 </para>
4749 </listitem></varlistentry>
4750 <varlistentry>
4751 <term><option>-bs</option></term>
4752 <listitem>
4753 <para>
4754 <indexterm role="option">
4755 <primary><option>-bs</option></primary>
4756 </indexterm>
4757 <indexterm role="concept">
4758 <primary>SMTP</primary>
4759 <secondary>local input</secondary>
4760 </indexterm>
4761 <indexterm role="concept">
4762 <primary>local SMTP input</primary>
4763 </indexterm>
4764 This option causes Exim to accept one or more messages by reading SMTP commands
4765 on the standard input, and producing SMTP replies on the standard output. SMTP
4766 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4767 Some user agents use this interface as a way of passing locally-generated
4768 messages to the MTA.
4769 </para>
4770 <para>
4771 In
4772 <indexterm role="concept">
4773 <primary>sender</primary>
4774 <secondary>source of</secondary>
4775 </indexterm>
4776 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4777 set, the senders of messages are taken from the SMTP MAIL commands.
4778 Otherwise the content of these commands is ignored and the sender is set up as
4779 the calling user. Unqualified addresses are automatically qualified using
4780 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4781 <option>-bnq</option> option is used.
4782 </para>
4783 <para>
4784 <indexterm role="concept">
4785 <primary>inetd</primary>
4786 </indexterm>
4787 The
4788 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4789 using a listening daemon. Exim can distinguish the two cases by checking
4790 whether the standard input is a TCP/IP socket. When Exim is called from
4791 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4792 above concerning senders and qualification do not apply. In this situation,
4793 Exim behaves in exactly the same way as it does when receiving a message via
4794 the listening daemon.
4795 </para>
4796 </listitem></varlistentry>
4797 <varlistentry>
4798 <term><option>-bt</option></term>
4799 <listitem>
4800 <para>
4801 <indexterm role="option">
4802 <primary><option>-bt</option></primary>
4803 </indexterm>
4804 <indexterm role="concept">
4805 <primary>testing</primary>
4806 <secondary>addresses</secondary>
4807 </indexterm>
4808 <indexterm role="concept">
4809 <primary>address</primary>
4810 <secondary>testing</secondary>
4811 </indexterm>
4812 This option runs Exim in address testing mode, in which each argument is taken
4813 as a recipient address to be tested for deliverability. The results are
4814 written to the standard output. If a test fails, and the caller is not an admin
4815 user, no details of the failure are output, because these might contain
4816 sensitive information such as usernames and passwords for database lookups.
4817 </para>
4818 <para>
4819 If no arguments are given, Exim runs in an interactive manner, prompting with a
4820 right angle bracket for addresses to be tested.
4821 </para>
4822 <para>
4823 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4824 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4825 security issues.
4826 </para>
4827 <para>
4828 Each address is handled as if it were the recipient address of a message
4829 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4830 written to the standard output. However, any router that has
4831 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4832 genuine routing tests if your first router passes everything to a scanner
4833 program.
4834 </para>
4835 <para>
4836 <indexterm role="concept">
4837 <primary>return code</primary>
4838 <secondary>for <option>-bt</option></secondary>
4839 </indexterm>
4840 The return code is 2 if any address failed outright; it is 1 if no address
4841 failed outright but at least one could not be resolved for some reason. Return
4842 code 0 is given only when all addresses succeed.
4843 </para>
4844 <para>
4845 <indexterm role="concept">
4846 <primary>duplicate addresses</primary>
4847 </indexterm>
4848 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4849 addresses after routing is complete, so that only one delivery takes place.
4850 This does not happen when testing with <option>-bt</option>; the full results of routing are
4851 always shown.
4852 </para>
4853 <para>
4854 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4855 routers in the configuration makes any tests on the sender address of a
4856 message,
4857 <indexterm role="option">
4858 <primary><option>-f</option></primary>
4859 <secondary>for address testing</secondary>
4860 </indexterm>
4861 you can use the <option>-f</option> option to set an appropriate sender when running
4862 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4863 default qualifying domain. However, if you have set up (for example) routers
4864 whose behaviour depends on the contents of an incoming message, you cannot test
4865 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4866 doing such tests.
4867 </para>
4868 </listitem></varlistentry>
4869 <varlistentry>
4870 <term><option>-bV</option></term>
4871 <listitem>
4872 <para>
4873 <indexterm role="option">
4874 <primary><option>-bV</option></primary>
4875 </indexterm>
4876 <indexterm role="concept">
4877 <primary>version number of Exim</primary>
4878 </indexterm>
4879 This option causes Exim to write the current version number, compilation
4880 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4881 It also lists the DBM library that is being used, the optional modules (such as
4882 specific lookup types), the drivers that are included in the binary, and the
4883 name of the run time configuration file that is in use.
4884 </para>
4885 <para>
4886 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4887 configuration file. However, this is a static check only. It cannot check
4888 values that are to be expanded. For example, although a misspelt ACL verb is
4889 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4890 alone to discover (for example) all the typos in the configuration; some
4891 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4892 dynamic testing facilities.
4893 </para>
4894 </listitem></varlistentry>
4895 <varlistentry>
4896 <term><option>-bv</option></term>
4897 <listitem>
4898 <para>
4899 <indexterm role="option">
4900 <primary><option>-bv</option></primary>
4901 </indexterm>
4902 <indexterm role="concept">
4903 <primary>verifying address</primary>
4904 <secondary>using <option>-bv</option></secondary>
4905 </indexterm>
4906 <indexterm role="concept">
4907 <primary>address</primary>
4908 <secondary>verification</secondary>
4909 </indexterm>
4910 This option runs Exim in address verification mode, in which each argument is
4911 taken as a recipient address to be verified by the routers. (This does
4912 not involve any verification callouts). During normal operation, verification
4913 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4914 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4915 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4916 </para>
4917 <para>
4918 If verification fails, and the caller is not an admin user, no details of the
4919 failure are output, because these might contain sensitive information such as
4920 usernames and passwords for database lookups.
4921 </para>
4922 <para>
4923 If no arguments are given, Exim runs in an interactive manner, prompting with a
4924 right angle bracket for addresses to be verified.
4925 </para>
4926 <para>
4927 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4928 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4929 security issues.
4930 </para>
4931 <para>
4932 Verification differs from address testing (the <option>-bt</option> option) in that routers
4933 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4934 router that has <option>fail_verify</option> set, verification fails. The address is
4935 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4936 address, <option>-bvs</option> should be used.
4937 </para>
4938 <para>
4939 If the <option>-v</option> option is not set, the output consists of a single line for each
4940 address, stating whether it was verified or not, and giving a reason in the
4941 latter case. Without <option>-v</option>, generating more than one address by redirection
4942 causes verification to end successfully, without considering the generated
4943 addresses. However, if just one address is generated, processing continues,
4944 and the generated address must verify successfully for the overall verification
4945 to succeed.
4946 </para>
4947 <para>
4948 When <option>-v</option> is set, more details are given of how the address has been handled,
4949 and in the case of address redirection, all the generated addresses are also
4950 considered. Verification may succeed for some and fail for others.
4951 </para>
4952 <para>
4953 The
4954 <indexterm role="concept">
4955 <primary>return code</primary>
4956 <secondary>for <option>-bv</option></secondary>
4957 </indexterm>
4958 return code is 2 if any address failed outright; it is 1 if no address
4959 failed outright but at least one could not be resolved for some reason. Return
4960 code 0 is given only when all addresses succeed.
4961 </para>
4962 <para>
4963 If any of the routers in the configuration makes any tests on the sender
4964 address of a message, you should use the <option>-f</option> option to set an appropriate
4965 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4966 calling user at the default qualifying domain.
4967 </para>
4968 </listitem></varlistentry>
4969 <varlistentry>
4970 <term><option>-bvs</option></term>
4971 <listitem>
4972 <para>
4973 <indexterm role="option">
4974 <primary><option>-bvs</option></primary>
4975 </indexterm>
4976 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4977 than a recipient address. This affects any rewriting and qualification that
4978 might happen.
4979 </para>
4980 </listitem></varlistentry>
4981 <varlistentry>
4982 <term><option>-bw</option></term>
4983 <listitem>
4984 <para>
4985 <indexterm role="option">
4986 <primary><option>-bw</option></primary>
4987 </indexterm>
4988 <indexterm role="concept">
4989 <primary>daemon</primary>
4990 </indexterm>
4991 <indexterm role="concept">
4992 <primary>inetd</primary>
4993 </indexterm>
4994 <indexterm role="concept">
4995 <primary>inetd</primary>
4996 <secondary>wait mode</secondary>
4997 </indexterm>
4998 This option runs Exim as a daemon, awaiting incoming SMTP connections,
4999 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5000 and in the configuration file are ignored.  Queue-running may not be specified.
5001 </para>
5002 <para>
5003 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5004 listening for connections.  This permits the system to start up and have
5005 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5006 each port only when the first connection is received.
5007 </para>
5008 <para>
5009 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5010 which the daemon will exit, which should cause inetd to listen once more.
5011 </para>
5012 </listitem></varlistentry>
5013 <varlistentry>
5014 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5015 <listitem>
5016 <para>
5017 <indexterm role="option">
5018 <primary><option>-C</option></primary>
5019 </indexterm>
5020 <indexterm role="concept">
5021 <primary>configuration file</primary>
5022 <secondary>alternate</secondary>
5023 </indexterm>
5024 <indexterm role="concept">
5025 <primary>CONFIGURE_FILE</primary>
5026 </indexterm>
5027 <indexterm role="concept">
5028 <primary>alternate configuration file</primary>
5029 </indexterm>
5030 This option causes Exim to find the run time configuration file from the given
5031 list instead of from the list specified by the CONFIGURE_FILE
5032 compile-time setting. Usually, the list will consist of just a single file
5033 name, but it can be a colon-separated list of names. In this case, the first
5034 file that exists is used. Failure to open an existing file stops Exim from
5035 proceeding any further along the list, and an error is generated.
5036 </para>
5037 <para>
5038 The file names need to be absolute names.
5039 </para>
5040 <para>
5041 When this option is used by a caller other than root, and the list is different
5042 from the compiled-in list, Exim gives up its root privilege immediately, and
5043 runs with the real and effective uid and gid set to those of the caller.
5044 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5045 file contains a list of full pathnames, one per line, for configuration files
5046 which are trusted. Root privilege is retained for any configuration file so
5047 listed, as long as the caller is the Exim user (or the user specified in the
5048 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5049 not writeable by inappropriate users or groups.
5050 </para>
5051 <para>
5052 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5053 configuration using <option>-C</option> right through message reception and delivery,
5054 even if the caller is root. The reception works, but by that time, Exim is
5055 running as the Exim user, so when it re-executes to regain privilege for the
5056 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5057 test reception and delivery using two separate commands (one to put a message
5058 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5059 </para>
5060 <para>
5061 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5062 prefix string with which any file named in a <option>-C</option> command line option
5063 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5064 However, if the value of the <option>-C</option> option is identical to the value of
5065 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5066 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5067 unset, any file name can be used with <option>-C</option>.
5068 </para>
5069 <para>
5070 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5071 to a directory to which only root has access. This prevents someone who has
5072 broken into the Exim account from running a privileged Exim with an arbitrary
5073 configuration file.
5074 </para>
5075 <para>
5076 The <option>-C</option> facility is useful for ensuring that configuration files are
5077 syntactically correct, but cannot be used for test deliveries, unless the
5078 caller is privileged, or unless it is an exotic configuration that does not
5079 require privilege. No check is made on the owner or group of the files
5080 specified by this option.
5081 </para>
5082 </listitem></varlistentry>
5083 <varlistentry>
5084 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5085 <listitem>
5086 <para>
5087 <indexterm role="option">
5088 <primary><option>-D</option></primary>
5089 </indexterm>
5090 <indexterm role="concept">
5091 <primary>macro</primary>
5092 <secondary>setting on command line</secondary>
5093 </indexterm>
5094 This option can be used to override macro definitions in the configuration file
5095 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5096 unprivileged caller, it causes Exim to give up its root privilege.
5097 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5098 completely disabled, and its use causes an immediate error exit.
5099 </para>
5100 <para>
5101 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5102 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5103 supplies macros from this list, and the values are acceptable, then Exim will
5104 not give up root privilege if the caller is root, the Exim run-time user, or
5105 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5106 to be removed in the future.  Acceptable values for the macros satisfy the
5107 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5108 </para>
5109 <para>
5110 The entire option (including equals sign if present) must all be within one
5111 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5112 string, in which case the equals sign is optional. These two commands are
5113 synonymous:
5114 </para>
5115 <literallayout class="monospaced">
5116 exim -DABC  ...
5117 exim -DABC= ...
5118 </literallayout>
5119 <para>
5120 To include spaces in a macro definition item, quotes must be used. If you use
5121 quotes, spaces are permitted around the macro name and the equals sign. For
5122 example:
5123 </para>
5124 <literallayout class="monospaced">
5125 exim '-D ABC = something' ...
5126 </literallayout>
5127 <para>
5128 <option>-D</option> may be repeated up to 10 times on a command line.
5129 </para>
5130 </listitem></varlistentry>
5131 <varlistentry>
5132 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5133 <listitem>
5134 <para>
5135 <indexterm role="option">
5136 <primary><option>-d</option></primary>
5137 </indexterm>
5138 <indexterm role="concept">
5139 <primary>debugging</primary>
5140 <secondary>list of selectors</secondary>
5141 </indexterm>
5142 <indexterm role="concept">
5143 <primary>debugging</primary>
5144 <secondary><option>-d</option> option</secondary>
5145 </indexterm>
5146 This option causes debugging information to be written to the standard
5147 error stream. It is restricted to admin users because debugging output may show
5148 database queries that contain password information. Also, the details of users&#x2019;
5149 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5150 writes an error message to the standard error stream and exits with a non-zero
5151 return code.
5152 </para>
5153 <para>
5154 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5155 standard debugging data is output. This can be reduced, or increased to include
5156 some more rarely needed information, by directly following <option>-d</option> with a string
5157 made up of names preceded by plus or minus characters. These add or remove sets
5158 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5159 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5160 no spaces are allowed in the debug setting. The available debugging categories
5161 are:
5162 </para>
5163 <literallayout>
5164 <literal>acl            </literal> ACL interpretation
5165 <literal>auth           </literal> authenticators
5166 <literal>deliver        </literal> general delivery logic
5167 <literal>dns            </literal> DNS lookups (see also resolver)
5168 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5169 <literal>exec           </literal> arguments for <function>execv()</function> calls
5170 <literal>expand         </literal> detailed debugging for string expansions
5171 <literal>filter         </literal> filter handling
5172 <literal>hints_lookup   </literal> hints data lookups
5173 <literal>host_lookup    </literal> all types of name-to-IP address handling
5174 <literal>ident          </literal> ident lookup
5175 <literal>interface      </literal> lists of local interfaces
5176 <literal>lists          </literal> matching things in lists
5177 <literal>load           </literal> system load checks
5178 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5179 <literal>lookup         </literal> general lookup code and all lookups
5180 <literal>memory         </literal> memory handling
5181 <literal>pid            </literal> add pid to debug output lines
5182 <literal>process_info   </literal> setting info for the process log
5183 <literal>queue_run      </literal> queue runs
5184 <literal>receive        </literal> general message reception logic
5185 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5186 <literal>retry          </literal> retry handling
5187 <literal>rewrite        </literal> address rewriting
5188 <literal>route          </literal> address routing
5189 <literal>timestamp      </literal> add timestamp to debug output lines
5190 <literal>tls            </literal> TLS logic
5191 <literal>transport      </literal> transports
5192 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5193 <literal>verify         </literal> address verification logic
5194 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5195 </literallayout>
5196 <para>
5197 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5198 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5199 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5200 is included, an awful lot of output that is very rarely of interest is
5201 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5202 turn everything off.
5203 </para>
5204 <para>
5205 <indexterm role="concept">
5206 <primary>resolver, debugging output</primary>
5207 </indexterm>
5208 <indexterm role="concept">
5209 <primary>DNS resolver, debugging output</primary>
5210 </indexterm>
5211 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5212 with DEBUG enabled. This is not the case in some operating systems. Also,
5213 unfortunately, debugging output from the DNS resolver is written to stdout
5214 rather than stderr.
5215 </para>
5216 <para>
5217 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5218 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5219 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5220 daemon, which then passes it on to any re-executed Exims. Exim also
5221 automatically adds the pid to debug lines when several remote deliveries are
5222 run in parallel.
5223 </para>
5224 <para>
5225 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5226 of all debug output lines. This can be useful when trying to track down delays
5227 in processing.
5228 </para>
5229 <para>
5230 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5231 any debugging is selected, or if <option>-v</option> is used.
5232 </para>
5233 </listitem></varlistentry>
5234 <varlistentry>
5235 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5236 <listitem>
5237 <para>
5238 <indexterm role="option">
5239 <primary><option>-dd</option></primary>
5240 </indexterm>
5241 This option behaves exactly like <option>-d</option> except when used on a command that
5242 starts a daemon process. In that case, debugging is turned off for the
5243 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5244 behaviour of the daemon without creating as much output as full debugging does.
5245 </para>
5246 </listitem></varlistentry>
5247 <varlistentry>
5248 <term><option>-dropcr</option></term>
5249 <listitem>
5250 <para>
5251 <indexterm role="option">
5252 <primary><option>-dropcr</option></primary>
5253 </indexterm>
5254 This is an obsolete option that is now a no-op. It used to affect the way Exim
5255 handled CR and LF characters in incoming messages. What happens now is
5256 described in section <xref linkend="SECTlineendings"/>.
5257 </para>
5258 </listitem></varlistentry>
5259 <varlistentry>
5260 <term><option>-E</option></term>
5261 <listitem>
5262 <para>
5263 <indexterm role="option">
5264 <primary><option>-E</option></primary>
5265 </indexterm>
5266 <indexterm role="concept">
5267 <primary>bounce message</primary>
5268 <secondary>generating</secondary>
5269 </indexterm>
5270 This option specifies that an incoming message is a locally-generated delivery
5271 failure report. It is used internally by Exim when handling delivery failures
5272 and is not intended for external use. Its only effect is to stop Exim
5273 generating certain messages to the postmaster, as otherwise message cascades
5274 could occur in some situations. As part of the same option, a message id may
5275 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5276 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5277 </para>
5278 </listitem></varlistentry>
5279 <varlistentry>
5280 <term><option>-e</option><emphasis>x</emphasis></term>
5281 <listitem>
5282 <para>
5283 <indexterm role="option">
5284 <primary><option>-e</option><emphasis>x</emphasis></primary>
5285 </indexterm>
5286 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5287 called by various programs without the leading <option>o</option> in the option. For
5288 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5289 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5290 </para>
5291 </listitem></varlistentry>
5292 <varlistentry>
5293 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5294 <listitem>
5295 <para>
5296 <indexterm role="option">
5297 <primary><option>-F</option></primary>
5298 </indexterm>
5299 <indexterm role="concept">
5300 <primary>sender</primary>
5301 <secondary>name</secondary>
5302 </indexterm>
5303 <indexterm role="concept">
5304 <primary>name</primary>
5305 <secondary>of sender</secondary>
5306 </indexterm>
5307 This option sets the sender&#x2019;s full name for use when a locally-generated
5308 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5309 entry from the password data is used. As users are generally permitted to alter
5310 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5311 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5312 </para>
5313 </listitem></varlistentry>
5314 <varlistentry>
5315 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5316 <listitem>
5317 <para>
5318 <indexterm role="option">
5319 <primary><option>-f</option></primary>
5320 </indexterm>
5321 <indexterm role="concept">
5322 <primary>sender</primary>
5323 <secondary>address</secondary>
5324 </indexterm>
5325 <indexterm role="concept">
5326 <primary>address</primary>
5327 <secondary>sender</secondary>
5328 </indexterm>
5329 <indexterm role="concept">
5330 <primary>trusted users</primary>
5331 </indexterm>
5332 <indexterm role="concept">
5333 <primary>envelope sender</primary>
5334 </indexterm>
5335 <indexterm role="concept">
5336 <primary>user</primary>
5337 <secondary>trusted</secondary>
5338 </indexterm>
5339 This option sets the address of the envelope sender of a locally-generated
5340 message (also known as the return path). The option can normally be used only
5341 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5342 users to use it.
5343 </para>
5344 <para>
5345 Processes running as root or the Exim user are always trusted. Other
5346 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5347 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5348 of a local message is set to the caller&#x2019;s login name at the default qualify
5349 domain.
5350 </para>
5351 <para>
5352 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5353 can be specified by any user, trusted or not, to create a message that can
5354 never provoke a bounce. An empty sender can be specified either as an empty
5355 string, or as a pair of angle brackets with nothing between them, as in these
5356 examples of shell commands:
5357 </para>
5358 <literallayout class="monospaced">
5359 exim -f '&lt;&gt;' user@domain
5360 exim -f "" user@domain
5361 </literallayout>
5362 <para>
5363 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5364 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5365 <option>-bv</option> options.
5366 </para>
5367 <para>
5368 Allowing untrusted users to change the sender address does not of itself make
5369 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5370 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5371 though this can be overridden by setting <option>no_local_from_check</option>.
5372 </para>
5373 <para>
5374 White
5375 <indexterm role="concept">
5376 <primary><quote>From</quote> line</primary>
5377 </indexterm>
5378 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5379 given as two arguments or one combined argument). The sender of a
5380 locally-generated message can also be set (when permitted) by an initial
5381 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5382 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5383 </para>
5384 </listitem></varlistentry>
5385 <varlistentry>
5386 <term><option>-G</option></term>
5387 <listitem>
5388 <para>
5389 <indexterm role="option">
5390 <primary><option>-G</option></primary>
5391 </indexterm>
5392 <indexterm role="concept">
5393 <primary>submission fixups, suppressing (command-line)</primary>
5394 </indexterm>
5395 This option is equivalent to an ACL applying:
5396 </para>
5397 <literallayout class="monospaced">
5398 control = suppress_local_fixups
5399 </literallayout>
5400 <para>
5401 for every message received.  Note that Sendmail will complain about such
5402 bad formatting, where Exim silently just does not fix it up.  This may change
5403 in future.
5404 </para>
5405 <para>
5406 As this affects audit information, the caller must be a trusted user to use
5407 this option.
5408 </para>
5409 </listitem></varlistentry>
5410 <varlistentry>
5411 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5412 <listitem>
5413 <para>
5414 <indexterm role="option">
5415 <primary><option>-h</option></primary>
5416 </indexterm>
5417 <indexterm role="concept">
5418 <primary>Sendmail compatibility</primary>
5419 <secondary><option>-h</option> option ignored</secondary>
5420 </indexterm>
5421 This option is accepted for compatibility with Sendmail, but has no effect. (In
5422 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5423 headers.)
5424 </para>
5425 </listitem></varlistentry>
5426 <varlistentry>
5427 <term><option>-i</option></term>
5428 <listitem>
5429 <para>
5430 <indexterm role="option">
5431 <primary><option>-i</option></primary>
5432 </indexterm>
5433 <indexterm role="concept">
5434 <primary>Solaris</primary>
5435 <secondary><emphasis>mail</emphasis> command</secondary>
5436 </indexterm>
5437 <indexterm role="concept">
5438 <primary>dot</primary>
5439 <secondary>in incoming non-SMTP message</secondary>
5440 </indexterm>
5441 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5442 line by itself should not terminate an incoming, non-SMTP message. I can find
5443 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5444 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5445 </para>
5446 </listitem></varlistentry>
5447 <varlistentry>
5448 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5449 <listitem>
5450 <para>
5451 <indexterm role="option">
5452 <primary><option>-L</option></primary>
5453 </indexterm>
5454 <indexterm role="concept">
5455 <primary>syslog</primary>
5456 <secondary>process name; set with flag</secondary>
5457 </indexterm>
5458 This option is equivalent to setting <option>syslog_processname</option> in the config
5459 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5460 Its use is restricted to administrators.  The configuration file has to be
5461 read and parsed, to determine access rights, before this is set and takes
5462 effect, so early configuration file errors will not honour this flag.
5463 </para>
5464 <para>
5465 The tag should not be longer than 32 characters.
5466 </para>
5467 </listitem></varlistentry>
5468 <varlistentry>
5469 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5470 <listitem>
5471 <para>
5472 <indexterm role="option">
5473 <primary><option>-M</option></primary>
5474 </indexterm>
5475 <indexterm role="concept">
5476 <primary>forcing delivery</primary>
5477 </indexterm>
5478 <indexterm role="concept">
5479 <primary>delivery</primary>
5480 <secondary>forcing attempt</secondary>
5481 </indexterm>
5482 <indexterm role="concept">
5483 <primary>frozen messages</primary>
5484 <secondary>forcing delivery</secondary>
5485 </indexterm>
5486 This option requests Exim to run a delivery attempt on each message in turn. If
5487 any of the messages are frozen, they are automatically thawed before the
5488 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5489 and <option>hold_domains</option> are ignored.
5490 </para>
5491 <para>
5492 Retry
5493 <indexterm role="concept">
5494 <primary>hints database</primary>
5495 <secondary>overriding retry hints</secondary>
5496 </indexterm>
5497 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5498 the normal retry time has not yet been reached. This option requires the caller
5499 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5500 which can be set false to relax this restriction (and also the same requirement
5501 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5502 </para>
5503 <para>
5504 The deliveries happen synchronously, that is, the original Exim process does
5505 not terminate until all the delivery attempts have finished. No output is
5506 produced unless there is a serious error. If you want to see what is happening,
5507 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5508 </para>
5509 </listitem></varlistentry>
5510 <varlistentry>
5511 <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>
5512 <listitem>
5513 <para>
5514 <indexterm role="option">
5515 <primary><option>-Mar</option></primary>
5516 </indexterm>
5517 <indexterm role="concept">
5518 <primary>message</primary>
5519 <secondary>adding recipients</secondary>
5520 </indexterm>
5521 <indexterm role="concept">
5522 <primary>recipient</primary>
5523 <secondary>adding</secondary>
5524 </indexterm>
5525 This option requests Exim to add the addresses to the list of recipients of the
5526 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5527 id, and the remaining ones must be email addresses. However, if the message is
5528 active (in the middle of a delivery attempt), it is not altered. This option
5529 can be used only by an admin user.
5530 </para>
5531 </listitem></varlistentry>
5532 <varlistentry>
5533 <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>
5534 <listitem>
5535 <para>
5536 <indexterm role="option">
5537 <primary><option>-MC</option></primary>
5538 </indexterm>
5539 <indexterm role="concept">
5540 <primary>SMTP</primary>
5541 <secondary>passed connection</secondary>
5542 </indexterm>
5543 <indexterm role="concept">
5544 <primary>SMTP</primary>
5545 <secondary>multiple deliveries</secondary>
5546 </indexterm>
5547 <indexterm role="concept">
5548 <primary>multiple SMTP deliveries</primary>
5549 </indexterm>
5550 This option is not intended for use by external callers. It is used internally
5551 by Exim to invoke another instance of itself to deliver a waiting message using
5552 an existing SMTP connection, which is passed as the standard input. Details are
5553 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5554 must be root or the Exim user in order to use it.
5555 </para>
5556 </listitem></varlistentry>
5557 <varlistentry>
5558 <term><option>-MCA</option></term>
5559 <listitem>
5560 <para>
5561 <indexterm role="option">
5562 <primary><option>-MCA</option></primary>
5563 </indexterm>
5564 This option is not intended for use by external callers. It is used internally
5565 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5566 connection to the remote host has been authenticated.
5567 </para>
5568 </listitem></varlistentry>
5569 <varlistentry revisionflag="changed">
5570 <term><option>-MCD</option></term>
5571 <listitem>
5572 <para revisionflag="changed">
5573 <indexterm role="option">
5574 <primary><option>-MCD</option></primary>
5575 </indexterm>
5576 This option is not intended for use by external callers. It is used internally
5577 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5578 remote host supports the ESMTP <filename>DSN</filename> extension.
5579 </para>
5580 </listitem></varlistentry>
5581 <varlistentry>
5582 <term><option>-MCP</option></term>
5583 <listitem>
5584 <para>
5585 <indexterm role="option">
5586 <primary><option>-MCP</option></primary>
5587 </indexterm>
5588 This option is not intended for use by external callers. It is used internally
5589 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5590 which Exim is connected supports pipelining.
5591 </para>
5592 </listitem></varlistentry>
5593 <varlistentry>
5594 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5595 <listitem>
5596 <para>
5597 <indexterm role="option">
5598 <primary><option>-MCQ</option></primary>
5599 </indexterm>
5600 This option is not intended for use by external callers. It is used internally
5601 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5602 started by a queue runner. It passes on the process id of the queue runner,
5603 together with the file descriptor number of an open pipe. Closure of the pipe
5604 signals the final completion of the sequence of processes that are passing
5605 messages through the same SMTP connection.
5606 </para>
5607 </listitem></varlistentry>
5608 <varlistentry>
5609 <term><option>-MCS</option></term>
5610 <listitem>
5611 <para>
5612 <indexterm role="option">
5613 <primary><option>-MCS</option></primary>
5614 </indexterm>
5615 This option is not intended for use by external callers. It is used internally
5616 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5617 SMTP SIZE option should be used on messages delivered down the existing
5618 connection.
5619 </para>
5620 </listitem></varlistentry>
5621 <varlistentry>
5622 <term><option>-MCT</option></term>
5623 <listitem>
5624 <para>
5625 <indexterm role="option">
5626 <primary><option>-MCT</option></primary>
5627 </indexterm>
5628 This option is not intended for use by external callers. It is used internally
5629 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5630 host to which Exim is connected supports TLS encryption.
5631 </para>
5632 </listitem></varlistentry>
5633 <varlistentry>
5634 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5635 <listitem>
5636 <para>
5637 <indexterm role="option">
5638 <primary><option>-Mc</option></primary>
5639 </indexterm>
5640 <indexterm role="concept">
5641 <primary>hints database</primary>
5642 <secondary>not overridden by <option>-Mc</option></secondary>
5643 </indexterm>
5644 <indexterm role="concept">
5645 <primary>delivery</primary>
5646 <secondary>manually started &ndash; not forced</secondary>
5647 </indexterm>
5648 This option requests Exim to run a delivery attempt on each message in turn,
5649 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5650 that are found. This option is not very useful to external callers. It is
5651 provided mainly for internal use by Exim when it needs to re-invoke itself in
5652 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5653 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5654 respects retry times and other options such as <option>hold_domains</option> that are
5655 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5656 If you want to run a specific delivery as if in a queue run, you should use
5657 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5658 and other deliveries is made in one or two places.
5659 </para>
5660 </listitem></varlistentry>
5661 <varlistentry>
5662 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5663 <listitem>
5664 <para>
5665 <indexterm role="option">
5666 <primary><option>-Mes</option></primary>
5667 </indexterm>
5668 <indexterm role="concept">
5669 <primary>message</primary>
5670 <secondary>changing sender</secondary>
5671 </indexterm>
5672 <indexterm role="concept">
5673 <primary>sender</primary>
5674 <secondary>changing</secondary>
5675 </indexterm>
5676 This option requests Exim to change the sender address in the message to the
5677 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5678 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5679 be a message id, and the second one an email address. However, if the message
5680 is active (in the middle of a delivery attempt), its status is not altered.
5681 This option can be used only by an admin user.
5682 </para>
5683 </listitem></varlistentry>
5684 <varlistentry>
5685 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5686 <listitem>
5687 <para>
5688 <indexterm role="option">
5689 <primary><option>-Mf</option></primary>
5690 </indexterm>
5691 <indexterm role="concept">
5692 <primary>freezing messages</primary>
5693 </indexterm>
5694 <indexterm role="concept">
5695 <primary>message</primary>
5696 <secondary>manually freezing</secondary>
5697 </indexterm>
5698 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5699 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5700 either manually or as a result of the <option>auto_thaw</option> configuration option.
5701 However, if any of the messages are active (in the middle of a delivery
5702 attempt), their status is not altered. This option can be used only by an admin
5703 user.
5704 </para>
5705 </listitem></varlistentry>
5706 <varlistentry>
5707 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5708 <listitem>
5709 <para>
5710 <indexterm role="option">
5711 <primary><option>-Mg</option></primary>
5712 </indexterm>
5713 <indexterm role="concept">
5714 <primary>giving up on messages</primary>
5715 </indexterm>
5716 <indexterm role="concept">
5717 <primary>message</primary>
5718 <secondary>abandoning delivery attempts</secondary>
5719 </indexterm>
5720 <indexterm role="concept">
5721 <primary>delivery</primary>
5722 <secondary>abandoning further attempts</secondary>
5723 </indexterm>
5724 This option requests Exim to give up trying to deliver the listed messages,
5725 including any that are frozen. However, if any of the messages are active,
5726 their status is not altered. For non-bounce messages, a delivery error message
5727 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5728 Bounce messages are just discarded. This option can be used only by an admin
5729 user.
5730 </para>
5731 </listitem></varlistentry>
5732 <varlistentry>
5733 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5734 <listitem>
5735 <para>
5736 <indexterm role="option">
5737 <primary><option>-Mmad</option></primary>
5738 </indexterm>
5739 <indexterm role="concept">
5740 <primary>delivery</primary>
5741 <secondary>cancelling all</secondary>
5742 </indexterm>
5743 This option requests Exim to mark all the recipient addresses in the messages
5744 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5745 message is active (in the middle of a delivery attempt), its status is not
5746 altered. This option can be used only by an admin user.
5747 </para>
5748 </listitem></varlistentry>
5749 <varlistentry>
5750 <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>
5751 <listitem>
5752 <para>
5753 <indexterm role="option">
5754 <primary><option>-Mmd</option></primary>
5755 </indexterm>
5756 <indexterm role="concept">
5757 <primary>delivery</primary>
5758 <secondary>cancelling by address</secondary>
5759 </indexterm>
5760 <indexterm role="concept">
5761 <primary>recipient</primary>
5762 <secondary>removing</secondary>
5763 </indexterm>
5764 <indexterm role="concept">
5765 <primary>removing recipients</primary>
5766 </indexterm>
5767 This option requests Exim to mark the given addresses as already delivered
5768 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5769 the remaining ones must be email addresses. These are matched to recipient
5770 addresses in the message in a case-sensitive manner. If the message is active
5771 (in the middle of a delivery attempt), its status is not altered. This option
5772 can be used only by an admin user.
5773 </para>
5774 </listitem></varlistentry>
5775 <varlistentry>
5776 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5777 <listitem>
5778 <para>
5779 <indexterm role="option">
5780 <primary><option>-Mrm</option></primary>
5781 </indexterm>
5782 <indexterm role="concept">
5783 <primary>removing messages</primary>
5784 </indexterm>
5785 <indexterm role="concept">
5786 <primary>abandoning mail</primary>
5787 </indexterm>
5788 <indexterm role="concept">
5789 <primary>message</primary>
5790 <secondary>manually discarding</secondary>
5791 </indexterm>
5792 This option requests Exim to remove the given messages from the queue. No
5793 bounce messages are sent; each message is simply forgotten. However, if any of
5794 the messages are active, their status is not altered. This option can be used
5795 only by an admin user or by the user who originally caused the message to be
5796 placed on the queue.
5797 </para>
5798 </listitem></varlistentry>
5799 <varlistentry>
5800 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5801 <listitem>
5802 <para>
5803 <indexterm role="option">
5804 <primary><option>-Mset</option></primary>
5805 </indexterm>
5806 <indexterm role="concept">
5807 <primary>testing</primary>
5808 <secondary>string expansion</secondary>
5809 </indexterm>
5810 <indexterm role="concept">
5811 <primary>expansion</primary>
5812 <secondary>testing</secondary>
5813 </indexterm>
5814 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5815 string expansions). Exim loads the given message from its spool before doing
5816 the test expansions, thus setting message-specific variables such as
5817 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5818 available. This feature is provided to make it easier to test expansions that
5819 make use of these variables. However, this option can be used only by an admin
5820 user. See also <option>-bem</option>.
5821 </para>
5822 </listitem></varlistentry>
5823 <varlistentry>
5824 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5825 <listitem>
5826 <para>
5827 <indexterm role="option">
5828 <primary><option>-Mt</option></primary>
5829 </indexterm>
5830 <indexterm role="concept">
5831 <primary>thawing messages</primary>
5832 </indexterm>
5833 <indexterm role="concept">
5834 <primary>unfreezing messages</primary>
5835 </indexterm>
5836 <indexterm role="concept">
5837 <primary>frozen messages</primary>
5838 <secondary>thawing</secondary>
5839 </indexterm>
5840 <indexterm role="concept">
5841 <primary>message</primary>
5842 <secondary>thawing frozen</secondary>
5843 </indexterm>
5844 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5845 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5846 messages are active, their status is not altered. This option can be used only
5847 by an admin user.
5848 </para>
5849 </listitem></varlistentry>
5850 <varlistentry>
5851 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5852 <listitem>
5853 <para>
5854 <indexterm role="option">
5855 <primary><option>-Mvb</option></primary>
5856 </indexterm>
5857 <indexterm role="concept">
5858 <primary>listing</primary>
5859 <secondary>message body</secondary>
5860 </indexterm>
5861 <indexterm role="concept">
5862 <primary>message</primary>
5863 <secondary>listing body of</secondary>
5864 </indexterm>
5865 This option causes the contents of the message body (-D) spool file to be
5866 written to the standard output. This option can be used only by an admin user.
5867 </para>
5868 </listitem></varlistentry>
5869 <varlistentry>
5870 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5871 <listitem>
5872 <para>
5873 <indexterm role="option">
5874 <primary><option>-Mvc</option></primary>
5875 </indexterm>
5876 <indexterm role="concept">
5877 <primary>message</primary>
5878 <secondary>listing in RFC 2822 format</secondary>
5879 </indexterm>
5880 <indexterm role="concept">
5881 <primary>listing</primary>
5882 <secondary>message in RFC 2822 format</secondary>
5883 </indexterm>
5884 This option causes a copy of the complete message (header lines plus body) to
5885 be written to the standard output in RFC 2822 format. This option can be used
5886 only by an admin user.
5887 </para>
5888 </listitem></varlistentry>
5889 <varlistentry>
5890 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5891 <listitem>
5892 <para>
5893 <indexterm role="option">
5894 <primary><option>-Mvh</option></primary>
5895 </indexterm>
5896 <indexterm role="concept">
5897 <primary>listing</primary>
5898 <secondary>message headers</secondary>
5899 </indexterm>
5900 <indexterm role="concept">
5901 <primary>header lines</primary>
5902 <secondary>listing</secondary>
5903 </indexterm>
5904 <indexterm role="concept">
5905 <primary>message</primary>
5906 <secondary>listing header lines</secondary>
5907 </indexterm>
5908 This option causes the contents of the message headers (-H) spool file to be
5909 written to the standard output. This option can be used only by an admin user.
5910 </para>
5911 </listitem></varlistentry>
5912 <varlistentry>
5913 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5914 <listitem>
5915 <para>
5916 <indexterm role="option">
5917 <primary><option>-Mvl</option></primary>
5918 </indexterm>
5919 <indexterm role="concept">
5920 <primary>listing</primary>
5921 <secondary>message log</secondary>
5922 </indexterm>
5923 <indexterm role="concept">
5924 <primary>message</primary>
5925 <secondary>listing message log</secondary>
5926 </indexterm>
5927 This option causes the contents of the message log spool file to be written to
5928 the standard output. This option can be used only by an admin user.
5929 </para>
5930 </listitem></varlistentry>
5931 <varlistentry>
5932 <term><option>-m</option></term>
5933 <listitem>
5934 <para>
5935 <indexterm role="option">
5936 <primary><option>-m</option></primary>
5937 </indexterm>
5938 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5939 treats it that way too.
5940 </para>
5941 </listitem></varlistentry>
5942 <varlistentry>
5943 <term><option>-N</option></term>
5944 <listitem>
5945 <para>
5946 <indexterm role="option">
5947 <primary><option>-N</option></primary>
5948 </indexterm>
5949 <indexterm role="concept">
5950 <primary>debugging</primary>
5951 <secondary><option>-N</option> option</secondary>
5952 </indexterm>
5953 <indexterm role="concept">
5954 <primary>debugging</primary>
5955 <secondary>suppressing delivery</secondary>
5956 </indexterm>
5957 This is a debugging option that inhibits delivery of a message at the transport
5958 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5959 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5960 had successfully done so. However, it does not make any updates to the retry
5961 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5962 than <quote>=&gt;</quote>.
5963 </para>
5964 <para>
5965 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5966 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5967 words, an ordinary user can use it only when supplying an incoming message to
5968 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5969 address may be deferred because of a configuration problem on a transport, or a
5970 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5971 the message, and applies to any subsequent delivery attempts that may happen
5972 for that message.
5973 </para>
5974 </listitem></varlistentry>
5975 <varlistentry>
5976 <term><option>-n</option></term>
5977 <listitem>
5978 <para>
5979 <indexterm role="option">
5980 <primary><option>-n</option></primary>
5981 </indexterm>
5982 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5983 For normal modes of operation, it is ignored by Exim.
5984 When combined with <option>-bP</option> it suppresses the name of an option from being output.
5985 </para>
5986 </listitem></varlistentry>
5987 <varlistentry>
5988 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5989 <listitem>
5990 <para>
5991 <indexterm role="option">
5992 <primary><option>-O</option></primary>
5993 </indexterm>
5994 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5995 Exim.
5996 </para>
5997 </listitem></varlistentry>
5998 <varlistentry>
5999 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6000 <listitem>
6001 <para>
6002 <indexterm role="option">
6003 <primary><option>-oA</option></primary>
6004 </indexterm>
6005 <indexterm role="concept">
6006 <primary>Sendmail compatibility</primary>
6007 <secondary><option>-oA</option> option</secondary>
6008 </indexterm>
6009 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6010 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6011 description above.
6012 </para>
6013 </listitem></varlistentry>
6014 <varlistentry>
6015 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6016 <listitem>
6017 <para>
6018 <indexterm role="option">
6019 <primary><option>-oB</option></primary>
6020 </indexterm>
6021 <indexterm role="concept">
6022 <primary>SMTP</primary>
6023 <secondary>passed connection</secondary>
6024 </indexterm>
6025 <indexterm role="concept">
6026 <primary>SMTP</primary>
6027 <secondary>multiple deliveries</secondary>
6028 </indexterm>
6029 <indexterm role="concept">
6030 <primary>multiple SMTP deliveries</primary>
6031 </indexterm>
6032 This is a debugging option which limits the maximum number of messages that can
6033 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6034 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6035 </para>
6036 </listitem></varlistentry>
6037 <varlistentry>
6038 <term><option>-odb</option></term>
6039 <listitem>
6040 <para>
6041 <indexterm role="option">
6042 <primary><option>-odb</option></primary>
6043 </indexterm>
6044 <indexterm role="concept">
6045 <primary>background delivery</primary>
6046 </indexterm>
6047 <indexterm role="concept">
6048 <primary>delivery</primary>
6049 <secondary>in the background</secondary>
6050 </indexterm>
6051 This option applies to all modes in which Exim accepts incoming messages,
6052 including the listening daemon. It requests <quote>background</quote> delivery of such
6053 messages, which means that the accepting process automatically starts a
6054 delivery process for each message received, but does not wait for the delivery
6055 processes to finish.
6056 </para>
6057 <para>
6058 When all the messages have been received, the reception process exits,
6059 leaving the delivery processes to finish in their own time. The standard output
6060 and error streams are closed at the start of each delivery process.
6061 This is the default action if none of the <option>-od</option> options are present.
6062 </para>
6063 <para>
6064 If one of the queueing options in the configuration file
6065 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6066 overrides it if <option>queue_only_override</option> is set true, which is the default
6067 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6068 </para>
6069 </listitem></varlistentry>
6070 <varlistentry>
6071 <term><option>-odf</option></term>
6072 <listitem>
6073 <para>
6074 <indexterm role="option">
6075 <primary><option>-odf</option></primary>
6076 </indexterm>
6077 <indexterm role="concept">
6078 <primary>foreground delivery</primary>
6079 </indexterm>
6080 <indexterm role="concept">
6081 <primary>delivery</primary>
6082 <secondary>in the foreground</secondary>
6083 </indexterm>
6084 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6085 accepted a locally-generated message. (For the daemon it is exactly the same as
6086 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6087 and Exim waits for it to complete before proceeding.
6088 </para>
6089 <para>
6090 The original Exim reception process does not finish until the delivery
6091 process for the final message has ended. The standard error stream is left open
6092 during deliveries.
6093 </para>
6094 <para>
6095 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6096 false and one of the queueing options in the configuration file is in effect.
6097 </para>
6098 <para>
6099 If there is a temporary delivery error during foreground delivery, the
6100 message is left on the queue for later delivery, and the original reception
6101 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6102 restricted configuration that never queues messages.
6103 </para>
6104 </listitem></varlistentry>
6105 <varlistentry>
6106 <term><option>-odi</option></term>
6107 <listitem>
6108 <para>
6109 <indexterm role="option">
6110 <primary><option>-odi</option></primary>
6111 </indexterm>
6112 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6113 Sendmail.
6114 </para>
6115 </listitem></varlistentry>
6116 <varlistentry>
6117 <term><option>-odq</option></term>
6118 <listitem>
6119 <para>
6120 <indexterm role="option">
6121 <primary><option>-odq</option></primary>
6122 </indexterm>
6123 <indexterm role="concept">
6124 <primary>non-immediate delivery</primary>
6125 </indexterm>
6126 <indexterm role="concept">
6127 <primary>delivery</primary>
6128 <secondary>suppressing immediate</secondary>
6129 </indexterm>
6130 <indexterm role="concept">
6131 <primary>queueing incoming messages</primary>
6132 </indexterm>
6133 This option applies to all modes in which Exim accepts incoming messages,
6134 including the listening daemon. It specifies that the accepting process should
6135 not automatically start a delivery process for each message received. Messages
6136 are placed on the queue, and remain there until a subsequent queue runner
6137 process encounters them. There are several configuration options (such as
6138 <option>queue_only</option>) that can be used to queue incoming messages under certain
6139 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6140 forces queueing.
6141 </para>
6142 </listitem></varlistentry>
6143 <varlistentry>
6144 <term><option>-odqs</option></term>
6145 <listitem>
6146 <para>
6147 <indexterm role="option">
6148 <primary><option>-odqs</option></primary>
6149 </indexterm>
6150 <indexterm role="concept">
6151 <primary>SMTP</primary>
6152 <secondary>delaying delivery</secondary>
6153 </indexterm>
6154 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6155 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6156 <option>queue_only_override</option> is false and one of the queueing options in the
6157 configuration file is in effect.
6158 </para>
6159 <para>
6160 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6161 message, in the background by default, but in the foreground if <option>-odi</option> is
6162 also present. The recipient addresses are routed, and local deliveries are done
6163 in the normal way. However, if any SMTP deliveries are required, they are not
6164 done at this time, so the message remains on the queue until a subsequent queue
6165 runner process encounters it. Because routing was done, Exim knows which
6166 messages are waiting for which hosts, and so a number of messages for the same
6167 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6168 configuration option has the same effect for specific domains. See also the
6169 <option>-qq</option> option.
6170 </para>
6171 </listitem></varlistentry>
6172 <varlistentry>
6173 <term><option>-oee</option></term>
6174 <listitem>
6175 <para>
6176 <indexterm role="option">
6177 <primary><option>-oee</option></primary>
6178 </indexterm>
6179 <indexterm role="concept">
6180 <primary>error</primary>
6181 <secondary>reporting</secondary>
6182 </indexterm>
6183 If an error is detected while a non-SMTP message is being received (for
6184 example, a malformed address), the error is reported to the sender in a mail
6185 message.
6186 </para>
6187 <para>
6188 <indexterm role="concept">
6189 <primary>return code</primary>
6190 <secondary>for <option>-oee</option></secondary>
6191 </indexterm>
6192 Provided
6193 this error message is successfully sent, the Exim receiving process
6194 exits with a return code of zero. If not, the return code is 2 if the problem
6195 is that the original message has no recipients, or 1 for any other error.
6196 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6197 </para>
6198 </listitem></varlistentry>
6199 <varlistentry>
6200 <term><option>-oem</option></term>
6201 <listitem>
6202 <para>
6203 <indexterm role="option">
6204 <primary><option>-oem</option></primary>
6205 </indexterm>
6206 <indexterm role="concept">
6207 <primary>error</primary>
6208 <secondary>reporting</secondary>
6209 </indexterm>
6210 <indexterm role="concept">
6211 <primary>return code</primary>
6212 <secondary>for <option>-oem</option></secondary>
6213 </indexterm>
6214 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6215 return code, whether or not the error message was successfully sent.
6216 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6217 </para>
6218 </listitem></varlistentry>
6219 <varlistentry>
6220 <term><option>-oep</option></term>
6221 <listitem>
6222 <para>
6223 <indexterm role="option">
6224 <primary><option>-oep</option></primary>
6225 </indexterm>
6226 <indexterm role="concept">
6227 <primary>error</primary>
6228 <secondary>reporting</secondary>
6229 </indexterm>
6230 If an error is detected while a non-SMTP message is being received, the
6231 error is reported by writing a message to the standard error file (stderr).
6232 <indexterm role="concept">
6233 <primary>return code</primary>
6234 <secondary>for <option>-oep</option></secondary>
6235 </indexterm>
6236 The return code is 1 for all errors.
6237 </para>
6238 </listitem></varlistentry>
6239 <varlistentry>
6240 <term><option>-oeq</option></term>
6241 <listitem>
6242 <para>
6243 <indexterm role="option">
6244 <primary><option>-oeq</option></primary>
6245 </indexterm>
6246 <indexterm role="concept">
6247 <primary>error</primary>
6248 <secondary>reporting</secondary>
6249 </indexterm>
6250 This option is supported for compatibility with Sendmail, but has the same
6251 effect as <option>-oep</option>.
6252 </para>
6253 </listitem></varlistentry>
6254 <varlistentry>
6255 <term><option>-oew</option></term>
6256 <listitem>
6257 <para>
6258 <indexterm role="option">
6259 <primary><option>-oew</option></primary>
6260 </indexterm>
6261 <indexterm role="concept">
6262 <primary>error</primary>
6263 <secondary>reporting</secondary>
6264 </indexterm>
6265 This option is supported for compatibility with Sendmail, but has the same
6266 effect as <option>-oem</option>.
6267 </para>
6268 </listitem></varlistentry>
6269 <varlistentry>
6270 <term><option>-oi</option></term>
6271 <listitem>
6272 <para>
6273 <indexterm role="option">
6274 <primary><option>-oi</option></primary>
6275 </indexterm>
6276 <indexterm role="concept">
6277 <primary>dot</primary>
6278 <secondary>in incoming non-SMTP message</secondary>
6279 </indexterm>
6280 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6281 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6282 single dot does terminate, though Exim does no special processing for other
6283 lines that start with a dot. This option is set by default if Exim is called as
6284 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6285 </para>
6286 </listitem></varlistentry>
6287 <varlistentry>
6288 <term><option>-oitrue</option></term>
6289 <listitem>
6290 <para>
6291 <indexterm role="option">
6292 <primary><option>-oitrue</option></primary>
6293 </indexterm>
6294 This option is treated as synonymous with <option>-oi</option>.
6295 </para>
6296 </listitem></varlistentry>
6297 <varlistentry>
6298 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6299 <listitem>
6300 <para>
6301 <indexterm role="option">
6302 <primary><option>-oMa</option></primary>
6303 </indexterm>
6304 <indexterm role="concept">
6305 <primary>sender</primary>
6306 <secondary>host address, specifying for local message</secondary>
6307 </indexterm>
6308 A number of options starting with <option>-oM</option> can be used to set values associated
6309 with remote hosts on locally-submitted messages (that is, messages not received
6310 over TCP/IP). These options can be used by any caller in conjunction with the
6311 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6312 other circumstances, they are ignored unless the caller is trusted.
6313 </para>
6314 <para>
6315 The <option>-oMa</option> option sets the sender host address. This may include a port
6316 number at the end, after a full stop (period). For example:
6317 </para>
6318 <literallayout class="monospaced">
6319 exim -bs -oMa 10.9.8.7.1234
6320 </literallayout>
6321 <para>
6322 An alternative syntax is to enclose the IP address in square brackets,
6323 followed by a colon and the port number:
6324 </para>
6325 <literallayout class="monospaced">
6326 exim -bs -oMa [10.9.8.7]:1234
6327 </literallayout>
6328 <para>
6329 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6330 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6331 are present on the command line, the sender host IP address is taken from
6332 whichever one is last.
6333 </para>
6334 </listitem></varlistentry>
6335 <varlistentry>
6336 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6337 <listitem>
6338 <para>
6339 <indexterm role="option">
6340 <primary><option>-oMaa</option></primary>
6341 </indexterm>
6342 <indexterm role="concept">
6343 <primary>authentication</primary>
6344 <secondary>name, specifying for local message</secondary>
6345 </indexterm>
6346 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6347 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6348 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6349 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6350 authenticated SMTP session without actually using the SMTP AUTH command.
6351 </para>
6352 </listitem></varlistentry>
6353 <varlistentry>
6354 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6355 <listitem>
6356 <para>
6357 <indexterm role="option">
6358 <primary><option>-oMai</option></primary>
6359 </indexterm>
6360 <indexterm role="concept">
6361 <primary>authentication</primary>
6362 <secondary>id, specifying for local message</secondary>
6363 </indexterm>
6364 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6365 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6366 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6367 where there is no default) for messages from local sources. See chapter
6368 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6369 </para>
6370 </listitem></varlistentry>
6371 <varlistentry>
6372 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6373 <listitem>
6374 <para>
6375 <indexterm role="option">
6376 <primary><option>-oMas</option></primary>
6377 </indexterm>
6378 <indexterm role="concept">
6379 <primary>authentication</primary>
6380 <secondary>sender, specifying for local message</secondary>
6381 </indexterm>
6382 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6383 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6384 overrides the sender address that is created from the caller&#x2019;s login id for
6385 messages from local sources, except when <option>-bh</option> is used, when there is no
6386 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6387 specified on a MAIL command overrides this value. See chapter
6388 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6389 </para>
6390 </listitem></varlistentry>
6391 <varlistentry>
6392 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6393 <listitem>
6394 <para>
6395 <indexterm role="option">
6396 <primary><option>-oMi</option></primary>
6397 </indexterm>
6398 <indexterm role="concept">
6399 <primary>interface</primary>
6400 <secondary>address, specifying for local message</secondary>
6401 </indexterm>
6402 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6403 option sets the IP interface address value. A port number may be included,
6404 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6405 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6406 </para>
6407 </listitem></varlistentry>
6408 <varlistentry>
6409 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6410 <listitem>
6411 <para>
6412 <indexterm role="option">
6413 <primary><option>-oMm</option></primary>
6414 </indexterm>
6415 <indexterm role="concept">
6416 <primary>message reference</primary>
6417 <secondary>message reference, specifying for local message</secondary>
6418 </indexterm>
6419 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6420 option sets the message reference, e.g. message-id, and is logged during
6421 delivery. This is useful when some kind of audit trail is required to tie
6422 messages together. The format of the message reference is checked and will
6423 abort if the format is invalid. The option will only be accepted if exim is
6424 running in trusted mode, not as any regular user.
6425 </para>
6426 <para>
6427 The best example of a message reference is when Exim sends a bounce message.
6428 The message reference is the message-id of the original message for which Exim
6429 is sending the bounce.
6430 </para>
6431 </listitem></varlistentry>
6432 <varlistentry>
6433 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6434 <listitem>
6435 <para>
6436 <indexterm role="option">
6437 <primary><option>-oMr</option></primary>
6438 </indexterm>
6439 <indexterm role="concept">
6440 <primary>protocol, specifying for local message</primary>
6441 </indexterm>
6442 <indexterm role="variable">
6443 <primary><varname>$received_protocol</varname></primary>
6444 </indexterm>
6445 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6446 option sets the received protocol value that is stored in
6447 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6448 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6449 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6450 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6451 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6452 be set by <option>-oMr</option>.
6453 </para>
6454 </listitem></varlistentry>
6455 <varlistentry>
6456 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6457 <listitem>
6458 <para>
6459 <indexterm role="option">
6460 <primary><option>-oMs</option></primary>
6461 </indexterm>
6462 <indexterm role="concept">
6463 <primary>sender</primary>
6464 <secondary>host name, specifying for local message</secondary>
6465 </indexterm>
6466 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6467 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6468 present, Exim does not attempt to look up a host name from an IP address; it
6469 uses the name it is given.
6470 </para>
6471 </listitem></varlistentry>
6472 <varlistentry>
6473 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6474 <listitem>
6475 <para>
6476 <indexterm role="option">
6477 <primary><option>-oMt</option></primary>
6478 </indexterm>
6479 <indexterm role="concept">
6480 <primary>sender</primary>
6481 <secondary>ident string, specifying for local message</secondary>
6482 </indexterm>
6483 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6484 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6485 local callers is the login id of the calling process, except when <option>-bh</option> is
6486 used, when there is no default.
6487 </para>
6488 </listitem></varlistentry>
6489 <varlistentry>
6490 <term><option>-om</option></term>
6491 <listitem>
6492 <para>
6493 <indexterm role="option">
6494 <primary><option>-om</option></primary>
6495 </indexterm>
6496 <indexterm role="concept">
6497 <primary>Sendmail compatibility</primary>
6498 <secondary><option>-om</option> option ignored</secondary>
6499 </indexterm>
6500 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6501 message should receive a copy of the message if the sender appears in an alias
6502 expansion. Exim always does this, so the option does nothing.
6503 </para>
6504 </listitem></varlistentry>
6505 <varlistentry>
6506 <term><option>-oo</option></term>
6507 <listitem>
6508 <para>
6509 <indexterm role="option">
6510 <primary><option>-oo</option></primary>
6511 </indexterm>
6512 <indexterm role="concept">
6513 <primary>Sendmail compatibility</primary>
6514 <secondary><option>-oo</option> option ignored</secondary>
6515 </indexterm>
6516 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6517 whatever that means.
6518 </para>
6519 </listitem></varlistentry>
6520 <varlistentry>
6521 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6522 <listitem>
6523 <para>
6524 <indexterm role="option">
6525 <primary><option>-oP</option></primary>
6526 </indexterm>
6527 <indexterm role="concept">
6528 <primary>pid (process id)</primary>
6529 <secondary>of daemon</secondary>
6530 </indexterm>
6531 <indexterm role="concept">
6532 <primary>daemon</primary>
6533 <secondary>process id (pid)</secondary>
6534 </indexterm>
6535 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6536 value. The option specifies the file to which the process id of the daemon is
6537 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6538 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6539 because in those cases, the normal pid file is not used.
6540 </para>
6541 </listitem></varlistentry>
6542 <varlistentry>
6543 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6544 <listitem>
6545 <para>
6546 <indexterm role="option">
6547 <primary><option>-or</option></primary>
6548 </indexterm>
6549 <indexterm role="concept">
6550 <primary>timeout</primary>
6551 <secondary>for non-SMTP input</secondary>
6552 </indexterm>
6553 This option sets a timeout value for incoming non-SMTP messages. If it is not
6554 set, Exim will wait forever for the standard input. The value can also be set
6555 by the <option>receive_timeout</option> option. The format used for specifying times is
6556 described in section <xref linkend="SECTtimeformat"/>.
6557 </para>
6558 </listitem></varlistentry>
6559 <varlistentry>
6560 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6561 <listitem>
6562 <para>
6563 <indexterm role="option">
6564 <primary><option>-os</option></primary>
6565 </indexterm>
6566 <indexterm role="concept">
6567 <primary>timeout</primary>
6568 <secondary>for SMTP input</secondary>
6569 </indexterm>
6570 <indexterm role="concept">
6571 <primary>SMTP</primary>
6572 <secondary>input timeout</secondary>
6573 </indexterm>
6574 This option sets a timeout value for incoming SMTP messages. The timeout
6575 applies to each SMTP command and block of data. The value can also be set by
6576 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6577 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6578 </para>
6579 </listitem></varlistentry>
6580 <varlistentry>
6581 <term><option>-ov</option></term>
6582 <listitem>
6583 <para>
6584 <indexterm role="option">
6585 <primary><option>-ov</option></primary>
6586 </indexterm>
6587 This option has exactly the same effect as <option>-v</option>.
6588 </para>
6589 </listitem></varlistentry>
6590 <varlistentry>
6591 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6592 <listitem>
6593 <para>
6594 <indexterm role="option">
6595 <primary><option>-oX</option></primary>
6596 </indexterm>
6597 <indexterm role="concept">
6598 <primary>TCP/IP</primary>
6599 <secondary>setting listening ports</secondary>
6600 </indexterm>
6601 <indexterm role="concept">
6602 <primary>TCP/IP</primary>
6603 <secondary>setting listening interfaces</secondary>
6604 </indexterm>
6605 <indexterm role="concept">
6606 <primary>port</primary>
6607 <secondary>receiving TCP/IP</secondary>
6608 </indexterm>
6609 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6610 is also given. It controls which ports and interfaces the daemon uses. Details
6611 of the syntax, and how it interacts with configuration file options, are given
6612 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6613 file is written unless <option>-oP</option> is also present to specify a pid file name.
6614 </para>
6615 </listitem></varlistentry>
6616 <varlistentry>
6617 <term><option>-pd</option></term>
6618 <listitem>
6619 <para>
6620 <indexterm role="option">
6621 <primary><option>-pd</option></primary>
6622 </indexterm>
6623 <indexterm role="concept">
6624 <primary>Perl</primary>
6625 <secondary>starting the interpreter</secondary>
6626 </indexterm>
6627 This option applies when an embedded Perl interpreter is linked with Exim (see
6628 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6629 option, forcing the starting of the interpreter to be delayed until it is
6630 needed.
6631 </para>
6632 </listitem></varlistentry>
6633 <varlistentry>
6634 <term><option>-ps</option></term>
6635 <listitem>
6636 <para>
6637 <indexterm role="option">
6638 <primary><option>-ps</option></primary>
6639 </indexterm>
6640 <indexterm role="concept">
6641 <primary>Perl</primary>
6642 <secondary>starting the interpreter</secondary>
6643 </indexterm>
6644 This option applies when an embedded Perl interpreter is linked with Exim (see
6645 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6646 option, forcing the starting of the interpreter to occur as soon as Exim is
6647 started.
6648 </para>
6649 </listitem></varlistentry>
6650 <varlistentry>
6651 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6652 <listitem>
6653 <para>
6654 <indexterm role="option">
6655 <primary><option>-p</option></primary>
6656 </indexterm>
6657 For compatibility with Sendmail, this option is equivalent to
6658 </para>
6659 <literallayout>
6660 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6661 </literallayout>
6662 <para>
6663 It sets the incoming protocol and host name (for trusted callers). The
6664 host name and its colon can be omitted when only the protocol is to be set.
6665 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6666 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6667 or <literal>s</literal> using this option (but that does not seem a real limitation).
6668 </para>
6669 </listitem></varlistentry>
6670 <varlistentry>
6671 <term><option>-q</option></term>
6672 <listitem>
6673 <para>
6674 <indexterm role="option">
6675 <primary><option>-q</option></primary>
6676 </indexterm>
6677 <indexterm role="concept">
6678 <primary>queue runner</primary>
6679 <secondary>starting manually</secondary>
6680 </indexterm>
6681 This option is normally restricted to admin users. However, there is a
6682 configuration option called <option>prod_requires_admin</option> which can be set false to
6683 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6684 and <option>-S</option> options).
6685 </para>
6686 <para>
6687 <indexterm role="concept">
6688 <primary>queue runner</primary>
6689 <secondary>description of operation</secondary>
6690 </indexterm>
6691 The <option>-q</option> option starts one queue runner process. This scans the queue of
6692 waiting messages, and runs a delivery process for each one in turn. It waits
6693 for each delivery process to finish before starting the next one. A delivery
6694 process may not actually do any deliveries if the retry times for the addresses
6695 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6696 </para>
6697 <para>
6698 If
6699 <indexterm role="concept">
6700 <primary>SMTP</primary>
6701 <secondary>passed connection</secondary>
6702 </indexterm>
6703 <indexterm role="concept">
6704 <primary>SMTP</primary>
6705 <secondary>multiple deliveries</secondary>
6706 </indexterm>
6707 <indexterm role="concept">
6708 <primary>multiple SMTP deliveries</primary>
6709 </indexterm>
6710 the delivery process spawns other processes to deliver other messages down
6711 passed SMTP connections, the queue runner waits for these to finish before
6712 proceeding.
6713 </para>
6714 <para>
6715 When all the queued messages have been considered, the original queue runner
6716 process terminates. In other words, a single pass is made over the waiting
6717 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6718 this to be repeated periodically.
6719 </para>
6720 <para>
6721 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6722 random, but it is likely to be different each time, which is all that matters.
6723 If one particular message screws up a remote MTA, other messages to the same
6724 MTA have a chance of getting through if they get tried first.
6725 </para>
6726 <para>
6727 It is possible to cause the messages to be processed in lexical message id
6728 order, which is essentially the order in which they arrived, by setting the
6729 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6730 </para>
6731 </listitem></varlistentry>
6732 <varlistentry>
6733 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6734 <listitem>
6735 <para>
6736 The <option>-q</option> option may be followed by one or more flag letters that change its
6737 behaviour. They are all optional, but if more than one is present, they must
6738 appear in the correct order. Each flag is described in a separate item below.
6739 </para>
6740 </listitem></varlistentry>
6741 <varlistentry>
6742 <term><option>-qq...</option></term>
6743 <listitem>
6744 <para>
6745 <indexterm role="option">
6746 <primary><option>-qq</option></primary>
6747 </indexterm>
6748 <indexterm role="concept">
6749 <primary>queue</primary>
6750 <secondary>double scanning</secondary>
6751 </indexterm>
6752 <indexterm role="concept">
6753 <primary>queue</primary>
6754 <secondary>routing</secondary>
6755 </indexterm>
6756 <indexterm role="concept">
6757 <primary>routing</primary>
6758 <secondary>whole queue before delivery</secondary>
6759 </indexterm>
6760 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6761 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6762 every domain. Addresses are routed, local deliveries happen, but no remote
6763 transports are run.
6764 </para>
6765 <para>
6766 <indexterm role="concept">
6767 <primary>hints database</primary>
6768 <secondary>remembering routing</secondary>
6769 </indexterm>
6770 The hints database that remembers which messages are waiting for specific hosts
6771 is updated, as if delivery to those hosts had been deferred. After this is
6772 complete, a second, normal queue scan happens, with routing and delivery taking
6773 place as normal. Messages that are routed to the same host should mostly be
6774 delivered down a single SMTP
6775 <indexterm role="concept">
6776 <primary>SMTP</primary>
6777 <secondary>passed connection</secondary>
6778 </indexterm>
6779 <indexterm role="concept">
6780 <primary>SMTP</primary>
6781 <secondary>multiple deliveries</secondary>
6782 </indexterm>
6783 <indexterm role="concept">
6784 <primary>multiple SMTP deliveries</primary>
6785 </indexterm>
6786 connection because of the hints that were set up during the first queue scan.
6787 This option may be useful for hosts that are connected to the Internet
6788 intermittently.
6789 </para>
6790 </listitem></varlistentry>
6791 <varlistentry>
6792 <term><option>-q[q]i...</option></term>
6793 <listitem>
6794 <para>
6795 <indexterm role="option">
6796 <primary><option>-qi</option></primary>
6797 </indexterm>
6798 <indexterm role="concept">
6799 <primary>queue</primary>
6800 <secondary>initial delivery</secondary>
6801 </indexterm>
6802 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6803 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6804 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6805 <option>-odq</option> and want a queue runner just to process the new messages.
6806 </para>
6807 </listitem></varlistentry>
6808 <varlistentry>
6809 <term><option>-q[q][i]f...</option></term>
6810 <listitem>
6811 <para>
6812 <indexterm role="option">
6813 <primary><option>-qf</option></primary>
6814 </indexterm>
6815 <indexterm role="concept">
6816 <primary>queue</primary>
6817 <secondary>forcing delivery</secondary>
6818 </indexterm>
6819 <indexterm role="concept">
6820 <primary>delivery</primary>
6821 <secondary>forcing in queue run</secondary>
6822 </indexterm>
6823 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6824 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6825 their retry times are tried.
6826 </para>
6827 </listitem></varlistentry>
6828 <varlistentry>
6829 <term><option>-q[q][i]ff...</option></term>
6830 <listitem>
6831 <para>
6832 <indexterm role="option">
6833 <primary><option>-qff</option></primary>
6834 </indexterm>
6835 <indexterm role="concept">
6836 <primary>frozen messages</primary>
6837 <secondary>forcing delivery</secondary>
6838 </indexterm>
6839 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6840 frozen or not.
6841 </para>
6842 </listitem></varlistentry>
6843 <varlistentry>
6844 <term><option>-q[q][i][f[f]]l</option></term>
6845 <listitem>
6846 <para>
6847 <indexterm role="option">
6848 <primary><option>-ql</option></primary>
6849 </indexterm>
6850 <indexterm role="concept">
6851 <primary>queue</primary>
6852 <secondary>local deliveries only</secondary>
6853 </indexterm>
6854 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6855 be done. If a message requires any remote deliveries, it remains on the queue
6856 for later delivery.
6857 </para>
6858 </listitem></varlistentry>
6859 <varlistentry>
6860 <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>
6861 <listitem>
6862 <para>
6863 <indexterm role="concept">
6864 <primary>queue</primary>
6865 <secondary>delivering specific messages</secondary>
6866 </indexterm>
6867 When scanning the queue, Exim can be made to skip over messages whose ids are
6868 lexically less than a given value by following the <option>-q</option> option with a
6869 starting message id. For example:
6870 </para>
6871 <literallayout class="monospaced">
6872 exim -q 0t5C6f-0000c8-00
6873 </literallayout>
6874 <para>
6875 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6876 second message id is given, messages whose ids are lexically greater than it
6877 are also skipped. If the same id is given twice, for example,
6878 </para>
6879 <literallayout class="monospaced">
6880 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6881 </literallayout>
6882 <para>
6883 just one delivery process is started, for that message. This differs from
6884 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6885 that it counts as a delivery from a queue run. Note that the selection
6886 mechanism does not affect the order in which the messages are scanned. There
6887 are also other ways of selecting specific sets of messages for delivery in a
6888 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6889 </para>
6890 </listitem></varlistentry>
6891 <varlistentry>
6892 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6893 <listitem>
6894 <para>
6895 <indexterm role="concept">
6896 <primary>queue runner</primary>
6897 <secondary>starting periodically</secondary>
6898 </indexterm>
6899 <indexterm role="concept">
6900 <primary>periodic queue running</primary>
6901 </indexterm>
6902 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6903 starting a queue runner process at intervals specified by the given time value
6904 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6905 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6906 single daemon process handles both functions. A common way of starting up a
6907 combined daemon at system boot time is to use a command such as
6908 </para>
6909 <literallayout class="monospaced">
6910 /usr/exim/bin/exim -bd -q30m
6911 </literallayout>
6912 <para>
6913 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6914 process every 30 minutes.
6915 </para>
6916 <para>
6917 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6918 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6919 </para>
6920 </listitem></varlistentry>
6921 <varlistentry>
6922 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6923 <listitem>
6924 <para>
6925 <indexterm role="option">
6926 <primary><option>-qR</option></primary>
6927 </indexterm>
6928 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6929 compatibility.
6930 </para>
6931 </listitem></varlistentry>
6932 <varlistentry>
6933 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6934 <listitem>
6935 <para>
6936 <indexterm role="option">
6937 <primary><option>-qS</option></primary>
6938 </indexterm>
6939 This option is synonymous with <option>-S</option>.
6940 </para>
6941 </listitem></varlistentry>
6942 <varlistentry>
6943 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6944 <listitem>
6945 <para>
6946 <indexterm role="option">
6947 <primary><option>-R</option></primary>
6948 </indexterm>
6949 <indexterm role="concept">
6950 <primary>queue runner</primary>
6951 <secondary>for specific recipients</secondary>
6952 </indexterm>
6953 <indexterm role="concept">
6954 <primary>delivery</primary>
6955 <secondary>to given domain</secondary>
6956 </indexterm>
6957 <indexterm role="concept">
6958 <primary>domain</primary>
6959 <secondary>delivery to</secondary>
6960 </indexterm>
6961 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6962 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6963 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6964 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6965 </para>
6966 <para>
6967 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6968 perform a single queue run, except that, when scanning the messages on the
6969 queue, Exim processes only those that have at least one undelivered recipient
6970 address containing the given string, which is checked in a case-independent
6971 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6972 regular expression; otherwise it is a literal string.
6973 </para>
6974 <para>
6975 If you want to do periodic queue runs for messages with specific recipients,
6976 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6977 </para>
6978 <literallayout class="monospaced">
6979 exim -q25m -R @special.domain.example
6980 </literallayout>
6981 <para>
6982 This example does a queue run for messages with recipients in the given domain
6983 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6984 applied to each queue run.
6985 </para>
6986 <para>
6987 Once a message is selected for delivery by this mechanism, all its addresses
6988 are processed. For the first selected message, Exim overrides any retry
6989 information and forces a delivery attempt for each undelivered address. This
6990 means that if delivery of any address in the first message is successful, any
6991 existing retry information is deleted, and so delivery attempts for that
6992 address in subsequently selected messages (which are processed without forcing)
6993 will run. However, if delivery of any address does not succeed, the retry
6994 information is updated, and in subsequently selected messages, the failing
6995 address will be skipped.
6996 </para>
6997 <para>
6998 <indexterm role="concept">
6999 <primary>frozen messages</primary>
7000 <secondary>forcing delivery</secondary>
7001 </indexterm>
7002 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7003 all selected messages, not just the first; frozen messages are included when
7004 <emphasis>ff</emphasis> is present.
7005 </para>
7006 <para>
7007 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7008 to a given domain after a host has been down for some time. When the SMTP
7009 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7010 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7011 an arbitrary command instead.
7012 </para>
7013 </listitem></varlistentry>
7014 <varlistentry>
7015 <term><option>-r</option></term>
7016 <listitem>
7017 <para>
7018 <indexterm role="option">
7019 <primary><option>-r</option></primary>
7020 </indexterm>
7021 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7022 </para>
7023 </listitem></varlistentry>
7024 <varlistentry>
7025 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7026 <listitem>
7027 <para>
7028 <indexterm role="option">
7029 <primary><option>-S</option></primary>
7030 </indexterm>
7031 <indexterm role="concept">
7032 <primary>delivery</primary>
7033 <secondary>from given sender</secondary>
7034 </indexterm>
7035 <indexterm role="concept">
7036 <primary>queue runner</primary>
7037 <secondary>for specific senders</secondary>
7038 </indexterm>
7039 This option acts like <option>-R</option> except that it checks the string against each
7040 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7041 conditions must be met for a message to be selected. If either of the options
7042 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7043 </para>
7044 </listitem></varlistentry>
7045 <varlistentry>
7046 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7047 <listitem>
7048 <para>
7049 <indexterm role="option">
7050 <primary><option>-Tqt</option></primary>
7051 </indexterm>
7052 This is an option that is exclusively for use by the Exim testing suite. It is not
7053 recognized when Exim is run normally. It allows for the setting up of explicit
7054 <quote>queue times</quote> so that various warning/retry features can be tested.
7055 </para>
7056 </listitem></varlistentry>
7057 <varlistentry>
7058 <term><option>-t</option></term>
7059 <listitem>
7060 <para>
7061 <indexterm role="option">
7062 <primary><option>-t</option></primary>
7063 </indexterm>
7064 <indexterm role="concept">
7065 <primary>recipient</primary>
7066 <secondary>extracting from header lines</secondary>
7067 </indexterm>
7068 <indexterm role="concept">
7069 <primary><emphasis>Bcc:</emphasis> header line</primary>
7070 </indexterm>
7071 <indexterm role="concept">
7072 <primary><emphasis>Cc:</emphasis> header line</primary>
7073 </indexterm>
7074 <indexterm role="concept">
7075 <primary><emphasis>To:</emphasis> header line</primary>
7076 </indexterm>
7077 When Exim is receiving a locally-generated, non-SMTP message on its standard
7078 input, the <option>-t</option> option causes the recipients of the message to be obtained
7079 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7080 from the command arguments. The addresses are extracted before any rewriting
7081 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7082 </para>
7083 <para>
7084 <indexterm role="concept">
7085 <primary>Sendmail compatibility</primary>
7086 <secondary><option>-t</option> option</secondary>
7087 </indexterm>
7088 If the command has any arguments, they specify addresses to which the message
7089 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7090 the recipients list obtained from the headers. This is compatible with Smail 3
7091 and in accordance with the documented behaviour of several versions of
7092 Sendmail, as described in man pages on a number of operating systems (e.g.
7093 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7094 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7095 Sendmail book documents it that way. Exim can be made to add argument addresses
7096 instead of subtracting them by setting the option
7097 <option>extract_addresses_remove_arguments</option> false.
7098 </para>
7099 <para>
7100 <indexterm role="concept">
7101 <primary><option>Resent-</option> header lines</primary>
7102 <secondary>with <option>-t</option></secondary>
7103 </indexterm>
7104 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7105 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7106 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7107 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7108 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7109 </para>
7110 <para>
7111 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7112 message is resent several times). The RFC also specifies that they should be
7113 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7114 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7115 nor indeed exactly what constitutes a <quote>set</quote>.
7116 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7117 are often added at the end of the header, and if a message is resent more than
7118 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7119 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7120 </para>
7121 </listitem></varlistentry>
7122 <varlistentry>
7123 <term><option>-ti</option></term>
7124 <listitem>
7125 <para>
7126 <indexterm role="option">
7127 <primary><option>-ti</option></primary>
7128 </indexterm>
7129 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7130 compatibility with Sendmail.
7131 </para>
7132 </listitem></varlistentry>
7133 <varlistentry>
7134 <term><option>-tls-on-connect</option></term>
7135 <listitem>
7136 <para>
7137 <indexterm role="option">
7138 <primary><option>-tls-on-connect</option></primary>
7139 </indexterm>
7140 <indexterm role="concept">
7141 <primary>TLS</primary>
7142 <secondary>use without STARTTLS</secondary>
7143 </indexterm>
7144 <indexterm role="concept">
7145 <primary>TLS</primary>
7146 <secondary>automatic start</secondary>
7147 </indexterm>
7148 This option is available when Exim is compiled with TLS support. It forces all
7149 incoming SMTP connections to behave as if the incoming port is listed in the
7150 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7151 <xref linkend="CHAPTLS"/> for further details.
7152 </para>
7153 </listitem></varlistentry>
7154 <varlistentry>
7155 <term><option>-U</option></term>
7156 <listitem>
7157 <para>
7158 <indexterm role="option">
7159 <primary><option>-U</option></primary>
7160 </indexterm>
7161 <indexterm role="concept">
7162 <primary>Sendmail compatibility</primary>
7163 <secondary><option>-U</option> option ignored</secondary>
7164 </indexterm>
7165 Sendmail uses this option for <quote>initial message submission</quote>, and its
7166 documentation states that in future releases, it may complain about
7167 syntactically invalid messages rather than fixing them when this flag is not
7168 set. Exim ignores this option.
7169 </para>
7170 </listitem></varlistentry>
7171 <varlistentry>
7172 <term><option>-v</option></term>
7173 <listitem>
7174 <para>
7175 <indexterm role="option">
7176 <primary><option>-v</option></primary>
7177 </indexterm>
7178 This option causes Exim to write information to the standard error stream,
7179 describing what it is doing. In particular, it shows the log lines for
7180 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7181 dialogue is shown. Some of the log lines shown may not actually be written to
7182 the log if the setting of <option>log_selector</option> discards them. Any relevant
7183 selectors are shown with each log line. If none are shown, the logging is
7184 unconditional.
7185 </para>
7186 </listitem></varlistentry>
7187 <varlistentry>
7188 <term><option>-x</option></term>
7189 <listitem>
7190 <para>
7191 <indexterm role="option">
7192 <primary><option>-x</option></primary>
7193 </indexterm>
7194 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7195 National Language Support extended characters in the body of the mail item</quote>).
7196 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7197 this option.
7198 </para>
7199 </listitem></varlistentry>
7200 <varlistentry>
7201 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7202 <listitem>
7203 <para>
7204 <indexterm role="option">
7205 <primary><option>-X</option></primary>
7206 </indexterm>
7207 This option is interpreted by Sendmail to cause debug information to be sent
7208 to the named file.  It is ignored by Exim.
7209 </para>
7210 </listitem></varlistentry>
7211 <varlistentry revisionflag="changed">
7212 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7213 <listitem>
7214 <para revisionflag="changed">
7215 <indexterm role="option">
7216 <primary><option>-z</option></primary>
7217 </indexterm>
7218 This option writes its argument to Exim&#x2019;s logfile.
7219 Use is restricted to administrators; the intent is for operational notes.
7220 Quotes should be used to maintain a multi-word item as a single argument,
7221 under most shells.
7222 </para>
7223 </listitem></varlistentry>
7224 </variablelist>
7225 <para>
7226 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7227 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7228 </para>
7229 <!-- === End of command line options === -->
7230 </section>
7231 </chapter>
7232
7233 <chapter id="CHAPconf">
7234 <title>The Exim run time configuration file</title>
7235 <titleabbrev>The runtime configuration file</titleabbrev>
7236 <para>
7237 <indexterm role="concept">
7238 <primary>run time configuration</primary>
7239 </indexterm>
7240 <indexterm role="concept">
7241 <primary>configuration file</primary>
7242 <secondary>general description</secondary>
7243 </indexterm>
7244 <indexterm role="concept">
7245 <primary>CONFIGURE_FILE</primary>
7246 </indexterm>
7247 <indexterm role="concept">
7248 <primary>configuration file</primary>
7249 <secondary>errors in</secondary>
7250 </indexterm>
7251 <indexterm role="concept">
7252 <primary>error</primary>
7253 <secondary>in configuration file</secondary>
7254 </indexterm>
7255 <indexterm role="concept">
7256 <primary>return code</primary>
7257 <secondary>for bad configuration</secondary>
7258 </indexterm>
7259 Exim uses a single run time configuration file that is read whenever an Exim
7260 binary is executed. Note that in normal operation, this happens frequently,
7261 because Exim is designed to operate in a distributed manner, without central
7262 control.
7263 </para>
7264 <para>
7265 If a syntax error is detected while reading the configuration file, Exim
7266 writes a message on the standard error, and exits with a non-zero return code.
7267 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7268 errors can be detected at this time. The values of any expanded options are
7269 not checked until the expansion happens, even when the expansion does not
7270 actually alter the string.
7271 </para>
7272 <para>
7273 The name of the configuration file is compiled into the binary for security
7274 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7275 most configurations, this specifies a single file. However, it is permitted to
7276 give a colon-separated list of file names, in which case Exim uses the first
7277 existing file in the list.
7278 </para>
7279 <para>
7280 <indexterm role="concept">
7281 <primary>EXIM_USER</primary>
7282 </indexterm>
7283 <indexterm role="concept">
7284 <primary>EXIM_GROUP</primary>
7285 </indexterm>
7286 <indexterm role="concept">
7287 <primary>CONFIGURE_OWNER</primary>
7288 </indexterm>
7289 <indexterm role="concept">
7290 <primary>CONFIGURE_GROUP</primary>
7291 </indexterm>
7292 <indexterm role="concept">
7293 <primary>configuration file</primary>
7294 <secondary>ownership</secondary>
7295 </indexterm>
7296 <indexterm role="concept">
7297 <primary>ownership</primary>
7298 <secondary>configuration file</secondary>
7299 </indexterm>
7300 The run time configuration file must be owned by root or by the user that is
7301 specified at compile time by the CONFIGURE_OWNER option (if set). The
7302 configuration file must not be world-writeable, or group-writeable unless its
7303 group is the root group or the one specified at compile time by the
7304 CONFIGURE_GROUP option.
7305 </para>
7306 <para>
7307 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7308 to root, anybody who is able to edit the run time configuration file has an
7309 easy way to run commands as root. If you specify a user or group in the
7310 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7311 who are members of that group will trivially be able to obtain root privileges.
7312 </para>
7313 <para>
7314 Up to Exim version 4.72, the run time configuration file was also permitted to
7315 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7316 since it offered a simple privilege escalation for any attacker who managed to
7317 compromise the Exim user account.
7318 </para>
7319 <para>
7320 A default configuration file, which will work correctly in simple situations,
7321 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7322 defines just one file name, the installation process copies the default
7323 configuration to a new file of that name if it did not previously exist. If
7324 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7325 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7326 configuration.
7327 </para>
7328 <section id="SECID40">
7329 <title>Using a different configuration file</title>
7330 <para>
7331 <indexterm role="concept">
7332 <primary>configuration file</primary>
7333 <secondary>alternate</secondary>
7334 </indexterm>
7335 A one-off alternate configuration can be specified by the <option>-C</option> command line
7336 option, which may specify a single file or a list of files. However, when
7337 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7338 unless the argument for <option>-C</option> is identical to the built-in value from
7339 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7340 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7341 is useful mainly for checking the syntax of configuration files before
7342 installing them. No owner or group checks are done on a configuration file
7343 specified by <option>-C</option>, if root privilege has been dropped.
7344 </para>
7345 <para>
7346 Even the Exim user is not trusted to specify an arbitrary configuration file
7347 with the <option>-C</option> option to be used with root privileges, unless that file is
7348 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7349 testing a configuration using <option>-C</option> right through message reception and
7350 delivery, even if the caller is root. The reception works, but by that time,
7351 Exim is running as the Exim user, so when it re-execs to regain privilege for
7352 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7353 can test reception and delivery using two separate commands (one to put a
7354 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7355 <option>-M</option>).
7356 </para>
7357 <para>
7358 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7359 prefix string with which any file named in a <option>-C</option> command line option must
7360 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7361 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7362 name can be used with <option>-C</option>.
7363 </para>
7364 <para>
7365 One-off changes to a configuration can be specified by the <option>-D</option> command line
7366 option, which defines and overrides values for macros used inside the
7367 configuration file. However, like <option>-C</option>, the use of this option by a
7368 non-privileged user causes Exim to discard its root privilege.
7369 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7370 completely disabled, and its use causes an immediate error exit.
7371 </para>
7372 <para>
7373 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7374 to declare certain macro names trusted, such that root privilege will not
7375 necessarily be discarded.
7376 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7377 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7378 values are acceptable, then Exim will not give up root privilege if the caller
7379 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7380 transition mechanism and is expected to be removed in the future.  Acceptable
7381 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7382 </para>
7383 <para>
7384 Some sites may wish to use the same Exim binary on different machines that
7385 share a file system, but to use different configuration files on each machine.
7386 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7387 looks for a file whose name is the configuration file name followed by a dot
7388 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7389 file does not exist, the standard name is tried. This processing occurs for
7390 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7391 </para>
7392 <para>
7393 In some esoteric situations different versions of Exim may be run under
7394 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7395 help with this. See the comments in <filename>src/EDITME</filename> for details.
7396 </para>
7397 </section>
7398 <section id="SECTconffilfor">
7399 <title>Configuration file format</title>
7400 <para>
7401 <indexterm role="concept">
7402 <primary>configuration file</primary>
7403 <secondary>format of</secondary>
7404 </indexterm>
7405 <indexterm role="concept">
7406 <primary>format</primary>
7407 <secondary>configuration file</secondary>
7408 </indexterm>
7409 Exim&#x2019;s configuration file is divided into a number of different parts. General
7410 option settings must always appear at the start of the file. The other parts
7411 are all optional, and may appear in any order. Each part other than the first
7412 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7413 optional parts are:
7414 </para>
7415 <itemizedlist>
7416 <listitem>
7417 <para>
7418 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7419 <xref linkend="CHAPACL"/>).
7420 </para>
7421 </listitem>
7422 <listitem>
7423 <para>
7424 <indexterm role="concept">
7425 <primary>AUTH</primary>
7426 <secondary>configuration</secondary>
7427 </indexterm>
7428 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7429 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7430 </para>
7431 </listitem>
7432 <listitem>
7433 <para>
7434 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7435 addresses and determine how the message is to be delivered (see chapters
7436 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7437 </para>
7438 </listitem>
7439 <listitem>
7440 <para>
7441 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7442 define mechanisms for copying messages to destinations (see chapters
7443 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7444 </para>
7445 </listitem>
7446 <listitem>
7447 <para>
7448 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7449 If there is no retry section, or if it is empty (that is, no retry rules are
7450 defined), Exim will not retry deliveries. In this situation, temporary errors
7451 are treated the same as permanent errors. Retry rules are discussed in chapter
7452 <xref linkend="CHAPretry"/>.
7453 </para>
7454 </listitem>
7455 <listitem>
7456 <para>
7457 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7458 when new addresses are generated during delivery. Rewriting is discussed in
7459 chapter <xref linkend="CHAPrewrite"/>.
7460 </para>
7461 </listitem>
7462 <listitem>
7463 <para>
7464 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7465 want to use this feature, you must set
7466 </para>
7467 <literallayout class="monospaced">
7468 LOCAL_SCAN_HAS_OPTIONS=yes
7469 </literallayout>
7470 <para>
7471 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7472 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7473 </para>
7474 </listitem>
7475 </itemizedlist>
7476 <para>
7477 <indexterm role="concept">
7478 <primary>configuration file</primary>
7479 <secondary>leading white space in</secondary>
7480 </indexterm>
7481 <indexterm role="concept">
7482 <primary>configuration file</primary>
7483 <secondary>trailing white space in</secondary>
7484 </indexterm>
7485 <indexterm role="concept">
7486 <primary>white space</primary>
7487 <secondary>in configuration file</secondary>
7488 </indexterm>
7489 Leading and trailing white space in configuration lines is always ignored.
7490 </para>
7491 <para>
7492 Blank lines in the file, and lines starting with a # character (ignoring
7493 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7494 # character other than at the beginning of a line is not treated specially,
7495 and does not introduce a comment.
7496 </para>
7497 <para>
7498 Any non-comment line can be continued by ending it with a backslash. Note that
7499 the general rule for white space means that trailing white space after the
7500 backslash and leading white space at the start of continuation
7501 lines is ignored. Comment lines beginning with # (but not empty lines) may
7502 appear in the middle of a sequence of continuation lines.
7503 </para>
7504 <para>
7505 A convenient way to create a configuration file is to start from the
7506 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7507 change settings as required.
7508 </para>
7509 <para>
7510 The ACLs, retry rules, and rewriting rules have their own syntax which is
7511 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7512 respectively. The other parts of the configuration file have some syntactic
7513 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7514 onwards. Before that, the inclusion, macro, and conditional facilities are
7515 described.
7516 </para>
7517 </section>
7518 <section id="SECID41">
7519 <title>File inclusions in the configuration file</title>
7520 <para>
7521 <indexterm role="concept">
7522 <primary>inclusions in configuration file</primary>
7523 </indexterm>
7524 <indexterm role="concept">
7525 <primary>configuration file</primary>
7526 <secondary>including other files</secondary>
7527 </indexterm>
7528 <indexterm role="concept">
7529 <primary><literal>.include</literal> in configuration file</primary>
7530 </indexterm>
7531 <indexterm role="concept">
7532 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7533 </indexterm>
7534 You can include other files inside Exim&#x2019;s run time configuration file by
7535 using this syntax:
7536 </para>
7537 <literallayout>
7538 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7539 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7540 </literallayout>
7541 <para>
7542 on a line by itself. Double quotes round the file name are optional. If you use
7543 the first form, a configuration error occurs if the file does not exist; the
7544 second form does nothing for non-existent files. In all cases, an absolute file
7545 name is required.
7546 </para>
7547 <para>
7548 Includes may be nested to any depth, but remember that Exim reads its
7549 configuration file often, so it is a good idea to keep them to a minimum.
7550 If you change the contents of an included file, you must HUP the daemon,
7551 because an included file is read only when the configuration itself is read.
7552 </para>
7553 <para>
7554 The processing of inclusions happens early, at a physical line level, so, like
7555 comment lines, an inclusion can be used in the middle of an option setting,
7556 for example:
7557 </para>
7558 <literallayout class="monospaced">
7559 hosts_lookup = a.b.c \
7560                .include /some/file
7561 </literallayout>
7562 <para>
7563 Include processing happens after macro processing (see below). Its effect is to
7564 process the lines of the included file as if they occurred inline where the
7565 inclusion appears.
7566 </para>
7567 </section>
7568 <section id="SECTmacrodefs">
7569 <title>Macros in the configuration file</title>
7570 <para>
7571 <indexterm role="concept">
7572 <primary>macro</primary>
7573 <secondary>description of</secondary>
7574 </indexterm>
7575 <indexterm role="concept">
7576 <primary>configuration file</primary>
7577 <secondary>macros</secondary>
7578 </indexterm>
7579 If a line in the main part of the configuration (that is, before the first
7580 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7581 definition, and must be of the form
7582 </para>
7583 <literallayout>
7584 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7585 </literallayout>
7586 <para>
7587 The name must consist of letters, digits, and underscores, and need not all be
7588 in upper case, though that is recommended. The rest of the line, including any
7589 continuations, is the replacement text, and has leading and trailing white
7590 space removed. Quotes are not removed. The replacement text can never end with
7591 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7592 </para>
7593 <para>
7594 Macros may also be defined between router, transport, authenticator, or ACL
7595 definitions. They may not, however, be defined within an individual driver or
7596 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7597 </para>
7598 </section>
7599 <section id="SECID42">
7600 <title>Macro substitution</title>
7601 <para>
7602 Once a macro is defined, all subsequent lines in the file (and any included
7603 files) are scanned for the macro name; if there are several macros, the line is
7604 scanned for each in turn, in the order in which the macros are defined. The
7605 replacement text is not re-scanned for the current macro, though it is scanned
7606 for subsequently defined macros. For this reason, a macro name may not contain
7607 the name of a previously defined macro as a substring. You could, for example,
7608 define
7609 </para>
7610 <literallayout>
7611 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7612 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7613 </literallayout>
7614 <para>
7615 but putting the definitions in the opposite order would provoke a configuration
7616 error. Macro expansion is applied to individual physical lines from the file,
7617 before checking for line continuation or file inclusion (see above). If a line
7618 consists solely of a macro name, and the expansion of the macro is empty, the
7619 line is ignored. A macro at the start of a line may turn the line into a
7620 comment line or a <literal>.include</literal> line.
7621 </para>
7622 </section>
7623 <section id="SECID43">
7624 <title>Redefining macros</title>
7625 <para>
7626 Once defined, the value of a macro can be redefined later in the configuration
7627 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7628 <emphasis>=</emphasis>. For example:
7629 </para>
7630 <literallayout class="monospaced">
7631 MAC =  initial value
7632 ...
7633 MAC == updated value
7634 </literallayout>
7635 <para>
7636 Redefinition does not alter the order in which the macros are applied to the
7637 subsequent lines of the configuration file. It is still the same order in which
7638 the macros were originally defined. All that changes is the macro&#x2019;s value.
7639 Redefinition makes it possible to accumulate values. For example:
7640 </para>
7641 <literallayout class="monospaced">
7642 MAC =  initial value
7643 ...
7644 MAC == MAC and something added
7645 </literallayout>
7646 <para>
7647 This can be helpful in situations where the configuration file is built
7648 from a number of other files.
7649 </para>
7650 </section>
7651 <section id="SECID44">
7652 <title>Overriding macro values</title>
7653 <para>
7654 The values set for macros in the configuration file can be overridden by the
7655 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7656 used, unless called by root or the Exim user. A definition on the command line
7657 using the <option>-D</option> option causes all definitions and redefinitions within the
7658 file to be ignored.
7659 </para>
7660 </section>
7661 <section id="SECID45">
7662 <title>Example of macro usage</title>
7663 <para>
7664 As an example of macro usage, consider a configuration where aliases are looked
7665 up in a MySQL database. It helps to keep the file less cluttered if long
7666 strings such as SQL statements are defined separately as macros, for example:
7667 </para>
7668 <literallayout class="monospaced">
7669 ALIAS_QUERY = select mailbox from user where \
7670               login='${quote_mysql:$local_part}';
7671 </literallayout>
7672 <para>
7673 This can then be used in a <command>redirect</command> router setting like this:
7674 </para>
7675 <literallayout class="monospaced">
7676 data = ${lookup mysql{ALIAS_QUERY}}
7677 </literallayout>
7678 <para>
7679 In earlier versions of Exim macros were sometimes used for domain, host, or
7680 address lists. In Exim 4 these are handled better by named lists &ndash; see
7681 section <xref linkend="SECTnamedlists"/>.
7682 </para>
7683 </section>
7684 <section id="SECID46">
7685 <title>Conditional skips in the configuration file</title>
7686 <para>
7687 <indexterm role="concept">
7688 <primary>configuration file</primary>
7689 <secondary>conditional skips</secondary>
7690 </indexterm>
7691 <indexterm role="concept">
7692 <primary><literal>.ifdef</literal></primary>
7693 </indexterm>
7694 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7695 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7696 portions of the configuration file. The processing happens whenever the file is
7697 read (that is, when an Exim binary starts to run).
7698 </para>
7699 <para>
7700 The implementation is very simple. Instances of the first four directives must
7701 be followed by text that includes the names of one or macros. The condition
7702 that is tested is whether or not any macro substitution has taken place in the
7703 line. Thus:
7704 </para>
7705 <literallayout class="monospaced">
7706 .ifdef AAA
7707 message_size_limit = 50M
7708 .else
7709 message_size_limit = 100M
7710 .endif
7711 </literallayout>
7712 <para>
7713 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7714 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7715 otherwise. If there is more than one macro named on the line, the condition
7716 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7717 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7718 </para>
7719 <para>
7720 Although you can use a macro expansion to generate one of these directives,
7721 it is not very useful, because the condition <quote>there was a macro substitution
7722 in this line</quote> will always be true.
7723 </para>
7724 <para>
7725 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7726 to clarify complicated nestings.
7727 </para>
7728 </section>
7729 <section id="SECTcos">
7730 <title>Common option syntax</title>
7731 <para>
7732 <indexterm role="concept">
7733 <primary>common option syntax</primary>
7734 </indexterm>
7735 <indexterm role="concept">
7736 <primary>syntax of common options</primary>
7737 </indexterm>
7738 <indexterm role="concept">
7739 <primary>configuration file</primary>
7740 <secondary>common option syntax</secondary>
7741 </indexterm>
7742 For the main set of options, driver options, and <function>local_scan()</function> options,
7743 each setting is on a line by itself, and starts with a name consisting of
7744 lower-case letters and underscores. Many options require a data value, and in
7745 these cases the name must be followed by an equals sign (with optional white
7746 space) and then the value. For example:
7747 </para>
7748 <literallayout class="monospaced">
7749 qualify_domain = mydomain.example.com
7750 </literallayout>
7751 <para>
7752 <indexterm role="concept">
7753 <primary>hiding configuration option values</primary>
7754 </indexterm>
7755 <indexterm role="concept">
7756 <primary>configuration options</primary>
7757 <secondary>hiding value of</secondary>
7758 </indexterm>
7759 <indexterm role="concept">
7760 <primary>options</primary>
7761 <secondary>hiding value of</secondary>
7762 </indexterm>
7763 Some option settings may contain sensitive data, for example, passwords for
7764 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7765 line option to read these values, you can precede the option settings with the
7766 word <quote>hide</quote>. For example:
7767 </para>
7768 <literallayout class="monospaced">
7769 hide mysql_servers = localhost/users/admin/secret-password
7770 </literallayout>
7771 <para>
7772 For non-admin users, such options are displayed like this:
7773 </para>
7774 <literallayout class="monospaced">
7775 mysql_servers = &lt;value not displayable&gt;
7776 </literallayout>
7777 <para>
7778 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7779 all instances of the same driver.
7780 </para>
7781 <para>
7782 The following sections describe the syntax used for the different data types
7783 that are found in option settings.
7784 </para>
7785 </section>
7786 <section id="SECID47">
7787 <title>Boolean options</title>
7788 <para>
7789 <indexterm role="concept">
7790 <primary>format</primary>
7791 <secondary>boolean</secondary>
7792 </indexterm>
7793 <indexterm role="concept">
7794 <primary>boolean configuration values</primary>
7795 </indexterm>
7796 <indexterm role="option">
7797 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7798 </indexterm>
7799 <indexterm role="option">
7800 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7801 </indexterm>
7802 Options whose type is given as boolean are on/off switches. There are two
7803 different ways of specifying such options: with and without a data value. If
7804 the option name is specified on its own without data, the switch is turned on;
7805 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7806 boolean options may be followed by an equals sign and one of the words
7807 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7808 the following two settings have exactly the same effect:
7809 </para>
7810 <literallayout class="monospaced">
7811 queue_only
7812 queue_only = true
7813 </literallayout>
7814 <para>
7815 The following two lines also have the same (opposite) effect:
7816 </para>
7817 <literallayout class="monospaced">
7818 no_queue_only
7819 queue_only = false
7820 </literallayout>
7821 <para>
7822 You can use whichever syntax you prefer.
7823 </para>
7824 </section>
7825 <section id="SECID48">
7826 <title>Integer values</title>
7827 <para>
7828 <indexterm role="concept">
7829 <primary>integer configuration values</primary>
7830 </indexterm>
7831 <indexterm role="concept">
7832 <primary>format</primary>
7833 <secondary>integer</secondary>
7834 </indexterm>
7835 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7836 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7837 number is assumed. Otherwise, it is treated as an octal number unless it starts
7838 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7839 hexadecimal number.
7840 </para>
7841 <para>
7842 If an integer value is followed by the letter K, it is multiplied by 1024; if
7843 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7844 of integer option settings are output, values which are an exact multiple of
7845 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7846 and M. The printing style is independent of the actual input format that was
7847 used.
7848 </para>
7849 </section>
7850 <section id="SECID49">
7851 <title>Octal integer values</title>
7852 <para>
7853 <indexterm role="concept">
7854 <primary>integer format</primary>
7855 </indexterm>
7856 <indexterm role="concept">
7857 <primary>format</primary>
7858 <secondary>octal integer</secondary>
7859 </indexterm>
7860 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7861 interpreted as an octal number, whether or not it starts with the digit zero.
7862 Such options are always output in octal.
7863 </para>
7864 </section>
7865 <section id="SECID50">
7866 <title>Fixed point numbers</title>
7867 <para>
7868 <indexterm role="concept">
7869 <primary>fixed point configuration values</primary>
7870 </indexterm>
7871 <indexterm role="concept">
7872 <primary>format</primary>
7873 <secondary>fixed point</secondary>
7874 </indexterm>
7875 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7876 integer, optionally followed by a decimal point and up to three further digits.
7877 </para>
7878 </section>
7879 <section id="SECTtimeformat">
7880 <title>Time intervals</title>
7881 <para>
7882 <indexterm role="concept">
7883 <primary>time interval</primary>
7884 <secondary>specifying in configuration</secondary>
7885 </indexterm>
7886 <indexterm role="concept">
7887 <primary>format</primary>
7888 <secondary>time interval</secondary>
7889 </indexterm>
7890 A time interval is specified as a sequence of numbers, each followed by one of
7891 the following letters, with no intervening white space:
7892 </para>
7893 <informaltable frame="none">
7894 <tgroup cols="2" colsep="0" rowsep="0">
7895 <colspec colwidth="30pt" align="left"/>
7896 <colspec colwidth="254pt" align="left"/>
7897 <tbody>
7898 <row>
7899 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7900 <entry>seconds</entry>
7901 </row>
7902 <row>
7903 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7904 <entry>minutes</entry>
7905 </row>
7906 <row>
7907 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7908 <entry>hours</entry>
7909 </row>
7910 <row>
7911 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7912 <entry>days</entry>
7913 </row>
7914 <row>
7915 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7916 <entry>weeks</entry>
7917 </row>
7918 </tbody>
7919 </tgroup>
7920 </informaltable>
7921 <para>
7922 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7923 intervals are output in the same format. Exim does not restrict the values; it
7924 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7925 </para>
7926 </section>
7927 <section id="SECTstrings">
7928 <title>String values</title>
7929 <para>
7930 <indexterm role="concept">
7931 <primary>string</primary>
7932 <secondary>format of configuration values</secondary>
7933 </indexterm>
7934 <indexterm role="concept">
7935 <primary>format</primary>
7936 <secondary>string</secondary>
7937 </indexterm>
7938 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7939 or without double-quotes. If it does not start with a double-quote, the value
7940 consists of the remainder of the line plus any continuation lines, starting at
7941 the first character after any leading white space, with trailing white space
7942 removed, and with no interpretation of the characters in the string. Because
7943 Exim removes comment lines (those beginning with #) at an early stage, they can
7944 appear in the middle of a multi-line string. The following two settings are
7945 therefore equivalent:
7946 </para>
7947 <literallayout class="monospaced">
7948 trusted_users = uucp:mail
7949 trusted_users = uucp:\
7950                 # This comment line is ignored
7951                 mail
7952 </literallayout>
7953 <para>
7954 <indexterm role="concept">
7955 <primary>string</primary>
7956 <secondary>quoted</secondary>
7957 </indexterm>
7958 <indexterm role="concept">
7959 <primary>escape characters in quoted strings</primary>
7960 </indexterm>
7961 If a string does start with a double-quote, it must end with a closing
7962 double-quote, and any backslash characters other than those used for line
7963 continuation are interpreted as escape characters, as follows:
7964 </para>
7965 <informaltable frame="none">
7966 <tgroup cols="2" colsep="0" rowsep="0">
7967 <colspec colwidth="100pt" align="left"/>
7968 <colspec colwidth="254pt" align="left"/>
7969 <tbody>
7970 <row>
7971 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7972 <entry>single backslash</entry>
7973 </row>
7974 <row>
7975 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7976 <entry>newline</entry>
7977 </row>
7978 <row>
7979 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7980 <entry>carriage return</entry>
7981 </row>
7982 <row>
7983 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7984 <entry>tab</entry>
7985 </row>
7986 <row>
7987 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7988 <entry>up to 3 octal digits specify one character</entry>
7989 </row>
7990 <row>
7991 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7992 <entry>up to 2 hexadecimal digits specify one character</entry>
7993 </row>
7994 </tbody>
7995 </tgroup>
7996 </informaltable>
7997 <para>
7998 If a backslash is followed by some other character, including a double-quote
7999 character, that character replaces the pair.
8000 </para>
8001 <para>
8002 Quoting is necessary only if you want to make use of the backslash escapes to
8003 insert special characters, or if you need to specify a value with leading or
8004 trailing spaces. These cases are rare, so quoting is almost never needed in
8005 current versions of Exim. In versions of Exim before 3.14, quoting was required
8006 in order to continue lines, so you may come across older configuration files
8007 and examples that apparently quote unnecessarily.
8008 </para>
8009 </section>
8010 <section id="SECID51">
8011 <title>Expanded strings</title>
8012 <para>
8013 <indexterm role="concept">
8014 <primary>expansion</primary>
8015 <secondary>definition of</secondary>
8016 </indexterm>
8017 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8018 by which means various parts of the string may be changed according to the
8019 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8020 is as just described; in particular, the handling of backslashes in quoted
8021 strings is done as part of the input process, before expansion takes place.
8022 However, backslash is also an escape character for the expander, so any
8023 backslashes that are required for that reason must be doubled if they are
8024 within a quoted configuration string.
8025 </para>
8026 </section>
8027 <section id="SECID52">
8028 <title>User and group names</title>
8029 <para>
8030 <indexterm role="concept">
8031 <primary>user name</primary>
8032 <secondary>format of</secondary>
8033 </indexterm>
8034 <indexterm role="concept">
8035 <primary>format</primary>
8036 <secondary>user name</secondary>
8037 </indexterm>
8038 <indexterm role="concept">
8039 <primary>groups</primary>
8040 <secondary>name format</secondary>
8041 </indexterm>
8042 <indexterm role="concept">
8043 <primary>format</primary>
8044 <secondary>group name</secondary>
8045 </indexterm>
8046 User and group names are specified as strings, using the syntax described
8047 above, but the strings are interpreted specially. A user or group name must
8048 either consist entirely of digits, or be a name that can be looked up using the
8049 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8050 </para>
8051 </section>
8052 <section id="SECTlistconstruct">
8053 <title>List construction</title>
8054 <para>
8055 <indexterm role="concept">
8056 <primary>list</primary>
8057 <secondary>syntax of in configuration</secondary>
8058 </indexterm>
8059 <indexterm role="concept">
8060 <primary>format</primary>
8061 <secondary>list item in configuration</secondary>
8062 </indexterm>
8063 <indexterm role="concept">
8064 <primary>string</primary>
8065 <secondary>list, definition of</secondary>
8066 </indexterm>
8067 The data for some configuration options is a list of items, with colon as the
8068 default separator. Many of these options are shown with type <quote>string list</quote> in
8069 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8070 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8071 are all the same; however, those other than <quote>string list</quote> are subject to
8072 particular kinds of interpretation, as described in chapter
8073 <xref linkend="CHAPdomhosaddlists"/>.
8074 </para>
8075 <para>
8076 In all these cases, the entire list is treated as a single string as far as the
8077 input syntax is concerned. The <option>trusted_users</option> setting in section
8078 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8079 in a list, it must be entered as two colons. Leading and trailing white space
8080 on each item in a list is ignored. This makes it possible to include items that
8081 start with a colon, and in particular, certain forms of IPv6 address. For
8082 example, the list
8083 </para>
8084 <literallayout class="monospaced">
8085 local_interfaces = 127.0.0.1 : ::::1
8086 </literallayout>
8087 <para>
8088 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8089 </para>
8090 <para>
8091 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8092 list items, it is not ignored when parsing the list. The space after the first
8093 colon in the example above is necessary. If it were not there, the list would
8094 be interpreted as the two items 127.0.0.1:: and 1.
8095 </para>
8096 </section>
8097 <section id="SECTlistsepchange">
8098 <title>Changing list separators</title>
8099 <para>
8100 <indexterm role="concept">
8101 <primary>list separator</primary>
8102 <secondary>changing</secondary>
8103 </indexterm>
8104 <indexterm role="concept">
8105 <primary>IPv6</primary>
8106 <secondary>addresses in lists</secondary>
8107 </indexterm>
8108 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8109 introduced to allow the separator character to be changed. If a list begins
8110 with a left angle bracket, followed by any punctuation character, that
8111 character is used instead of colon as the list separator. For example, the list
8112 above can be rewritten to use a semicolon separator like this:
8113 </para>
8114 <literallayout class="monospaced">
8115 local_interfaces = &lt;; 127.0.0.1 ; ::1
8116 </literallayout>
8117 <para>
8118 This facility applies to all lists, with the exception of the list in
8119 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8120 confined to circumstances where they really are needed.
8121 </para>
8122 <para>
8123 <indexterm role="concept">
8124 <primary>list separator</primary>
8125 <secondary>newline as</secondary>
8126 </indexterm>
8127 <indexterm role="concept">
8128 <primary>newline</primary>
8129 <secondary>as list separator</secondary>
8130 </indexterm>
8131 It is also possible to use newline and other control characters (those with
8132 code values less than 32, plus DEL) as separators in lists. Such separators
8133 must be provided literally at the time the list is processed. For options that
8134 are string-expanded, you can write the separator using a normal escape
8135 sequence. This will be processed by the expander before the string is
8136 interpreted as a list. For example, if a newline-separated list of domains is
8137 generated by a lookup, you can process it directly by a line such as this:
8138 </para>
8139 <literallayout class="monospaced">
8140 domains = &lt;\n ${lookup mysql{.....}}
8141 </literallayout>
8142 <para>
8143 This avoids having to change the list separator in such data. You are unlikely
8144 to want to use a control character as a separator in an option that is not
8145 expanded, because the value is literal text. However, it can be done by giving
8146 the value in quotes. For example:
8147 </para>
8148 <literallayout class="monospaced">
8149 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8150 </literallayout>
8151 <para>
8152 Unlike printing character separators, which can be included in list items by
8153 doubling, it is not possible to include a control character as data when it is
8154 set as the separator. Two such characters in succession are interpreted as
8155 enclosing an empty list item.
8156 </para>
8157 </section>
8158 <section id="SECTempitelis">
8159 <title>Empty items in lists</title>
8160 <para>
8161 <indexterm role="concept">
8162 <primary>list</primary>
8163 <secondary>empty item in</secondary>
8164 </indexterm>
8165 An empty item at the end of a list is always ignored. In other words, trailing
8166 separator characters are ignored. Thus, the list in
8167 </para>
8168 <literallayout class="monospaced">
8169 senders = user@domain :
8170 </literallayout>
8171 <para>
8172 contains only a single item. If you want to include an empty string as one item
8173 in a list, it must not be the last item. For example, this list contains three
8174 items, the second of which is empty:
8175 </para>
8176 <literallayout class="monospaced">
8177 senders = user1@domain : : user2@domain
8178 </literallayout>
8179 <para>
8180 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8181 are interpreted as representing a single colon data character (and the list
8182 would then contain just one item). If you want to specify a list that contains
8183 just one, empty item, you can do it as in this example:
8184 </para>
8185 <literallayout class="monospaced">
8186 senders = :
8187 </literallayout>
8188 <para>
8189 In this case, the first item is empty, and the second is discarded because it
8190 is at the end of the list.
8191 </para>
8192 </section>
8193 <section id="SECTfordricon">
8194 <title>Format of driver configurations</title>
8195 <para>
8196 <indexterm role="concept">
8197 <primary>drivers</primary>
8198 <secondary>configuration format</secondary>
8199 </indexterm>
8200 There are separate parts in the configuration for defining routers, transports,
8201 and authenticators. In each part, you are defining a number of driver
8202 instances, each with its own set of options. Each driver instance is defined by
8203 a sequence of lines like this:
8204 </para>
8205 <literallayout>
8206 &lt;<emphasis>instance name</emphasis>&gt;:
8207   &lt;<emphasis>option</emphasis>&gt;
8208   ...
8209   &lt;<emphasis>option</emphasis>&gt;
8210 </literallayout>
8211 <para>
8212 In the following example, the instance name is <command>localuser</command>, and it is
8213 followed by three options settings:
8214 </para>
8215 <literallayout class="monospaced">
8216 localuser:
8217   driver = accept
8218   check_local_user
8219   transport = local_delivery
8220 </literallayout>
8221 <para>
8222 For each driver instance, you specify which Exim code module it uses &ndash; by the
8223 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8224 settings. For example, in the case of transports, if you want a transport to
8225 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8226 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8227 described in detail in its own separate chapter later in this manual.
8228 </para>
8229 <para>
8230 You can have several routers, transports, or authenticators that are based on
8231 the same underlying driver (each must have a different instance name).
8232 </para>
8233 <para>
8234 The order in which routers are defined is important, because addresses are
8235 passed to individual routers one by one, in order. The order in which
8236 transports are defined does not matter at all. The order in which
8237 authenticators are defined is used only when Exim, as a client, is searching
8238 them to find one that matches an authentication mechanism offered by the
8239 server.
8240 </para>
8241 <para>
8242 <indexterm role="concept">
8243 <primary>generic options</primary>
8244 </indexterm>
8245 <indexterm role="concept">
8246 <primary>options</primary>
8247 <secondary>generic &ndash; definition of</secondary>
8248 </indexterm>
8249 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8250 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8251 same type (that is, all routers, all transports or all authenticators). The
8252 <option>driver</option> option is a generic option that must appear in every definition.
8253 <indexterm role="concept">
8254 <primary>private options</primary>
8255 </indexterm>
8256 The private options are special for each driver, and none need appear, because
8257 they all have default values.
8258 </para>
8259 <para>
8260 The options may appear in any order, except that the <option>driver</option> option must
8261 precede any private options, since these depend on the particular driver. For
8262 this reason, it is recommended that <option>driver</option> always be the first option.
8263 </para>
8264 <para>
8265 Driver instance names, which are used for reference in log entries and
8266 elsewhere, can be any sequence of letters, digits, and underscores (starting
8267 with a letter) and must be unique among drivers of the same type. A router and
8268 a transport (for example) can each have the same name, but no two router
8269 instances can have the same name. The name of a driver instance should not be
8270 confused with the name of the underlying driver module. For example, the
8271 configuration lines:
8272 </para>
8273 <literallayout class="monospaced">
8274 remote_smtp:
8275   driver = smtp
8276 </literallayout>
8277 <para>
8278 create an instance of the <command>smtp</command> transport driver whose name is
8279 <command>remote_smtp</command>. The same driver code can be used more than once, with
8280 different instance names and different option settings each time. A second
8281 instance of the <command>smtp</command> transport, with different options, might be defined
8282 thus:
8283 </para>
8284 <literallayout class="monospaced">
8285 special_smtp:
8286   driver = smtp
8287   port = 1234
8288   command_timeout = 10s
8289 </literallayout>
8290 <para>
8291 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8292 these transport instances from routers, and these names would appear in log
8293 lines.
8294 </para>
8295 <para>
8296 Comment lines may be present in the middle of driver specifications. The full
8297 list of option settings for any particular driver instance, including all the
8298 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8299 option.
8300 </para>
8301 </section>
8302 </chapter>
8303
8304 <chapter id="CHAPdefconfil">
8305 <title>The default configuration file</title>
8306 <para>
8307 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8308 <primary>configuration file</primary>
8309 <secondary>default <quote>walk through</quote></secondary>
8310 </indexterm>
8311 <indexterm role="concept">
8312 <primary>default</primary>
8313 <secondary>configuration file <quote>walk through</quote></secondary>
8314 </indexterm>
8315 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8316 is sufficient for a host with simple mail requirements. As an introduction to
8317 the way Exim is configured, this chapter <quote>walks through</quote> the default
8318 configuration, giving brief explanations of the settings. Detailed descriptions
8319 of the options are given in subsequent chapters. The default configuration file
8320 itself contains extensive comments about ways you might want to modify the
8321 initial settings. However, note that there are many options that are not
8322 mentioned at all in the default configuration.
8323 </para>
8324 <section id="SECTdefconfmain">
8325 <title>Main configuration settings</title>
8326 <para>
8327 The main (global) configuration option settings must always come first in the
8328 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8329 the line
8330 </para>
8331 <literallayout class="monospaced">
8332 # primary_hostname =
8333 </literallayout>
8334 <para>
8335 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8336 to know the official, fully qualified name of your host, and this is where you
8337 can specify it. However, in most cases you do not need to set this option. When
8338 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8339 </para>
8340 <para>
8341 The first three non-comment configuration lines are as follows:
8342 </para>
8343 <literallayout class="monospaced">
8344 domainlist local_domains    = @
8345 domainlist relay_to_domains =
8346 hostlist   relay_from_hosts = 127.0.0.1
8347 </literallayout>
8348 <para>
8349 These are not, in fact, option settings. They are definitions of two named
8350 domain lists and one named host list. Exim allows you to give names to lists of
8351 domains, hosts, and email addresses, in order to make it easier to manage the
8352 configuration file (see section <xref linkend="SECTnamedlists"/>).
8353 </para>
8354 <para>
8355 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8356 later in the configuration to identify domains that are to be delivered
8357 on the local host.
8358 </para>
8359 <para>
8360 <indexterm role="concept">
8361 <primary>@ in a domain list</primary>
8362 </indexterm>
8363 There is just one item in this list, the string <quote>@</quote>. This is a special form
8364 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8365 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8366 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8367 the same configuration file can be used on different hosts.
8368 </para>
8369 <para>
8370 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8371 list itself is empty. Later in the configuration we will come to the part that
8372 controls mail relaying through the local host; it allows relaying to any
8373 domains in this list. By default, therefore, no relaying on the basis of a mail
8374 domain is permitted.
8375 </para>
8376 <para>
8377 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8378 used later in the configuration to permit relaying from any host or IP address
8379 that matches the list. The default contains just the IP address of the IPv4
8380 loopback interface, which means that processes on the local host are able to
8381 submit mail for relaying by sending it over TCP/IP to that interface. No other
8382 hosts are permitted to submit messages for relaying.
8383 </para>
8384 <para>
8385 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8386 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8387 and hosts that will be used in the controls that are specified later.
8388 </para>
8389 <para>
8390 The next two configuration lines are genuine option settings:
8391 </para>
8392 <literallayout class="monospaced">
8393 acl_smtp_rcpt = acl_check_rcpt
8394 acl_smtp_data = acl_check_data
8395 </literallayout>
8396 <para>
8397 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8398 during an incoming SMTP session for every recipient of a message (every RCPT
8399 command), and after the contents of the message have been received,
8400 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8401 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8402 section of the configuration. The RCPT ACL controls which recipients are
8403 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8404 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8405 contents of a message to be checked.
8406 </para>
8407 <para>
8408 Two commented-out option settings are next:
8409 </para>
8410 <literallayout class="monospaced">
8411 # av_scanner = clamd:/tmp/clamd
8412 # spamd_address = 127.0.0.1 783
8413 </literallayout>
8414 <para>
8415 These are example settings that can be used when Exim is compiled with the
8416 content-scanning extension. The first specifies the interface to the virus
8417 scanner, and the second specifies the interface to SpamAssassin. Further
8418 details are given in chapter <xref linkend="CHAPexiscan"/>.
8419 </para>
8420 <para>
8421 Three more commented-out option settings follow:
8422 </para>
8423 <literallayout class="monospaced">
8424 # tls_advertise_hosts = *
8425 # tls_certificate = /etc/ssl/exim.crt
8426 # tls_privatekey = /etc/ssl/exim.pem
8427 </literallayout>
8428 <para>
8429 These are example settings that can be used when Exim is compiled with
8430 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8431 first one specifies the list of clients that are allowed to use TLS when
8432 connecting to this server; in this case the wildcard means all clients. The
8433 other options specify where Exim should find its TLS certificate and private
8434 key, which together prove the server&#x2019;s identity to any clients that connect.
8435 More details are given in chapter <xref linkend="CHAPTLS"/>.
8436 </para>
8437 <para>
8438 Another two commented-out option settings follow:
8439 </para>
8440 <literallayout class="monospaced">
8441 # daemon_smtp_ports = 25 : 465 : 587
8442 # tls_on_connect_ports = 465
8443 </literallayout>
8444 <para>
8445 <indexterm role="concept">
8446 <primary>port</primary>
8447 <secondary>465 and 587</secondary>
8448 </indexterm>
8449 <indexterm role="concept">
8450 <primary>port</primary>
8451 <secondary>for message submission</secondary>
8452 </indexterm>
8453 <indexterm role="concept">
8454 <primary>message</primary>
8455 <secondary>submission, ports for</secondary>
8456 </indexterm>
8457 <indexterm role="concept">
8458 <primary>ssmtp protocol</primary>
8459 </indexterm>
8460 <indexterm role="concept">
8461 <primary>smtps protocol</primary>
8462 </indexterm>
8463 <indexterm role="concept">
8464 <primary>SMTP</primary>
8465 <secondary>ssmtp protocol</secondary>
8466 </indexterm>
8467 <indexterm role="concept">
8468 <primary>SMTP</primary>
8469 <secondary>smtps protocol</secondary>
8470 </indexterm>
8471 These options provide better support for roaming users who wish to use this
8472 server for message submission. They are not much use unless you have turned on
8473 TLS (as described in the previous paragraph) and authentication (about which
8474 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8475 on end-user networks, so RFC 4409 specifies that message submission should use
8476 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8477 configured to use port 587 correctly, so these settings also enable the
8478 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8479 <xref linkend="SECTsupobssmt"/>).
8480 </para>
8481 <para>
8482 Two more commented-out options settings follow:
8483 </para>
8484 <literallayout class="monospaced">
8485 # qualify_domain =
8486 # qualify_recipient =
8487 </literallayout>
8488 <para>
8489 The first of these specifies a domain that Exim uses when it constructs a
8490 complete email address from a local login name. This is often needed when Exim
8491 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8492 the value of <option>primary_hostname</option> is used. If you set both of these options,
8493 you can have different qualification domains for sender and recipient
8494 addresses. If you set only the first one, its value is used in both cases.
8495 </para>
8496 <para>
8497 <indexterm role="concept">
8498 <primary>domain literal</primary>
8499 <secondary>recognizing format</secondary>
8500 </indexterm>
8501 The following line must be uncommented if you want Exim to recognize
8502 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8503 (an IP address within square brackets) instead of a named domain.
8504 </para>
8505 <literallayout class="monospaced">
8506 # allow_domain_literals
8507 </literallayout>
8508 <para>
8509 The RFCs still require this form, but many people think that in the modern
8510 Internet it makes little sense to permit mail to be sent to specific hosts by
8511 quoting their IP addresses. This ancient format has been used by people who
8512 try to abuse hosts by using them for unwanted relaying. However, some
8513 people believe there are circumstances (for example, messages addressed to
8514 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8515 </para>
8516 <para>
8517 The next configuration line is a kind of trigger guard:
8518 </para>
8519 <literallayout class="monospaced">
8520 never_users = root
8521 </literallayout>
8522 <para>
8523 It specifies that no delivery must ever be run as the root user. The normal
8524 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8525 setting is a guard against slips in the configuration.
8526 The list of users specified by <option>never_users</option> is not, however, the complete
8527 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8528 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8529 contents of <option>never_users</option> are added to this list. By default
8530 FIXED_NEVER_USERS also specifies root.
8531 </para>
8532 <para>
8533 When a remote host connects to Exim in order to send mail, the only information
8534 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8535 line,
8536 </para>
8537 <literallayout class="monospaced">
8538 host_lookup = *
8539 </literallayout>
8540 <para>
8541 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8542 in order to get a host name. This improves the quality of the logging
8543 information, but if you feel it is too expensive, you can remove it entirely,
8544 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8545 Note that it is not always possible to find a host name from an IP address,
8546 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8547 unreachable.
8548 </para>
8549 <para>
8550 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8551 1413 (hence their names):
8552 </para>
8553 <literallayout class="monospaced">
8554 rfc1413_hosts = *
8555 rfc1413_query_timeout = 0s
8556 </literallayout>
8557 <para>
8558 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8559 Few hosts offer RFC1413 service these days; calls have to be
8560 terminated by a timeout and this needlessly delays the startup
8561 of an incoming SMTP connection.
8562 If you have hosts for which you trust RFC1413 and need this
8563 information, you can change this.
8564 </para>
8565 <para>
8566 This line enables an efficiency SMTP option.  It is negotiated by clients
8567 and not expected to cause problems but can be disabled if needed.
8568 </para>
8569 <literallayout class="monospaced">
8570 prdr_enable = true
8571 </literallayout>
8572 <para>
8573 When Exim receives messages over SMTP connections, it expects all addresses to
8574 be fully qualified with a domain, as required by the SMTP definition. However,
8575 if you are running a server to which simple clients submit messages, you may
8576 find that they send unqualified addresses. The two commented-out options:
8577 </para>
8578 <literallayout class="monospaced">
8579 # sender_unqualified_hosts =
8580 # recipient_unqualified_hosts =
8581 </literallayout>
8582 <para>
8583 show how you can specify hosts that are permitted to send unqualified sender
8584 and recipient addresses, respectively.
8585 </para>
8586 <para revisionflag="changed">
8587 The <option>log_selector</option> option is used to increase the detail of logging
8588 over the default:
8589 </para>
8590 <literallayout class="monospaced" revisionflag="changed">
8591 log_selector = +smtp_protocol_error +smtp_syntax_error \
8592                +tls_certificate_verified
8593 </literallayout>
8594 <para>
8595 The <option>percent_hack_domains</option> option is also commented out:
8596 </para>
8597 <literallayout class="monospaced">
8598 # percent_hack_domains =
8599 </literallayout>
8600 <para>
8601 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8602 This is an almost obsolete form of explicit email routing. If you do not know
8603 anything about it, you can safely ignore this topic.
8604 </para>
8605 <para>
8606 The last two settings in the main part of the default configuration are
8607 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8608 message is frozen, Exim no longer continues to try to deliver it. Freezing
8609 occurs when a bounce message encounters a permanent failure because the sender
8610 address of the original message that caused the bounce is invalid, so the
8611 bounce cannot be delivered. This is probably the most common case, but there
8612 are also other conditions that cause freezing, and frozen messages are not
8613 always bounce messages.
8614 </para>
8615 <literallayout class="monospaced">
8616 ignore_bounce_errors_after = 2d
8617 timeout_frozen_after = 7d
8618 </literallayout>
8619 <para>
8620 The first of these options specifies that failing bounce messages are to be
8621 discarded after 2 days on the queue. The second specifies that any frozen
8622 message (whether a bounce message or not) is to be timed out (and discarded)
8623 after a week. In this configuration, the first setting ensures that no failing
8624 bounce message ever lasts a week.
8625 </para>
8626 </section>
8627 <section id="SECID54">
8628 <title>ACL configuration</title>
8629 <para>
8630 <indexterm role="concept">
8631 <primary>default</primary>
8632 <secondary>ACLs</secondary>
8633 </indexterm>
8634 <indexterm role="concept">
8635 <primary>access control lists (ACLs)</primary>
8636 <secondary>default configuration</secondary>
8637 </indexterm>
8638 In the default configuration, the ACL section follows the main configuration.
8639 It starts with the line
8640 </para>
8641 <literallayout class="monospaced">
8642 begin acl
8643 </literallayout>
8644 <para>
8645 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8646 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8647 and <option>acl_smtp_data</option> above.
8648 </para>
8649 <para>
8650 <indexterm role="concept">
8651 <primary>RCPT</primary>
8652 <secondary>ACL for</secondary>
8653 </indexterm>
8654 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8655 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8656 are considered in order, until the recipient address is either accepted or
8657 rejected. The RCPT command is then accepted or rejected, according to the
8658 result of the ACL processing.
8659 </para>
8660 <literallayout class="monospaced">
8661 acl_check_rcpt:
8662 </literallayout>
8663 <para>
8664 This line, consisting of a name terminated by a colon, marks the start of the
8665 ACL, and names it.
8666 </para>
8667 <literallayout class="monospaced">
8668 accept  hosts = :
8669 </literallayout>
8670 <para>
8671 This ACL statement accepts the recipient if the sending host matches the list.
8672 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8673 names or IP addresses. The presence of the colon puts an empty item in the
8674 list; Exim matches this only if the incoming message did not come from a remote
8675 host, because in that case, the remote hostname is empty. The colon is
8676 important. Without it, the list itself is empty, and can never match anything.
8677 </para>
8678 <para>
8679 What this statement is doing is to accept unconditionally all recipients in
8680 messages that are submitted by SMTP from local processes using the standard
8681 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8682 manner.
8683 </para>
8684 <literallayout class="monospaced">
8685 deny    message       = Restricted characters in address
8686         domains       = +local_domains
8687         local_parts   = ^[.] : ^.*[@%!/|]
8688
8689 deny    message       = Restricted characters in address
8690         domains       = !+local_domains
8691         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8692 </literallayout>
8693 <para>
8694 These statements are concerned with local parts that contain any of the
8695 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8696 Although these characters are entirely legal in local parts (in the case of
8697 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8698 in Internet mail addresses.
8699 </para>
8700 <para>
8701 The first three have in the past been associated with explicitly routed
8702 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8703 option). Addresses containing these characters are regularly tried by spammers
8704 in an attempt to bypass relaying restrictions, and also by open relay testing
8705 programs. Unless you really need them it is safest to reject these characters
8706 at this early stage. This configuration is heavy-handed in rejecting these
8707 characters for all messages it accepts from remote hosts. This is a deliberate
8708 policy of being as safe as possible.
8709 </para>
8710 <para>
8711 The first rule above is stricter, and is applied to messages that are addressed
8712 to one of the local domains handled by this host. This is implemented by the
8713 first condition, which restricts it to domains that are listed in the
8714 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8715 reference to a named list. In this configuration, there is just one domain in
8716 <emphasis>local_domains</emphasis>, but in general there may be many.
8717 </para>
8718 <para>
8719 The second condition on the first statement uses two regular expressions to
8720 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8721 or <quote>|</quote>. If you have local accounts that include these characters, you will
8722 have to modify this rule.
8723 </para>
8724 <para>
8725 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8726 allows them because they have been encountered in practice. (Consider the
8727 common convention of local parts constructed as
8728 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8729 the author of Exim, who has no second initial.) However, a local part starting
8730 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8731 file name (for example, for a mailing list). This is also true for local parts
8732 that contain slashes. A pipe symbol can also be troublesome if the local part
8733 is incorporated unthinkingly into a shell command line.
8734 </para>
8735 <para>
8736 The second rule above applies to all other domains, and is less strict. This
8737 allows your own users to send outgoing messages to sites that use slashes
8738 and vertical bars in their local parts. It blocks local parts that begin
8739 with a dot, slash, or vertical bar, but allows these characters within the
8740 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8741 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8742 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8743 </para>
8744 <literallayout class="monospaced">
8745 accept  local_parts   = postmaster
8746         domains       = +local_domains
8747 </literallayout>
8748 <para>
8749 This statement, which has two conditions, accepts an incoming address if the
8750 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8751 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8752 reference to a named list. In this configuration, there is just one domain in
8753 <emphasis>local_domains</emphasis>, but in general there may be many.
8754 </para>
8755 <para>
8756 The presence of this statement means that mail to postmaster is never blocked
8757 by any of the subsequent tests. This can be helpful while sorting out problems
8758 in cases where the subsequent tests are incorrectly denying access.
8759 </para>
8760 <literallayout class="monospaced">
8761 require verify        = sender
8762 </literallayout>
8763 <para>
8764 This statement requires the sender address to be verified before any subsequent
8765 ACL statement can be used. If verification fails, the incoming recipient
8766 address is refused. Verification consists of trying to route the address, to
8767 see if a bounce message could be delivered to it. In the case of remote
8768 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8769 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8770 discusses the details of address verification.
8771 </para>
8772 <literallayout class="monospaced">
8773 accept  hosts         = +relay_from_hosts
8774         control       = submission
8775 </literallayout>
8776 <para>
8777 This statement accepts the address if the message is coming from one of the
8778 hosts that are defined as being allowed to relay through this host. Recipient
8779 verification is omitted here, because in many cases the clients are dumb MUAs
8780 that do not cope well with SMTP error responses. For the same reason, the
8781 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8782 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8783 messages that are deficient in some way, for example, because they lack a
8784 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8785 probably add recipient verification here, and disable submission mode.
8786 </para>
8787 <literallayout class="monospaced">
8788 accept  authenticated = *
8789         control       = submission
8790 </literallayout>
8791 <para>
8792 This statement accepts the address if the client host has authenticated itself.
8793 Submission mode is again specified, on the grounds that such messages are most
8794 likely to come from MUAs. The default configuration does not define any
8795 authenticators, though it does include some nearly complete commented-out
8796 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8797 fact authenticate until you complete the authenticator definitions.
8798 </para>
8799 <literallayout class="monospaced">
8800 require message = relay not permitted
8801         domains = +local_domains : +relay_to_domains
8802 </literallayout>
8803 <para>
8804 This statement rejects the address if its domain is neither a local domain nor
8805 one of the domains for which this host is a relay.
8806 </para>
8807 <literallayout class="monospaced">
8808 require verify = recipient
8809 </literallayout>
8810 <para>
8811 This statement requires the recipient address to be verified; if verification
8812 fails, the address is rejected.
8813 </para>
8814 <literallayout class="monospaced">
8815 # deny    message     = rejected because $sender_host_address \
8816 #                       is in a black list at $dnslist_domain\n\
8817 #                       $dnslist_text
8818 #         dnslists    = black.list.example
8819 #
8820 # warn    dnslists    = black.list.example
8821 #         add_header  = X-Warning: $sender_host_address is in \
8822 #                       a black list at $dnslist_domain
8823 #         log_message = found in $dnslist_domain
8824 </literallayout>
8825 <para>
8826 These commented-out lines are examples of how you could configure Exim to check
8827 sending hosts against a DNS black list. The first statement rejects messages
8828 from blacklisted hosts, whereas the second just inserts a warning header
8829 line.
8830 </para>
8831 <literallayout class="monospaced">
8832 # require verify = csa
8833 </literallayout>
8834 <para>
8835 This commented-out line is an example of how you could turn on client SMTP
8836 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8837 records.
8838 </para>
8839 <literallayout class="monospaced">
8840 accept
8841 </literallayout>
8842 <para>
8843 The final statement in the first ACL unconditionally accepts any recipient
8844 address that has successfully passed all the previous tests.
8845 </para>
8846 <literallayout class="monospaced">
8847 acl_check_data:
8848 </literallayout>
8849 <para>
8850 This line marks the start of the second ACL, and names it. Most of the contents
8851 of this ACL are commented out:
8852 </para>
8853 <literallayout class="monospaced">
8854 # deny    malware   = *
8855 #         message   = This message contains a virus \
8856 #                     ($malware_name).
8857 </literallayout>
8858 <para>
8859 These lines are examples of how to arrange for messages to be scanned for
8860 viruses when Exim has been compiled with the content-scanning extension, and a
8861 suitable virus scanner is installed. If the message is found to contain a
8862 virus, it is rejected with the given custom error message.
8863 </para>
8864 <literallayout class="monospaced">
8865 # warn    spam      = nobody
8866 #         message   = X-Spam_score: $spam_score\n\
8867 #                     X-Spam_score_int: $spam_score_int\n\
8868 #                     X-Spam_bar: $spam_bar\n\
8869 #                     X-Spam_report: $spam_report
8870 </literallayout>
8871 <para>
8872 These lines are an example of how to arrange for messages to be scanned by
8873 SpamAssassin when Exim has been compiled with the content-scanning extension,
8874 and SpamAssassin has been installed. The SpamAssassin check is run with
8875 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8876 series of extra header line. In this case, the message is not rejected,
8877 whatever the spam score.
8878 </para>
8879 <literallayout class="monospaced">
8880 accept
8881 </literallayout>
8882 <para>
8883 This final line in the DATA ACL accepts the message unconditionally.
8884 </para>
8885 </section>
8886 <section id="SECID55">
8887 <title>Router configuration</title>
8888 <para>
8889 <indexterm role="concept">
8890 <primary>default</primary>
8891 <secondary>routers</secondary>
8892 </indexterm>
8893 <indexterm role="concept">
8894 <primary>routers</primary>
8895 <secondary>default</secondary>
8896 </indexterm>
8897 The router configuration comes next in the default configuration, introduced
8898 by the line
8899 </para>
8900 <literallayout class="monospaced">
8901 begin routers
8902 </literallayout>
8903 <para>
8904 Routers are the modules in Exim that make decisions about where to send
8905 messages. An address is passed to each router in turn, until it is either
8906 accepted, or failed. This means that the order in which you define the routers
8907 matters. Each router is fully described in its own chapter later in this
8908 manual. Here we give only brief overviews.
8909 </para>
8910 <literallayout class="monospaced">
8911 # domain_literal:
8912 #   driver = ipliteral
8913 #   domains = !+local_domains
8914 #   transport = remote_smtp
8915 </literallayout>
8916 <para>
8917 <indexterm role="concept">
8918 <primary>domain literal</primary>
8919 <secondary>default router</secondary>
8920 </indexterm>
8921 This router is commented out because the majority of sites do not want to
8922 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8923 you uncomment this router, you also need to uncomment the setting of
8924 <option>allow_domain_literals</option> in the main part of the configuration.
8925 </para>
8926 <literallayout class="monospaced">
8927 dnslookup:
8928   driver = dnslookup
8929   domains = ! +local_domains
8930   transport = remote_smtp
8931   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8932   no_more
8933 </literallayout>
8934 <para>
8935 The first uncommented router handles addresses that do not involve any local
8936 domains. This is specified by the line
8937 </para>
8938 <literallayout class="monospaced">
8939 domains = ! +local_domains
8940 </literallayout>
8941 <para>
8942 The <option>domains</option> option lists the domains to which this router applies, but the
8943 exclamation mark is a negation sign, so the router is used only for domains
8944 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8945 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8946 indicates that it is referring to a named list. Addresses in other domains are
8947 passed on to the following routers.
8948 </para>
8949 <para>
8950 The name of the router driver is <command>dnslookup</command>,
8951 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8952 the name of this router instance is the same as the name of the driver. The
8953 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8954 one of the driver modules that is in the Exim binary.
8955 </para>
8956 <para>
8957 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8958 DNS in order to obtain a list of hosts to which the address is routed. If the
8959 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8960 specified by the <option>transport</option> option. If the router does not find the domain
8961 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8962 the address fails and is bounced.
8963 </para>
8964 <para>
8965 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8966 be entirely ignored. This option is present because a number of cases have been
8967 encountered where MX records in the DNS point to host names
8968 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8969 Completely ignoring these IP addresses causes Exim to fail to route the
8970 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8971 continue to try to deliver the message periodically until the address timed
8972 out.
8973 </para>
8974 <literallayout class="monospaced">
8975 system_aliases:
8976   driver = redirect
8977   allow_fail
8978   allow_defer
8979   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8980 # user = exim
8981   file_transport = address_file
8982   pipe_transport = address_pipe
8983 </literallayout>
8984 <para>
8985 Control reaches this and subsequent routers only for addresses in the local
8986 domains. This router checks to see whether the local part is defined as an
8987 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8988 data that it looks up from that file. If no data is found for the local part,
8989 the value of the <option>data</option> option is empty, causing the address to be passed to
8990 the next router.
8991 </para>
8992 <para>
8993 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8994 often used. That is why it is referenced by from the default configuration
8995 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8996 <filename>Local/Makefile</filename> before building Exim.
8997 </para>
8998 <literallayout class="monospaced">
8999 userforward:
9000   driver = redirect
9001   check_local_user
9002 # local_part_suffix = +* : -*
9003 # local_part_suffix_optional
9004   file = $home/.forward
9005 # allow_filter
9006   no_verify
9007   no_expn
9008   check_ancestor
9009   file_transport = address_file
9010   pipe_transport = address_pipe
9011   reply_transport = address_reply
9012 </literallayout>
9013 <para>
9014 This is the most complicated router in the default configuration. It is another
9015 redirection router, but this time it is looking for forwarding data set up by
9016 individual users. The <option>check_local_user</option> setting specifies a check that the
9017 local part of the address is the login name of a local user. If it is not, the
9018 router is skipped. The two commented options that follow <option>check_local_user</option>,
9019 namely:
9020 </para>
9021 <literallayout class="monospaced">
9022 # local_part_suffix = +* : -*
9023 # local_part_suffix_optional
9024 </literallayout>
9025 <para>
9026 <indexterm role="variable">
9027 <primary><varname>$local_part_suffix</varname></primary>
9028 </indexterm>
9029 show how you can specify the recognition of local part suffixes. If the first
9030 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9031 by any sequence of characters, is removed from the local part and placed in the
9032 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9033 presence of a suffix in the local part is optional. When a suffix is present,
9034 the check for a local login uses the local part with the suffix removed.
9035 </para>
9036 <para>
9037 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9038 home directory is consulted. If it does not exist, or is empty, the router
9039 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9040 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9041 </para>
9042 <para>
9043 <indexterm role="concept">
9044 <primary>Sieve filter</primary>
9045 <secondary>enabling in default router</secondary>
9046 </indexterm>
9047 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9048 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9049 is commented out by default), the contents of the file are interpreted as a set
9050 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9051 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9052 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9053 </para>
9054 <para>
9055 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9056 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9057 There are two reasons for doing this:
9058 </para>
9059 <orderedlist numeration="arabic">
9060 <listitem>
9061 <para>
9062 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9063 checking an address for validity; it makes sense not to waste resources doing
9064 unnecessary work.
9065 </para>
9066 </listitem>
9067 <listitem>
9068 <para>
9069 More importantly, when Exim is verifying addresses or handling an EXPN
9070 command during an SMTP session, it is running as the Exim user, not as root.
9071 The group is the Exim group, and no additional groups are set up.
9072 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9073 this time.
9074 </para>
9075 </listitem>
9076 </orderedlist>
9077 <para>
9078 The setting of <option>check_ancestor</option> prevents the router from generating a new
9079 address that is the same as any previous address that was redirected. (This
9080 works round a problem concerning a bad interaction between aliasing and
9081 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9082 </para>
9083 <para>
9084 The final three option settings specify the transports that are to be used when
9085 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9086 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9087 </para>
9088 <literallayout class="monospaced">
9089 a.nother@elsewhere.example, /home/spqr/archive
9090 </literallayout>
9091 <para>
9092 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9093 transport.
9094 </para>
9095 <literallayout class="monospaced">
9096 localuser:
9097   driver = accept
9098   check_local_user
9099 # local_part_suffix = +* : -*
9100 # local_part_suffix_optional
9101   transport = local_delivery
9102 </literallayout>
9103 <para>
9104 The final router sets up delivery into local mailboxes, provided that the local
9105 part is the name of a local login, by accepting the address and assigning it to
9106 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9107 routers, so the address is bounced. The commented suffix settings fulfil the
9108 same purpose as they do for the <command>userforward</command> router.
9109 </para>
9110 </section>
9111 <section id="SECID56">
9112 <title>Transport configuration</title>
9113 <para>
9114 <indexterm role="concept">
9115 <primary>default</primary>
9116 <secondary>transports</secondary>
9117 </indexterm>
9118 <indexterm role="concept">
9119 <primary>transports</primary>
9120 <secondary>default</secondary>
9121 </indexterm>
9122 Transports define mechanisms for actually delivering messages. They operate
9123 only when referenced from routers, so the order in which they are defined does
9124 not matter. The transports section of the configuration starts with
9125 </para>
9126 <literallayout class="monospaced">
9127 begin transports
9128 </literallayout>
9129 <para>
9130 One remote transport and four local transports are defined.
9131 </para>
9132 <literallayout class="monospaced">
9133 remote_smtp:
9134   driver = smtp
9135   hosts_try_prdr = *
9136 </literallayout>
9137 <para>
9138 This transport is used for delivering messages over SMTP connections.
9139 The list of remote hosts comes from the router.
9140 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9141 It is negotiated between client and server
9142 and not expected to cause problems but can be disabled if needed.
9143 All other options are defaulted.
9144 </para>
9145 <literallayout class="monospaced">
9146 local_delivery:
9147   driver = appendfile
9148   file = /var/mail/$local_part
9149   delivery_date_add
9150   envelope_to_add
9151   return_path_add
9152 # group = mail
9153 # mode = 0660
9154 </literallayout>
9155 <para>
9156 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9157 traditional BSD mailbox format. By default it runs under the uid and gid of the
9158 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9159 directory. Some systems use the alternative approach of running mail deliveries
9160 under a particular group instead of using the sticky bit. The commented options
9161 show how this can be done.
9162 </para>
9163 <para>
9164 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9165 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9166 similarly-named options above.
9167 </para>
9168 <literallayout class="monospaced">
9169 address_pipe:
9170   driver = pipe
9171   return_output
9172 </literallayout>
9173 <para>
9174 This transport is used for handling deliveries to pipes that are generated by
9175 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9176 option specifies that any output generated by the pipe is to be returned to the
9177 sender.
9178 </para>
9179 <literallayout class="monospaced">
9180 address_file:
9181   driver = appendfile
9182   delivery_date_add
9183   envelope_to_add
9184   return_path_add
9185 </literallayout>
9186 <para>
9187 This transport is used for handling deliveries to files that are generated by
9188 redirection. The name of the file is not specified in this instance of
9189 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9190 </para>
9191 <literallayout class="monospaced">
9192 address_reply:
9193   driver = autoreply
9194 </literallayout>
9195 <para>
9196 This transport is used for handling automatic replies generated by users&#x2019;
9197 filter files.
9198 </para>
9199 </section>
9200 <section id="SECID57">
9201 <title>Default retry rule</title>
9202 <para>
9203 <indexterm role="concept">
9204 <primary>retry</primary>
9205 <secondary>default rule</secondary>
9206 </indexterm>
9207 <indexterm role="concept">
9208 <primary>default</primary>
9209 <secondary>retry rule</secondary>
9210 </indexterm>
9211 The retry section of the configuration file contains rules which affect the way
9212 Exim retries deliveries that cannot be completed at the first attempt. It is
9213 introduced by the line
9214 </para>
9215 <literallayout class="monospaced">
9216 begin retry
9217 </literallayout>
9218 <para>
9219 In the default configuration, there is just one rule, which applies to all
9220 errors:
9221 </para>
9222 <literallayout class="monospaced">
9223 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9224 </literallayout>
9225 <para>
9226 This causes any temporarily failing address to be retried every 15 minutes for
9227 2 hours, then at intervals starting at one hour and increasing by a factor of
9228 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9229 is not delivered after 4 days of temporary failure, it is bounced.
9230 </para>
9231 <para>
9232 If the retry section is removed from the configuration, or is empty (that is,
9233 if no retry rules are defined), Exim will not retry deliveries. This turns
9234 temporary errors into permanent errors.
9235 </para>
9236 </section>
9237 <section id="SECID58">
9238 <title>Rewriting configuration</title>
9239 <para>
9240 The rewriting section of the configuration, introduced by
9241 </para>
9242 <literallayout class="monospaced">
9243 begin rewrite
9244 </literallayout>
9245 <para>
9246 contains rules for rewriting addresses in messages as they arrive. There are no
9247 rewriting rules in the default configuration file.
9248 </para>
9249 </section>
9250 <section id="SECTdefconfauth">
9251 <title>Authenticators configuration</title>
9252 <para>
9253 <indexterm role="concept">
9254 <primary>AUTH</primary>
9255 <secondary>configuration</secondary>
9256 </indexterm>
9257 The authenticators section of the configuration, introduced by
9258 </para>
9259 <literallayout class="monospaced">
9260 begin authenticators
9261 </literallayout>
9262 <para>
9263 defines mechanisms for the use of the SMTP AUTH command. The default
9264 configuration file contains two commented-out example authenticators
9265 which support plaintext username/password authentication using the
9266 standard PLAIN mechanism and the traditional but non-standard LOGIN
9267 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9268 to support most MUA software.
9269 </para>
9270 <para>
9271 The example PLAIN authenticator looks like this:
9272 </para>
9273 <literallayout class="monospaced">
9274 #PLAIN:
9275 #  driver                  = plaintext
9276 #  server_set_id           = $auth2
9277 #  server_prompts          = :
9278 #  server_condition        = Authentication is not yet configured
9279 #  server_advertise_condition = ${if def:tls_in_cipher }
9280 </literallayout>
9281 <para>
9282 And the example LOGIN authenticator looks like this:
9283 </para>
9284 <literallayout class="monospaced">
9285 #LOGIN:
9286 #  driver                  = plaintext
9287 #  server_set_id           = $auth1
9288 #  server_prompts          = &lt;| Username: | Password:
9289 #  server_condition        = Authentication is not yet configured
9290 #  server_advertise_condition = ${if def:tls_in_cipher }
9291 </literallayout>
9292 <para>
9293 The <option>server_set_id</option> option makes Exim remember the authenticated username
9294 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9295 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9296 that it implements the details of the specific authentication mechanism,
9297 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9298 when Exim offers authentication to clients; in the examples, this is only
9299 when TLS or SSL has been started, so to enable the authenticators you also
9300 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9301 </para>
9302 <para>
9303 The <option>server_condition</option> setting defines how to verify that the username and
9304 password are correct. In the examples it just produces an error message.
9305 To make the authenticators work, you can use a string expansion
9306 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9307 </para>
9308 <para>
9309 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9310 usercode and password are in different positions.
9311 Chapter <xref linkend="CHAPplaintext"/> covers both.
9312 </para>
9313 <para>
9314 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9315 </para>
9316 </section>
9317 </chapter>
9318
9319 <chapter id="CHAPregexp">
9320 <title>Regular expressions</title>
9321 <para>
9322 <indexterm role="concept">
9323 <primary>regular expressions</primary>
9324 <secondary>library</secondary>
9325 </indexterm>
9326 <indexterm role="concept">
9327 <primary>PCRE</primary>
9328 </indexterm>
9329 Exim supports the use of regular expressions in many of its options. It
9330 uses the PCRE regular expression library; this provides regular expression
9331 matching that is compatible with Perl 5. The syntax and semantics of
9332 regular expressions is discussed in many Perl reference books, and also in
9333 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9334 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9335 </para>
9336 <para>
9337 The documentation for the syntax and semantics of the regular expressions that
9338 are supported by PCRE is included in the PCRE distribution, and no further
9339 description is included here. The PCRE functions are called from Exim using
9340 the default option settings (that is, with no PCRE options set), except that
9341 the PCRE_CASELESS option is set when the matching is required to be
9342 case-insensitive.
9343 </para>
9344 <para>
9345 In most cases, when a regular expression is required in an Exim configuration,
9346 it has to start with a circumflex, in order to distinguish it from plain text
9347 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9348 second item in the colon-separated list is a regular expression.
9349 </para>
9350 <literallayout class="monospaced">
9351 domains = a.b.c : ^\\d{3} : *.y.z : ...
9352 </literallayout>
9353 <para>
9354 The doubling of the backslash is required because of string expansion that
9355 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9356 of this issue, and a way of avoiding the need for doubling backslashes. The
9357 regular expression that is eventually used in this example contains just one
9358 backslash. The circumflex is included in the regular expression, and has the
9359 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9360 matched.
9361 </para>
9362 <para>
9363 There are, however, two cases where a circumflex is not required for the
9364 recognition of a regular expression: these are the <option>match</option> condition in a
9365 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9366 these cases, the relevant string is always treated as a regular expression; if
9367 it does not start with a circumflex, the expression is not anchored, and can
9368 match anywhere in the subject string.
9369 </para>
9370 <para>
9371 In all cases, if you want a regular expression to match at the end of a string,
9372 you must code the $ metacharacter to indicate this. For example:
9373 </para>
9374 <literallayout class="monospaced">
9375 domains = ^\\d{3}\\.example
9376 </literallayout>
9377 <para>
9378 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9379 You need to use:
9380 </para>
9381 <literallayout class="monospaced">
9382 domains = ^\\d{3}\\.example\$
9383 </literallayout>
9384 <para>
9385 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9386 $ is needed because string expansion also interprets dollar characters.
9387 </para>
9388 </chapter>
9389
9390 <chapter id="CHAPfdlookup">
9391 <title>File and database lookups</title>
9392 <para>
9393 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9394 <primary>file</primary>
9395 <secondary>lookups</secondary>
9396 </indexterm>
9397 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9398 <primary>database</primary>
9399 <secondary>lookups</secondary>
9400 </indexterm>
9401 <indexterm role="concept">
9402 <primary>lookup</primary>
9403 <secondary>description of</secondary>
9404 </indexterm>
9405 Exim can be configured to look up data in files or databases as it processes
9406 messages. Two different kinds of syntax are used:
9407 </para>
9408 <orderedlist numeration="arabic">
9409 <listitem>
9410 <para>
9411 A string that is to be expanded may contain explicit lookup requests. These
9412 cause parts of the string to be replaced by data that is obtained from the
9413 lookup. Lookups of this type are conditional expansion items. Different results
9414 can be defined for the cases of lookup success and failure. See chapter
9415 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9416 </para>
9417 </listitem>
9418 <listitem>
9419 <para>
9420 Lists of domains, hosts, and email addresses can contain lookup requests as a
9421 way of avoiding excessively long linear lists. In this case, the data that is
9422 returned by the lookup is often (but not always) discarded; whether the lookup
9423 succeeds or fails is what really counts. These kinds of list are described in
9424 chapter <xref linkend="CHAPdomhosaddlists"/>.
9425 </para>
9426 </listitem>
9427 </orderedlist>
9428 <para>
9429 String expansions, lists, and lookups interact with each other in such a way
9430 that there is no order in which to describe any one of them that does not
9431 involve references to the others. Each of these three chapters makes more sense
9432 if you have read the other two first. If you are reading this for the first
9433 time, be aware that some of it will make a lot more sense after you have read
9434 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9435 </para>
9436 <section id="SECID60">
9437 <title>Examples of different lookup syntax</title>
9438 <para>
9439 It is easy to confuse the two different kinds of lookup, especially as the
9440 lists that may contain the second kind are always expanded before being
9441 processed as lists. Therefore, they may also contain lookups of the first kind.
9442 Be careful to distinguish between the following two examples:
9443 </para>
9444 <literallayout class="monospaced">
9445 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9446 domains = lsearch;/some/file
9447 </literallayout>
9448 <para>
9449 The first uses a string expansion, the result of which must be a domain list.
9450 No strings have been specified for a successful or a failing lookup; the
9451 defaults in this case are the looked-up data and an empty string, respectively.
9452 The expansion takes place before the string is processed as a list, and the
9453 file that is searched could contain lines like this:
9454 </para>
9455 <literallayout class="monospaced">
9456 192.168.3.4: domain1:domain2:...
9457 192.168.1.9: domain3:domain4:...
9458 </literallayout>
9459 <para>
9460 When the lookup succeeds, the result of the expansion is a list of domains (and
9461 possibly other types of item that are allowed in domain lists).
9462 </para>
9463 <para>
9464 In the second example, the lookup is a single item in a domain list. It causes
9465 Exim to use a lookup to see if the domain that is being processed can be found
9466 in the file. The file could contains lines like this:
9467 </para>
9468 <literallayout class="monospaced">
9469 domain1:
9470 domain2:
9471 </literallayout>
9472 <para>
9473 Any data that follows the keys is not relevant when checking that the domain
9474 matches the list item.
9475 </para>
9476 <para>
9477 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9478 Consider a file containing lines like this:
9479 </para>
9480 <literallayout class="monospaced">
9481 192.168.5.6: lsearch;/another/file
9482 </literallayout>
9483 <para>
9484 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9485 first <option>domains</option> setting above generates the second setting, which therefore
9486 causes a second lookup to occur.
9487 </para>
9488 <para>
9489 The rest of this chapter describes the different lookup types that are
9490 available. Any of them can be used in any part of the configuration where a
9491 lookup is permitted.
9492 </para>
9493 </section>
9494 <section id="SECID61">
9495 <title>Lookup types</title>
9496 <para>
9497 <indexterm role="concept">
9498 <primary>lookup</primary>
9499 <secondary>types of</secondary>
9500 </indexterm>
9501 <indexterm role="concept">
9502 <primary>single-key lookup</primary>
9503 <secondary>definition of</secondary>
9504 </indexterm>
9505 Two different types of data lookup are implemented:
9506 </para>
9507 <itemizedlist>
9508 <listitem>
9509 <para>
9510 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9511 and a single key to search for. The key must be a non-empty string for the
9512 lookup to succeed. The lookup type determines how the file is searched.
9513 </para>
9514 </listitem>
9515 <listitem>
9516 <para>
9517 <indexterm role="concept">
9518 <primary>query-style lookup</primary>
9519 <secondary>definition of</secondary>
9520 </indexterm>
9521 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9522 key value is assumed by Exim for query-style lookups. You can use whichever
9523 Exim variables you need to construct the database query.
9524 </para>
9525 </listitem>
9526 </itemizedlist>
9527 <para>
9528 The code for each lookup type is in a separate source file that is included in
9529 the binary of Exim only if the corresponding compile-time option is set. The
9530 default settings in <filename>src/EDITME</filename> are:
9531 </para>
9532 <literallayout class="monospaced">
9533 LOOKUP_DBM=yes
9534 LOOKUP_LSEARCH=yes
9535 </literallayout>
9536 <para>
9537 which means that only linear searching and DBM lookups are included by default.
9538 For some types of lookup (e.g. SQL databases), you need to install appropriate
9539 libraries and header files before building Exim.
9540 </para>
9541 </section>
9542 <section id="SECTsinglekeylookups">
9543 <title>Single-key lookup types</title>
9544 <para>
9545 <indexterm role="concept">
9546 <primary>lookup</primary>
9547 <secondary>single-key types</secondary>
9548 </indexterm>
9549 <indexterm role="concept">
9550 <primary>single-key lookup</primary>
9551 <secondary>list of types</secondary>
9552 </indexterm>
9553 The following single-key lookup types are implemented:
9554 </para>
9555 <itemizedlist>
9556 <listitem>
9557 <para>
9558 <indexterm role="concept">
9559 <primary>cdb</primary>
9560 <secondary>description of</secondary>
9561 </indexterm>
9562 <indexterm role="concept">
9563 <primary>lookup</primary>
9564 <secondary>cdb</secondary>
9565 </indexterm>
9566 <indexterm role="concept">
9567 <primary>binary zero</primary>
9568 <secondary>in lookup key</secondary>
9569 </indexterm>
9570 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9571 string without a terminating binary zero. The cdb format is designed for
9572 indexed files that are read frequently and never updated, except by total
9573 re-creation. As such, it is particularly suitable for large files containing
9574 aliases or other indexed data referenced by an MTA. Information about cdb can
9575 be found in several places:
9576 </para>
9577 <literallayout>
9578 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9579 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9580 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9581 </literallayout>
9582 <para>
9583 A cdb distribution is not needed in order to build Exim with cdb support,
9584 because the code for reading cdb files is included directly in Exim itself.
9585 However, no means of building or testing cdb files is provided with Exim, so
9586 you need to obtain a cdb distribution in order to do this.
9587 </para>
9588 </listitem>
9589 <listitem>
9590 <para>
9591 <indexterm role="concept">
9592 <primary>DBM</primary>
9593 <secondary>lookup type</secondary>
9594 </indexterm>
9595 <indexterm role="concept">
9596 <primary>lookup</primary>
9597 <secondary>dbm</secondary>
9598 </indexterm>
9599 <indexterm role="concept">
9600 <primary>binary zero</primary>
9601 <secondary>in lookup key</secondary>
9602 </indexterm>
9603 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9604 DBM file by looking up the record with the given key. A terminating binary
9605 zero is included in the key that is passed to the DBM library. See section
9606 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9607 </para>
9608 <para>
9609 <indexterm role="concept">
9610 <primary>Berkeley DB library</primary>
9611 <secondary>file format</secondary>
9612 </indexterm>
9613 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9614 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9615 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9616 the DB_UNKNOWN option. This enables it to handle any of the types of database
9617 that the library supports, and can be useful for accessing DBM files created by
9618 other applications. (For earlier DB versions, DB_HASH is always used.)
9619 </para>
9620 </listitem>
9621 <listitem>
9622 <para>
9623 <indexterm role="concept">
9624 <primary>lookup</primary>
9625 <secondary>dbmjz</secondary>
9626 </indexterm>
9627 <indexterm role="concept">
9628 <primary>lookup</primary>
9629 <secondary>dbm &ndash; embedded NULs</secondary>
9630 </indexterm>
9631 <indexterm role="concept">
9632 <primary>sasldb2</primary>
9633 </indexterm>
9634 <indexterm role="concept">
9635 <primary>dbmjz lookup type</primary>
9636 </indexterm>
9637 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9638 interpreted as an Exim list; the elements of the list are joined together with
9639 ASCII NUL characters to form the lookup key.  An example usage would be to
9640 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9641 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9642 <command>cram_md5</command> authenticator.
9643 </para>
9644 </listitem>
9645 <listitem>
9646 <para>
9647 <indexterm role="concept">
9648 <primary>lookup</primary>
9649 <secondary>dbmnz</secondary>
9650 </indexterm>
9651 <indexterm role="concept">
9652 <primary>lookup</primary>
9653 <secondary>dbm &ndash; terminating zero</secondary>
9654 </indexterm>
9655 <indexterm role="concept">
9656 <primary>binary zero</primary>
9657 <secondary>in lookup key</secondary>
9658 </indexterm>
9659 <indexterm role="concept">
9660 <primary>Courier</primary>
9661 </indexterm>
9662 <indexterm role="concept">
9663 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9664 </indexterm>
9665 <indexterm role="concept">
9666 <primary>dbmnz lookup type</primary>
9667 </indexterm>
9668 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9669 is not included in the key that is passed to the DBM library. You may need this
9670 if you want to look up data in files that are created by or shared with some
9671 other application that does not use terminating zeros. For example, you need to
9672 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9673 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9674 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9675 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9676 </para>
9677 </listitem>
9678 <listitem>
9679 <para>
9680 <indexterm role="concept">
9681 <primary>lookup</primary>
9682 <secondary>dsearch</secondary>
9683 </indexterm>
9684 <indexterm role="concept">
9685 <primary>dsearch lookup type</primary>
9686 </indexterm>
9687 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9688 whose name is the key by calling the <function>lstat()</function> function. The key may not
9689 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9690 the lookup is the name of the entry, which may be a file, directory,
9691 symbolic link, or any other kind of directory entry. An example of how this
9692 lookup can be used to support virtual domains is given in section
9693 <xref linkend="SECTvirtualdomains"/>.
9694 </para>
9695 </listitem>
9696 <listitem>
9697 <para>
9698 <indexterm role="concept">
9699 <primary>lookup</primary>
9700 <secondary>iplsearch</secondary>
9701 </indexterm>
9702 <indexterm role="concept">
9703 <primary>iplsearch lookup type</primary>
9704 </indexterm>
9705 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9706 terminated by a colon or white space or the end of the line. The keys in the
9707 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9708 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9709 being interpreted as a key terminator. For example:
9710 </para>
9711 <literallayout class="monospaced">
9712 1.2.3.4:           data for 1.2.3.4
9713 192.168.0.0/16:    data for 192.168.0.0/16
9714 "abcd::cdab":      data for abcd::cdab
9715 "abcd:abcd::/32"   data for abcd:abcd::/32
9716 </literallayout>
9717 <para>
9718 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9719 file is searched linearly, using the CIDR masks where present, until a matching
9720 key is found. The first key that matches is used; there is no attempt to find a
9721 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9722 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9723 </para>
9724 <para>
9725 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9726 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9727 lookup types support only literal keys.
9728 </para>
9729 <para>
9730 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9731 the implicit key is the host&#x2019;s IP address rather than its name (see section
9732 <xref linkend="SECThoslispatsikey"/>).
9733 </para>
9734 </listitem>
9735 <listitem>
9736 <para>
9737 <indexterm role="concept">
9738 <primary>linear search</primary>
9739 </indexterm>
9740 <indexterm role="concept">
9741 <primary>lookup</primary>
9742 <secondary>lsearch</secondary>
9743 </indexterm>
9744 <indexterm role="concept">
9745 <primary>lsearch lookup type</primary>
9746 </indexterm>
9747 <indexterm role="concept">
9748 <primary>case sensitivity</primary>
9749 <secondary>in lsearch lookup</secondary>
9750 </indexterm>
9751 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9752 line beginning with the search key, terminated by a colon or white space or the
9753 end of the line. The search is case-insensitive; that is, upper and lower case
9754 letters are treated as the same. The first occurrence of the key that is found
9755 in the file is used.
9756 </para>
9757 <para>
9758 White space between the key and the colon is permitted. The remainder of the
9759 line, with leading and trailing white space removed, is the data. This can be
9760 continued onto subsequent lines by starting them with any amount of white
9761 space, but only a single space character is included in the data at such a
9762 junction. If the data begins with a colon, the key must be terminated by a
9763 colon, for example:
9764 </para>
9765 <literallayout class="monospaced">
9766 baduser:  :fail:
9767 </literallayout>
9768 <para>
9769 Empty lines and lines beginning with # are ignored, even if they occur in the
9770 middle of an item. This is the traditional textual format of alias files. Note
9771 that the keys in an <command>lsearch</command> file are literal strings. There is no
9772 wildcarding of any kind.
9773 </para>
9774 <para>
9775 <indexterm role="concept">
9776 <primary>lookup</primary>
9777 <secondary>lsearch &ndash; colons in keys</secondary>
9778 </indexterm>
9779 <indexterm role="concept">
9780 <primary>white space</primary>
9781 <secondary>in lsearch key</secondary>
9782 </indexterm>
9783 In most <command>lsearch</command> files, keys are not required to contain colons or #
9784 characters, or white space. However, if you need this feature, it is available.
9785 If a key begins with a doublequote character, it is terminated only by a
9786 matching quote (or end of line), and the normal escaping rules apply to its
9787 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9788 quoted keys (exactly as for unquoted keys). There is no special handling of
9789 quotes for the data part of an <command>lsearch</command> line.
9790 </para>
9791 </listitem>
9792 <listitem>
9793 <para>
9794 <indexterm role="concept">
9795 <primary>NIS lookup type</primary>
9796 </indexterm>
9797 <indexterm role="concept">
9798 <primary>lookup</primary>
9799 <secondary>NIS</secondary>
9800 </indexterm>
9801 <indexterm role="concept">
9802 <primary>binary zero</primary>
9803 <secondary>in lookup key</secondary>
9804 </indexterm>
9805 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9806 the given key, without a terminating binary zero. There is a variant called
9807 <command>nis0</command> which does include the terminating binary zero in the key. This is
9808 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9809 aliases; the full map names must be used.
9810 </para>
9811 </listitem>
9812 <listitem>
9813 <para>
9814 <indexterm role="concept">
9815 <primary>wildlsearch lookup type</primary>
9816 </indexterm>
9817 <indexterm role="concept">
9818 <primary>lookup</primary>
9819 <secondary>wildlsearch</secondary>
9820 </indexterm>
9821 <indexterm role="concept">
9822 <primary>nwildlsearch lookup type</primary>
9823 </indexterm>
9824 <indexterm role="concept">
9825 <primary>lookup</primary>
9826 <secondary>nwildlsearch</secondary>
9827 </indexterm>
9828 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9829 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9830 the file may be wildcarded. The difference between these two lookup types is
9831 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9832 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9833 </para>
9834 <para>
9835 <indexterm role="concept">
9836 <primary>case sensitivity</primary>
9837 <secondary>in (n)wildlsearch lookup</secondary>
9838 </indexterm>
9839 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9840 file that are regular expressions can be made case-sensitive by the use of
9841 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9842 </para>
9843 <orderedlist numeration="arabic">
9844 <listitem>
9845 <para>
9846 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9847 </para>
9848 <literallayout class="monospaced">
9849     *.a.b.c       data for anything.a.b.c
9850     *fish         data for anythingfish
9851 </literallayout>
9852 </listitem>
9853 <listitem>
9854 <para>
9855 The string may begin with a circumflex to indicate a regular expression. For
9856 example, for <command>wildlsearch</command>:
9857 </para>
9858 <literallayout class="monospaced">
9859     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9860 </literallayout>
9861 <para>
9862 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9863 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9864 string-expanded, the equivalent entry is:
9865 </para>
9866 <literallayout class="monospaced">
9867     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9868 </literallayout>
9869 <para>
9870 The case-insensitive flag is set at the start of compiling the regular
9871 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9872 For example, to make the entire pattern case-sensitive:
9873 </para>
9874 <literallayout class="monospaced">
9875     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9876 </literallayout>
9877 <para>
9878 If the regular expression contains white space or colon characters, you must
9879 either quote it (see <command>lsearch</command> above), or represent these characters in other
9880 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9881 colon. This may be easier than quoting, because if you quote, you have to
9882 escape all the backslashes inside the quotes.
9883 </para>
9884 <para>
9885 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9886 match for later use, because the results of all lookups are cached. If a lookup
9887 is repeated, the result is taken from the cache, and no actual pattern matching
9888 takes place. The values of all the numeric variables are unset after a
9889 <command>(n)wildlsearch</command> match.
9890 </para>
9891 </listitem>
9892 <listitem>
9893 <para>
9894 Although I cannot see it being of much use, the general matching function that
9895 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9896 lookup name terminated by a semicolon, and followed by lookup data. For
9897 example:
9898 </para>
9899 <literallayout class="monospaced">
9900     cdb;/some/file  data for keys that match the file
9901 </literallayout>
9902 <para>
9903 The data that is obtained from the nested lookup is discarded.
9904 </para>
9905 </listitem>
9906 </orderedlist>
9907 <para>
9908 Keys that do not match any of these patterns are interpreted literally. The
9909 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9910 be followed by optional colons.
9911 </para>
9912 <para>
9913 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9914 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9915 lookup types support only literal keys.
9916 </para>
9917 </listitem>
9918 </itemizedlist>
9919 </section>
9920 <section id="SECID62">
9921 <title>Query-style lookup types</title>
9922 <para>
9923 <indexterm role="concept">
9924 <primary>lookup</primary>
9925 <secondary>query-style types</secondary>
9926 </indexterm>
9927 <indexterm role="concept">
9928 <primary>query-style lookup</primary>
9929 <secondary>list of types</secondary>
9930 </indexterm>
9931 The supported query-style lookup types are listed below. Further details about
9932 many of them are given in later sections.
9933 </para>
9934 <itemizedlist>
9935 <listitem>
9936 <para>
9937 <indexterm role="concept">
9938 <primary>DNS</primary>
9939 <secondary>as a lookup type</secondary>
9940 </indexterm>
9941 <indexterm role="concept">
9942 <primary>lookup</primary>
9943 <secondary>DNS</secondary>
9944 </indexterm>
9945 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9946 are given in the supplied query. The resulting data is the contents of the
9947 records. See section <xref linkend="SECTdnsdb"/>.
9948 </para>
9949 </listitem>
9950 <listitem>
9951 <para>
9952 <indexterm role="concept">
9953 <primary>InterBase lookup type</primary>
9954 </indexterm>
9955 <indexterm role="concept">
9956 <primary>lookup</primary>
9957 <secondary>InterBase</secondary>
9958 </indexterm>
9959 <command>ibase</command>: This does a lookup in an InterBase database.
9960 </para>
9961 </listitem>
9962 <listitem>
9963 <para>
9964 <indexterm role="concept">
9965 <primary>LDAP</primary>
9966 <secondary>lookup type</secondary>
9967 </indexterm>
9968 <indexterm role="concept">
9969 <primary>lookup</primary>
9970 <secondary>LDAP</secondary>
9971 </indexterm>
9972 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9973 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9974 that permits values from multiple entries to be returned. A third variant
9975 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9976 any attribute values. See section <xref linkend="SECTldap"/>.
9977 </para>
9978 </listitem>
9979 <listitem>
9980 <para>
9981 <indexterm role="concept">
9982 <primary>MySQL</primary>
9983 <secondary>lookup type</secondary>
9984 </indexterm>
9985 <indexterm role="concept">
9986 <primary>lookup</primary>
9987 <secondary>MySQL</secondary>
9988 </indexterm>
9989 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9990 MySQL database. See section <xref linkend="SECTsql"/>.
9991 </para>
9992 </listitem>
9993 <listitem>
9994 <para>
9995 <indexterm role="concept">
9996 <primary>NIS+ lookup type</primary>
9997 </indexterm>
9998 <indexterm role="concept">
9999 <primary>lookup</primary>
10000 <secondary>NIS+</secondary>
10001 </indexterm>
10002 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10003 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10004 </para>
10005 </listitem>
10006 <listitem>
10007 <para>
10008 <indexterm role="concept">
10009 <primary>Oracle</primary>
10010 <secondary>lookup type</secondary>
10011 </indexterm>
10012 <indexterm role="concept">
10013 <primary>lookup</primary>
10014 <secondary>Oracle</secondary>
10015 </indexterm>
10016 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10017 Oracle database. See section <xref linkend="SECTsql"/>.
10018 </para>
10019 </listitem>
10020 <listitem>
10021 <para>
10022 <indexterm role="concept">
10023 <primary>lookup</primary>
10024 <secondary>passwd</secondary>
10025 </indexterm>
10026 <indexterm role="concept">
10027 <primary>passwd lookup type</primary>
10028 </indexterm>
10029 <indexterm role="concept">
10030 <primary><filename>/etc/passwd</filename></primary>
10031 </indexterm>
10032 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10033 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10034 success, the result string is the same as you would get from an <command>lsearch</command>
10035 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10036 password value. For example:
10037 </para>
10038 <literallayout class="monospaced">
10039 *:42:42:King Rat:/home/kr:/bin/bash
10040 </literallayout>
10041 </listitem>
10042 <listitem>
10043 <para>
10044 <indexterm role="concept">
10045 <primary>PostgreSQL lookup type</primary>
10046 </indexterm>
10047 <indexterm role="concept">
10048 <primary>lookup</primary>
10049 <secondary>PostgreSQL</secondary>
10050 </indexterm>
10051 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10052 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10053 </para>
10054 </listitem>
10055 <listitem>
10056 <para>
10057 <indexterm role="concept">
10058 <primary>sqlite lookup type</primary>
10059 </indexterm>
10060 <indexterm role="concept">
10061 <primary>lookup</primary>
10062 <secondary>sqlite</secondary>
10063 </indexterm>
10064 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10065 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10066 </para>
10067 </listitem>
10068 <listitem>
10069 <para>
10070 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10071 not likely to be useful in normal operation.
10072 </para>
10073 </listitem>
10074 <listitem>
10075 <para>
10076 <indexterm role="concept">
10077 <primary>whoson lookup type</primary>
10078 </indexterm>
10079 <indexterm role="concept">
10080 <primary>lookup</primary>
10081 <secondary>whoson</secondary>
10082 </indexterm>
10083 <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
10084 allows a server to check whether a particular (dynamically allocated) IP
10085 address is currently allocated to a known (trusted) user and, optionally, to
10086 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10087 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10088 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10089 <quote>POP before SMTP</quote> checking using ACL statements such as
10090 </para>
10091 <literallayout class="monospaced">
10092 require condition = \
10093   ${lookup whoson {$sender_host_address}{yes}{no}}
10094 </literallayout>
10095 <para>
10096 The query consists of a single IP address. The value returned is the name of
10097 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10098 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10099 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10100 </para>
10101 </listitem>
10102 </itemizedlist>
10103 </section>
10104 <section id="SECID63">
10105 <title>Temporary errors in lookups</title>
10106 <para>
10107 <indexterm role="concept">
10108 <primary>lookup</primary>
10109 <secondary>temporary error in</secondary>
10110 </indexterm>
10111 Lookup functions can return temporary error codes if the lookup cannot be
10112 completed. For example, an SQL or LDAP database might be unavailable. For this
10113 reason, it is not advisable to use a lookup that might do this for critical
10114 options such as a list of local domains.
10115 </para>
10116 <para>
10117 When a lookup cannot be completed in a router or transport, delivery
10118 of the message (to the relevant address) is deferred, as for any other
10119 temporary error. In other circumstances Exim may assume the lookup has failed,
10120 or may give up altogether.
10121 </para>
10122 </section>
10123 <section id="SECTdefaultvaluelookups">
10124 <title>Default values in single-key lookups</title>
10125 <para>
10126 <indexterm role="concept">
10127 <primary>wildcard lookups</primary>
10128 </indexterm>
10129 <indexterm role="concept">
10130 <primary>lookup</primary>
10131 <secondary>default values</secondary>
10132 </indexterm>
10133 <indexterm role="concept">
10134 <primary>lookup</primary>
10135 <secondary>wildcard</secondary>
10136 </indexterm>
10137 <indexterm role="concept">
10138 <primary>lookup</primary>
10139 <secondary>* added to type</secondary>
10140 </indexterm>
10141 <indexterm role="concept">
10142 <primary>default</primary>
10143 <secondary>in single-key lookups</secondary>
10144 </indexterm>
10145 In this context, a <quote>default value</quote> is a value specified by the administrator
10146 that is to be used if a lookup fails.
10147 </para>
10148 <para>
10149 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10150 lookups, the facilities of the query language must be used. An attempt to
10151 specify a default for a query-style lookup provokes an error.
10152 </para>
10153 <para>
10154 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10155 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10156 provide a default value. See also the section on partial matching below.
10157 </para>
10158 <para>
10159 <indexterm role="concept">
10160 <primary>*@ with single-key lookup</primary>
10161 </indexterm>
10162 <indexterm role="concept">
10163 <primary>lookup</primary>
10164 <secondary>*@ added to type</secondary>
10165 </indexterm>
10166 <indexterm role="concept">
10167 <primary>alias file</primary>
10168 <secondary>per-domain default</secondary>
10169 </indexterm>
10170 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10171 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10172 character, a second lookup is done with everything before the last @ replaced
10173 by *. This makes it possible to provide per-domain defaults in alias files
10174 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10175 take place because there is no @ in the key), <quote>*</quote> is looked up.
10176 For example, a <command>redirect</command> router might contain:
10177 </para>
10178 <literallayout class="monospaced">
10179 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10180 </literallayout>
10181 <para>
10182 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10183 looks up these keys, in this order:
10184 </para>
10185 <literallayout class="monospaced">
10186 jane@eyre.example
10187 *@eyre.example
10188 *
10189 </literallayout>
10190 <para>
10191 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10192 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10193 complete scan is done for each key, and only if it is not found at all does
10194 Exim move on to try the next key.
10195 </para>
10196 </section>
10197 <section id="SECTpartiallookup">
10198 <title>Partial matching in single-key lookups</title>
10199 <para>
10200 <indexterm role="concept">
10201 <primary>partial matching</primary>
10202 </indexterm>
10203 <indexterm role="concept">
10204 <primary>wildcard lookups</primary>
10205 </indexterm>
10206 <indexterm role="concept">
10207 <primary>lookup</primary>
10208 <secondary>partial matching</secondary>
10209 </indexterm>
10210 <indexterm role="concept">
10211 <primary>lookup</primary>
10212 <secondary>wildcard</secondary>
10213 </indexterm>
10214 <indexterm role="concept">
10215 <primary>asterisk</primary>
10216 <secondary>in search type</secondary>
10217 </indexterm>
10218 The normal operation of a single-key lookup is to search the file for an exact
10219 match with the given key. However, in a number of situations where domains are
10220 being looked up, it is useful to be able to do partial matching. In this case,
10221 information in the file that has a key starting with <quote>*.</quote> is matched by any
10222 domain that ends with the components that follow the full stop. For example, if
10223 a key in a DBM file is
10224 </para>
10225 <literallayout class="monospaced">
10226 *.dates.fict.example
10227 </literallayout>
10228 <para>
10229 then when partial matching is enabled this is matched by (amongst others)
10230 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10231 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10232 file.
10233 </para>
10234 <para>
10235 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10236 also not available for any lookup items in address lists (see section
10237 <xref linkend="SECTaddresslist"/>).
10238 </para>
10239 <para>
10240 Partial matching is implemented by doing a series of separate lookups using
10241 keys constructed by modifying the original subject key. This means that it can
10242 be used with any of the single-key lookup types, provided that
10243 partial matching keys
10244 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10245 Keys in the file that do not begin with the prefix are matched only by
10246 unmodified subject keys when partial matching is in use.
10247 </para>
10248 <para>
10249 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10250 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10251 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10252 is added at the start of the subject key, and it is looked up again. If that
10253 fails, further lookups are tried with dot-separated components removed from the
10254 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10255 remains.
10256 </para>
10257 <para>
10258 A minimum number of two non-* components are required. This can be adjusted
10259 by including a number before the hyphen in the search type. For example,
10260 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10261 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10262 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10263 up when the minimum number of non-* components is two:
10264 </para>
10265 <literallayout class="monospaced">
10266 2250.dates.fict.example
10267 *.2250.dates.fict.example
10268 *.dates.fict.example
10269 *.fict.example
10270 </literallayout>
10271 <para>
10272 As soon as one key in the sequence is successfully looked up, the lookup
10273 finishes.
10274 </para>
10275 <para>
10276 <indexterm role="concept">
10277 <primary>lookup</primary>
10278 <secondary>partial matching &ndash; changing prefix</secondary>
10279 </indexterm>
10280 <indexterm role="concept">
10281 <primary>prefix</primary>
10282 <secondary>for partial matching</secondary>
10283 </indexterm>
10284 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10285 changed. The motivation for this feature is to allow Exim to operate with file
10286 formats that are used by other MTAs. A different prefix can be supplied in
10287 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10288 </para>
10289 <literallayout class="monospaced">
10290 domains = partial(.)lsearch;/some/file
10291 </literallayout>
10292 <para>
10293 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10294 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10295 components is unchanged). The prefix may consist of any punctuation characters
10296 other than a closing parenthesis. It may be empty, for example:
10297 </para>
10298 <literallayout class="monospaced">
10299 domains = partial1()cdb;/some/file
10300 </literallayout>
10301 <para>
10302 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10303 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10304 </para>
10305 <para>
10306 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10307 just one non-wild component has failed, and the original key is shortened right
10308 down to the null string) depends on the prefix:
10309 </para>
10310 <itemizedlist>
10311 <listitem>
10312 <para>
10313 If the prefix has zero length, the whole lookup fails.
10314 </para>
10315 </listitem>
10316 <listitem>
10317 <para>
10318 If the prefix has length 1, a lookup for just the prefix is done. For
10319 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10320 </para>
10321 </listitem>
10322 <listitem>
10323 <para>
10324 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10325 remainder is looked up. With the default prefix, therefore, the final lookup is
10326 for <quote>*</quote> on its own.
10327 </para>
10328 </listitem>
10329 <listitem>
10330 <para>
10331 Otherwise, the whole prefix is looked up.
10332 </para>
10333 </listitem>
10334 </itemizedlist>
10335 <para>
10336 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10337 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10338 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10339 specified, adding <quote>*</quote> to the search type has no effect with the default
10340 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10341 lookups. However, there might be a use for lookup types such as
10342 <quote>partial0(.)lsearch*</quote>.
10343 </para>
10344 <para>
10345 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10346 in domain lists and the like. Partial matching works only in terms of
10347 dot-separated components; a key such as <literal>*fict.example</literal>
10348 in a database file is useless, because the asterisk in a partial matching
10349 subject key is always followed by a dot.
10350 </para>
10351 </section>
10352 <section id="SECID64">
10353 <title>Lookup caching</title>
10354 <para>
10355 <indexterm role="concept">
10356 <primary>lookup</primary>
10357 <secondary>caching</secondary>
10358 </indexterm>
10359 <indexterm role="concept">
10360 <primary>caching</primary>
10361 <secondary>lookup data</secondary>
10362 </indexterm>
10363 Exim caches all lookup results in order to avoid needless repetition of
10364 lookups. However, because (apart from the daemon) Exim operates as a collection
10365 of independent, short-lived processes, this caching applies only within a
10366 single Exim process. There is no inter-process lookup caching facility.
10367 </para>
10368 <para>
10369 For single-key lookups, Exim keeps the relevant files open in case there is
10370 another lookup that needs them. In some types of configuration this can lead to
10371 many files being kept open for messages with many recipients. To avoid hitting
10372 the operating system limit on the number of simultaneously open files, Exim
10373 closes the least recently used file when it needs to open more files than its
10374 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10375 </para>
10376 <para>
10377 The single-key lookup files are closed and the lookup caches are flushed at
10378 strategic points during delivery &ndash; for example, after all routing is
10379 complete.
10380 </para>
10381 </section>
10382 <section id="SECID65">
10383 <title>Quoting lookup data</title>
10384 <para>
10385 <indexterm role="concept">
10386 <primary>lookup</primary>
10387 <secondary>quoting</secondary>
10388 </indexterm>
10389 <indexterm role="concept">
10390 <primary>quoting</primary>
10391 <secondary>in lookups</secondary>
10392 </indexterm>
10393 When data from an incoming message is included in a query-style lookup, there
10394 is the possibility of special characters in the data messing up the syntax of
10395 the query. For example, a NIS+ query that contains
10396 </para>
10397 <literallayout class="monospaced">
10398 [name=$local_part]
10399 </literallayout>
10400 <para>
10401 will be broken if the local part happens to contain a closing square bracket.
10402 For NIS+, data can be enclosed in double quotes like this:
10403 </para>
10404 <literallayout class="monospaced">
10405 [name="$local_part"]
10406 </literallayout>
10407 <para>
10408 but this still leaves the problem of a double quote in the data. The rule for
10409 NIS+ is that double quotes must be doubled. Other lookup types have different
10410 rules, and to cope with the differing requirements, an expansion operator
10411 of the following form is provided:
10412 </para>
10413 <literallayout class="monospaced">
10414 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10415 </literallayout>
10416 <para>
10417 For example, the safest way to write the NIS+ query is
10418 </para>
10419 <literallayout class="monospaced">
10420 [name="${quote_nisplus:$local_part}"]
10421 </literallayout>
10422 <para>
10423 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10424 operator can be used for all lookup types, but has no effect for single-key
10425 lookups, since no quoting is ever needed in their key strings.
10426 </para>
10427 </section>
10428 <section id="SECTdnsdb">
10429 <title>More about dnsdb</title>
10430 <para>
10431 <indexterm role="concept">
10432 <primary>dnsdb lookup</primary>
10433 </indexterm>
10434 <indexterm role="concept">
10435 <primary>lookup</primary>
10436 <secondary>dnsdb</secondary>
10437 </indexterm>
10438 <indexterm role="concept">
10439 <primary>DNS</primary>
10440 <secondary>as a lookup type</secondary>
10441 </indexterm>
10442 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10443 of a record type and a domain name, separated by an equals sign. For example,
10444 an expansion string could contain:
10445 </para>
10446 <literallayout class="monospaced">
10447 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10448 </literallayout>
10449 <para>
10450 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10451 is used on its own as the result. If the lookup does not succeed, the
10452 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10453 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10454 </para>
10455 <para revisionflag="changed">
10456 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10457 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10458 If no type is given, TXT is assumed.
10459 </para>
10460 <para>
10461 For any record type, if multiple records are found, the data is returned as a
10462 concatenation, with newline as the default separator. The order, of course,
10463 depends on the DNS resolver. You can specify a different separator character
10464 between multiple records by putting a right angle-bracket followed immediately
10465 by the new separator at the start of the query. For example:
10466 </para>
10467 <literallayout class="monospaced">
10468 ${lookup dnsdb{&gt;: a=host1.example}}
10469 </literallayout>
10470 <para>
10471 It is permitted to specify a space as the separator character. Further
10472 white space is ignored.
10473 For lookup types that return multiple fields per record,
10474 an alternate field separator can be specified using a comma after the main
10475 separator character, followed immediately by the field separator.
10476 </para>
10477 <para>
10478 <indexterm role="concept">
10479 <primary>PTR record</primary>
10480 <secondary>in <command>dnsdb</command> lookup</secondary>
10481 </indexterm>
10482 When the type is PTR,
10483 the data can be an IP address, written as normal; inversion and the addition of
10484 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10485 </para>
10486 <literallayout class="monospaced">
10487 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10488 </literallayout>
10489 <para>
10490 If the data for a PTR record is not a syntactically valid IP address, it is not
10491 altered and nothing is added.
10492 </para>
10493 <para>
10494 <indexterm role="concept">
10495 <primary>MX record</primary>
10496 <secondary>in <command>dnsdb</command> lookup</secondary>
10497 </indexterm>
10498 <indexterm role="concept">
10499 <primary>SRV record</primary>
10500 <secondary>in <command>dnsdb</command> lookup</secondary>
10501 </indexterm>
10502 For an MX lookup, both the preference value and the host name are returned for
10503 each record, separated by a space. For an SRV lookup, the priority, weight,
10504 port, and host name are returned for each record, separated by spaces.
10505 The field separator can be modified as above.
10506 </para>
10507 <para>
10508 <indexterm role="concept">
10509 <primary>TXT record</primary>
10510 <secondary>in <command>dnsdb</command> lookup</secondary>
10511 </indexterm>
10512 <indexterm role="concept">
10513 <primary>SPF record</primary>
10514 <secondary>in <command>dnsdb</command> lookup</secondary>
10515 </indexterm>
10516 For TXT records with multiple items of data, only the first item is returned,
10517 unless a field separator is specified.
10518 To concatenate items without a separator, use a semicolon instead.
10519 For SPF records the
10520 default behaviour is to concatenate multiple items without using a separator.
10521 </para>
10522 <literallayout class="monospaced">
10523 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10524 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10525 ${lookup dnsdb{spf=example.org}}
10526 </literallayout>
10527 <para>
10528 It is permitted to specify a space as the separator character. Further
10529 white space is ignored.
10530 </para>
10531 <para revisionflag="changed">
10532 <indexterm role="concept">
10533 <primary>SOA record</primary>
10534 <secondary>in <command>dnsdb</command> lookup</secondary>
10535 </indexterm>
10536 For an SOA lookup, while no result is obtained the lookup is redone with
10537 successively more leading components dropped from the given domain.
10538 Only the primary-nameserver field is returned unless a field separator is
10539 specified.
10540 </para>
10541 <literallayout class="monospaced" revisionflag="changed">
10542 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10543 </literallayout>
10544 </section>
10545 <section id="SECTdnsdb_mod">
10546 <title>Dnsdb lookup modifiers</title>
10547 <para>
10548 <indexterm role="concept">
10549 <primary>dnsdb modifiers</primary>
10550 </indexterm>
10551 <indexterm role="concept">
10552 <primary>modifiers</primary>
10553 <secondary>dnsdb</secondary>
10554 </indexterm>
10555 <indexterm role="concept">
10556 <primary>options</primary>
10557 <secondary>dnsdb</secondary>
10558 </indexterm>
10559 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10560 each followed by a comma,
10561 that may appear before the record type.
10562 </para>
10563 <para>
10564 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10565 temporary DNS error for any of them, the behaviour is controlled by
10566 a defer-option modifier.
10567 The possible keywords are
10568 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10569 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10570 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10571 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10572 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10573 error causes the whole lookup to defer only if none of the other lookups
10574 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10575 </para>
10576 <literallayout class="monospaced">
10577 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10578 ${lookup dnsdb{a=one.host.com:two.host.com}}
10579 </literallayout>
10580 <para>
10581 Thus, in the default case, as long as at least one of the DNS lookups
10582 yields some data, the lookup succeeds.
10583 </para>
10584 <para>
10585 <indexterm role="concept">
10586 <primary>DNSSEC</primary>
10587 <secondary>dns lookup</secondary>
10588 </indexterm>
10589 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10590 The possible keywords are
10591 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10592 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10593 with the lookup.
10594 With <quote>strict</quote> a response from the DNS resolver that
10595 is not labelled as authenticated data
10596 is treated as equivalent to a temporary DNS error.
10597 The default is <quote>never</quote>.
10598 </para>
10599 <para>
10600 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10601 </para>
10602 <para revisionflag="changed">
10603 <indexterm role="concept">
10604 <primary>timeout</primary>
10605 <secondary>dns lookup</secondary>
10606 </indexterm>
10607 <indexterm role="concept">
10608 <primary>DNS</primary>
10609 <secondary>timeout</secondary>
10610 </indexterm>
10611 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10612 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10613 (e.g. <quote>5s</quote>).
10614 The default value is set by the main configuration option <option>dns_retrans</option>.
10615 </para>
10616 <para revisionflag="changed">
10617 Retries for the dnsdb lookup can be controlled by a retry modifier.
10618 The form if <quote>retry_VAL</quote> where VAL is an integer.
10619 The default count is set by the main configuration option <option>dns_retry</option>.
10620 </para>
10621 </section>
10622 <section id="SECID66">
10623 <title>Pseudo dnsdb record types</title>
10624 <para>
10625 <indexterm role="concept">
10626 <primary>MX record</primary>
10627 <secondary>in <command>dnsdb</command> lookup</secondary>
10628 </indexterm>
10629 By default, both the preference value and the host name are returned for
10630 each MX record, separated by a space. If you want only host names, you can use
10631 the pseudo-type MXH:
10632 </para>
10633 <literallayout class="monospaced">
10634 ${lookup dnsdb{mxh=a.b.example}}
10635 </literallayout>
10636 <para>
10637 In this case, the preference values are omitted, and just the host names are
10638 returned.
10639 </para>
10640 <para>
10641 <indexterm role="concept">
10642 <primary>name server for enclosing domain</primary>
10643 </indexterm>
10644 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10645 records on the given domain, but if none are found, it removes the first
10646 component of the domain name, and tries again. This process continues until NS
10647 records are found or there are no more components left (or there is a DNS
10648 error). In other words, it may return the name servers for a top-level domain,
10649 but it never returns the root name servers. If there are no NS records for the
10650 top-level domain, the lookup fails. Consider these examples:
10651 </para>
10652 <literallayout class="monospaced">
10653 ${lookup dnsdb{zns=xxx.quercite.com}}
10654 ${lookup dnsdb{zns=xxx.edu}}
10655 </literallayout>
10656 <para>
10657 Assuming that in each case there are no NS records for the full domain name,
10658 the first returns the name servers for <option>quercite.com</option>, and the second returns
10659 the name servers for <option>edu</option>.
10660 </para>
10661 <para>
10662 You should be careful about how you use this lookup because, unless the
10663 top-level domain does not exist, the lookup always returns some host names. The
10664 sort of use to which this might be put is for seeing if the name servers for a
10665 given domain are on a blacklist. You can probably assume that the name servers
10666 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10667 such a list.
10668 </para>
10669 <para>
10670 <indexterm role="concept">
10671 <primary>CSA</primary>
10672 <secondary>in <command>dnsdb</command> lookup</secondary>
10673 </indexterm>
10674 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10675 records according to the CSA rules, which are described in section
10676 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10677 not sufficient because of the extra parent domain search behaviour of CSA. The
10678 result of a successful lookup such as:
10679 </para>
10680 <literallayout class="monospaced">
10681 ${lookup dnsdb {csa=$sender_helo_name}}
10682 </literallayout>
10683 <para>
10684 has two space-separated fields: an authorization code and a target host name.
10685 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10686 authorization required but absent, or <quote>?</quote> for unknown.
10687 </para>
10688 <para>
10689 <indexterm role="concept">
10690 <primary>A+</primary>
10691 <secondary>in <command>dnsdb</command> lookup</secondary>
10692 </indexterm>
10693 The pseudo-type A+ performs an AAAA
10694 and then an A lookup.  All results are returned; defer processing
10695 (see below) is handled separately for each lookup.  Example:
10696 </para>
10697 <literallayout class="monospaced">
10698 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10699 </literallayout>
10700 </section>
10701 <section id="SECID67">
10702 <title>Multiple dnsdb lookups</title>
10703 <para>
10704 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10705 However, you can specify a list of domains or IP addresses in a single
10706 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10707 the default separator, but with the ability to change this. For example:
10708 </para>
10709 <literallayout class="monospaced">
10710 ${lookup dnsdb{one.domain.com:two.domain.com}}
10711 ${lookup dnsdb{a=one.host.com:two.host.com}}
10712 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10713 </literallayout>
10714 <para>
10715 In order to retain backwards compatibility, there is one special case: if
10716 the lookup type is PTR and no change of separator is specified, Exim looks
10717 to see if the rest of the string is precisely one IPv6 address. In this
10718 case, it does not treat it as a list.
10719 </para>
10720 <para>
10721 The data from each lookup is concatenated, with newline separators by default,
10722 in the same way that multiple DNS records for a single item are handled. A
10723 different separator can be specified, as described above.
10724 </para>
10725 </section>
10726 <section id="SECTldap">
10727 <title>More about LDAP</title>
10728 <para>
10729 <indexterm role="concept">
10730 <primary>LDAP</primary>
10731 <secondary>lookup, more about</secondary>
10732 </indexterm>
10733 <indexterm role="concept">
10734 <primary>lookup</primary>
10735 <secondary>LDAP</secondary>
10736 </indexterm>
10737 <indexterm role="concept">
10738 <primary>Solaris</primary>
10739 <secondary>LDAP</secondary>
10740 </indexterm>
10741 The original LDAP implementation came from the University of Michigan; this has
10742 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10743 implementation comes from Netscape, and Solaris 7 and subsequent releases
10744 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10745 the lookup function level, their error handling is different. For this reason
10746 it is necessary to set a compile-time variable when building Exim with LDAP, to
10747 indicate which LDAP library is in use. One of the following should appear in
10748 your <filename>Local/Makefile</filename>:
10749 </para>
10750 <literallayout class="monospaced">
10751 LDAP_LIB_TYPE=UMICHIGAN
10752 LDAP_LIB_TYPE=OPENLDAP1
10753 LDAP_LIB_TYPE=OPENLDAP2
10754 LDAP_LIB_TYPE=NETSCAPE
10755 LDAP_LIB_TYPE=SOLARIS
10756 </literallayout>
10757 <para>
10758 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10759 same interface as the University of Michigan version.
10760 </para>
10761 <para>
10762 There are three LDAP lookup types in Exim. These behave slightly differently in
10763 the way they handle the results of a query:
10764 </para>
10765 <itemizedlist>
10766 <listitem>
10767 <para>
10768 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10769 gives an error.
10770 </para>
10771 </listitem>
10772 <listitem>
10773 <para>
10774 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10775 Distinguished Name that is returned rather than any attribute values.
10776 </para>
10777 </listitem>
10778 <listitem>
10779 <para>
10780 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10781 from all of them are returned.
10782 </para>
10783 </listitem>
10784 </itemizedlist>
10785 <para>
10786 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10787 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10788 the data returned by a successful lookup is described in the next section.
10789 First we explain how LDAP queries are coded.
10790 </para>
10791 </section>
10792 <section id="SECTforldaque">
10793 <title>Format of LDAP queries</title>
10794 <para>
10795 <indexterm role="concept">
10796 <primary>LDAP</primary>
10797 <secondary>query format</secondary>
10798 </indexterm>
10799 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10800 the configuration of a <command>redirect</command> router one might have this setting:
10801 </para>
10802 <literallayout class="monospaced">
10803 data = ${lookup ldap \
10804   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10805   c=UK?mailbox?base?}}
10806 </literallayout>
10807 <para>
10808 <indexterm role="concept">
10809 <primary>LDAP</primary>
10810 <secondary>with TLS</secondary>
10811 </indexterm>
10812 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10813 secure (encrypted) LDAP connections. The second of these ensures that an
10814 encrypted TLS connection is used.
10815 </para>
10816 <para>
10817 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10818 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10819 See the <option>ldap_start_tls</option> option.
10820 </para>
10821 <para>
10822 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10823 controlled. Every part of the TLS configuration can be configured by settings in
10824 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10825 your system, some of the initialization may have required setting options in
10826 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10827 certificates. This revealed a nuance where the current UID that exim was
10828 running as could affect which config files it read. With Exim 4.83, these
10829 methods become optional, only taking effect if not specifically set in
10830 <filename>exim.conf</filename>.
10831 </para>
10832 </section>
10833 <section id="SECID68">
10834 <title>LDAP quoting</title>
10835 <para>
10836 <indexterm role="concept">
10837 <primary>LDAP</primary>
10838 <secondary>quoting</secondary>
10839 </indexterm>
10840 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10841 and the second because the LDAP query is represented as a URL. Furthermore,
10842 within an LDAP query, two different kinds of quoting are required. For this
10843 reason, there are two different LDAP-specific quoting operators.
10844 </para>
10845 <para>
10846 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10847 filter specifications. Conceptually, it first does the following conversions on
10848 the string:
10849 </para>
10850 <literallayout class="monospaced">
10851 *   =&gt;   \2A
10852 (   =&gt;   \28
10853 )   =&gt;   \29
10854 \   =&gt;   \5C
10855 </literallayout>
10856 <para>
10857 in accordance with RFC 2254. The resulting string is then quoted according
10858 to the rules for URLs, that is, all non-alphanumeric characters except
10859 </para>
10860 <literallayout class="monospaced">
10861 ! $ ' - . _ ( ) * +
10862 </literallayout>
10863 <para>
10864 are converted to their hex values, preceded by a percent sign. For example:
10865 </para>
10866 <literallayout class="monospaced">
10867 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10868 </literallayout>
10869 <para>
10870 yields
10871 </para>
10872 <literallayout class="monospaced">
10873 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10874 </literallayout>
10875 <para>
10876 Removing the URL quoting, this is (with a leading and a trailing space):
10877 </para>
10878 <literallayout class="monospaced">
10879 a\28bc\29\2A, a&lt;yz&gt;;
10880 </literallayout>
10881 <para>
10882 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10883 base DN specifications in queries. Conceptually, it first converts the string
10884 by inserting a backslash in front of any of the following characters:
10885 </para>
10886 <literallayout class="monospaced">
10887 , + " \ &lt; &gt; ;
10888 </literallayout>
10889 <para>
10890 It also inserts a backslash before any leading spaces or # characters, and
10891 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10892 is then quoted according to the rules for URLs. For example:
10893 </para>
10894 <literallayout class="monospaced">
10895 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10896 </literallayout>
10897 <para>
10898 yields
10899 </para>
10900 <literallayout class="monospaced">
10901 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10902 </literallayout>
10903 <para>
10904 Removing the URL quoting, this is (with a trailing space):
10905 </para>
10906 <literallayout class="monospaced">
10907 \ a(bc)*\, a\&lt;yz\&gt;\;\
10908 </literallayout>
10909 <para>
10910 There are some further comments about quoting in the section on LDAP
10911 authentication below.
10912 </para>
10913 </section>
10914 <section id="SECID69">
10915 <title>LDAP connections</title>
10916 <para>
10917 <indexterm role="concept">
10918 <primary>LDAP</primary>
10919 <secondary>connections</secondary>
10920 </indexterm>
10921 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10922 is in use, via a Unix domain socket. The example given above does not specify
10923 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10924 by starting it with
10925 </para>
10926 <literallayout class="monospaced">
10927 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10928 </literallayout>
10929 <para>
10930 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10931 used. When no server is specified in a query, a list of default servers is
10932 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10933 colon-separated list of servers which are tried in turn until one successfully
10934 handles a query, or there is a serious error. Successful handling either
10935 returns the requested data, or indicates that it does not exist. Serious errors
10936 are syntactical, or multiple values when only a single value is expected.
10937 Errors which cause the next server to be tried are connection failures, bind
10938 failures, and timeouts.
10939 </para>
10940 <para>
10941 For each server name in the list, a port number can be given. The standard way
10942 of specifying a host and port is to use a colon separator (RFC 1738). Because
10943 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10944 doubled. For example
10945 </para>
10946 <literallayout class="monospaced">
10947 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10948 </literallayout>
10949 <para>
10950 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10951 to the LDAP library with no server name, and the library&#x2019;s default (normally
10952 the local host) is used.
10953 </para>
10954 <para>
10955 If you are using the OpenLDAP library, you can connect to an LDAP server using
10956 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10957 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10958 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10959 not available.
10960 </para>
10961 <para>
10962 For this type of connection, instead of a host name for the server, a pathname
10963 for the socket is required, and the port number is not relevant. The pathname
10964 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10965 the query. In the former case, you can have settings such as
10966 </para>
10967 <literallayout class="monospaced">
10968 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10969 </literallayout>
10970 <para>
10971 When the pathname is given in the query, you have to escape the slashes as
10972 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10973 </para>
10974 <literallayout class="monospaced">
10975 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10976 </literallayout>
10977 <para>
10978 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10979 a pathname, it uses the Unix domain socket code, even if the query actually
10980 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10981 socket connection. This behaviour means that you can use a setting of
10982 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10983 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10984 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10985 backup host.
10986 </para>
10987 <para>
10988 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10989 specified, an error is diagnosed. However, if there are more items in
10990 <option>ldap_default_servers</option>, they are tried. In other words:
10991 </para>
10992 <itemizedlist>
10993 <listitem>
10994 <para>
10995 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10996 interface.
10997 </para>
10998 </listitem>
10999 <listitem>
11000 <para>
11001 Using <literal>ldapi</literal> with a host name causes an error.
11002 </para>
11003 </listitem>
11004 </itemizedlist>
11005 <para>
11006 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11007 <option>ldap_default_servers</option>, does whatever the library does by default.
11008 </para>
11009 </section>
11010 <section id="SECID70">
11011 <title>LDAP authentication and control information</title>
11012 <para>
11013 <indexterm role="concept">
11014 <primary>LDAP</primary>
11015 <secondary>authentication</secondary>
11016 </indexterm>
11017 The LDAP URL syntax provides no way of passing authentication and other control
11018 information to the server. To make this possible, the URL in an LDAP query may
11019 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11020 spaces. If a value contains spaces it must be enclosed in double quotes, and
11021 when double quotes are used, backslash is interpreted in the usual way inside
11022 them. The following names are recognized:
11023 </para>
11024 <literallayout>
11025 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11026 <literal>NETTIME    </literal>  set a timeout for a network operation
11027 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11028 <literal>PASS       </literal>  set the password, likewise
11029 <literal>REFERRALS  </literal>  set the referrals parameter
11030 <literal>SERVERS    </literal>  set alternate server list for this query only
11031 <literal>SIZE       </literal>  set the limit for the number of entries returned
11032 <literal>TIME       </literal>  set the maximum waiting time for a query
11033 </literallayout>
11034 <para>
11035 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11036 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11037 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11038 library from trying to follow referrals issued by the LDAP server.
11039 </para>
11040 <para>
11041 The name CONNECT is an obsolete name for NETTIME, retained for
11042 backwards compatibility. This timeout (specified as a number of seconds) is
11043 enforced from the client end for operations that can be carried out over a
11044 network. Specifically, it applies to network connections and calls to the
11045 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11046 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11047 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11048 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11049 Netscape SDK; for OpenLDAP no action is taken.
11050 </para>
11051 <para>
11052 The TIME parameter (also a number of seconds) is passed to the server to
11053 set a server-side limit on the time taken to complete a search.
11054 </para>
11055 <para>
11056 The SERVERS parameter allows you to specify an alternate list of ldap servers
11057 to use for an individual lookup.  The global ldap_servers option provides a
11058 default list of ldap servers, and a single lookup can specify a single ldap
11059 server to use.  But when you need to do a lookup with a list of servers that is
11060 different than the default list (maybe different order, maybe a completely
11061 different set of servers), the SERVERS parameter allows you to specify this
11062 alternate list (colon-separated).
11063 </para>
11064 <para>
11065 Here is an example of an LDAP query in an Exim lookup that uses some of these
11066 values. This is a single line, folded to fit on the page:
11067 </para>
11068 <literallayout class="monospaced">
11069 ${lookup ldap
11070   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11071   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11072   {$value}fail}
11073 </literallayout>
11074 <para>
11075 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11076 any of the auxiliary data. Exim configuration settings that include lookups
11077 which contain password information should be preceded by <quote>hide</quote> to prevent
11078 non-admin users from using the <option>-bP</option> option to see their values.
11079 </para>
11080 <para>
11081 The auxiliary data items may be given in any order. The default is no
11082 connection timeout (the system timeout is used), no user or password, no limit
11083 on the number of entries returned, and no time limit on queries.
11084 </para>
11085 <para>
11086 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11087 removes any URL quoting that it may contain before passing it LDAP. Apparently
11088 some libraries do this for themselves, but some do not. Removing the URL
11089 quoting has two advantages:
11090 </para>
11091 <itemizedlist>
11092 <listitem>
11093 <para>
11094 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11095 DNs as with DNs inside actual queries.
11096 </para>
11097 </listitem>
11098 <listitem>
11099 <para>
11100 It permits spaces inside USER= DNs.
11101 </para>
11102 </listitem>
11103 </itemizedlist>
11104 <para>
11105 For example, a setting such as
11106 </para>
11107 <literallayout class="monospaced">
11108 USER=cn=${quote_ldap_dn:$1}
11109 </literallayout>
11110 <para>
11111 should work even if <varname>$1</varname> contains spaces.
11112 </para>
11113 <para>
11114 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11115 expansion operator, rather than the LDAP quote operators. The only reason this
11116 field needs quoting is to ensure that it conforms to the Exim syntax, which
11117 does not allow unquoted spaces. For example:
11118 </para>
11119 <literallayout class="monospaced">
11120 PASS=${quote:$3}
11121 </literallayout>
11122 <para>
11123 The LDAP authentication mechanism can be used to check passwords as part of
11124 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11125 <xref linkend="CHAPexpand"/>.
11126 </para>
11127 </section>
11128 <section id="SECID71">
11129 <title>Format of data returned by LDAP</title>
11130 <para>
11131 <indexterm role="concept">
11132 <primary>LDAP</primary>
11133 <secondary>returned data formats</secondary>
11134 </indexterm>
11135 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11136 as a sequence of values, for example
11137 </para>
11138 <literallayout class="monospaced">
11139 cn=manager, o=University of Cambridge, c=UK
11140 </literallayout>
11141 <para>
11142 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11143 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11144 the result between the data from different entries. It is possible for multiple
11145 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11146 you know that whatever values are returned all came from a single entry in the
11147 directory.
11148 </para>
11149 <para>
11150 In the common case where you specify a single attribute in your LDAP query, the
11151 result is not quoted, and does not contain the attribute name. If the attribute
11152 has multiple values, they are separated by commas.
11153 </para>
11154 <para>
11155 If you specify multiple attributes, the result contains space-separated, quoted
11156 strings, each preceded by the attribute name and an equals sign. Within the
11157 quotes, the quote character, backslash, and newline are escaped with
11158 backslashes, and commas are used to separate multiple values for the attribute.
11159 Any commas in attribute values are doubled
11160 (permitting treatment of the values as a comma-separated list).
11161 Apart from the escaping, the string within quotes takes the same form as the
11162 output when a single attribute is requested. Specifying no attributes is the
11163 same as specifying all of an entry&#x2019;s attributes.
11164 </para>
11165 <para>
11166 Here are some examples of the output format. The first line of each pair is an
11167 LDAP query, and the second is the data that is returned. The attribute called
11168 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11169 <option>attr2</option> has only one value:
11170 </para>
11171 <literallayout class="monospaced">
11172 ldap:///o=base?attr1?sub?(uid=fred)
11173 value1.1,value1,,2
11174
11175 ldap:///o=base?attr2?sub?(uid=fred)
11176 value two
11177
11178 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11179 attr1="value1.1,value1,,2" attr2="value two"
11180
11181 ldap:///o=base??sub?(uid=fred)
11182 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11183 </literallayout>
11184 <para>
11185 You can
11186 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11187 results of LDAP lookups.
11188 The <option>extract</option> operator in string expansions can be used to pick out
11189 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11190 The <option>listextract</option> operator should be used to pick out individual values
11191 of attributes, even when only a single value is expected.
11192 The doubling of embedded commas allows you to use the returned data as a
11193 comma separated list (using the "&lt;," syntax for changing the input list separator).
11194 </para>
11195 </section>
11196 <section id="SECTnisplus">
11197 <title>More about NIS+</title>
11198 <para>
11199 <indexterm role="concept">
11200 <primary>NIS+ lookup type</primary>
11201 </indexterm>
11202 <indexterm role="concept">
11203 <primary>lookup</primary>
11204 <secondary>NIS+</secondary>
11205 </indexterm>
11206 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11207 and field name. If this is given, the result of a successful query is the
11208 contents of the named field; otherwise the result consists of a concatenation
11209 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11210 values containing spaces are quoted. For example, the query
11211 </para>
11212 <literallayout class="monospaced">
11213 [name=mg1456],passwd.org_dir
11214 </literallayout>
11215 <para>
11216 might return the string
11217 </para>
11218 <literallayout class="monospaced">
11219 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11220 home=/home/mg1456 shell=/bin/bash shadow=""
11221 </literallayout>
11222 <para>
11223 (split over two lines here to fit on the page), whereas
11224 </para>
11225 <literallayout class="monospaced">
11226 [name=mg1456],passwd.org_dir:gcos
11227 </literallayout>
11228 <para>
11229 would just return
11230 </para>
11231 <literallayout class="monospaced">
11232 Martin Guerre
11233 </literallayout>
11234 <para>
11235 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11236 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11237 operator is to double any quote characters within the text.
11238 </para>
11239 </section>
11240 <section id="SECTsql">
11241 <title>SQL lookups</title>
11242 <para>
11243 <indexterm role="concept">
11244 <primary>SQL lookup types</primary>
11245 </indexterm>
11246 <indexterm role="concept">
11247 <primary>MySQL</primary>
11248 <secondary>lookup type</secondary>
11249 </indexterm>
11250 <indexterm role="concept">
11251 <primary>PostgreSQL lookup type</primary>
11252 </indexterm>
11253 <indexterm role="concept">
11254 <primary>lookup</primary>
11255 <secondary>MySQL</secondary>
11256 </indexterm>
11257 <indexterm role="concept">
11258 <primary>lookup</primary>
11259 <secondary>PostgreSQL</secondary>
11260 </indexterm>
11261 <indexterm role="concept">
11262 <primary>Oracle</primary>
11263 <secondary>lookup type</secondary>
11264 </indexterm>
11265 <indexterm role="concept">
11266 <primary>lookup</primary>
11267 <secondary>Oracle</secondary>
11268 </indexterm>
11269 <indexterm role="concept">
11270 <primary>InterBase lookup type</primary>
11271 </indexterm>
11272 <indexterm role="concept">
11273 <primary>lookup</primary>
11274 <secondary>InterBase</secondary>
11275 </indexterm>
11276 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11277 databases. Queries for these databases contain SQL statements, so an example
11278 might be
11279 </para>
11280 <literallayout class="monospaced">
11281 ${lookup mysql{select mailbox from users where id='userx'}\
11282   {$value}fail}
11283 </literallayout>
11284 <para>
11285 If the result of the query contains more than one field, the data for each
11286 field in the row is returned, preceded by its name, so the result of
11287 </para>
11288 <literallayout class="monospaced">
11289 ${lookup pgsql{select home,name from users where id='userx'}\
11290   {$value}}
11291 </literallayout>
11292 <para>
11293 might be
11294 </para>
11295 <literallayout class="monospaced">
11296 home=/home/userx name="Mister X"
11297 </literallayout>
11298 <para>
11299 Empty values and values containing spaces are double quoted, with embedded
11300 quotes escaped by a backslash. If the result of the query contains just one
11301 field, the value is passed back verbatim, without a field name, for example:
11302 </para>
11303 <literallayout class="monospaced">
11304 Mister X
11305 </literallayout>
11306 <para>
11307 If the result of the query yields more than one row, it is all concatenated,
11308 with a newline between the data for each row.
11309 </para>
11310 </section>
11311 <section id="SECID72">
11312 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11313 <para>
11314 <indexterm role="concept">
11315 <primary>MySQL</primary>
11316 <secondary>lookup type</secondary>
11317 </indexterm>
11318 <indexterm role="concept">
11319 <primary>PostgreSQL lookup type</primary>
11320 </indexterm>
11321 <indexterm role="concept">
11322 <primary>lookup</primary>
11323 <secondary>MySQL</secondary>
11324 </indexterm>
11325 <indexterm role="concept">
11326 <primary>lookup</primary>
11327 <secondary>PostgreSQL</secondary>
11328 </indexterm>
11329 <indexterm role="concept">
11330 <primary>Oracle</primary>
11331 <secondary>lookup type</secondary>
11332 </indexterm>
11333 <indexterm role="concept">
11334 <primary>lookup</primary>
11335 <secondary>Oracle</secondary>
11336 </indexterm>
11337 <indexterm role="concept">
11338 <primary>InterBase lookup type</primary>
11339 </indexterm>
11340 <indexterm role="concept">
11341 <primary>lookup</primary>
11342 <secondary>InterBase</secondary>
11343 </indexterm>
11344 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11345 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11346 option (as appropriate) must be set to a colon-separated list of server
11347 information.
11348 (For MySQL and PostgreSQL only, the global option need not be set if all
11349 queries contain their own server information &ndash; see section
11350 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11351 items: host name, database name, user name, and password. In the case of
11352 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11353 name field is not used and should be empty. For example:
11354 </para>
11355 <literallayout class="monospaced">
11356 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11357 </literallayout>
11358 <para>
11359 Because password data is sensitive, you should always precede the setting with
11360 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11361 option. Here is an example where two MySQL servers are listed:
11362 </para>
11363 <literallayout class="monospaced">
11364 hide mysql_servers = localhost/users/root/secret:\
11365                      otherhost/users/root/othersecret
11366 </literallayout>
11367 <para>
11368 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11369 because this is a colon-separated list, the colon has to be doubled. For each
11370 query, these parameter groups are tried in order until a connection is made and
11371 a query is successfully processed. The result of a query may be that no data is
11372 found, but that is still a successful query. In other words, the list of
11373 servers provides a backup facility, not a list of different places to look.
11374 </para>
11375 <para>
11376 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11377 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11378 respectively, and the characters single-quote, double-quote, and backslash
11379 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11380 addition, escapes the percent and underscore characters. This cannot be done
11381 for MySQL because these escapes are not recognized in contexts where these
11382 characters are not special.
11383 </para>
11384 </section>
11385 <section id="SECTspeserque">
11386 <title>Specifying the server in the query</title>
11387 <para>
11388 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11389 it is possible to specify a list of servers with an individual query. This is
11390 done by starting the query with
11391 </para>
11392 <literallayout>
11393 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11394 </literallayout>
11395 <para>
11396 Each item in the list may take one of two forms:
11397 </para>
11398 <orderedlist numeration="arabic">
11399 <listitem>
11400 <para>
11401 If it contains no slashes it is assumed to be just a host name. The appropriate
11402 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11403 of the same name, and the remaining parameters (database, user, password) are
11404 taken from there.
11405 </para>
11406 </listitem>
11407 <listitem>
11408 <para>
11409 If it contains any slashes, it is taken as a complete parameter set.
11410 </para>
11411 </listitem>
11412 </orderedlist>
11413 <para>
11414 The list of servers is used in exactly the same way as the global list.
11415 Once a connection to a server has happened and a query has been
11416 successfully executed, processing of the lookup ceases.
11417 </para>
11418 <para>
11419 This feature is intended for use in master/slave situations where updates
11420 are occurring and you want to update the master rather than a slave. If the
11421 master is in the list as a backup for reading, you might have a global setting
11422 like this:
11423 </para>
11424 <literallayout class="monospaced">
11425 mysql_servers = slave1/db/name/pw:\
11426                 slave2/db/name/pw:\
11427                 master/db/name/pw
11428 </literallayout>
11429 <para>
11430 In an updating lookup, you could then write:
11431 </para>
11432 <literallayout class="monospaced">
11433 ${lookup mysql{servers=master; UPDATE ...} }
11434 </literallayout>
11435 <para>
11436 That query would then be sent only to the master server. If, on the other hand,
11437 the master is not to be used for reading, and so is not present in the global
11438 option, you can still update it by a query of this form:
11439 </para>
11440 <literallayout class="monospaced">
11441 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11442 </literallayout>
11443 </section>
11444 <section id="SECID73">
11445 <title>Special MySQL features</title>
11446 <para>
11447 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11448 causes a connection to the server on the local host by means of a Unix domain
11449 socket. An alternate socket can be specified in parentheses. The full syntax of
11450 each item in <option>mysql_servers</option> is:
11451 </para>
11452 <literallayout>
11453 &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;
11454 </literallayout>
11455 <para>
11456 Any of the three sub-parts of the first field can be omitted. For normal use on
11457 the local host it can be left blank or set to just <quote>localhost</quote>.
11458 </para>
11459 <para>
11460 No database need be supplied &ndash; but if it is absent here, it must be given in
11461 the queries.
11462 </para>
11463 <para>
11464 If a MySQL query is issued that does not request any data (an insert, update,
11465 or delete command), the result of the lookup is the number of rows affected.
11466 </para>
11467 <para>
11468 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11469 anything (for example, setting a field to the value it already has), the result
11470 is zero because no rows are affected.
11471 </para>
11472 </section>
11473 <section id="SECID74">
11474 <title>Special PostgreSQL features</title>
11475 <para>
11476 PostgreSQL lookups can also use Unix domain socket connections to the database.
11477 This is usually faster and costs less CPU time than a TCP/IP connection.
11478 However it can be used only if the mail server runs on the same machine as the
11479 database server. A configuration line for PostgreSQL via Unix domain sockets
11480 looks like this:
11481 </para>
11482 <literallayout class="monospaced">
11483 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11484 </literallayout>
11485 <para>
11486 In other words, instead of supplying a host name, a path to the socket is
11487 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11488 visually confused with the delimiters for the other server parameters.
11489 </para>
11490 <para>
11491 If a PostgreSQL query is issued that does not request any data (an insert,
11492 update, or delete command), the result of the lookup is the number of rows
11493 affected.
11494 </para>
11495 </section>
11496 <section id="SECTsqlite">
11497 <title>More about SQLite</title>
11498 <para>
11499 <indexterm role="concept">
11500 <primary>lookup</primary>
11501 <secondary>SQLite</secondary>
11502 </indexterm>
11503 <indexterm role="concept">
11504 <primary>sqlite lookup type</primary>
11505 </indexterm>
11506 SQLite is different to the other SQL lookups because a file name is required in
11507 addition to the SQL query. An SQLite database is a single file, and there is no
11508 daemon as in the other SQL databases. The interface to Exim requires the name
11509 of the file, as an absolute path, to be given at the start of the query. It is
11510 separated from the query by white space. This means that the path name cannot
11511 contain white space. Here is a lookup expansion example:
11512 </para>
11513 <literallayout class="monospaced">
11514 ${lookup sqlite {/some/thing/sqlitedb \
11515   select name from aliases where id='userx';}}
11516 </literallayout>
11517 <para>
11518 In a list, the syntax is similar. For example:
11519 </para>
11520 <literallayout class="monospaced">
11521 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11522    select * from relays where ip='$sender_host_address';
11523 </literallayout>
11524 <para>
11525 The only character affected by the <option>quote_sqlite</option> operator is a single
11526 quote, which it doubles.
11527 </para>
11528 <para>
11529 The SQLite library handles multiple simultaneous accesses to the database
11530 internally. Multiple readers are permitted, but only one process can
11531 update at once. Attempts to access the database while it is being updated
11532 are rejected after a timeout period, during which the SQLite library
11533 waits for the lock to be released. In Exim, the default timeout is set
11534 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11535 option.
11536 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11537 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11538 </para>
11539 </section>
11540 </chapter>
11541
11542 <chapter id="CHAPdomhosaddlists">
11543 <title>Domain, host, address, and local part lists</title>
11544 <titleabbrev>Domain, host, and address lists</titleabbrev>
11545 <para>
11546 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11547 <primary>lists of domains; hosts; etc.</primary>
11548 </indexterm>
11549 A number of Exim configuration options contain lists of domains, hosts,
11550 email addresses, or local parts. For example, the <option>hold_domains</option> option
11551 contains a list of domains whose delivery is currently suspended. These lists
11552 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11553 arguments to expansion conditions such as <option>match_domain</option>.
11554 </para>
11555 <para>
11556 Each item in one of these lists is a pattern to be matched against a domain,
11557 host, email address, or local part, respectively. In the sections below, the
11558 different types of pattern for each case are described, but first we cover some
11559 general facilities that apply to all four kinds of list.
11560 </para>
11561 <para revisionflag="changed">
11562 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11563 support all the complexity available in
11564 domain, host, address and local part lists.
11565 </para>
11566 <section id="SECTlistexpand">
11567 <title>Expansion of lists</title>
11568 <para>
11569 <indexterm role="concept">
11570 <primary>expansion</primary>
11571 <secondary>of lists</secondary>
11572 </indexterm>
11573 Each list is expanded as a single string before it is used. The result of
11574 expansion must be a list, possibly containing empty items, which is split up
11575 into separate items for matching. By default, colon is the separator character,
11576 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11577 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11578 discusses the way to specify empty list items.
11579 </para>
11580 <para>
11581 If the string expansion is forced to fail, Exim behaves as if the item it is
11582 testing (domain, host, address, or local part) is not in the list. Other
11583 expansion failures cause temporary errors.
11584 </para>
11585 <para>
11586 If an item in a list is a regular expression, backslashes, dollars and possibly
11587 other special characters in the expression must be protected against
11588 misinterpretation by the string expander. The easiest way to do this is to use
11589 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11590 expression should not be expanded. For example, in an ACL you might have:
11591 </para>
11592 <literallayout class="monospaced">
11593 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11594                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11595 </literallayout>
11596 <para>
11597 The first item is a regular expression that is protected from expansion by
11598 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11599 senders based on the receiving domain.
11600 </para>
11601 </section>
11602 <section id="SECID76">
11603 <title>Negated items in lists</title>
11604 <para>
11605 <indexterm role="concept">
11606 <primary>list</primary>
11607 <secondary>negation</secondary>
11608 </indexterm>
11609 <indexterm role="concept">
11610 <primary>negation</primary>
11611 <secondary>in lists</secondary>
11612 </indexterm>
11613 Items in a list may be positive or negative. Negative items are indicated by a
11614 leading exclamation mark, which may be followed by optional white space. A list
11615 defines a set of items (domains, etc). When Exim processes one of these lists,
11616 it is trying to find out whether a domain, host, address, or local part
11617 (respectively) is in the set that is defined by the list. It works like this:
11618 </para>
11619 <para>
11620 The list is scanned from left to right. If a positive item is matched, the
11621 subject that is being checked is in the set; if a negative item is matched, the
11622 subject is not in the set. If the end of the list is reached without the
11623 subject having matched any of the patterns, it is in the set if the last item
11624 was a negative one, but not if it was a positive one. For example, the list in
11625 </para>
11626 <literallayout class="monospaced">
11627 domainlist relay_to_domains = !a.b.c : *.b.c
11628 </literallayout>
11629 <para>
11630 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11631 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11632 list is positive. However, if the setting were
11633 </para>
11634 <literallayout class="monospaced">
11635 domainlist relay_to_domains = !a.b.c
11636 </literallayout>
11637 <para>
11638 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11639 list is negative. In other words, a list that ends with a negative item behaves
11640 as if it had an extra item <literal>:*</literal> on the end.
11641 </para>
11642 <para>
11643 Another way of thinking about positive and negative items in lists is to read
11644 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11645 item.
11646 </para>
11647 </section>
11648 <section id="SECTfilnamlis">
11649 <title>File names in lists</title>
11650 <para>
11651 <indexterm role="concept">
11652 <primary>list</primary>
11653 <secondary>file name in</secondary>
11654 </indexterm>
11655 If an item in a domain, host, address, or local part list is an absolute file
11656 name (beginning with a slash character), each line of the file is read and
11657 processed as if it were an independent item in the list, except that further
11658 file names are not allowed,
11659 and no expansion of the data from the file takes place.
11660 Empty lines in the file are ignored, and the file may also contain comment
11661 lines:
11662 </para>
11663 <itemizedlist>
11664 <listitem>
11665 <para>
11666 For domain and host lists, if a # character appears anywhere in a line of the
11667 file, it and all following characters are ignored.
11668 </para>
11669 </listitem>
11670 <listitem>
11671 <para>
11672 Because local parts may legitimately contain # characters, a comment in an
11673 address list or local part list file is recognized only if # is preceded by
11674 white space or the start of the line. For example:
11675 </para>
11676 <literallayout class="monospaced">
11677 not#comment@x.y.z   # but this is a comment
11678 </literallayout>
11679 </listitem>
11680 </itemizedlist>
11681 <para>
11682 Putting a file name in a list has the same effect as inserting each line of the
11683 file as an item in the list (blank lines and comments excepted). However, there
11684 is one important difference: the file is read each time the list is processed,
11685 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11686 </para>
11687 <para>
11688 If a file name is preceded by an exclamation mark, the sense of any match
11689 within the file is inverted. For example, if
11690 </para>
11691 <literallayout class="monospaced">
11692 hold_domains = !/etc/nohold-domains
11693 </literallayout>
11694 <para>
11695 and the file contains the lines
11696 </para>
11697 <literallayout class="monospaced">
11698 !a.b.c
11699 *.b.c
11700 </literallayout>
11701 <para>
11702 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11703 any domain matching <literal>*.b.c</literal> is not.
11704 </para>
11705 </section>
11706 <section id="SECID77">
11707 <title>An lsearch file is not an out-of-line list</title>
11708 <para>
11709 As will be described in the sections that follow, lookups can be used in lists
11710 to provide indexed methods of checking list membership. There has been some
11711 confusion about the way <command>lsearch</command> lookups work in lists. Because
11712 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11713 sometimes thought that it is allowed to contain wild cards and other kinds of
11714 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11715 always fixed strings, just as for any other single-key lookup type.
11716 </para>
11717 <para>
11718 If you want to use a file to contain wild-card patterns that form part of a
11719 list, just give the file name on its own, without a search type, as described
11720 in the previous section. You could also use the <command>wildlsearch</command> or
11721 <command>nwildlsearch</command>, but there is no advantage in doing this.
11722 </para>
11723 </section>
11724 <section id="SECTnamedlists">
11725 <title>Named lists</title>
11726 <para>
11727 <indexterm role="concept">
11728 <primary>named lists</primary>
11729 </indexterm>
11730 <indexterm role="concept">
11731 <primary>list</primary>
11732 <secondary>named</secondary>
11733 </indexterm>
11734 A list of domains, hosts, email addresses, or local parts can be given a name
11735 which is then used to refer to the list elsewhere in the configuration. This is
11736 particularly convenient if the same list is required in several different
11737 places. It also allows lists to be given meaningful names, which can improve
11738 the readability of the configuration. For example, it is conventional to define
11739 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11740 locally on a host, using a configuration line such as
11741 </para>
11742 <literallayout class="monospaced">
11743 domainlist local_domains = localhost:my.dom.example
11744 </literallayout>
11745 <para>
11746 Named lists are referenced by giving their name preceded by a plus sign, so,
11747 for example, a router that is intended to handle local domains would be
11748 configured with the line
11749 </para>
11750 <literallayout class="monospaced">
11751 domains = +local_domains
11752 </literallayout>
11753 <para>
11754 The first router in a configuration is often one that handles all domains
11755 except the local ones, using a configuration with a negated item like this:
11756 </para>
11757 <literallayout class="monospaced">
11758 dnslookup:
11759   driver = dnslookup
11760   domains = ! +local_domains
11761   transport = remote_smtp
11762   no_more
11763 </literallayout>
11764 <para>
11765 The four kinds of named list are created by configuration lines starting with
11766 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11767 respectively. Then there follows the name that you are defining, followed by an
11768 equals sign and the list itself. For example:
11769 </para>
11770 <literallayout class="monospaced">
11771 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11772 addresslist bad_senders = cdb;/etc/badsenders
11773 </literallayout>
11774 <para>
11775 A named list may refer to other named lists:
11776 </para>
11777 <literallayout class="monospaced">
11778 domainlist  dom1 = first.example : second.example
11779 domainlist  dom2 = +dom1 : third.example
11780 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11781 </literallayout>
11782 <para>
11783 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11784 effect may not be what you intended, because the negation does not propagate
11785 out to the higher level. For example, consider:
11786 </para>
11787 <literallayout class="monospaced">
11788 domainlist  dom1 = !a.b
11789 domainlist  dom2 = +dom1 : *.b
11790 </literallayout>
11791 <para>
11792 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11793 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11794 means it matches the second list as well. The effect is not the same as
11795 </para>
11796 <literallayout class="monospaced">
11797 domainlist  dom2 = !a.b : *.b
11798 </literallayout>
11799 <para>
11800 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11801 referenced lists if you can.
11802 </para>
11803 <para>
11804 Named lists may have a performance advantage. When Exim is routing an
11805 address or checking an incoming message, it caches the result of tests on named
11806 lists. So, if you have a setting such as
11807 </para>
11808 <literallayout class="monospaced">
11809 domains = +local_domains
11810 </literallayout>
11811 <para>
11812 on several of your routers
11813 or in several ACL statements,
11814 the actual test is done only for the first one. However, the caching works only
11815 if there are no expansions within the list itself or any sublists that it
11816 references. In other words, caching happens only for lists that are known to be
11817 the same each time they are referenced.
11818 </para>
11819 <para>
11820 By default, there may be up to 16 named lists of each type. This limit can be
11821 extended by changing a compile-time variable. The use of domain and host lists
11822 is recommended for concepts such as local domains, relay domains, and relay
11823 hosts. The default configuration is set up like this.
11824 </para>
11825 </section>
11826 <section id="SECID78">
11827 <title>Named lists compared with macros</title>
11828 <para>
11829 <indexterm role="concept">
11830 <primary>list</primary>
11831 <secondary>named compared with macro</secondary>
11832 </indexterm>
11833 <indexterm role="concept">
11834 <primary>macro</primary>
11835 <secondary>compared with named list</secondary>
11836 </indexterm>
11837 At first sight, named lists might seem to be no different from macros in the
11838 configuration file. However, macros are just textual substitutions. If you
11839 write
11840 </para>
11841 <literallayout class="monospaced">
11842 ALIST = host1 : host2
11843 auth_advertise_hosts = !ALIST
11844 </literallayout>
11845 <para>
11846 it probably won&#x2019;t do what you want, because that is exactly the same as
11847 </para>
11848 <literallayout class="monospaced">
11849 auth_advertise_hosts = !host1 : host2
11850 </literallayout>
11851 <para>
11852 Notice that the second host name is not negated. However, if you use a host
11853 list, and write
11854 </para>
11855 <literallayout class="monospaced">
11856 hostlist alist = host1 : host2
11857 auth_advertise_hosts = ! +alist
11858 </literallayout>
11859 <para>
11860 the negation applies to the whole list, and so that is equivalent to
11861 </para>
11862 <literallayout class="monospaced">
11863 auth_advertise_hosts = !host1 : !host2
11864 </literallayout>
11865 </section>
11866 <section id="SECID79">
11867 <title>Named list caching</title>
11868 <para>
11869 <indexterm role="concept">
11870 <primary>list</primary>
11871 <secondary>caching of named</secondary>
11872 </indexterm>
11873 <indexterm role="concept">
11874 <primary>caching</primary>
11875 <secondary>named lists</secondary>
11876 </indexterm>
11877 While processing a message, Exim caches the result of checking a named list if
11878 it is sure that the list is the same each time. In practice, this means that
11879 the cache operates only if the list contains no $ characters, which guarantees
11880 that it will not change when it is expanded. Sometimes, however, you may have
11881 an expanded list that you know will be the same each time within a given
11882 message. For example:
11883 </para>
11884 <literallayout class="monospaced">
11885 domainlist special_domains = \
11886            ${lookup{$sender_host_address}cdb{/some/file}}
11887 </literallayout>
11888 <para>
11889 This provides a list of domains that depends only on the sending host&#x2019;s IP
11890 address. If this domain list is referenced a number of times (for example,
11891 in several ACL lines, or in several routers) the result of the check is not
11892 cached by default, because Exim does not know that it is going to be the
11893 same list each time.
11894 </para>
11895 <para>
11896 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11897 cache the result anyway. For example:
11898 </para>
11899 <literallayout class="monospaced">
11900 domainlist_cache special_domains = ${lookup{...
11901 </literallayout>
11902 <para>
11903 If you do this, you should be absolutely sure that caching is going to do
11904 the right thing in all cases. When in doubt, leave it out.
11905 </para>
11906 </section>
11907 <section id="SECTdomainlist">
11908 <title>Domain lists</title>
11909 <para>
11910 <indexterm role="concept">
11911 <primary>domain list</primary>
11912 <secondary>patterns for</secondary>
11913 </indexterm>
11914 <indexterm role="concept">
11915 <primary>list</primary>
11916 <secondary>domain list</secondary>
11917 </indexterm>
11918 Domain lists contain patterns that are to be matched against a mail domain.
11919 The following types of item may appear in domain lists:
11920 </para>
11921 <itemizedlist>
11922 <listitem>
11923 <para>
11924 <indexterm role="concept">
11925 <primary>primary host name</primary>
11926 </indexterm>
11927 <indexterm role="concept">
11928 <primary>host name</primary>
11929 <secondary>matched in domain list</secondary>
11930 </indexterm>
11931 <indexterm role="option">
11932 <primary><option>primary_hostname</option></primary>
11933 </indexterm>
11934 <indexterm role="concept">
11935 <primary>domain list</primary>
11936 <secondary>matching primary host name</secondary>
11937 </indexterm>
11938 <indexterm role="concept">
11939 <primary>@ in a domain list</primary>
11940 </indexterm>
11941 If a pattern consists of a single @ character, it matches the local host name,
11942 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11943 possible to use the same configuration file on several different hosts that
11944 differ only in their names.
11945 </para>
11946 </listitem>
11947 <listitem>
11948 <para>
11949 <indexterm role="concept">
11950 <primary>@[] in a domain list</primary>
11951 </indexterm>
11952 <indexterm role="concept">
11953 <primary>domain list</primary>
11954 <secondary>matching local IP interfaces</secondary>
11955 </indexterm>
11956 <indexterm role="concept">
11957 <primary>domain literal</primary>
11958 </indexterm>
11959 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11960 in square brackets (as in an email address that contains a domain literal), but
11961 only if that IP address is recognized as local for email routing purposes. The
11962 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11963 control which of a host&#x2019;s several IP addresses are treated as local.
11964 In today&#x2019;s Internet, the use of domain literals is controversial.
11965 </para>
11966 </listitem>
11967 <listitem>
11968 <para>
11969 <indexterm role="concept">
11970 <primary>@mx_any</primary>
11971 </indexterm>
11972 <indexterm role="concept">
11973 <primary>@mx_primary</primary>
11974 </indexterm>
11975 <indexterm role="concept">
11976 <primary>@mx_secondary</primary>
11977 </indexterm>
11978 <indexterm role="concept">
11979 <primary>domain list</primary>
11980 <secondary>matching MX pointers to local host</secondary>
11981 </indexterm>
11982 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11983 has an MX record pointing to the local host or to any host that is listed in
11984 <indexterm role="option">
11985 <primary><option>hosts_treat_as_local</option></primary>
11986 </indexterm>
11987 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11988 are similar, except that the first matches only when a primary MX target is the
11989 local host, and the second only when no primary MX target is the local host,
11990 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11991 preference value &ndash; there may of course be more than one of them.
11992 </para>
11993 <para>
11994 The MX lookup that takes place when matching a pattern of this type is
11995 performed with the resolver options for widening names turned off. Thus, for
11996 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11997 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11998 options of the <command>dnslookup</command> router for a discussion of domain widening.
11999 </para>
12000 <para>
12001 Sometimes you may want to ignore certain IP addresses when using one of these
12002 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12003 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12004 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12005 on a router). For example:
12006 </para>
12007 <literallayout class="monospaced">
12008 domains = @mx_any/ignore=127.0.0.1
12009 </literallayout>
12010 <para>
12011 This example matches any domain that has an MX record pointing to one of
12012 the local host&#x2019;s IP addresses other than 127.0.0.1.
12013 </para>
12014 <para>
12015 The list of IP addresses is in fact processed by the same code that processes
12016 host lists, so it may contain CIDR-coded network specifications and it may also
12017 contain negative items.
12018 </para>
12019 <para>
12020 Because the list of IP addresses is a sublist within a domain list, you have to
12021 be careful about delimiters if there is more than one address. Like any other
12022 list, the default delimiter can be changed. Thus, you might have:
12023 </para>
12024 <literallayout class="monospaced">
12025 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12026           an.other.domain : ...
12027 </literallayout>
12028 <para>
12029 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12030 involved, it is easiest to change the delimiter for the main list as well:
12031 </para>
12032 <literallayout class="monospaced">
12033 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12034           an.other.domain ? ...
12035 </literallayout>
12036 </listitem>
12037 <listitem>
12038 <para>
12039 <indexterm role="concept">
12040 <primary>asterisk</primary>
12041 <secondary>in domain list</secondary>
12042 </indexterm>
12043 <indexterm role="concept">
12044 <primary>domain list</primary>
12045 <secondary>asterisk in</secondary>
12046 </indexterm>
12047 <indexterm role="concept">
12048 <primary>domain list</primary>
12049 <secondary>matching <quote>ends with</quote></secondary>
12050 </indexterm>
12051 If a pattern starts with an asterisk, the remaining characters of the pattern
12052 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12053 domain lists differs from its use in partial matching lookups. In a domain
12054 list, the character following the asterisk need not be a dot, whereas partial
12055 matching works only in terms of dot-separated components. For example, a domain
12056 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12057 <emphasis>cipher.key.ex</emphasis>.
12058 </para>
12059 </listitem>
12060 <listitem>
12061 <para>
12062 <indexterm role="concept">
12063 <primary>regular expressions</primary>
12064 <secondary>in domain list</secondary>
12065 </indexterm>
12066 <indexterm role="concept">
12067 <primary>domain list</primary>
12068 <secondary>matching regular expression</secondary>
12069 </indexterm>
12070 If a pattern starts with a circumflex character, it is treated as a regular
12071 expression, and matched against the domain using a regular expression matching
12072 function. The circumflex is treated as part of the regular expression.
12073 Email domains are case-independent, so this regular expression match is by
12074 default case-independent, but you can make it case-dependent by starting it
12075 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12076 are given in chapter <xref linkend="CHAPregexp"/>.
12077 </para>
12078 <para>
12079 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12080 must escape any backslash and dollar characters in the regular expression, or
12081 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12082 it is not to be expanded (unless you really do want to build a regular
12083 expression by expansion, of course).
12084 </para>
12085 </listitem>
12086 <listitem>
12087 <para>
12088 <indexterm role="concept">
12089 <primary>lookup</primary>
12090 <secondary>in domain list</secondary>
12091 </indexterm>
12092 <indexterm role="concept">
12093 <primary>domain list</primary>
12094 <secondary>matching by lookup</secondary>
12095 </indexterm>
12096 If a pattern starts with the name of a single-key lookup type followed by a
12097 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12098 must be a file name in a suitable format for the lookup type. For example, for
12099 <quote>cdb;</quote> it must be an absolute path:
12100 </para>
12101 <literallayout class="monospaced">
12102 domains = cdb;/etc/mail/local_domains.cdb
12103 </literallayout>
12104 <para>
12105 The appropriate type of lookup is done on the file using the domain name as the
12106 key. In most cases, the data that is looked up is not used; Exim is interested
12107 only in whether or not the key is present in the file. However, when a lookup
12108 is used for the <option>domains</option> option on a router
12109 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12110 <varname>$domain_data</varname> variable and can be referred to in other router options or
12111 other statements in the same ACL.
12112 </para>
12113 </listitem>
12114 <listitem>
12115 <para>
12116 Any of the single-key lookup type names may be preceded by
12117 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12118 </para>
12119 <literallayout class="monospaced">
12120 domains = partial-dbm;/partial/domains
12121 </literallayout>
12122 <para>
12123 This causes partial matching logic to be invoked; a description of how this
12124 works is given in section <xref linkend="SECTpartiallookup"/>.
12125 </para>
12126 </listitem>
12127 <listitem>
12128 <para>
12129 <indexterm role="concept">
12130 <primary>asterisk</primary>
12131 <secondary>in lookup type</secondary>
12132 </indexterm>
12133 Any of the single-key lookup types may be followed by an asterisk. This causes
12134 a default lookup for a key consisting of a single asterisk to be done if the
12135 original lookup fails. This is not a useful feature when using a domain list to
12136 select particular domains (because any domain would match), but it might have
12137 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12138 expansion variable.
12139 </para>
12140 </listitem>
12141 <listitem>
12142 <para>
12143 If the pattern starts with the name of a query-style lookup type followed by a
12144 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12145 pattern must be an appropriate query for the lookup type, as described in
12146 chapter <xref linkend="CHAPfdlookup"/>. For example:
12147 </para>
12148 <literallayout class="monospaced">
12149 hold_domains = mysql;select domain from holdlist \
12150   where domain = '${quote_mysql:$domain}';
12151 </literallayout>
12152 <para>
12153 In most cases, the data that is looked up is not used (so for an SQL query, for
12154 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12155 whether or not the query succeeds. However, when a lookup is used for the
12156 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12157 variable and can be referred to in other options.
12158 </para>
12159 </listitem>
12160 <listitem>
12161 <para>
12162 <indexterm role="concept">
12163 <primary>domain list</primary>
12164 <secondary>matching literal domain name</secondary>
12165 </indexterm>
12166 If none of the above cases apply, a caseless textual comparison is made
12167 between the pattern and the domain.
12168 </para>
12169 </listitem>
12170 </itemizedlist>
12171 <para>
12172 Here is an example that uses several different kinds of pattern:
12173 </para>
12174 <literallayout class="monospaced">
12175 domainlist funny_domains = \
12176   @ : \
12177   lib.unseen.edu : \
12178   *.foundation.fict.example : \
12179   \N^[1-2]\d{3}\.fict\.example$\N : \
12180   partial-dbm;/opt/data/penguin/book : \
12181   nis;domains.byname : \
12182   nisplus;[name=$domain,status=local],domains.org_dir
12183 </literallayout>
12184 <para>
12185 There are obvious processing trade-offs among the various matching modes. Using
12186 an asterisk is faster than a regular expression, and listing a few names
12187 explicitly probably is too. The use of a file or database lookup is expensive,
12188 but may be the only option if hundreds of names are required. Because the
12189 patterns are tested in order, it makes sense to put the most commonly matched
12190 patterns earlier.
12191 </para>
12192 </section>
12193 <section id="SECThostlist">
12194 <title>Host lists</title>
12195 <para>
12196 <indexterm role="concept">
12197 <primary>host list</primary>
12198 <secondary>patterns in</secondary>
12199 </indexterm>
12200 <indexterm role="concept">
12201 <primary>list</primary>
12202 <secondary>host list</secondary>
12203 </indexterm>
12204 Host lists are used to control what remote hosts are allowed to do. For
12205 example, some hosts may be allowed to use the local host as a relay, and some
12206 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12207 two different ways, by name or by IP address. In a host list, some types of
12208 pattern are matched to a host name, and some are matched to an IP address.
12209 You need to be particularly careful with this when single-key lookups are
12210 involved, to ensure that the right value is being used as the key.
12211 </para>
12212 </section>
12213 <section id="SECID80">
12214 <title>Special host list patterns</title>
12215 <para>
12216 <indexterm role="concept">
12217 <primary>empty item in hosts list</primary>
12218 </indexterm>
12219 <indexterm role="concept">
12220 <primary>host list</primary>
12221 <secondary>empty string in</secondary>
12222 </indexterm>
12223 If a host list item is the empty string, it matches only when no remote host is
12224 involved. This is the case when a message is being received from a local
12225 process using SMTP on the standard input, that is, when a TCP/IP connection is
12226 not used.
12227 </para>
12228 <para>
12229 <indexterm role="concept">
12230 <primary>asterisk</primary>
12231 <secondary>in host list</secondary>
12232 </indexterm>
12233 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12234 the IP address nor the name is actually inspected.
12235 </para>
12236 </section>
12237 <section id="SECThoslispatip">
12238 <title>Host list patterns that match by IP address</title>
12239 <para>
12240 <indexterm role="concept">
12241 <primary>host list</primary>
12242 <secondary>matching IP addresses</secondary>
12243 </indexterm>
12244 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12245 the incoming address actually appears in the IPv6 host as
12246 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12247 list, it is converted into a traditional IPv4 address first. (Not all operating
12248 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12249 concerns.)
12250 </para>
12251 <para>
12252 The following types of pattern in a host list check the remote host by
12253 inspecting its IP address:
12254 </para>
12255 <itemizedlist>
12256 <listitem>
12257 <para>
12258 If the pattern is a plain domain name (not a regular expression, not starting
12259 with *, not a lookup of any kind), Exim calls the operating system function
12260 to find the associated IP address(es). Exim uses the newer
12261 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12262 This typically causes a forward DNS lookup of the name. The result is compared
12263 with the IP address of the subject host.
12264 </para>
12265 <para>
12266 If there is a temporary problem (such as a DNS timeout) with the host name
12267 lookup, a temporary error occurs. For example, if the list is being used in an
12268 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12269 temporary SMTP error code. If no IP address can be found for the host name,
12270 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12271 </para>
12272 </listitem>
12273 <listitem>
12274 <para>
12275 <indexterm role="concept">
12276 <primary>@ in a host list</primary>
12277 </indexterm>
12278 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12279 domain name, as just described.
12280 </para>
12281 </listitem>
12282 <listitem>
12283 <para>
12284 If the pattern is an IP address, it is matched against the IP address of the
12285 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12286 IPv6 addresses can be given in colon-separated format, but the colons have to
12287 be doubled so as not to be taken as item separators when the default list
12288 separator is used. IPv6 addresses are recognized even when Exim is compiled
12289 without IPv6 support. This means that if they appear in a host list on an
12290 IPv4-only host, Exim will not treat them as host names. They are just addresses
12291 that can never match a client host.
12292 </para>
12293 </listitem>
12294 <listitem>
12295 <para>
12296 <indexterm role="concept">
12297 <primary>@[] in a host list</primary>
12298 </indexterm>
12299 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12300 the local host. For example, if the local host is an IPv4 host with one
12301 interface address 10.45.23.56, these two ACL statements have the same effect:
12302 </para>
12303 <literallayout class="monospaced">
12304 accept hosts = 127.0.0.1 : 10.45.23.56
12305 accept hosts = @[]
12306 </literallayout>
12307 </listitem>
12308 <listitem>
12309 <para>
12310 <indexterm role="concept">
12311 <primary>CIDR notation</primary>
12312 </indexterm>
12313 If the pattern is an IP address followed by a slash and a mask length (for
12314 example 10.11.42.0/24), it is matched against the IP address of the subject
12315 host under the given mask. This allows, an entire network of hosts to be
12316 included (or excluded) by a single item. The mask uses CIDR notation; it
12317 specifies the number of address bits that must match, starting from the most
12318 significant end of the address.
12319 </para>
12320 <para>
12321 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12322 of a range of addresses. It is the number of bits in the network portion of the
12323 address. The above example specifies a 24-bit netmask, so it matches all 256
12324 addresses in the 10.11.42.0 network. An item such as
12325 </para>
12326 <literallayout class="monospaced">
12327 192.168.23.236/31
12328 </literallayout>
12329 <para>
12330 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12331 32 for an IPv4 address is the same as no mask at all; just a single address
12332 matches.
12333 </para>
12334 <para>
12335 Here is another example which shows an IPv4 and an IPv6 network:
12336 </para>
12337 <literallayout class="monospaced">
12338 recipient_unqualified_hosts = 192.168.0.0/16: \
12339                               3ffe::ffff::836f::::/48
12340 </literallayout>
12341 <para>
12342 The doubling of list separator characters applies only when these items
12343 appear inline in a host list. It is not required when indirecting via a file.
12344 For example:
12345 </para>
12346 <literallayout class="monospaced">
12347 recipient_unqualified_hosts = /opt/exim/unqualnets
12348 </literallayout>
12349 <para>
12350 could make use of a file containing
12351 </para>
12352 <literallayout class="monospaced">
12353 172.16.0.0/12
12354 3ffe:ffff:836f::/48
12355 </literallayout>
12356 <para>
12357 to have exactly the same effect as the previous example. When listing IPv6
12358 addresses inline, it is usually more convenient to use the facility for
12359 changing separator characters. This list contains the same two networks:
12360 </para>
12361 <literallayout class="monospaced">
12362 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12363                                  3ffe:ffff:836f::/48
12364 </literallayout>
12365 <para>
12366 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12367 list.
12368 </para>
12369 </listitem>
12370 </itemizedlist>
12371 </section>
12372 <section id="SECThoslispatsikey">
12373 <title>Host list patterns for single-key lookups by host address</title>
12374 <para>
12375 <indexterm role="concept">
12376 <primary>host list</primary>
12377 <secondary>lookup of IP address</secondary>
12378 </indexterm>
12379 When a host is to be identified by a single-key lookup of its complete IP
12380 address, the pattern takes this form:
12381 </para>
12382 <literallayout>
12383 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12384 </literallayout>
12385 <para>
12386 For example:
12387 </para>
12388 <literallayout class="monospaced">
12389 hosts_lookup = net-cdb;/hosts-by-ip.db
12390 </literallayout>
12391 <para>
12392 The text form of the IP address of the subject host is used as the lookup key.
12393 IPv6 addresses are converted to an unabbreviated form, using lower case
12394 letters, with dots as separators because colon is the key terminator in
12395 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12396 quoting the keys, but this is a facility that was added later.] The data
12397 returned by the lookup is not used.
12398 </para>
12399 <para>
12400 <indexterm role="concept">
12401 <primary>IP address</primary>
12402 <secondary>masking</secondary>
12403 </indexterm>
12404 <indexterm role="concept">
12405 <primary>host list</primary>
12406 <secondary>masked IP address</secondary>
12407 </indexterm>
12408 Single-key lookups can also be performed using masked IP addresses, using
12409 patterns of this form:
12410 </para>
12411 <literallayout>
12412 <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>
12413 </literallayout>
12414 <para>
12415 For example:
12416 </para>
12417 <literallayout class="monospaced">
12418 net24-dbm;/networks.db
12419 </literallayout>
12420 <para>
12421 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12422 length. A textual string is constructed from the masked value, followed by the
12423 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12424 is 192.168.34.6, the key that is looked up for the above example is
12425 <quote>192.168.34.0/24</quote>.
12426 </para>
12427 <para>
12428 When an IPv6 address is converted to a string, dots are normally used instead
12429 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12430 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12431 to quote keys was made available in <command>lsearch</command> files. However, the more
12432 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12433 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12434 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12435 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12436 addresses are always used.
12437 </para>
12438 <para>
12439 Ideally, it would be nice to tidy up this anomalous situation by changing to
12440 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12441 However, this would be an incompatible change that might break some existing
12442 configurations.
12443 </para>
12444 <para>
12445 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12446 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12447 the former case the key strings include the mask value, whereas in the latter
12448 case the IP address is used on its own.
12449 </para>
12450 </section>
12451 <section id="SECThoslispatnam">
12452 <title>Host list patterns that match by host name</title>
12453 <para>
12454 <indexterm role="concept">
12455 <primary>host</primary>
12456 <secondary>lookup failures</secondary>
12457 </indexterm>
12458 <indexterm role="concept">
12459 <primary>unknown host name</primary>
12460 </indexterm>
12461 <indexterm role="concept">
12462 <primary>host list</primary>
12463 <secondary>matching host name</secondary>
12464 </indexterm>
12465 There are several types of pattern that require Exim to know the name of the
12466 remote host. These are either wildcard patterns or lookups by name. (If a
12467 complete hostname is given without any wildcarding, it is used to find an IP
12468 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12469 above.)
12470 </para>
12471 <para>
12472 If the remote host name is not already known when Exim encounters one of these
12473 patterns, it has to be found from the IP address.
12474 Although many sites on the Internet are conscientious about maintaining reverse
12475 DNS data for their hosts, there are also many that do not do this.
12476 Consequently, a name cannot always be found, and this may lead to unwanted
12477 effects. Take care when configuring host lists with wildcarded name patterns.
12478 Consider what will happen if a name cannot be found.
12479 </para>
12480 <para>
12481 Because of the problems of determining host names from IP addresses, matching
12482 against host names is not as common as matching against IP addresses.
12483 </para>
12484 <para>
12485 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12486 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12487 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12488 are done can be changed by setting the <option>host_lookup_order</option> option. For
12489 security, once Exim has found one or more names, it looks up the IP addresses
12490 for these names and compares them with the IP address that it started with.
12491 Only those names whose IP addresses match are accepted. Any other names are
12492 discarded. If no names are left, Exim behaves as if the host name cannot be
12493 found. In the most common case there is only one name and one IP address.
12494 </para>
12495 <para>
12496 There are some options that control what happens if a host name cannot be
12497 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12498 </para>
12499 <para>
12500 <indexterm role="concept">
12501 <primary>host</primary>
12502 <secondary>alias for</secondary>
12503 </indexterm>
12504 <indexterm role="concept">
12505 <primary>alias for host</primary>
12506 </indexterm>
12507 As a result of aliasing, hosts may have more than one name. When processing any
12508 of the following types of pattern, all the host&#x2019;s names are checked:
12509 </para>
12510 <itemizedlist>
12511 <listitem>
12512 <para>
12513 <indexterm role="concept">
12514 <primary>asterisk</primary>
12515 <secondary>in host list</secondary>
12516 </indexterm>
12517 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12518 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12519 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12520 requirement. Other kinds of wildcarding require the use of a regular
12521 expression.
12522 </para>
12523 </listitem>
12524 <listitem>
12525 <para>
12526 <indexterm role="concept">
12527 <primary>regular expressions</primary>
12528 <secondary>in host list</secondary>
12529 </indexterm>
12530 <indexterm role="concept">
12531 <primary>host list</primary>
12532 <secondary>regular expression in</secondary>
12533 </indexterm>
12534 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12535 matched against the host name. Host names are case-independent, so this regular
12536 expression match is by default case-independent, but you can make it
12537 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12538 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12539 example,
12540 </para>
12541 <literallayout class="monospaced">
12542 ^(a|b)\.c\.d$
12543 </literallayout>
12544 <para>
12545 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12546 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12547 that backslash and dollar characters are not misinterpreted as part of the
12548 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12549 part of the string as non-expandable. For example:
12550 </para>
12551 <literallayout class="monospaced">
12552 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12553 </literallayout>
12554 <para>
12555 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12556 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12557 example. Without it, a match at the start of the host name is all that is
12558 required.
12559 </para>
12560 </listitem>
12561 </itemizedlist>
12562 </section>
12563 <section id="SECTbehipnot">
12564 <title>Behaviour when an IP address or name cannot be found</title>
12565 <para>
12566 <indexterm role="concept">
12567 <primary>host</primary>
12568 <secondary>lookup failures, permanent</secondary>
12569 </indexterm>
12570 While processing a host list, Exim may need to look up an IP address from a
12571 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12572 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12573 behaviour when it fails to find the information it is seeking is the same.
12574 </para>
12575 <para>
12576 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12577 apply to temporary DNS errors, whose handling is described in the next section.
12578 </para>
12579 <para>
12580 <indexterm role="concept">
12581 <primary><literal>+include_unknown</literal></primary>
12582 </indexterm>
12583 <indexterm role="concept">
12584 <primary><literal>+ignore_unknown</literal></primary>
12585 </indexterm>
12586 Exim parses a host list from left to right. If it encounters a permanent
12587 lookup failure in any item in the host list before it has found a match,
12588 Exim treats it as a failure and the default behavior is as if the host
12589 does not match the list. This may not always be what you want to happen.
12590 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12591 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12592 not recognized in an indirected file).
12593 </para>
12594 <itemizedlist>
12595 <listitem>
12596 <para>
12597 If any item that follows <literal>+include_unknown</literal> requires information that
12598 cannot found, Exim behaves as if the host does match the list. For example,
12599 </para>
12600 <literallayout class="monospaced">
12601 host_reject_connection = +include_unknown:*.enemy.ex
12602 </literallayout>
12603 <para>
12604 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12605 any hosts whose name it cannot find.
12606 </para>
12607 </listitem>
12608 <listitem>
12609 <para>
12610 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12611 be found, Exim ignores that item and proceeds to the rest of the list. For
12612 example:
12613 </para>
12614 <literallayout class="monospaced">
12615 accept hosts = +ignore_unknown : friend.example : \
12616                192.168.4.5
12617 </literallayout>
12618 <para>
12619 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12620 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12621 name can be found for 192.168.4.5, it is rejected.
12622 </para>
12623 </listitem>
12624 </itemizedlist>
12625 <para>
12626 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12627 list. The effect of each one lasts until the next, or until the end of the
12628 list.
12629 </para>
12630 </section>
12631 <section id="SECTmixwilhos">
12632 <title>Mixing wildcarded host names and addresses in host lists</title>
12633 <para>
12634 <indexterm role="concept">
12635 <primary>host list</primary>
12636 <secondary>mixing names and addresses in</secondary>
12637 </indexterm>
12638 </para>
12639 <para>
12640 This section explains the host/ip processing logic with the same concepts
12641 as the previous section, but specifically addresses what happens when a
12642 wildcarded hostname is one of the items in the hostlist.
12643 </para>
12644 <itemizedlist>
12645 <listitem>
12646 <para>
12647 If you have name lookups or wildcarded host names and
12648 IP addresses in the same host list, you should normally put the IP
12649 addresses first. For example, in an ACL you could have:
12650 </para>
12651 <literallayout class="monospaced">
12652 accept hosts = 10.9.8.7 : *.friend.example
12653 </literallayout>
12654 <para>
12655 The reason you normally would order it this way lies in the
12656 left-to-right way that Exim processes lists.  It can test IP addresses
12657 without doing any DNS lookups, but when it reaches an item that requires
12658 a host name, it fails if it cannot find a host name to compare with the
12659 pattern. If the above list is given in the opposite order, the
12660 <option>accept</option> statement fails for a host whose name cannot be found, even
12661 if its IP address is 10.9.8.7.
12662 </para>
12663 </listitem>
12664 <listitem>
12665 <para>
12666 If you really do want to do the name check first, and still recognize the IP
12667 address, you can rewrite the ACL like this:
12668 </para>
12669 <literallayout class="monospaced">
12670 accept hosts = *.friend.example
12671 accept hosts = 10.9.8.7
12672 </literallayout>
12673 <para>
12674 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12675 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12676 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12677 this section.
12678 </para>
12679 </listitem>
12680 </itemizedlist>
12681 </section>
12682 <section id="SECTtemdnserr">
12683 <title>Temporary DNS errors when looking up host information</title>
12684 <para>
12685 <indexterm role="concept">
12686 <primary>host</primary>
12687 <secondary>lookup failures, temporary</secondary>
12688 </indexterm>
12689 <indexterm role="concept">
12690 <primary><literal>+include_defer</literal></primary>
12691 </indexterm>
12692 <indexterm role="concept">
12693 <primary><literal>+ignore_defer</literal></primary>
12694 </indexterm>
12695 A temporary DNS lookup failure normally causes a defer action (except when
12696 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12697 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
12698 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12699 section. These options should be used with care, probably only in non-critical
12700 host lists such as whitelists.
12701 </para>
12702 </section>
12703 <section id="SECThoslispatnamsk">
12704 <title>Host list patterns for single-key lookups by host name</title>
12705 <para>
12706 <indexterm role="concept">
12707 <primary>unknown host name</primary>
12708 </indexterm>
12709 <indexterm role="concept">
12710 <primary>host list</primary>
12711 <secondary>matching host name</secondary>
12712 </indexterm>
12713 If a pattern is of the form
12714 </para>
12715 <literallayout>
12716 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12717 </literallayout>
12718 <para>
12719 for example
12720 </para>
12721 <literallayout class="monospaced">
12722 dbm;/host/accept/list
12723 </literallayout>
12724 <para>
12725 a single-key lookup is performed, using the host name as its key. If the
12726 lookup succeeds, the host matches the item. The actual data that is looked up
12727 is not used.
12728 </para>
12729 <para>
12730 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12731 keys in the file, not IP addresses. If you want to do lookups based on IP
12732 addresses, you must precede the search type with <quote>net-</quote> (see section
12733 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12734 two items in the same list, one doing an address lookup and one doing a name
12735 lookup, both using the same file.
12736 </para>
12737 </section>
12738 <section id="SECID81">
12739 <title>Host list patterns for query-style lookups</title>
12740 <para>
12741 If a pattern is of the form
12742 </para>
12743 <literallayout>
12744 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12745 </literallayout>
12746 <para>
12747 the query is obeyed, and if it succeeds, the host matches the item. The actual
12748 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12749 <varname>$sender_host_name</varname> can be used in the query. For example:
12750 </para>
12751 <literallayout class="monospaced">
12752 hosts_lookup = pgsql;\
12753   select ip from hostlist where ip='$sender_host_address'
12754 </literallayout>
12755 <para>
12756 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12757 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12758 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12759 operator.
12760 </para>
12761 <para>
12762 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12763 looks up the host name if it has not already done so. (See section
12764 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12765 </para>
12766 <para>
12767 Historical note: prior to release 4.30, Exim would always attempt to find a
12768 host name before running the query, unless the search type was preceded by
12769 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12770 still recognized for query-style lookups, but its presence or absence has no
12771 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12772 See section <xref linkend="SECThoslispatsikey"/>.)
12773 </para>
12774 </section>
12775 <section id="SECTaddresslist">
12776 <title>Address lists</title>
12777 <para>
12778 <indexterm role="concept">
12779 <primary>list</primary>
12780 <secondary>address list</secondary>
12781 </indexterm>
12782 <indexterm role="concept">
12783 <primary>address list</primary>
12784 <secondary>empty item</secondary>
12785 </indexterm>
12786 <indexterm role="concept">
12787 <primary>address list</primary>
12788 <secondary>patterns</secondary>
12789 </indexterm>
12790 Address lists contain patterns that are matched against mail addresses. There
12791 is one special case to be considered: the sender address of a bounce message is
12792 always empty. You can test for this by providing an empty item in an address
12793 list. For example, you can set up a router to process bounce messages by
12794 using this option setting:
12795 </para>
12796 <literallayout class="monospaced">
12797 senders = :
12798 </literallayout>
12799 <para>
12800 The presence of the colon creates an empty item. If you do not provide any
12801 data, the list is empty and matches nothing. The empty sender can also be
12802 detected by a regular expression that matches an empty string,
12803 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12804 </para>
12805 <para>
12806 Non-empty items in an address list can be straightforward email addresses. For
12807 example:
12808 </para>
12809 <literallayout class="monospaced">
12810 senders = jbc@askone.example : hs@anacreon.example
12811 </literallayout>
12812 <para>
12813 A certain amount of wildcarding is permitted. If a pattern contains an @
12814 character, but is not a regular expression and does not begin with a
12815 semicolon-terminated lookup type (described below), the local part of the
12816 subject address is compared with the local part of the pattern, which may start
12817 with an asterisk. If the local parts match, the domain is checked in exactly
12818 the same way as for a pattern in a domain list. For example, the domain can be
12819 wildcarded, refer to a named list, or be a lookup:
12820 </para>
12821 <literallayout class="monospaced">
12822 deny senders = *@*.spamming.site:\
12823                *@+hostile_domains:\
12824                bozo@partial-lsearch;/list/of/dodgy/sites:\
12825                *@dbm;/bad/domains.db
12826 </literallayout>
12827 <para>
12828 <indexterm role="concept">
12829 <primary>local part</primary>
12830 <secondary>starting with !</secondary>
12831 </indexterm>
12832 <indexterm role="concept">
12833 <primary>address list</primary>
12834 <secondary>local part starting with !</secondary>
12835 </indexterm>
12836 If a local part that begins with an exclamation mark is required, it has to be
12837 specified using a regular expression, because otherwise the exclamation mark is
12838 treated as a sign of negation, as is standard in lists.
12839 </para>
12840 <para>
12841 If a non-empty pattern that is not a regular expression or a lookup does not
12842 contain an @ character, it is matched against the domain part of the subject
12843 address. The only two formats that are recognized this way are a literal
12844 domain, or a domain pattern that starts with *. In both these cases, the effect
12845 is the same as if <literal>*@</literal> preceded the pattern. For example:
12846 </para>
12847 <literallayout class="monospaced">
12848 deny senders = enemy.domain : *.enemy.domain
12849 </literallayout>
12850 <para>
12851 The following kinds of more complicated address list pattern can match any
12852 address, including the empty address that is characteristic of bounce message
12853 senders:
12854 </para>
12855 <itemizedlist>
12856 <listitem>
12857 <para>
12858 <indexterm role="concept">
12859 <primary>regular expressions</primary>
12860 <secondary>in address list</secondary>
12861 </indexterm>
12862 <indexterm role="concept">
12863 <primary>address list</primary>
12864 <secondary>regular expression in</secondary>
12865 </indexterm>
12866 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12867 done against the complete address, with the pattern as the regular expression.
12868 You must take care that backslash and dollar characters are not misinterpreted
12869 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12870 to mark that part of the string as non-expandable. For example:
12871 </para>
12872 <literallayout class="monospaced">
12873 deny senders = \N^.*this.*@example\.com$\N : \
12874                \N^\d{8}.+@spamhaus.example$\N : ...
12875 </literallayout>
12876 <para>
12877 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12878 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12879 </para>
12880 </listitem>
12881 <listitem>
12882 <para>
12883 <indexterm role="concept">
12884 <primary>address list</primary>
12885 <secondary>lookup for complete address</secondary>
12886 </indexterm>
12887 Complete addresses can be looked up by using a pattern that starts with a
12888 lookup type terminated by a semicolon, followed by the data for the lookup. For
12889 example:
12890 </para>
12891 <literallayout class="monospaced">
12892 deny senders = cdb;/etc/blocked.senders : \
12893   mysql;select address from blocked where \
12894   address='${quote_mysql:$sender_address}'
12895 </literallayout>
12896 <para>
12897 Both query-style and single-key lookup types can be used. For a single-key
12898 lookup type, Exim uses the complete address as the key. However, empty keys are
12899 not supported for single-key lookups, so a match against the empty address
12900 always fails. This restriction does not apply to query-style lookups.
12901 </para>
12902 <para>
12903 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12904 cannot be used, and is ignored if specified, with an entry being written to the
12905 panic log.
12906 <indexterm role="concept">
12907 <primary>*@ with single-key lookup</primary>
12908 </indexterm>
12909 However, you can configure lookup defaults, as described in section
12910 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12911 default. For example, with this lookup:
12912 </para>
12913 <literallayout class="monospaced">
12914 accept senders = lsearch*@;/some/file
12915 </literallayout>
12916 <para>
12917 the file could contains lines like this:
12918 </para>
12919 <literallayout class="monospaced">
12920 user1@domain1.example
12921 *@domain2.example
12922 </literallayout>
12923 <para>
12924 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12925 that are tried is:
12926 </para>
12927 <literallayout class="monospaced">
12928 nimrod@jaeger.example
12929 *@jaeger.example
12930 *
12931 </literallayout>
12932 <para>
12933 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12934 would mean that every address matches, thus rendering the test useless.
12935 </para>
12936 <para>
12937 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12938 </para>
12939 <literallayout class="monospaced">
12940 deny recipients = dbm*@;/some/file
12941 deny recipients = *@dbm;/some/file
12942 </literallayout>
12943 <para>
12944 The first does a whole address lookup, with defaulting, as just described,
12945 because it starts with a lookup type. The second matches the local part and
12946 domain independently, as described in a bullet point below.
12947 </para>
12948 </listitem>
12949 </itemizedlist>
12950 <para>
12951 The following kinds of address list pattern can match only non-empty addresses.
12952 If the subject address is empty, a match against any of these pattern types
12953 always fails.
12954 </para>
12955 <itemizedlist>
12956 <listitem>
12957 <para>
12958 <indexterm role="concept">
12959 <primary>@@ with single-key lookup</primary>
12960 </indexterm>
12961 <indexterm role="concept">
12962 <primary>address list</primary>
12963 <secondary>@@ lookup type</secondary>
12964 </indexterm>
12965 <indexterm role="concept">
12966 <primary>address list</primary>
12967 <secondary>split local part and domain</secondary>
12968 </indexterm>
12969 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12970 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12971 split into a local part and a domain. The domain is looked up in the file. If
12972 it is not found, there is no match. If it is found, the data that is looked up
12973 from the file is treated as a colon-separated list of local part patterns, each
12974 of which is matched against the subject local part in turn.
12975 </para>
12976 <para>
12977 <indexterm role="concept">
12978 <primary>asterisk</primary>
12979 <secondary>in address list</secondary>
12980 </indexterm>
12981 The lookup may be a partial one, and/or one involving a search for a default
12982 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12983 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12984 even be further lookups. They may also be independently negated. For example,
12985 with
12986 </para>
12987 <literallayout class="monospaced">
12988 deny senders = @@dbm;/etc/reject-by-domain
12989 </literallayout>
12990 <para>
12991 the data from which the DBM file is built could contain lines like
12992 </para>
12993 <literallayout class="monospaced">
12994 baddomain.com:  !postmaster : *
12995 </literallayout>
12996 <para>
12997 to reject all senders except <option>postmaster</option> from that domain.
12998 </para>
12999 <para>
13000 <indexterm role="concept">
13001 <primary>local part</primary>
13002 <secondary>starting with !</secondary>
13003 </indexterm>
13004 If a local part that actually begins with an exclamation mark is required, it
13005 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13006 may be split over several lines by indenting the second and subsequent lines,
13007 but the separating colon must still be included at line breaks. White space
13008 surrounding the colons is ignored. For example:
13009 </para>
13010 <literallayout class="monospaced">
13011 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13012   spammer3 : spammer4
13013 </literallayout>
13014 <para>
13015 As in all colon-separated lists in Exim, a colon can be included in an item by
13016 doubling.
13017 </para>
13018 <para>
13019 If the last item in the list starts with a right angle-bracket, the remainder
13020 of the item is taken as a new key to look up in order to obtain a continuation
13021 list of local parts. The new key can be any sequence of characters. Thus one
13022 might have entries like
13023 </para>
13024 <literallayout class="monospaced">
13025 aol.com: spammer1 : spammer 2 : &gt;*
13026 xyz.com: spammer3 : &gt;*
13027 *:       ^\d{8}$
13028 </literallayout>
13029 <para>
13030 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13031 local parts for all domains, in addition to the specific local parts listed for
13032 each domain. Of course, using this feature costs another lookup each time a
13033 chain is followed, but the effort needed to maintain the data is reduced.
13034 </para>
13035 <para>
13036 <indexterm role="concept">
13037 <primary>loop</primary>
13038 <secondary>in lookups</secondary>
13039 </indexterm>
13040 It is possible to construct loops using this facility, and in order to catch
13041 them, the chains may be no more than fifty items long.
13042 </para>
13043 </listitem>
13044 <listitem>
13045 <para>
13046 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13047 lookup, but in this case, the chaining facility is not available. The lookup
13048 can only return a single list of local parts.
13049 </para>
13050 </listitem>
13051 </itemizedlist>
13052 <para>
13053 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13054 in these two examples:
13055 </para>
13056 <literallayout class="monospaced">
13057 senders = +my_list
13058 senders = *@+my_list
13059 </literallayout>
13060 <para>
13061 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13062 example it is a named domain list.
13063 </para>
13064 </section>
13065 <section id="SECTcasletadd">
13066 <title>Case of letters in address lists</title>
13067 <para>
13068 <indexterm role="concept">
13069 <primary>case of local parts</primary>
13070 </indexterm>
13071 <indexterm role="concept">
13072 <primary>address list</primary>
13073 <secondary>case forcing</secondary>
13074 </indexterm>
13075 <indexterm role="concept">
13076 <primary>case forcing in address lists</primary>
13077 </indexterm>
13078 Domains in email addresses are always handled caselessly, but for local parts
13079 case may be significant on some systems (see <option>caseful_local_part</option> for how
13080 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13081 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13082 blocking lists should be done in a case-independent manner. Since most address
13083 lists in Exim are used for this kind of control, Exim attempts to do this by
13084 default.
13085 </para>
13086 <para>
13087 The domain portion of an address is always lowercased before matching it to an
13088 address list. The local part is lowercased by default, and any string
13089 comparisons that take place are done caselessly. This means that the data in
13090 the address list itself, in files included as plain file names, and in any file
13091 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13092 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13093 works caselessly) must be in lower case, because these lookups are not
13094 case-independent.
13095 </para>
13096 <para>
13097 <indexterm role="concept">
13098 <primary><literal>+caseful</literal></primary>
13099 </indexterm>
13100 To allow for the possibility of caseful address list matching, if an item in
13101 an address list is the string <quote>+caseful</quote>, the original case of the local
13102 part is restored for any comparisons that follow, and string comparisons are no
13103 longer case-independent. This does not affect the domain, which remains in
13104 lower case. However, although independent matches on the domain alone are still
13105 performed caselessly, regular expressions that match against an entire address
13106 become case-sensitive after <quote>+caseful</quote> has been seen.
13107 </para>
13108 </section>
13109 <section id="SECTlocparlis">
13110 <title>Local part lists</title>
13111 <para>
13112 <indexterm role="concept">
13113 <primary>list</primary>
13114 <secondary>local part list</secondary>
13115 </indexterm>
13116 <indexterm role="concept">
13117 <primary>local part</primary>
13118 <secondary>list</secondary>
13119 </indexterm>
13120 Case-sensitivity in local part lists is handled in the same way as for address
13121 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13122 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13123 set false, the subject is lowercased and the matching is initially
13124 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13125 matching in the local part list, but not elsewhere in the router. If
13126 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13127 option is case-sensitive from the start.
13128 </para>
13129 <para>
13130 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13131 comments are handled in the same way as address lists &ndash; they are recognized
13132 only if the # is preceded by white space or the start of the line.
13133 Otherwise, local part lists are matched in the same way as domain lists, except
13134 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13135 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13136 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13137 types.
13138 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13139 </para>
13140 </section>
13141 </chapter>
13142
13143 <chapter id="CHAPexpand">
13144 <title>String expansions</title>
13145 <para>
13146 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13147 <primary>expansion</primary>
13148 <secondary>of strings</secondary>
13149 </indexterm>
13150 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13151 them are expanded every time they are used; others are expanded only once.
13152 </para>
13153 <para>
13154 When a string is being expanded it is copied verbatim from left to right except
13155 when a dollar or backslash character is encountered. A dollar specifies the
13156 start of a portion of the string that is interpreted and replaced as described
13157 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13158 escape character, as described in the following section.
13159 </para>
13160 <para>
13161 Whether a string is expanded depends upon the context.  Usually this is solely
13162 dependent upon the option for which a value is sought; in this documentation,
13163 options for which string expansion is performed are marked with &dagger; after
13164 the data type.  ACL rules always expand strings.  A couple of expansion
13165 conditions do not expand some of the brace-delimited branches, for security
13166 reasons.
13167 </para>
13168 <section id="SECTlittext">
13169 <title>Literal text in expanded strings</title>
13170 <para>
13171 <indexterm role="concept">
13172 <primary>expansion</primary>
13173 <secondary>including literal text</secondary>
13174 </indexterm>
13175 An uninterpreted dollar can be included in an expanded string by putting a
13176 backslash in front of it. A backslash can be used to prevent any special
13177 character being treated specially in an expansion, including backslash itself.
13178 If the string appears in quotes in the configuration file, two backslashes are
13179 required because the quotes themselves cause interpretation of backslashes when
13180 the string is read in (see section <xref linkend="SECTstrings"/>).
13181 </para>
13182 <para>
13183 <indexterm role="concept">
13184 <primary>expansion</primary>
13185 <secondary>non-expandable substrings</secondary>
13186 </indexterm>
13187 A portion of the string can specified as non-expandable by placing it between
13188 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13189 expressions, which often contain backslashes and dollar signs. For example:
13190 </para>
13191 <literallayout class="monospaced">
13192 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13193 </literallayout>
13194 <para>
13195 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13196 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13197 string.
13198 </para>
13199 </section>
13200 <section id="SECID82">
13201 <title>Character escape sequences in expanded strings</title>
13202 <para>
13203 <indexterm role="concept">
13204 <primary>expansion</primary>
13205 <secondary>escape sequences</secondary>
13206 </indexterm>
13207 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13208 expanded string is recognized as an escape sequence for the character newline,
13209 carriage return, or tab, respectively. A backslash followed by up to three
13210 octal digits is recognized as an octal encoding for a single character, and a
13211 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13212 encoding.
13213 </para>
13214 <para>
13215 These escape sequences are also recognized in quoted strings when they are read
13216 in. Their interpretation in expansions as well is useful for unquoted strings,
13217 and for other cases such as looked-up strings that are then expanded.
13218 </para>
13219 </section>
13220 <section id="SECID83">
13221 <title>Testing string expansions</title>
13222 <para>
13223 <indexterm role="concept">
13224 <primary>expansion</primary>
13225 <secondary>testing</secondary>
13226 </indexterm>
13227 <indexterm role="concept">
13228 <primary>testing</primary>
13229 <secondary>string expansion</secondary>
13230 </indexterm>
13231 <indexterm role="option">
13232 <primary><option>-be</option></primary>
13233 </indexterm>
13234 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13235 takes the command arguments, or lines from the standard input if there are no
13236 arguments, runs them through the string expansion code, and writes the results
13237 to the standard output. Variables based on configuration values are set up, but
13238 since no message is being processed, variables such as <varname>$local_part</varname> have no
13239 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13240 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13241 and <option>nhash</option>.
13242 </para>
13243 <para>
13244 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13245 instead runs under the uid and gid it was called with, to prevent users from
13246 using <option>-be</option> for reading files to which they do not have access.
13247 </para>
13248 <para>
13249 <indexterm role="option">
13250 <primary><option>-bem</option></primary>
13251 </indexterm>
13252 If you want to test expansions that include variables whose values are taken
13253 from a message, there are two other options that can be used. The <option>-bem</option>
13254 option is like <option>-be</option> except that it is followed by a file name. The file is
13255 read as a message before doing the test expansions. For example:
13256 </para>
13257 <literallayout class="monospaced">
13258 exim -bem /tmp/test.message '$h_subject:'
13259 </literallayout>
13260 <para>
13261 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13262 Exim message identifier. For example:
13263 </para>
13264 <literallayout class="monospaced">
13265 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13266 </literallayout>
13267 <para>
13268 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13269 is therefore restricted to admin users.
13270 </para>
13271 </section>
13272 <section id="SECTforexpfai">
13273 <title>Forced expansion failure</title>
13274 <para>
13275 <indexterm role="concept">
13276 <primary>expansion</primary>
13277 <secondary>forced failure</secondary>
13278 </indexterm>
13279 A number of expansions that are described in the following section have
13280 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13281 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13282 used depends on some condition that is evaluated as part of the expansion. If,
13283 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13284 the entire string expansion fails in a way that can be detected by the code
13285 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13286 its consequences depend on the circumstances. In some cases it is no different
13287 from any other expansion failure, but in others a different action may be
13288 taken. Such variations are mentioned in the documentation of the option that is
13289 being expanded.
13290 </para>
13291 </section>
13292 <section id="SECTexpansionitems">
13293 <title>Expansion items</title>
13294 <para>
13295 The following items are recognized in expanded strings. White space may be used
13296 between sub-items that are keywords or substrings enclosed in braces inside an
13297 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13298 white space is significant.
13299 </para>
13300 <variablelist>
13301 <varlistentry>
13302 <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>
13303 <listitem>
13304 <para>
13305 <indexterm role="concept">
13306 <primary>expansion</primary>
13307 <secondary>variables</secondary>
13308 </indexterm>
13309 Substitute the contents of the named variable, for example:
13310 </para>
13311 <literallayout class="monospaced">
13312 $local_part
13313 ${domain}
13314 </literallayout>
13315 <para>
13316 The second form can be used to separate the name from subsequent alphanumeric
13317 characters. This form (using braces) is available only for variables; it does
13318 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13319 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13320 given, the expansion fails.
13321 </para>
13322 </listitem></varlistentry>
13323 <varlistentry>
13324 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13325 <listitem>
13326 <para>
13327 <indexterm role="concept">
13328 <primary>expansion</primary>
13329 <secondary>operators</secondary>
13330 </indexterm>
13331 The string is first itself expanded, and then the operation specified by
13332 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13333 </para>
13334 <literallayout class="monospaced">
13335 ${lc:$local_part}
13336 </literallayout>
13337 <para>
13338 The string starts with the first character after the colon, which may be
13339 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13340 below. The operator notation is used for simple expansion items that have just
13341 one argument, because it reduces the number of braces and therefore makes the
13342 string easier to understand.
13343 </para>
13344 </listitem></varlistentry>
13345 <varlistentry>
13346 <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>
13347 <listitem>
13348 <para>
13349 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13350 expansion item below.
13351 </para>
13352 </listitem></varlistentry>
13353 <varlistentry>
13354 <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>
13355 <listitem>
13356 <para>
13357 <indexterm role="concept">
13358 <primary>expansion</primary>
13359 <secondary>calling an acl</secondary>
13360 </indexterm>
13361 <indexterm role="concept">
13362 <primary><option>acl</option></primary>
13363 <secondary>call from expansion</secondary>
13364 </indexterm>
13365 The name and zero to nine argument strings are first expanded separately.  The expanded
13366 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13367 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13368 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13369 and may use the variables; if another acl expansion is used the values
13370 are restored after it returns.  If the ACL sets
13371 a value using a "message =" modifier and returns accept or deny, the value becomes
13372 the result of the expansion.
13373 If no message is set and the ACL returns accept or deny
13374 the expansion result is an empty string.
13375 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13376 </para>
13377 </listitem></varlistentry>
13378 <varlistentry>
13379 <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>
13380 <listitem>
13381 <para>
13382 <indexterm role="concept">
13383 <primary>expansion</primary>
13384 <secondary>extracting cerificate fields</secondary>
13385 </indexterm>
13386 <indexterm role="concept">
13387 <primary><option>certextract</option></primary>
13388 <secondary>certificate fields</secondary>
13389 </indexterm>
13390 <indexterm role="concept">
13391 <primary>certificate</primary>
13392 <secondary>extracting fields</secondary>
13393 </indexterm>
13394 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13395 The field name is expanded and used to retrieve the relevant field from
13396 the certificate.  Supported fields are:
13397 </para>
13398 <literallayout>
13399 <literal>version        </literal>
13400 <literal>serial_number  </literal>
13401 <literal>subject        </literal> RFC4514 DN
13402 <literal>issuer         </literal> RFC4514 DN
13403 <literal>notbefore      </literal> time
13404 <literal>notafter       </literal> time
13405 <literal>sig_algorithm  </literal>
13406 <literal>signature      </literal>
13407 <literal>subj_altname   </literal> tagged list
13408 <literal>ocsp_uri       </literal> list
13409 <literal>crl_uri        </literal> list
13410 </literallayout>
13411 <para>
13412 If the field is found,
13413 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13414 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13415 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13416 is restored to any previous value it might have had.
13417 </para>
13418 <para>
13419 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13420 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13421 extracted is used.
13422 </para>
13423 <para>
13424 Some field names take optional modifiers, appended and separated by commas.
13425 </para>
13426 <para>
13427 The field selectors marked as "RFC4514" above
13428 output a Distinguished Name string which is
13429 not quite
13430 parseable by Exim as a comma-separated tagged list
13431 (the exceptions being elements containing commas).
13432 RDN elements of a single type may be selected by
13433 a modifier of the type label; if so the expansion
13434 result is a list (newline-separated by default).
13435 The separator may be changed by another modifier of
13436 a right angle-bracket followed immediately by the new separator.
13437 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13438 </para>
13439 <para>
13440 The field selectors marked as "time" above
13441 take an optional modifier of "int"
13442 for which the result is the number of seconds since epoch.
13443 Otherwise the result is a human-readable string
13444 in the timezone selected by the main "timezone" option.
13445 </para>
13446 <para>
13447 The field selectors marked as "list" above return a list,
13448 newline-separated by default,
13449 (embedded separator characters in elements are doubled).
13450 The separator may be changed by a modifier of
13451 a right angle-bracket followed immediately by the new separator.
13452 </para>
13453 <para>
13454 The field selectors marked as "tagged" above
13455 prefix each list element with a type string and an equals sign.
13456 Elements of only one type may be selected by a modifier
13457 which is one of "dns", "uri" or "mail";
13458 if so the element tags are omitted.
13459 </para>
13460 <para>
13461 If not otherwise noted field values are presented in human-readable form.
13462 </para>
13463 </listitem></varlistentry>
13464 <varlistentry>
13465 <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>
13466 <listitem>
13467 <para>
13468 <indexterm role="concept">
13469 <primary><option>dlfunc</option></primary>
13470 </indexterm>
13471 This expansion dynamically loads and then calls a locally-written C function.
13472 This functionality is available only if Exim is compiled with
13473 </para>
13474 <literallayout class="monospaced">
13475 EXPAND_DLFUNC=yes
13476 </literallayout>
13477 <para>
13478 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13479 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13480 (but of course Exim does start new processes frequently).
13481 </para>
13482 <para>
13483 There may be from zero to eight arguments to the function. When compiling
13484 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13485 included. The Exim variables and functions that are defined by that API
13486 are also available for dynamically loaded functions. The function itself
13487 must have the following type:
13488 </para>
13489 <literallayout class="monospaced">
13490 int dlfunction(uschar **yield, int argc, uschar *argv[])
13491 </literallayout>
13492 <para>
13493 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13494 function should return one of the following values:
13495 </para>
13496 <para>
13497 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13498 into the expanded string that is being built.
13499 </para>
13500 <para>
13501 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13502 from <emphasis>yield</emphasis>, if it is set.
13503 </para>
13504 <para>
13505 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13506 taken from <emphasis>yield</emphasis> if it is set.
13507 </para>
13508 <para>
13509 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13510 </para>
13511 <para>
13512 When compiling a function that is to be used in this way with gcc,
13513 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13514 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13515 </para>
13516 </listitem></varlistentry>
13517 <varlistentry revisionflag="changed">
13518 <term><emphasis role="bold">${env{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13519 <listitem>
13520 <para revisionflag="changed">
13521 <indexterm role="concept">
13522 <primary>expansion</primary>
13523 <secondary>extracting value from environment</secondary>
13524 </indexterm>
13525 <indexterm role="concept">
13526 <primary>environment</primary>
13527 <secondary>value from</secondary>
13528 </indexterm>
13529 The key is first expanded separately, and leading and trailing white space
13530 removed.
13531 This is then searched for as a name in the environment.
13532 If a variable is found then its value is placed in <varname>$value</varname>
13533 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13534 </para>
13535 <para revisionflag="changed">
13536 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13537 appear, for example:
13538 </para>
13539 <literallayout class="monospaced" revisionflag="changed">
13540 ${env{USER}{$value} fail }
13541 </literallayout>
13542 <para revisionflag="changed">
13543 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13544 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13545 </para>
13546 <para revisionflag="changed">
13547 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13548 search failure.
13549 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13550 search success.
13551 </para>
13552 </listitem></varlistentry>
13553 <varlistentry>
13554 <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>
13555 <listitem>
13556 <para>
13557 <indexterm role="concept">
13558 <primary>expansion</primary>
13559 <secondary>extracting substrings by key</secondary>
13560 </indexterm>
13561 <indexterm role="concept">
13562 <primary><option>extract</option></primary>
13563 <secondary>substrings by key</secondary>
13564 </indexterm>
13565 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13566 white space is removed from the key (but not from any of the strings). The key
13567 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13568 form:
13569 </para>
13570 <literallayout>
13571 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13572 </literallayout>
13573 <para>
13574 <indexterm role="variable">
13575 <primary><varname>$value</varname></primary>
13576 </indexterm>
13577 where the equals signs and spaces (but not both) are optional. If any of the
13578 values contain white space, they must be enclosed in double quotes, and any
13579 values that are enclosed in double quotes are subject to escape processing as
13580 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13581 for the value that corresponds to the key. The search is case-insensitive. If
13582 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13583 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13584 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13585 is restored to any previous value it might have had.
13586 </para>
13587 <para>
13588 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13589 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13590 extracted is used. Thus, for example, these two expansions are identical, and
13591 yield <quote>2001</quote>:
13592 </para>
13593 <literallayout class="monospaced">
13594 ${extract{gid}{uid=1984 gid=2001}}
13595 ${extract{gid}{uid=1984 gid=2001}{$value}}
13596 </literallayout>
13597 <para>
13598 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13599 appear, for example:
13600 </para>
13601 <literallayout class="monospaced">
13602 ${extract{Z}{A=... B=...}{$value} fail }
13603 </literallayout>
13604 <para>
13605 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13606 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13607 </para>
13608 </listitem></varlistentry>
13609 <varlistentry>
13610 <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>
13611 <listitem>
13612 <para>
13613 <indexterm role="concept">
13614 <primary>expansion</primary>
13615 <secondary>extracting substrings by number</secondary>
13616 </indexterm>
13617 <indexterm role="concept">
13618 <primary><option>extract</option></primary>
13619 <secondary>substrings by number</secondary>
13620 </indexterm>
13621 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13622 apart from leading and trailing white space, which is ignored.
13623 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13624 behaves in the same way, except that, instead of extracting a named field, it
13625 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13626 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13627 &lt;<emphasis>string3</emphasis>&gt; as before.
13628 </para>
13629 <para>
13630 The fields in the string are separated by any one of the characters in the
13631 separator string. These may include space or tab characters.
13632 The first field is numbered one. If the number is negative, the fields are
13633 counted from the end of the string, with the rightmost one numbered -1. If the
13634 number given is zero, the entire string is returned. If the modulus of the
13635 number is greater than the number of fields in the string, the result is the
13636 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13637 provided. For example:
13638 </para>
13639 <literallayout class="monospaced">
13640 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13641 </literallayout>
13642 <para>
13643 yields <quote>42</quote>, and
13644 </para>
13645 <literallayout class="monospaced">
13646 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13647 </literallayout>
13648 <para>
13649 yields <quote>99</quote>. Two successive separators mean that the field between them is
13650 empty (for example, the fifth field above).
13651 </para>
13652 </listitem></varlistentry>
13653 <varlistentry>
13654 <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>
13655 <listitem>
13656 <para>
13657 <indexterm role="concept">
13658 <primary>list</primary>
13659 <secondary>selecting by condition</secondary>
13660 </indexterm>
13661 <indexterm role="concept">
13662 <primary>expansion</primary>
13663 <secondary>selecting from list by condition</secondary>
13664 </indexterm>
13665 <indexterm role="variable">
13666 <primary><varname>$item</varname></primary>
13667 </indexterm>
13668 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13669 default, but the separator can be changed in the usual way. For each item
13670 in this list, its value is place in <varname>$item</varname>, and then the condition is
13671 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13672 item in a new list; if the condition is false, the item is discarded. The
13673 separator used for the output list is the same as the one used for the
13674 input, but a separator setting is not included in the output. For example:
13675 </para>
13676 <literallayout class="monospaced">
13677 ${filter{a:b:c}{!eq{$item}{b}}
13678 </literallayout>
13679 <para>
13680 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13681 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13682 </para>
13683 </listitem></varlistentry>
13684 <varlistentry>
13685 <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>
13686 <listitem>
13687 <para>
13688 <indexterm role="concept">
13689 <primary>hash function</primary>
13690 <secondary>textual</secondary>
13691 </indexterm>
13692 <indexterm role="concept">
13693 <primary>expansion</primary>
13694 <secondary>textual hash</secondary>
13695 </indexterm>
13696 This is a textual hashing function, and was the first to be implemented in
13697 early versions of Exim. In current releases, there are other hashing functions
13698 (numeric, MD5, and SHA-1), which are described below.
13699 </para>
13700 <para>
13701 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13702 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13703 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13704 use the simpler operator notation that avoids some of the braces:
13705 </para>
13706 <literallayout class="monospaced">
13707 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13708 </literallayout>
13709 <para>
13710 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13711 or equal to the length of the string, the expansion item returns the string.
13712 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13713 function to the string. The new string consists of characters taken from the
13714 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13715 </para>
13716 <literallayout class="monospaced">
13717 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13718 </literallayout>
13719 <para>
13720 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13721 letters appear. For example:
13722 </para>
13723 <literallayout>
13724 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13725 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13726 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13727 </literallayout>
13728 </listitem></varlistentry>
13729 <varlistentry>
13730 <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>
13731 <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>
13732 <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>
13733 <listitem>
13734 <para>
13735 <indexterm role="concept">
13736 <primary>expansion</primary>
13737 <secondary>header insertion</secondary>
13738 </indexterm>
13739 <indexterm role="variable">
13740 <primary><varname>$header_</varname></primary>
13741 </indexterm>
13742 <indexterm role="variable">
13743 <primary><varname>$bheader_</varname></primary>
13744 </indexterm>
13745 <indexterm role="variable">
13746 <primary><varname>$rheader_</varname></primary>
13747 </indexterm>
13748 <indexterm role="concept">
13749 <primary>header lines</primary>
13750 <secondary>in expansion strings</secondary>
13751 </indexterm>
13752 <indexterm role="concept">
13753 <primary>header lines</primary>
13754 <secondary>character sets</secondary>
13755 </indexterm>
13756 <indexterm role="concept">
13757 <primary>header lines</primary>
13758 <secondary>decoding</secondary>
13759 </indexterm>
13760 Substitute the contents of the named message header line, for example
13761 </para>
13762 <literallayout class="monospaced">
13763 $header_reply-to:
13764 </literallayout>
13765 <para>
13766 The newline that terminates a header line is not included in the expansion, but
13767 internal newlines (caused by splitting the header line over several physical
13768 lines) may be present.
13769 </para>
13770 <para>
13771 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13772 the data in the header line is interpreted.
13773 </para>
13774 <itemizedlist>
13775 <listitem>
13776 <para>
13777 <indexterm role="concept">
13778 <primary>white space</primary>
13779 <secondary>in header lines</secondary>
13780 </indexterm>
13781 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13782 processing at all, and without the removal of leading and trailing white space.
13783 </para>
13784 </listitem>
13785 <listitem>
13786 <para>
13787 <indexterm role="concept">
13788 <primary>base64 encoding</primary>
13789 <secondary>in header lines</secondary>
13790 </indexterm>
13791 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13792 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13793 character set translation. If decoding of what looks superficially like a MIME
13794 <quote>word</quote> fails, the raw string is returned. If decoding
13795 <indexterm role="concept">
13796 <primary>binary zero</primary>
13797 <secondary>in header line</secondary>
13798 </indexterm>
13799 produces a binary zero character, it is replaced by a question mark &ndash; this is
13800 what Exim does for binary zeros that are actually received in header lines.
13801 </para>
13802 </listitem>
13803 <listitem>
13804 <para>
13805 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13806 standard character set. This is an attempt to produce the same string as would
13807 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13808 returned. Translation is attempted only on operating systems that support the
13809 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13810 a system Makefile or in <filename>Local/Makefile</filename>.
13811 </para>
13812 </listitem>
13813 </itemizedlist>
13814 <para>
13815 In a filter file, the target character set for <option>header</option> can be specified by a
13816 command of the following form:
13817 </para>
13818 <literallayout class="monospaced">
13819 headers charset "UTF-8"
13820 </literallayout>
13821 <para>
13822 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13823 subsequently obeyed filter commands. In the absence of this command, the target
13824 character set in a filter is taken from the setting of the <option>headers_charset</option>
13825 option in the runtime configuration. The value of this option defaults to the
13826 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13827 ISO-8859-1.
13828 </para>
13829 <para>
13830 Header names follow the syntax of RFC 2822, which states that they may contain
13831 any printing characters except space and colon. Consequently, curly brackets
13832 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13833 if they were variables. Attempting to do so causes a syntax error.
13834 </para>
13835 <para>
13836 Only header lines that are common to all copies of a message are visible to
13837 this mechanism. These are the original header lines that are received with the
13838 message, and any that are added by an ACL statement or by a system
13839 filter. Header lines that are added to a particular copy of a message by a
13840 router or transport are not accessible.
13841 </para>
13842 <para>
13843 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13844 before the DATA ACL, because the header structure is not set up until the
13845 message is received. Header lines that are added in a RCPT ACL (for example)
13846 are saved until the message&#x2019;s incoming header lines are available, at which
13847 point they are added. When a DATA ACL is running, however, header lines added
13848 by earlier ACLs are visible.
13849 </para>
13850 <para>
13851 Upper case and lower case letters are synonymous in header names. If the
13852 following character is white space, the terminating colon may be omitted, but
13853 this is not recommended, because you may then forget it when it is needed. When
13854 white space terminates the header name, it is included in the expanded string.
13855 If the message does not contain the given header, the expansion item is
13856 replaced by an empty string. (See the <option>def</option> condition in section
13857 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13858 </para>
13859 <para>
13860 If there is more than one header with the same name, they are all concatenated
13861 to form the substitution string, up to a maximum length of 64K. Unless
13862 <option>rheader</option> is being used, leading and trailing white space is removed from
13863 each header before concatenation, and a completely empty header is ignored. A
13864 newline character is then inserted between non-empty headers, but there is no
13865 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13866 those headers that contain lists of addresses, a comma is also inserted at the
13867 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13868 </para>
13869 </listitem></varlistentry>
13870 <varlistentry>
13871 <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>
13872 <listitem>
13873 <para>
13874 <indexterm role="concept">
13875 <primary>expansion</primary>
13876 <secondary>hmac hashing</secondary>
13877 </indexterm>
13878 <indexterm role="concept">
13879 <primary><option>hmac</option></primary>
13880 </indexterm>
13881 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13882 shared secret and some text into a message authentication code, as specified in
13883 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13884 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13885 cryptographic hash, allowing for authentication that is not possible with MD5
13886 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13887 present. For example:
13888 </para>
13889 <literallayout class="monospaced">
13890 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13891 </literallayout>
13892 <para>
13893 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13894 produces:
13895 </para>
13896 <literallayout class="monospaced">
13897 dd97e3ba5d1a61b5006108f8c8252953
13898 </literallayout>
13899 <para>
13900 As an example of how this might be used, you might put in the main part of
13901 an Exim configuration:
13902 </para>
13903 <literallayout class="monospaced">
13904 SPAMSCAN_SECRET=cohgheeLei2thahw
13905 </literallayout>
13906 <para>
13907 In a router or a transport you could then have:
13908 </para>
13909 <literallayout class="monospaced">
13910 headers_add = \
13911   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13912   ${hmac{md5}{SPAMSCAN_SECRET}\
13913   {${primary_hostname},${message_exim_id},$h_message-id:}}
13914 </literallayout>
13915 <para>
13916 Then given a message, you can check where it was scanned by looking at the
13917 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13918 this header line is authentic by recomputing the authentication code from the
13919 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13920 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13921 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13922 </para>
13923 </listitem></varlistentry>
13924 <varlistentry>
13925 <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>
13926 <listitem>
13927 <para>
13928 <indexterm role="concept">
13929 <primary>expansion</primary>
13930 <secondary>conditional</secondary>
13931 </indexterm>
13932 <indexterm role="concept">
13933 <primary><option>if</option>, expansion item</primary>
13934 </indexterm>
13935 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13936 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13937 in section <xref linkend="SECTexpcond"/> below. For example:
13938 </para>
13939 <literallayout class="monospaced">
13940 ${if eq {$local_part}{postmaster} {yes}{no} }
13941 </literallayout>
13942 <para>
13943 The second string need not be present; if it is not and the condition is not
13944 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13945 be present instead of the second string (without any curly brackets). In this
13946 case, the expansion is forced to fail if the condition is not true (see section
13947 <xref linkend="SECTforexpfai"/>).
13948 </para>
13949 <para>
13950 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13951 is true, and the empty string if the condition is false. This makes it less
13952 cumbersome to write custom ACL and router conditions. For example, instead of
13953 </para>
13954 <literallayout class="monospaced">
13955 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13956 </literallayout>
13957 <para>
13958 you can use
13959 </para>
13960 <literallayout class="monospaced">
13961 condition = ${if &gt;{$acl_m4}{3}}
13962 </literallayout>
13963 </listitem></varlistentry>
13964 <varlistentry>
13965 <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>
13966 <listitem>
13967 <para>
13968 <indexterm role="concept">
13969 <primary>expansion</primary>
13970 <secondary>string truncation</secondary>
13971 </indexterm>
13972 <indexterm role="concept">
13973 <primary><option>length</option> expansion item</primary>
13974 </indexterm>
13975 The <option>length</option> item is used to extract the initial portion of a string. Both
13976 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13977 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13978 change when expanded, you can use the simpler operator notation that avoids
13979 some of the braces:
13980 </para>
13981 <literallayout class="monospaced">
13982 ${length_&lt;n&gt;:&lt;string&gt;}
13983 </literallayout>
13984 <para>
13985 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13986 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13987 <option>strlen</option>, which gives the length of a string.
13988 </para>
13989 </listitem></varlistentry>
13990 <varlistentry>
13991 <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>
13992 <listitem>
13993 <para>
13994 <indexterm role="concept">
13995 <primary>expansion</primary>
13996 <secondary>extracting list elements by number</secondary>
13997 </indexterm>
13998 <indexterm role="concept">
13999 <primary><option>listextract</option></primary>
14000 <secondary>extract list elements by number</secondary>
14001 </indexterm>
14002 <indexterm role="concept">
14003 <primary>list</primary>
14004 <secondary>extracting elements by number</secondary>
14005 </indexterm>
14006 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14007 apart from an optional leading minus,
14008 and leading and trailing white space (which is ignored).
14009 </para>
14010 <para>
14011 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14012 default, but the separator can be changed in the usual way.
14013 </para>
14014 <para>
14015 The first field of the list is numbered one.
14016 If the number is negative, the fields are
14017 counted from the end of the list, with the rightmost one numbered -1.
14018 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14019 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14020 </para>
14021 <para>
14022 If the modulus of the
14023 number is zero or greater than the number of fields in the string,
14024 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14025 </para>
14026 <para>
14027 For example:
14028 </para>
14029 <literallayout class="monospaced">
14030 ${listextract{2}{x:42:99}}
14031 </literallayout>
14032 <para>
14033 yields <quote>42</quote>, and
14034 </para>
14035 <literallayout class="monospaced">
14036 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14037 </literallayout>
14038 <para>
14039 yields <quote>result: 99</quote>.
14040 </para>
14041 <para>
14042 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14043 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14044 extracted is used.
14045 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14046 </para>
14047 </listitem></varlistentry>
14048 <varlistentry>
14049 <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>
14050 <listitem>
14051 <para>
14052 This is the first of one of two different types of lookup item, which are both
14053 described in the next item.
14054 </para>
14055 </listitem></varlistentry>
14056 <varlistentry>
14057 <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>
14058 <listitem>
14059 <para>
14060 <indexterm role="concept">
14061 <primary>expansion</primary>
14062 <secondary>lookup in</secondary>
14063 </indexterm>
14064 <indexterm role="concept">
14065 <primary>file</primary>
14066 <secondary>lookups</secondary>
14067 </indexterm>
14068 <indexterm role="concept">
14069 <primary>lookup</primary>
14070 <secondary>in expanded string</secondary>
14071 </indexterm>
14072 The two forms of lookup item specify data lookups in files and databases, as
14073 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14074 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14075 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14076 </para>
14077 <para>
14078 If there is any white space in a lookup item which is part of a filter command,
14079 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14080 other place where white space is significant, the lookup item must be enclosed
14081 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14082 out by the system administrator.
14083 </para>
14084 <para>
14085 <indexterm role="variable">
14086 <primary><varname>$value</varname></primary>
14087 </indexterm>
14088 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14089 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14090 lookup. Afterwards it reverts to the value it had previously (at the outer
14091 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14092 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14093 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14094 lookup, thus providing a mechanism for looking up a default value when the
14095 original lookup fails.
14096 </para>
14097 <para>
14098 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14099 data for the outer lookup while the parameters of the second lookup are
14100 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14101 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14102 appear, and in this case, if the lookup fails, the entire expansion is forced
14103 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14104 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14105 successful lookup, and nothing in the case of failure.
14106 </para>
14107 <para>
14108 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14109 search type in order to do partial matching, and * or *@ may follow a search
14110 type to request default lookups if the key does not match (see sections
14111 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14112 </para>
14113 <para>
14114 <indexterm role="concept">
14115 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14116 <secondary>in lookup expansion</secondary>
14117 </indexterm>
14118 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14119 and non-wild parts of the key during the expansion of the replacement text.
14120 They return to their previous values at the end of the lookup item.
14121 </para>
14122 <para>
14123 This example looks up the postmaster alias in the conventional alias file:
14124 </para>
14125 <literallayout class="monospaced">
14126 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14127 </literallayout>
14128 <para>
14129 This example uses NIS+ to look up the full name of the user corresponding to
14130 the local part of an address, forcing the expansion to fail if it is not found:
14131 </para>
14132 <literallayout class="monospaced">
14133 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14134   {$value}fail}
14135 </literallayout>
14136 </listitem></varlistentry>
14137 <varlistentry>
14138 <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>
14139 <listitem>
14140 <para>
14141 <indexterm role="concept">
14142 <primary>expansion</primary>
14143 <secondary>list creation</secondary>
14144 </indexterm>
14145 <indexterm role="variable">
14146 <primary><varname>$item</varname></primary>
14147 </indexterm>
14148 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14149 default, but the separator can be changed in the usual way. For each item
14150 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14151 expanded and added to the output as an item in a new list. The separator used
14152 for the output list is the same as the one used for the input, but a separator
14153 setting is not included in the output. For example:
14154 </para>
14155 <literallayout class="monospaced">
14156 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14157 </literallayout>
14158 <para>
14159 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14160 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14161 and <emphasis role="bold">reduce</emphasis> expansion items.
14162 </para>
14163 </listitem></varlistentry>
14164 <varlistentry>
14165 <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>
14166 <listitem>
14167 <para>
14168 <indexterm role="concept">
14169 <primary>expansion</primary>
14170 <secondary>numeric hash</secondary>
14171 </indexterm>
14172 <indexterm role="concept">
14173 <primary>hash function</primary>
14174 <secondary>numeric</secondary>
14175 </indexterm>
14176 The three strings are expanded; the first two must yield numbers. Call them
14177 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14178 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14179 can use the simpler operator notation that avoids some of the braces:
14180 </para>
14181 <literallayout class="monospaced">
14182 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14183 </literallayout>
14184 <para>
14185 The second number is optional (in both notations). If there is only one number,
14186 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14187 processed by a div/mod hash function that returns two numbers, separated by a
14188 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14189 example,
14190 </para>
14191 <literallayout class="monospaced">
14192 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14193 </literallayout>
14194 <para>
14195 returns the string <quote>6/33</quote>.
14196 </para>
14197 </listitem></varlistentry>
14198 <varlistentry>
14199 <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>
14200 <listitem>
14201 <para>
14202 <indexterm role="concept">
14203 <primary>Perl</primary>
14204 <secondary>use in expanded string</secondary>
14205 </indexterm>
14206 <indexterm role="concept">
14207 <primary>expansion</primary>
14208 <secondary>calling Perl from</secondary>
14209 </indexterm>
14210 This item is available only if Exim has been built to include an embedded Perl
14211 interpreter. The subroutine name and the arguments are first separately
14212 expanded, and then the Perl subroutine is called with those arguments. No
14213 additional arguments need be given; the maximum number permitted, including the
14214 name of the subroutine, is nine.
14215 </para>
14216 <para>
14217 The return value of the subroutine is inserted into the expanded string, unless
14218 the return value is <option>undef</option>. In that case, the expansion fails in the same
14219 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14220 Whatever you return is evaluated in a scalar context. For example, if you
14221 return the name of a Perl vector, the return value is the size of the vector,
14222 not its contents.
14223 </para>
14224 <para>
14225 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14226 with the error message that was passed to <option>die</option>. More details of the embedded
14227 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14228 </para>
14229 <para>
14230 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14231 out the use of this expansion item in filter files.
14232 </para>
14233 </listitem></varlistentry>
14234 <varlistentry>
14235 <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>
14236 <listitem>
14237 <para>
14238 <indexterm role="concept">
14239 <primary><option>prvs</option> expansion item</primary>
14240 </indexterm>
14241 The first argument is a complete email address and the second is secret
14242 keystring. The third argument, specifying a key number, is optional. If absent,
14243 it defaults to 0. The result of the expansion is a prvs-signed email address,
14244 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14245 as part of a bounce address tag validation (BATV) scheme. For more discussion
14246 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14247 </para>
14248 </listitem></varlistentry>
14249 <varlistentry>
14250 <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>
14251 <listitem>
14252 <para>
14253 <indexterm role="concept">
14254 <primary><option>prvscheck</option> expansion item</primary>
14255 </indexterm>
14256 This expansion item is the complement of the <option>prvs</option> item. It is used for
14257 checking prvs-signed addresses. If the expansion of the first argument does not
14258 yield a syntactically valid prvs-signed address, the whole item expands to the
14259 empty string. When the first argument does expand to a syntactically valid
14260 prvs-signed address, the second argument is expanded, with the prvs-decoded
14261 version of the address and the key number extracted from the address in the
14262 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14263 </para>
14264 <para>
14265 These two variables can be used in the expansion of the second argument to
14266 retrieve the secret. The validity of the prvs-signed address is then checked
14267 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14268 which is empty for failure or <quote>1</quote> for success.
14269 </para>
14270 <para>
14271 The third argument is optional; if it is missing, it defaults to an empty
14272 string. This argument is now expanded. If the result is an empty string, the
14273 result of the expansion is the decoded version of the address. This is the case
14274 whether or not the signature was valid. Otherwise, the result of the expansion
14275 is the expansion of the third argument.
14276 </para>
14277 <para>
14278 All three variables can be used in the expansion of the third argument.
14279 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14280 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14281 </para>
14282 </listitem></varlistentry>
14283 <varlistentry>
14284 <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>
14285 <listitem>
14286 <para>
14287 <indexterm role="concept">
14288 <primary>expansion</primary>
14289 <secondary>inserting an entire file</secondary>
14290 </indexterm>
14291 <indexterm role="concept">
14292 <primary>file</primary>
14293 <secondary>inserting into expansion</secondary>
14294 </indexterm>
14295 <indexterm role="concept">
14296 <primary><option>readfile</option> expansion item</primary>
14297 </indexterm>
14298 The file name and end-of-line string are first expanded separately. The file is
14299 then read, and its contents replace the entire item. All newline characters in
14300 the file are replaced by the end-of-line string if it is present. Otherwise,
14301 newlines are left in the string.
14302 String expansion is not applied to the contents of the file. If you want this,
14303 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14304 the string expansion fails.
14305 </para>
14306 <para>
14307 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14308 locks out the use of this expansion item in filter files.
14309 </para>
14310 </listitem></varlistentry>
14311 <varlistentry>
14312 <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>
14313 <listitem>
14314 <para>
14315 <indexterm role="concept">
14316 <primary>expansion</primary>
14317 <secondary>inserting from a socket</secondary>
14318 </indexterm>
14319 <indexterm role="concept">
14320 <primary>socket, use of in expansion</primary>
14321 </indexterm>
14322 <indexterm role="concept">
14323 <primary><option>readsocket</option> expansion item</primary>
14324 </indexterm>
14325 This item inserts data from a Unix domain or TCP socket into the expanded
14326 string. The minimal way of using it uses just two arguments, as in these
14327 examples:
14328 </para>
14329 <literallayout class="monospaced">
14330 ${readsocket{/socket/name}{request string}}
14331 ${readsocket{inet:some.host:1234}{request string}}
14332 </literallayout>
14333 <para>
14334 For a Unix domain socket, the first substring must be the path to the socket.
14335 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14336 a host name or IP address, followed by a colon and a port, which can be a
14337 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14338 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14339 example:
14340 </para>
14341 <literallayout class="monospaced">
14342 ${readsocket{inet:[::1]:1234}{request string}}
14343 </literallayout>
14344 <para>
14345 Only a single host name may be given, but if looking it up yields more than
14346 one IP address, they are each tried in turn until a connection is made. For
14347 both kinds of socket, Exim makes a connection, writes the request string
14348 (unless it is an empty string) and reads from the socket until an end-of-file
14349 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14350 extend what can be done. Firstly, you can vary the timeout. For example:
14351 </para>
14352 <literallayout class="monospaced">
14353 ${readsocket{/socket/name}{request string}{3s}}
14354 </literallayout>
14355 <para>
14356 A fourth argument allows you to change any newlines that are in the data
14357 that is read, in the same way as for <option>readfile</option> (see above). This example
14358 turns them into spaces:
14359 </para>
14360 <literallayout class="monospaced">
14361 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14362 </literallayout>
14363 <para>
14364 As with all expansions, the substrings are expanded before the processing
14365 happens. Errors in these sub-expansions cause the expansion to fail. In
14366 addition, the following errors can occur:
14367 </para>
14368 <itemizedlist>
14369 <listitem>
14370 <para>
14371 Failure to create a socket file descriptor;
14372 </para>
14373 </listitem>
14374 <listitem>
14375 <para>
14376 Failure to connect the socket;
14377 </para>
14378 </listitem>
14379 <listitem>
14380 <para>
14381 Failure to write the request string;
14382 </para>
14383 </listitem>
14384 <listitem>
14385 <para>
14386 Timeout on reading from the socket.
14387 </para>
14388 </listitem>
14389 </itemizedlist>
14390 <para>
14391 By default, any of these errors causes the expansion to fail. However, if
14392 you supply a fifth substring, it is expanded and used when any of the above
14393 errors occurs. For example:
14394 </para>
14395 <literallayout class="monospaced">
14396 ${readsocket{/socket/name}{request string}{3s}{\n}\
14397   {socket failure}}
14398 </literallayout>
14399 <para>
14400 You can test for the existence of a Unix domain socket by wrapping this
14401 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14402 and the actual opening of the socket, so it is safer to use the fifth argument
14403 if you want to be absolutely sure of avoiding an expansion error for a
14404 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14405 </para>
14406 <para>
14407 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14408 locks out the use of this expansion item in filter files.
14409 </para>
14410 </listitem></varlistentry>
14411 <varlistentry>
14412 <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>
14413 <listitem>
14414 <para>
14415 <indexterm role="concept">
14416 <primary>expansion</primary>
14417 <secondary>reducing a list to a scalar</secondary>
14418 </indexterm>
14419 <indexterm role="concept">
14420 <primary>list</primary>
14421 <secondary>reducing to a scalar</secondary>
14422 </indexterm>
14423 <indexterm role="variable">
14424 <primary><varname>$value</varname></primary>
14425 </indexterm>
14426 <indexterm role="variable">
14427 <primary><varname>$item</varname></primary>
14428 </indexterm>
14429 This operation reduces a list to a single, scalar string. After expansion,
14430 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14431 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14432 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14433 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14434 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14435 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14436 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14437 number of ways. For example, to add up a list of numbers:
14438 </para>
14439 <literallayout class="monospaced">
14440 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14441 </literallayout>
14442 <para>
14443 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14444 can be found:
14445 </para>
14446 <literallayout class="monospaced">
14447 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14448 </literallayout>
14449 <para>
14450 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14451 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14452 expansion items.
14453 </para>
14454 </listitem></varlistentry>
14455 <varlistentry>
14456 <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>
14457 <listitem>
14458 <para>
14459 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14460 expansion item above.
14461 </para>
14462 </listitem></varlistentry>
14463 <varlistentry>
14464 <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>
14465 <listitem>
14466 <para>
14467 <indexterm role="concept">
14468 <primary>expansion</primary>
14469 <secondary>running a command</secondary>
14470 </indexterm>
14471 <indexterm role="concept">
14472 <primary><option>run</option> expansion item</primary>
14473 </indexterm>
14474 The command and its arguments are first expanded as one string. The string is
14475 split apart into individual arguments by spaces, and then the command is run
14476 in a separate process, but under the same uid and gid.  As in other command
14477 executions from Exim, a shell is not used by default. If the command requires
14478 a shell, you must explicitly code it.
14479 </para>
14480 <para>
14481 Since the arguments are split by spaces, when there is a variable expansion
14482 which has an empty result, it will cause the situation that the argument will
14483 simply be omitted when the program is actually executed by Exim. If the
14484 script/program requires a specific number of arguments and the expanded
14485 variable could possibly result in this empty expansion, the variable must be
14486 quoted. This is more difficult if the expanded variable itself could result
14487 in a string containing quotes, because it would interfere with the quotes
14488 around the command arguments. A possible guard against this is to wrap the
14489 variable in the <option>sg</option> operator to change any quote marks to some other
14490 character.
14491 </para>
14492 <para>
14493 The standard input for the command exists, but is empty. The standard output
14494 and standard error are set to the same file descriptor.
14495 <indexterm role="concept">
14496 <primary>return code</primary>
14497 <secondary>from <option>run</option> expansion</secondary>
14498 </indexterm>
14499 <indexterm role="variable">
14500 <primary><varname>$value</varname></primary>
14501 </indexterm>
14502 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14503 and replaces the entire item; during this expansion, the standard output/error
14504 from the command is in the variable <varname>$value</varname>. If the command fails,
14505 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14506 expansion, the standard output/error from the command is in the variable
14507 <varname>$value</varname>.
14508 </para>
14509 <para>
14510 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14511 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14512 command does not succeed. If both strings are omitted, the result is contents
14513 of the standard output/error on success, and nothing on failure.
14514 </para>
14515 <para>
14516 <indexterm role="variable">
14517 <primary><varname>$run_in_acl</varname></primary>
14518 </indexterm>
14519 The standard output/error of the command is put in the variable <varname>$value</varname>.
14520 In this ACL example, the output of a command is logged for the admin to
14521 troubleshoot:
14522 </para>
14523 <literallayout class="monospaced">
14524 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14525       log_message  = Output of id: $value
14526 </literallayout>
14527 <para>
14528 If the command requires shell idioms, such as the &gt; redirect operator, the
14529 shell must be invoked directly, such as with:
14530 </para>
14531 <literallayout class="monospaced">
14532 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14533 </literallayout>
14534 <para>
14535 <indexterm role="variable">
14536 <primary><varname>$runrc</varname></primary>
14537 </indexterm>
14538 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14539 remains set afterwards, so in a filter file you can do things like this:
14540 </para>
14541 <literallayout class="monospaced">
14542 if "${run{x y z}{}}$runrc" is 1 then ...
14543   elif $runrc is 2 then ...
14544   ...
14545 endif
14546 </literallayout>
14547 <para>
14548 If execution of the command fails (for example, the command does not exist),
14549 the return code is 127 &ndash; the same code that shells use for non-existent
14550 commands.
14551 </para>
14552 <para>
14553 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14554 option values are expanded, except for those preconditions whose order of
14555 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14556 by the expansion of one option, and use it in another.
14557 </para>
14558 <para>
14559 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14560 out the use of this expansion item in filter files.
14561 </para>
14562 </listitem></varlistentry>
14563 <varlistentry>
14564 <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>
14565 <listitem>
14566 <para>
14567 <indexterm role="concept">
14568 <primary>expansion</primary>
14569 <secondary>string substitution</secondary>
14570 </indexterm>
14571 <indexterm role="concept">
14572 <primary><option>sg</option> expansion item</primary>
14573 </indexterm>
14574 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14575 option; hence its name. However, unlike the Perl equivalent, Exim does not
14576 modify the subject string; instead it returns the modified string for insertion
14577 into the overall expansion. The item takes three arguments: the subject string,
14578 a regular expression, and a substitution string. For example:
14579 </para>
14580 <literallayout class="monospaced">
14581 ${sg{abcdefabcdef}{abc}{xyz}}
14582 </literallayout>
14583 <para>
14584 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14585 if any $ or \ characters are required in the regular expression or in the
14586 substitution string, they have to be escaped. For example:
14587 </para>
14588 <literallayout class="monospaced">
14589 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14590 </literallayout>
14591 <para>
14592 yields <quote>defabc</quote>, and
14593 </para>
14594 <literallayout class="monospaced">
14595 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14596 </literallayout>
14597 <para>
14598 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14599 the regular expression from string expansion.
14600 </para>
14601 </listitem></varlistentry>
14602 <varlistentry>
14603 <term><emphasis role="bold">${sort{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>comparator</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>extractor</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14604 <listitem>
14605 <para>
14606 <indexterm role="concept">
14607 <primary>sorting</primary>
14608 <secondary>a list</secondary>
14609 </indexterm>
14610 <indexterm role="concept">
14611 <primary>list</primary>
14612 <secondary>sorting</secondary>
14613 </indexterm>
14614 <indexterm role="concept">
14615 <primary>expansion</primary>
14616 <secondary>list sorting</secondary>
14617 </indexterm>
14618 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14619 default, but the separator can be changed in the usual way.
14620 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14621 of a two-argument expansion condition.
14622 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14623 The comparison should return true when applied to two values
14624 if the first value should sort before the second value.
14625 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14626 the element being placed in <varname>$item</varname>,
14627 to give values for comparison.
14628 </para>
14629 <para>
14630 The item result is a sorted list,
14631 with the original list separator,
14632 of the list elements (in full) of the original.
14633 </para>
14634 <para>
14635 Examples:
14636 </para>
14637 <literallayout class="monospaced">
14638 ${sort{3:2:1:4}{&lt;}{$item}}
14639 </literallayout>
14640 <para>
14641 sorts a list of numbers, and
14642 </para>
14643 <literallayout class="monospaced">
14644 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14645 </literallayout>
14646 <para>
14647 will sort an MX lookup into priority order.
14648 </para>
14649 </listitem></varlistentry>
14650 <varlistentry>
14651 <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>
14652 <listitem>
14653 <para>
14654 <indexterm role="concept">
14655 <primary><option>substr</option> expansion item</primary>
14656 </indexterm>
14657 <indexterm role="concept">
14658 <primary>substring extraction</primary>
14659 </indexterm>
14660 <indexterm role="concept">
14661 <primary>expansion</primary>
14662 <secondary>substring extraction</secondary>
14663 </indexterm>
14664 The three strings are expanded; the first two must yield numbers. Call them
14665 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14666 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14667 can use the simpler operator notation that avoids some of the braces:
14668 </para>
14669 <literallayout class="monospaced">
14670 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14671 </literallayout>
14672 <para>
14673 The second number is optional (in both notations).
14674 If it is absent in the simpler format, the preceding underscore must also be
14675 omitted.
14676 </para>
14677 <para>
14678 The <option>substr</option> item can be used to extract more general substrings than
14679 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14680 length required. For example
14681 </para>
14682 <literallayout class="monospaced">
14683 ${substr{3}{2}{$local_part}}
14684 </literallayout>
14685 <para>
14686 If the starting offset is greater than the string length the result is the
14687 null string; if the length plus starting offset is greater than the string
14688 length, the result is the right-hand part of the string, starting from the
14689 given offset. The first character in the string has offset zero.
14690 </para>
14691 <para>
14692 The <option>substr</option> expansion item can take negative offset values to count
14693 from the right-hand end of its operand. The last character is offset -1, the
14694 second-last is offset -2, and so on. Thus, for example,
14695 </para>
14696 <literallayout class="monospaced">
14697 ${substr{-5}{2}{1234567}}
14698 </literallayout>
14699 <para>
14700 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14701 length of the string, the substring starts at the beginning of the string, and
14702 the length is reduced by the amount of overshoot. Thus, for example,
14703 </para>
14704 <literallayout class="monospaced">
14705 ${substr{-5}{2}{12}}
14706 </literallayout>
14707 <para>
14708 yields an empty string, but
14709 </para>
14710 <literallayout class="monospaced">
14711 ${substr{-3}{2}{12}}
14712 </literallayout>
14713 <para>
14714 yields <quote>1</quote>.
14715 </para>
14716 <para>
14717 When the second number is omitted from <option>substr</option>, the remainder of the string
14718 is taken if the offset is positive. If it is negative, all characters in the
14719 string preceding the offset point are taken. For example, an offset of -1 and
14720 no length, as in these semantically identical examples:
14721 </para>
14722 <literallayout class="monospaced">
14723 ${substr_-1:abcde}
14724 ${substr{-1}{abcde}}
14725 </literallayout>
14726 <para>
14727 yields all but the last character of the string, that is, <quote>abcd</quote>.
14728 </para>
14729 </listitem></varlistentry>
14730 <varlistentry>
14731 <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>
14732 <listitem>
14733 <para>
14734 <indexterm role="concept">
14735 <primary>expansion</primary>
14736 <secondary>character translation</secondary>
14737 </indexterm>
14738 <indexterm role="concept">
14739 <primary><option>tr</option> expansion item</primary>
14740 </indexterm>
14741 This item does single-character translation on its subject string. The second
14742 argument is a list of characters to be translated in the subject string. Each
14743 matching character is replaced by the corresponding character from the
14744 replacement list. For example
14745 </para>
14746 <literallayout class="monospaced">
14747 ${tr{abcdea}{ac}{13}}
14748 </literallayout>
14749 <para>
14750 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14751 last occurrence is used. If the third string is shorter than the second, its
14752 last character is replicated. However, if it is empty, no translation takes
14753 place.
14754 </para>
14755 </listitem></varlistentry>
14756 </variablelist>
14757 </section>
14758 <section id="SECTexpop">
14759 <title>Expansion operators</title>
14760 <para>
14761 <indexterm role="concept">
14762 <primary>expansion</primary>
14763 <secondary>operators</secondary>
14764 </indexterm>
14765 For expansion items that perform transformations on a single argument string,
14766 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14767 The substring is first expanded before the operation is applied to it. The
14768 following operations can be performed:
14769 </para>
14770 <variablelist>
14771 <varlistentry>
14772 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14773 <listitem>
14774 <para>
14775 <indexterm role="concept">
14776 <primary>expansion</primary>
14777 <secondary>RFC 2822 address handling</secondary>
14778 </indexterm>
14779 <indexterm role="concept">
14780 <primary><option>address</option> expansion item</primary>
14781 </indexterm>
14782 The string is interpreted as an RFC 2822 address, as it might appear in a
14783 header line, and the effective address is extracted from it. If the string does
14784 not parse successfully, the result is empty.
14785 </para>
14786 </listitem></varlistentry>
14787 <varlistentry>
14788 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14789 <listitem>
14790 <para>
14791 <indexterm role="concept">
14792 <primary>expansion</primary>
14793 <secondary>RFC 2822 address handling</secondary>
14794 </indexterm>
14795 <indexterm role="concept">
14796 <primary><option>addresses</option> expansion item</primary>
14797 </indexterm>
14798 The string (after expansion) is interpreted as a list of addresses in RFC
14799 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14800 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14801 result of the expansion is a colon-separated list, with appropriate
14802 doubling of colons should any happen to be present in the email addresses.
14803 Syntactically invalid RFC2822 address items are omitted from the output.
14804 </para>
14805 <para>
14806 It is possible to specify a character other than colon for the output
14807 separator by starting the string with &gt; followed by the new separator
14808 character. For example:
14809 </para>
14810 <literallayout class="monospaced">
14811 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14812 </literallayout>
14813 <para>
14814 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14815 expansion item, which extracts the working address from a single RFC2822
14816 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14817 processing lists.
14818 </para>
14819 <para>
14820 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14821 a strict interpretation of header line formatting.  Exim parses the bare,
14822 unquoted portion of an email address and if it finds a comma, treats it as an
14823 email address separator. For the example header line:
14824 </para>
14825 <literallayout class="monospaced">
14826 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14827 </literallayout>
14828 <para>
14829 The first example below demonstrates that Q-encoded email addresses are parsed
14830 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14831 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14832 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14833 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14834 The third example shows that the presence of a comma is skipped when it is
14835 quoted.
14836 </para>
14837 <literallayout class="monospaced">
14838 # exim -be '${addresses:From: \
14839 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14840 user@example.com
14841 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14842 Last:user@example.com
14843 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14844 user@example.com
14845 </literallayout>
14846 </listitem></varlistentry>
14847 <varlistentry>
14848 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14849 <listitem>
14850 <para>
14851 <indexterm role="concept">
14852 <primary><option>base62</option> expansion item</primary>
14853 </indexterm>
14854 <indexterm role="concept">
14855 <primary>expansion</primary>
14856 <secondary>conversion to base 62</secondary>
14857 </indexterm>
14858 The string must consist entirely of decimal digits. The number is converted to
14859 base 62 and output as a string of six characters, including leading zeros. In
14860 the few operating environments where Exim uses base 36 instead of base 62 for
14861 its message identifiers (because those systems do not have case-sensitive file
14862 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14863 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14864 </para>
14865 </listitem></varlistentry>
14866 <varlistentry>
14867 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14868 <listitem>
14869 <para>
14870 <indexterm role="concept">
14871 <primary><option>base62d</option> expansion item</primary>
14872 </indexterm>
14873 <indexterm role="concept">
14874 <primary>expansion</primary>
14875 <secondary>conversion to base 62</secondary>
14876 </indexterm>
14877 The string must consist entirely of base-62 digits, or, in operating
14878 environments where Exim uses base 36 instead of base 62 for its message
14879 identifiers, base-36 digits. The number is converted to decimal and output as a
14880 string.
14881 </para>
14882 </listitem></varlistentry>
14883 <varlistentry>
14884 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14885 <listitem>
14886 <para>
14887 <indexterm role="concept">
14888 <primary>domain</primary>
14889 <secondary>extraction</secondary>
14890 </indexterm>
14891 <indexterm role="concept">
14892 <primary>expansion</primary>
14893 <secondary>domain extraction</secondary>
14894 </indexterm>
14895 The string is interpreted as an RFC 2822 address and the domain is extracted
14896 from it. If the string does not parse successfully, the result is empty.
14897 </para>
14898 </listitem></varlistentry>
14899 <varlistentry>
14900 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14901 <listitem>
14902 <para>
14903 <indexterm role="concept">
14904 <primary>expansion</primary>
14905 <secondary>escaping non-printing characters</secondary>
14906 </indexterm>
14907 <indexterm role="concept">
14908 <primary><option>escape</option> expansion item</primary>
14909 </indexterm>
14910 If the string contains any non-printing characters, they are converted to
14911 escape sequences starting with a backslash. Whether characters with the most
14912 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14913 is controlled by the <option>print_topbitchars</option> option.
14914 </para>
14915 </listitem></varlistentry>
14916 <varlistentry>
14917 <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>
14918 <listitem>
14919 <para>
14920 <indexterm role="concept">
14921 <primary>expansion</primary>
14922 <secondary>expression evaluation</secondary>
14923 </indexterm>
14924 <indexterm role="concept">
14925 <primary>expansion</primary>
14926 <secondary>arithmetic expression</secondary>
14927 </indexterm>
14928 <indexterm role="concept">
14929 <primary><option>eval</option> expansion item</primary>
14930 </indexterm>
14931 These items supports simple arithmetic and bitwise logical operations in
14932 expansion strings. The string (after expansion) must be a conventional
14933 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14934 logical operators, and parentheses. All operations are carried out using
14935 integer arithmetic. The operator priorities are as follows (the same as in the
14936 C programming language):
14937 </para>
14938 <informaltable frame="none">
14939 <tgroup cols="2" colsep="0" rowsep="0">
14940 <colspec colwidth="70pt" align="left"/>
14941 <colspec colwidth="300pt" align="left"/>
14942 <tbody>
14943 <row>
14944 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14945 <entry>not (~), negate (-)</entry>
14946 </row>
14947 <row>
14948 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14949 <entry>multiply (*), divide (/), remainder (%)</entry>
14950 </row>
14951 <row>
14952 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14953 <entry>plus (+), minus (-)</entry>
14954 </row>
14955 <row>
14956 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14957 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14958 </row>
14959 <row>
14960 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14961 <entry>and (&amp;)</entry>
14962 </row>
14963 <row>
14964 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14965 <entry>xor (^)</entry>
14966 </row>
14967 <row>
14968 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14969 <entry>or (|)</entry>
14970 </row>
14971 </tbody>
14972 </tgroup>
14973 </informaltable>
14974 <para>
14975 Binary operators with the same priority are evaluated from left to right. White
14976 space is permitted before or after operators.
14977 </para>
14978 <para>
14979 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14980 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14981 decimal, even if they start with a leading zero; hexadecimal numbers are not
14982 permitted. This can be useful when processing numbers extracted from dates or
14983 times, which often do have leading zeros.
14984 </para>
14985 <para>
14986 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14987 or 1024*1024*1024,
14988 respectively. Negative numbers are supported. The result of the computation is
14989 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14990 </para>
14991 <literallayout>
14992 <literal>${eval:1+1}            </literal>  yields 2
14993 <literal>${eval:1+2*3}          </literal>  yields 7
14994 <literal>${eval:(1+2)*3}        </literal>  yields 9
14995 <literal>${eval:2+42%5}         </literal>  yields 4
14996 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14997 <literal>${eval:0xc|5}          </literal>  yields 13
14998 <literal>${eval:0xc^5}          </literal>  yields 9
14999 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15000 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15001 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15002 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15003 </literallayout>
15004 <para>
15005 As a more realistic example, in an ACL you might have
15006 </para>
15007 <literallayout class="monospaced">
15008 deny   message = Too many bad recipients
15009        condition =                    \
15010          ${if and {                   \
15011            {&gt;{$rcpt_count}{10}}       \
15012            {                          \
15013            &lt;                          \
15014              {$recipients_count}      \
15015              {${eval:$rcpt_count/2}}  \
15016            }                          \
15017          }{yes}{no}}
15018 </literallayout>
15019 <para>
15020 The condition is true if there have been more than 10 RCPT commands and
15021 fewer than half of them have resulted in a valid recipient.
15022 </para>
15023 </listitem></varlistentry>
15024 <varlistentry>
15025 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15026 <listitem>
15027 <para>
15028 <indexterm role="concept">
15029 <primary>expansion</primary>
15030 <secondary>re-expansion of substring</secondary>
15031 </indexterm>
15032 The <option>expand</option> operator causes a string to be expanded for a second time. For
15033 example,
15034 </para>
15035 <literallayout class="monospaced">
15036 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15037 </literallayout>
15038 <para>
15039 first looks up a string in a file while expanding the operand for <option>expand</option>,
15040 and then re-expands what it has found.
15041 </para>
15042 </listitem></varlistentry>
15043 <varlistentry>
15044 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15045 <listitem>
15046 <para>
15047 <indexterm role="concept">
15048 <primary>Unicode</primary>
15049 </indexterm>
15050 <indexterm role="concept">
15051 <primary>UTF-8</primary>
15052 <secondary>conversion from</secondary>
15053 </indexterm>
15054 <indexterm role="concept">
15055 <primary>expansion</primary>
15056 <secondary>UTF-8 conversion</secondary>
15057 </indexterm>
15058 <indexterm role="concept">
15059 <primary><option>from_utf8</option> expansion item</primary>
15060 </indexterm>
15061 The world is slowly moving towards Unicode, although there are no standards for
15062 email yet. However, other applications (including some databases) are starting
15063 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15064 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15065 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15066 the result is an undefined sequence of bytes.
15067 </para>
15068 <para>
15069 Unicode code points with values less than 256 are compatible with ASCII and
15070 ISO-8859-1 (also known as Latin-1).
15071 For example, character 169 is the copyright symbol in both cases, though the
15072 way it is encoded is different. In UTF-8, more than one byte is needed for
15073 characters with code values greater than 127, whereas ISO-8859-1 is a
15074 single-byte encoding (but thereby limited to 256 characters). This makes
15075 translation from UTF-8 to ISO-8859-1 straightforward.
15076 </para>
15077 </listitem></varlistentry>
15078 <varlistentry>
15079 <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>
15080 <listitem>
15081 <para>
15082 <indexterm role="concept">
15083 <primary>hash function</primary>
15084 <secondary>textual</secondary>
15085 </indexterm>
15086 <indexterm role="concept">
15087 <primary>expansion</primary>
15088 <secondary>textual hash</secondary>
15089 </indexterm>
15090 The <option>hash</option> operator is a simpler interface to the hashing function that can
15091 be used when the two parameters are fixed numbers (as opposed to strings that
15092 change when expanded). The effect is the same as
15093 </para>
15094 <literallayout class="monospaced">
15095 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15096 </literallayout>
15097 <para>
15098 See the description of the general <option>hash</option> item above for details. The
15099 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15100 </para>
15101 </listitem></varlistentry>
15102 <varlistentry>
15103 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15104 <listitem>
15105 <para>
15106 <indexterm role="concept">
15107 <primary>base64 encoding</primary>
15108 <secondary>conversion from hex</secondary>
15109 </indexterm>
15110 <indexterm role="concept">
15111 <primary>expansion</primary>
15112 <secondary>hex to base64</secondary>
15113 </indexterm>
15114 <indexterm role="concept">
15115 <primary><option>hex2b64</option> expansion item</primary>
15116 </indexterm>
15117 This operator converts a hex string into one that is base64 encoded. This can
15118 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15119 </para>
15120 </listitem></varlistentry>
15121 <varlistentry>
15122 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15123 <listitem>
15124 <para>
15125 <indexterm role="concept">
15126 <primary>quoting</primary>
15127 <secondary>hex-encoded unprintable characters</secondary>
15128 </indexterm>
15129 <indexterm role="concept">
15130 <primary><option>hexquote</option> expansion item</primary>
15131 </indexterm>
15132 This operator converts non-printable characters in a string into a hex
15133 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15134 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15135 byte value 127 is converted to <literal>\x7f</literal>.
15136 </para>
15137 </listitem></varlistentry>
15138 <varlistentry>
15139 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15140 <listitem>
15141 <para>
15142 <indexterm role="concept">
15143 <primary>case forcing in strings</primary>
15144 </indexterm>
15145 <indexterm role="concept">
15146 <primary>string</primary>
15147 <secondary>case forcing</secondary>
15148 </indexterm>
15149 <indexterm role="concept">
15150 <primary>lower casing</primary>
15151 </indexterm>
15152 <indexterm role="concept">
15153 <primary>expansion</primary>
15154 <secondary>case forcing</secondary>
15155 </indexterm>
15156 <indexterm role="concept">
15157 <primary><option>lc</option> expansion item</primary>
15158 </indexterm>
15159 This forces the letters in the string into lower-case, for example:
15160 </para>
15161 <literallayout class="monospaced">
15162 ${lc:$local_part}
15163 </literallayout>
15164 </listitem></varlistentry>
15165 <varlistentry>
15166 <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>
15167 <listitem>
15168 <para>
15169 <indexterm role="concept">
15170 <primary>expansion</primary>
15171 <secondary>string truncation</secondary>
15172 </indexterm>
15173 <indexterm role="concept">
15174 <primary><option>length</option> expansion item</primary>
15175 </indexterm>
15176 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15177 can be used when the parameter is a fixed number (as opposed to a string that
15178 changes when expanded). The effect is the same as
15179 </para>
15180 <literallayout class="monospaced">
15181 ${length{&lt;number&gt;}{&lt;string&gt;}}
15182 </literallayout>
15183 <para>
15184 See the description of the general <option>length</option> item above for details. Note that
15185 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15186 when <option>length</option> is used as an operator.
15187 </para>
15188 </listitem></varlistentry>
15189 <varlistentry>
15190 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15191 <listitem>
15192 <para>
15193 <indexterm role="concept">
15194 <primary>expansion</primary>
15195 <secondary>list item count</secondary>
15196 </indexterm>
15197 <indexterm role="concept">
15198 <primary>list</primary>
15199 <secondary>item count</secondary>
15200 </indexterm>
15201 <indexterm role="concept">
15202 <primary>list</primary>
15203 <secondary>count of items</secondary>
15204 </indexterm>
15205 <indexterm role="concept">
15206 <primary><option>listcount</option> expansion item</primary>
15207 </indexterm>
15208 The string is interpreted as a list and the number of items is returned.
15209 </para>
15210 </listitem></varlistentry>
15211 <varlistentry>
15212 <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>
15213 <listitem>
15214 <para>
15215 <indexterm role="concept">
15216 <primary>expansion</primary>
15217 <secondary>named list</secondary>
15218 </indexterm>
15219 <indexterm role="concept">
15220 <primary><option>listnamed</option> expansion item</primary>
15221 </indexterm>
15222 The name is interpreted as a named list and the content of the list is returned,
15223 expanding any referenced lists, re-quoting as needed for colon-separation.
15224 If the optional type is given it must be one of "a", "d", "h" or "l"
15225 and selects address-, domain-, host- or localpart- lists to search among respectively.
15226 Otherwise all types are searched in an undefined order and the first
15227 matching list is returned.
15228 </para>
15229 </listitem></varlistentry>
15230 <varlistentry>
15231 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15232 <listitem>
15233 <para>
15234 <indexterm role="concept">
15235 <primary>expansion</primary>
15236 <secondary>local part extraction</secondary>
15237 </indexterm>
15238 <indexterm role="concept">
15239 <primary><option>local_part</option> expansion item</primary>
15240 </indexterm>
15241 The string is interpreted as an RFC 2822 address and the local part is
15242 extracted from it. If the string does not parse successfully, the result is
15243 empty.
15244 </para>
15245 </listitem></varlistentry>
15246 <varlistentry>
15247 <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>
15248 <listitem>
15249 <para>
15250 <indexterm role="concept">
15251 <primary>masked IP address</primary>
15252 </indexterm>
15253 <indexterm role="concept">
15254 <primary>IP address</primary>
15255 <secondary>masking</secondary>
15256 </indexterm>
15257 <indexterm role="concept">
15258 <primary>CIDR notation</primary>
15259 </indexterm>
15260 <indexterm role="concept">
15261 <primary>expansion</primary>
15262 <secondary>IP address masking</secondary>
15263 </indexterm>
15264 <indexterm role="concept">
15265 <primary><option>mask</option> expansion item</primary>
15266 </indexterm>
15267 If the form of the string to be operated on is not an IP address followed by a
15268 slash and an integer (that is, a network address in CIDR notation), the
15269 expansion fails. Otherwise, this operator converts the IP address to binary,
15270 masks off the least significant bits according to the bit count, and converts
15271 the result back to text, with mask appended. For example,
15272 </para>
15273 <literallayout class="monospaced">
15274 ${mask:10.111.131.206/28}
15275 </literallayout>
15276 <para>
15277 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15278 be mostly used for looking up masked addresses in files, the result for an IPv6
15279 address uses dots to separate components instead of colons, because colon
15280 terminates a key string in lsearch files. So, for example,
15281 </para>
15282 <literallayout class="monospaced">
15283 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15284 </literallayout>
15285 <para>
15286 returns the string
15287 </para>
15288 <literallayout class="monospaced">
15289 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15290 </literallayout>
15291 <para>
15292 Letters in IPv6 addresses are always output in lower case.
15293 </para>
15294 </listitem></varlistentry>
15295 <varlistentry>
15296 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15297 <listitem>
15298 <para>
15299 <indexterm role="concept">
15300 <primary>MD5 hash</primary>
15301 </indexterm>
15302 <indexterm role="concept">
15303 <primary>expansion</primary>
15304 <secondary>MD5 hash</secondary>
15305 </indexterm>
15306 <indexterm role="concept">
15307 <primary>certificate fingerprint</primary>
15308 </indexterm>
15309 <indexterm role="concept">
15310 <primary><option>md5</option> expansion item</primary>
15311 </indexterm>
15312 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15313 as a 32-digit hexadecimal number, in which any letters are in lower case.
15314 </para>
15315 </listitem></varlistentry>
15316 <varlistentry>
15317 <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>
15318 <listitem>
15319 <para>
15320 <indexterm role="concept">
15321 <primary>expansion</primary>
15322 <secondary>numeric hash</secondary>
15323 </indexterm>
15324 <indexterm role="concept">
15325 <primary>hash function</primary>
15326 <secondary>numeric</secondary>
15327 </indexterm>
15328 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15329 that can be used when the two parameters are fixed numbers (as opposed to
15330 strings that change when expanded). The effect is the same as
15331 </para>
15332 <literallayout class="monospaced">
15333 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15334 </literallayout>
15335 <para>
15336 See the description of the general <option>nhash</option> item above for details.
15337 </para>
15338 </listitem></varlistentry>
15339 <varlistentry>
15340 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15341 <listitem>
15342 <para>
15343 <indexterm role="concept">
15344 <primary>quoting</primary>
15345 <secondary>in string expansions</secondary>
15346 </indexterm>
15347 <indexterm role="concept">
15348 <primary>expansion</primary>
15349 <secondary>quoting</secondary>
15350 </indexterm>
15351 <indexterm role="concept">
15352 <primary><option>quote</option> expansion item</primary>
15353 </indexterm>
15354 The <option>quote</option> operator puts its argument into double quotes if it
15355 is an empty string or
15356 contains anything other than letters, digits, underscores, dots, and hyphens.
15357 Any occurrences of double quotes and backslashes are escaped with a backslash.
15358 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15359 respectively For example,
15360 </para>
15361 <literallayout class="monospaced">
15362 ${quote:ab"*"cd}
15363 </literallayout>
15364 <para>
15365 becomes
15366 </para>
15367 <literallayout class="monospaced">
15368 "ab\"*\"cd"
15369 </literallayout>
15370 <para>
15371 The place where this is useful is when the argument is a substitution from a
15372 variable or a message header.
15373 </para>
15374 </listitem></varlistentry>
15375 <varlistentry>
15376 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15377 <listitem>
15378 <para>
15379 <indexterm role="concept">
15380 <primary><option>quote_local_part</option> expansion item</primary>
15381 </indexterm>
15382 This operator is like <option>quote</option>, except that it quotes the string only if
15383 required to do so by the rules of RFC 2822 for quoting local parts. For
15384 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15385 If you are creating a new email address from the contents of <varname>$local_part</varname>
15386 (or any other unknown data), you should always use this operator.
15387 </para>
15388 </listitem></varlistentry>
15389 <varlistentry>
15390 <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>
15391 <listitem>
15392 <para>
15393 <indexterm role="concept">
15394 <primary>quoting</primary>
15395 <secondary>lookup-specific</secondary>
15396 </indexterm>
15397 This operator applies lookup-specific quoting rules to the string. Each
15398 query-style lookup type has its own quoting rules which are described with
15399 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15400 </para>
15401 <literallayout class="monospaced">
15402 ${quote_ldap:two * two}
15403 </literallayout>
15404 <para>
15405 returns
15406 </para>
15407 <literallayout class="monospaced">
15408 two%20%5C2A%20two
15409 </literallayout>
15410 <para>
15411 For single-key lookup types, no quoting is ever necessary and this operator
15412 yields an unchanged string.
15413 </para>
15414 </listitem></varlistentry>
15415 <varlistentry>
15416 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15417 <listitem>
15418 <para>
15419 <indexterm role="concept">
15420 <primary>random number</primary>
15421 </indexterm>
15422 This operator returns a somewhat random number which is less than the
15423 supplied number and is at least 0.  The quality of this randomness depends
15424 on how Exim was built; the values are not suitable for keying material.
15425 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15426 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15427 for versions of GnuTLS with that function.
15428 Otherwise, the implementation may be arc4random(), random() seeded by
15429 srandomdev() or srandom(), or a custom implementation even weaker than
15430 random().
15431 </para>
15432 </listitem></varlistentry>
15433 <varlistentry>
15434 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15435 <listitem>
15436 <para>
15437 <indexterm role="concept">
15438 <primary>expansion</primary>
15439 <secondary>IP address</secondary>
15440 </indexterm>
15441 This operator reverses an IP address; for IPv4 addresses, the result is in
15442 dotted-quad decimal form, while for IPv6 addresses the result is in
15443 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15444 for DNS.  For example,
15445 </para>
15446 <literallayout class="monospaced">
15447 ${reverse_ip:192.0.2.4}
15448 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15449 </literallayout>
15450 <para>
15451 returns
15452 </para>
15453 <literallayout class="monospaced">
15454 4.2.0.192
15455 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
15456 </literallayout>
15457 </listitem></varlistentry>
15458 <varlistentry>
15459 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15460 <listitem>
15461 <para>
15462 <indexterm role="concept">
15463 <primary>expansion</primary>
15464 <secondary>RFC 2047</secondary>
15465 </indexterm>
15466 <indexterm role="concept">
15467 <primary>RFC 2047</primary>
15468 <secondary>expansion operator</secondary>
15469 </indexterm>
15470 <indexterm role="concept">
15471 <primary><option>rfc2047</option> expansion item</primary>
15472 </indexterm>
15473 This operator encodes text according to the rules of RFC 2047. This is an
15474 encoding that is used in header lines to encode non-ASCII characters. It is
15475 assumed that the input string is in the encoding specified by the
15476 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15477 contains only characters in the range 33&ndash;126, and no instances of the
15478 characters
15479 </para>
15480 <literallayout class="monospaced">
15481 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15482 </literallayout>
15483 <para>
15484 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15485 string, using as many <quote>encoded words</quote> as necessary to encode all the
15486 characters.
15487 </para>
15488 </listitem></varlistentry>
15489 <varlistentry>
15490 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15491 <listitem>
15492 <para>
15493 <indexterm role="concept">
15494 <primary>expansion</primary>
15495 <secondary>RFC 2047</secondary>
15496 </indexterm>
15497 <indexterm role="concept">
15498 <primary>RFC 2047</primary>
15499 <secondary>decoding</secondary>
15500 </indexterm>
15501 <indexterm role="concept">
15502 <primary><option>rfc2047d</option> expansion item</primary>
15503 </indexterm>
15504 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15505 bytes are replaced by question marks. Characters are converted into the
15506 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15507 not recognized unless <option>check_rfc2047_length</option> is set false.
15508 </para>
15509 <para>
15510 <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
15511 access a header line, RFC 2047 decoding is done automatically. You do not need
15512 to use this operator as well.
15513 </para>
15514 </listitem></varlistentry>
15515 <varlistentry>
15516 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15517 <listitem>
15518 <para>
15519 <indexterm role="concept">
15520 <primary>quoting</primary>
15521 <secondary>in regular expressions</secondary>
15522 </indexterm>
15523 <indexterm role="concept">
15524 <primary>regular expressions</primary>
15525 <secondary>quoting</secondary>
15526 </indexterm>
15527 <indexterm role="concept">
15528 <primary><option>rxquote</option> expansion item</primary>
15529 </indexterm>
15530 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15531 characters in its argument. This is useful when substituting the values of
15532 variables or headers inside regular expressions.
15533 </para>
15534 </listitem></varlistentry>
15535 <varlistentry>
15536 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15537 <listitem>
15538 <para>
15539 <indexterm role="concept">
15540 <primary>SHA-1 hash</primary>
15541 </indexterm>
15542 <indexterm role="concept">
15543 <primary>expansion</primary>
15544 <secondary>SHA-1 hashing</secondary>
15545 </indexterm>
15546 <indexterm role="concept">
15547 <primary>certificate fingerprint</primary>
15548 </indexterm>
15549 <indexterm role="concept">
15550 <primary><option>sha2</option> expansion item</primary>
15551 </indexterm>
15552 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15553 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15554 </para>
15555 </listitem></varlistentry>
15556 <varlistentry>
15557 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15558 <listitem>
15559 <para>
15560 <indexterm role="concept">
15561 <primary>SHA-256 hash</primary>
15562 </indexterm>
15563 <indexterm role="concept">
15564 <primary>certificate fingerprint</primary>
15565 </indexterm>
15566 <indexterm role="concept">
15567 <primary>expansion</primary>
15568 <secondary>SHA-256 hashing</secondary>
15569 </indexterm>
15570 <indexterm role="concept">
15571 <primary><option>sha256</option> expansion item</primary>
15572 </indexterm>
15573 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15574 certificate,
15575 and returns
15576 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15577 Only arguments which are a single variable of certificate type are supported.
15578 </para>
15579 </listitem></varlistentry>
15580 <varlistentry>
15581 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15582 <listitem>
15583 <para>
15584 <indexterm role="concept">
15585 <primary>expansion</primary>
15586 <secondary>statting a file</secondary>
15587 </indexterm>
15588 <indexterm role="concept">
15589 <primary>file</primary>
15590 <secondary>extracting characteristics</secondary>
15591 </indexterm>
15592 <indexterm role="concept">
15593 <primary><option>stat</option> expansion item</primary>
15594 </indexterm>
15595 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15596 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15597 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15598 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15599 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15600 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15601 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15602 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15603 can extract individual fields using the <option>extract</option> expansion item.
15604 </para>
15605 <para>
15606 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15607 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15608 systems for files larger than 2GB.
15609 </para>
15610 </listitem></varlistentry>
15611 <varlistentry>
15612 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15613 <listitem>
15614 <para>
15615 <indexterm role="concept">
15616 <primary>expansion</primary>
15617 <secondary>base64 encoding</secondary>
15618 </indexterm>
15619 <indexterm role="concept">
15620 <primary>base64 encoding</primary>
15621 <secondary>in string expansion</secondary>
15622 </indexterm>
15623 <indexterm role="concept">
15624 <primary><option>str2b64</option> expansion item</primary>
15625 </indexterm>
15626 This operator converts a string into one that is base64 encoded.
15627 </para>
15628 </listitem></varlistentry>
15629 <varlistentry>
15630 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15631 <listitem>
15632 <para>
15633 <indexterm role="concept">
15634 <primary>expansion</primary>
15635 <secondary>string length</secondary>
15636 </indexterm>
15637 <indexterm role="concept">
15638 <primary>string</primary>
15639 <secondary>length in expansion</secondary>
15640 </indexterm>
15641 <indexterm role="concept">
15642 <primary><option>strlen</option> expansion item</primary>
15643 </indexterm>
15644 The item is replace by the length of the expanded string, expressed as a
15645 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15646 </para>
15647 </listitem></varlistentry>
15648 <varlistentry>
15649 <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>
15650 <listitem>
15651 <para>
15652 <indexterm role="concept">
15653 <primary><option>substr</option> expansion item</primary>
15654 </indexterm>
15655 <indexterm role="concept">
15656 <primary>substring extraction</primary>
15657 </indexterm>
15658 <indexterm role="concept">
15659 <primary>expansion</primary>
15660 <secondary>substring expansion</secondary>
15661 </indexterm>
15662 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15663 can be used when the two parameters are fixed numbers (as opposed to strings
15664 that change when expanded). The effect is the same as
15665 </para>
15666 <literallayout class="monospaced">
15667 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15668 </literallayout>
15669 <para>
15670 See the description of the general <option>substr</option> item above for details. The
15671 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15672 </para>
15673 </listitem></varlistentry>
15674 <varlistentry>
15675 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15676 <listitem>
15677 <para>
15678 <indexterm role="concept">
15679 <primary><option>time_eval</option> expansion item</primary>
15680 </indexterm>
15681 <indexterm role="concept">
15682 <primary>time interval</primary>
15683 <secondary>decoding</secondary>
15684 </indexterm>
15685 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15686 seconds.
15687 </para>
15688 </listitem></varlistentry>
15689 <varlistentry>
15690 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15691 <listitem>
15692 <para>
15693 <indexterm role="concept">
15694 <primary><option>time_interval</option> expansion item</primary>
15695 </indexterm>
15696 <indexterm role="concept">
15697 <primary>time interval</primary>
15698 <secondary>formatting</secondary>
15699 </indexterm>
15700 The argument (after sub-expansion) must be a sequence of decimal digits that
15701 represents an interval of time as a number of seconds. It is converted into a
15702 number of larger units and output in Exim&#x2019;s normal time format, for example,
15703 <literal>1w3d4h2m6s</literal>.
15704 </para>
15705 </listitem></varlistentry>
15706 <varlistentry>
15707 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15708 <listitem>
15709 <para>
15710 <indexterm role="concept">
15711 <primary>case forcing in strings</primary>
15712 </indexterm>
15713 <indexterm role="concept">
15714 <primary>string</primary>
15715 <secondary>case forcing</secondary>
15716 </indexterm>
15717 <indexterm role="concept">
15718 <primary>upper casing</primary>
15719 </indexterm>
15720 <indexterm role="concept">
15721 <primary>expansion</primary>
15722 <secondary>case forcing</secondary>
15723 </indexterm>
15724 <indexterm role="concept">
15725 <primary><option>uc</option> expansion item</primary>
15726 </indexterm>
15727 This forces the letters in the string into upper-case.
15728 </para>
15729 </listitem></varlistentry>
15730 <varlistentry>
15731 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15732 <listitem>
15733 <para>
15734 <indexterm role="concept">
15735 <primary>correction of invalid utf-8 sequences in strings</primary>
15736 </indexterm>
15737 <indexterm role="concept">
15738 <primary>utf-8</primary>
15739 <secondary>utf-8 sequences</secondary>
15740 </indexterm>
15741 <indexterm role="concept">
15742 <primary>incorrect utf-8</primary>
15743 </indexterm>
15744 <indexterm role="concept">
15745 <primary>expansion</primary>
15746 <secondary>utf-8 forcing</secondary>
15747 </indexterm>
15748 <indexterm role="concept">
15749 <primary><option>utf8clean</option> expansion item</primary>
15750 </indexterm>
15751 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
15752 </para>
15753 </listitem></varlistentry>
15754 </variablelist>
15755 </section>
15756 <section id="SECTexpcond">
15757 <title>Expansion conditions</title>
15758 <para>
15759 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15760 <primary>expansion</primary>
15761 <secondary>conditions</secondary>
15762 </indexterm>
15763 The following conditions are available for testing by the <option>${if</option> construct
15764 while expanding strings:
15765 </para>
15766 <variablelist>
15767 <varlistentry>
15768 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15769 <listitem>
15770 <para>
15771 <indexterm role="concept">
15772 <primary>expansion</primary>
15773 <secondary>negating a condition</secondary>
15774 </indexterm>
15775 <indexterm role="concept">
15776 <primary>negation</primary>
15777 <secondary>in expansion condition</secondary>
15778 </indexterm>
15779 Preceding any condition with an exclamation mark negates the result of the
15780 condition.
15781 </para>
15782 </listitem></varlistentry>
15783 <varlistentry>
15784 <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>
15785 <listitem>
15786 <para>
15787 <indexterm role="concept">
15788 <primary>numeric comparison</primary>
15789 </indexterm>
15790 <indexterm role="concept">
15791 <primary>expansion</primary>
15792 <secondary>numeric comparison</secondary>
15793 </indexterm>
15794 There are a number of symbolic operators for doing numeric comparisons. They
15795 are:
15796 </para>
15797 <literallayout>
15798 <literal>=   </literal>   equal
15799 <literal>==  </literal>   equal
15800 <literal>&gt;   </literal>   greater
15801 <literal>&gt;=  </literal>   greater or equal
15802 <literal>&lt;   </literal>   less
15803 <literal>&lt;=  </literal>   less or equal
15804 </literallayout>
15805 <para>
15806 For example:
15807 </para>
15808 <literallayout class="monospaced">
15809 ${if &gt;{$message_size}{10M} ...
15810 </literallayout>
15811 <para>
15812 Note that the general negation operator provides for inequality testing. The
15813 two strings must take the form of optionally signed decimal integers,
15814 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15815 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15816 As a special case, the numerical value of an empty string is taken as
15817 zero.
15818 </para>
15819 <para>
15820 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15821 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15822 10M, not if 10M is larger than <varname>$message_size</varname>.
15823 </para>
15824 </listitem></varlistentry>
15825 <varlistentry>
15826 <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>
15827 <listitem>
15828 <para>
15829 <indexterm role="concept">
15830 <primary>expansion</primary>
15831 <secondary>calling an acl</secondary>
15832 </indexterm>
15833 <indexterm role="concept">
15834 <primary><option>acl</option></primary>
15835 <secondary>expansion condition</secondary>
15836 </indexterm>
15837 The name and zero to nine argument strings are first expanded separately.  The expanded
15838 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15839 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15840 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15841 and may use the variables; if another acl expansion is used the values
15842 are restored after it returns.  If the ACL sets
15843 a value using a "message =" modifier the variable $value becomes
15844 the result of the expansion, otherwise it is empty.
15845 If the ACL returns accept the condition is true; if deny, false.
15846 If the ACL returns defer the result is a forced-fail.
15847 </para>
15848 </listitem></varlistentry>
15849 <varlistentry>
15850 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15851 <listitem>
15852 <para>
15853 <indexterm role="concept">
15854 <primary>expansion</primary>
15855 <secondary>boolean parsing</secondary>
15856 </indexterm>
15857 <indexterm role="concept">
15858 <primary><option>bool</option> expansion condition</primary>
15859 </indexterm>
15860 This condition turns a string holding a true or false representation into
15861 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15862 (case-insensitively); also integer numbers map to true if non-zero,
15863 false if zero.
15864 An empty string is treated as false.
15865 Leading and trailing whitespace is ignored;
15866 thus a string consisting only of whitespace is false.
15867 All other string values will result in expansion failure.
15868 </para>
15869 <para>
15870 When combined with ACL variables, this expansion condition will let you
15871 make decisions in one place and act on those decisions in another place.
15872 For example:
15873 </para>
15874 <literallayout class="monospaced">
15875 ${if bool{$acl_m_privileged_sender} ...
15876 </literallayout>
15877 </listitem></varlistentry>
15878 <varlistentry>
15879 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15880 <listitem>
15881 <para>
15882 <indexterm role="concept">
15883 <primary>expansion</primary>
15884 <secondary>boolean parsing</secondary>
15885 </indexterm>
15886 <indexterm role="concept">
15887 <primary><option>bool_lax</option> expansion condition</primary>
15888 </indexterm>
15889 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15890 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15891 loose definition that the Router <option>condition</option> option uses.  The empty string
15892 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15893 true.  Leading and trailing whitespace is ignored.
15894 </para>
15895 <para>
15896 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15897 </para>
15898 </listitem></varlistentry>
15899 <varlistentry>
15900 <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>
15901 <listitem>
15902 <para>
15903 <indexterm role="concept">
15904 <primary>expansion</primary>
15905 <secondary>encrypted comparison</secondary>
15906 </indexterm>
15907 <indexterm role="concept">
15908 <primary>encrypted strings, comparing</primary>
15909 </indexterm>
15910 <indexterm role="concept">
15911 <primary><option>crypteq</option> expansion condition</primary>
15912 </indexterm>
15913 This condition is included in the Exim binary if it is built to support any
15914 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15915 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15916 included in the binary.
15917 </para>
15918 <para>
15919 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15920 compared against the second, which is already encrypted. The second string may
15921 be in the LDAP form for storing encrypted strings, which starts with the
15922 encryption type in curly brackets, followed by the data. If the second string
15923 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15924 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15925 Typically this will be a field from a password file. An example of an encrypted
15926 string in LDAP form is:
15927 </para>
15928 <literallayout class="monospaced">
15929 {md5}CY9rzUYh03PK3k6DJie09g==
15930 </literallayout>
15931 <para>
15932 If such a string appears directly in an expansion, the curly brackets have to
15933 be quoted, because they are part of the expansion syntax. For example:
15934 </para>
15935 <literallayout class="monospaced">
15936 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15937 </literallayout>
15938 <para>
15939 The following encryption types (whose names are matched case-independently) are
15940 supported:
15941 </para>
15942 <itemizedlist>
15943 <listitem>
15944 <para>
15945 <indexterm role="concept">
15946 <primary>MD5 hash</primary>
15947 </indexterm>
15948 <indexterm role="concept">
15949 <primary>base64 encoding</primary>
15950 <secondary>in encrypted password</secondary>
15951 </indexterm>
15952 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15953 printable characters to compare with the remainder of the second string. If the
15954 length of the comparison string is 24, Exim assumes that it is base64 encoded
15955 (as in the above example). If the length is 32, Exim assumes that it is a
15956 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15957 comparison fails.
15958 </para>
15959 </listitem>
15960 <listitem>
15961 <para>
15962 <indexterm role="concept">
15963 <primary>SHA-1 hash</primary>
15964 </indexterm>
15965 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15966 printable characters to compare with the remainder of the second string. If the
15967 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15968 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15969 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15970 </para>
15971 </listitem>
15972 <listitem>
15973 <para>
15974 <indexterm role="concept">
15975 <primary><function>crypt()</function></primary>
15976 </indexterm>
15977 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15978 only the first eight characters of the password. However, in modern operating
15979 systems this is no longer true, and in many cases the entire password is used,
15980 whatever its length.
15981 </para>
15982 </listitem>
15983 <listitem>
15984 <para>
15985 <indexterm role="concept">
15986 <primary><function>crypt16()</function></primary>
15987 </indexterm>
15988 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15989 use up to 16 characters of the password in some operating systems. Again, in
15990 modern operating systems, more characters may be used.
15991 </para>
15992 </listitem>
15993 </itemizedlist>
15994 <para>
15995 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15996 <function>crypt()</function>. For operating systems that have their own version, setting
15997 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15998 operating system version instead of its own. This option is set by default in
15999 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16000 support <function>crypt16()</function>.
16001 </para>
16002 <para>
16003 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16004 it was not using the same algorithm as some operating systems&#x2019; versions. It
16005 turns out that as well as <function>crypt16()</function> there is a function called
16006 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16007 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16008 </para>
16009 <para>
16010 However, since there is now a move away from the traditional <function>crypt()</function>
16011 functions towards using SHA1 and other algorithms, tidying up this area of
16012 Exim is seen as very low priority.
16013 </para>
16014 <para>
16015 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16016 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16017 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16018 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16019 function by specifying it explicitly in curly brackets.
16020 </para>
16021 </listitem></varlistentry>
16022 <varlistentry>
16023 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16024 <listitem>
16025 <para>
16026 <indexterm role="concept">
16027 <primary>expansion</primary>
16028 <secondary>checking for empty variable</secondary>
16029 </indexterm>
16030 <indexterm role="concept">
16031 <primary><option>def</option> expansion condition</primary>
16032 </indexterm>
16033 The <option>def</option> condition must be followed by the name of one of the expansion
16034 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16035 variable does not contain the empty string. For example:
16036 </para>
16037 <literallayout class="monospaced">
16038 ${if def:sender_ident {from $sender_ident}}
16039 </literallayout>
16040 <para>
16041 Note that the variable name is given without a leading <option>$</option> character. If the
16042 variable does not exist, the expansion fails.
16043 </para>
16044 </listitem></varlistentry>
16045 <varlistentry>
16046 <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>
16047 <listitem>
16048 <para>
16049 <indexterm role="concept">
16050 <primary>expansion</primary>
16051 <secondary>checking header line existence</secondary>
16052 </indexterm>
16053 This condition is true if a message is being processed and the named header
16054 exists in the message. For example,
16055 </para>
16056 <literallayout class="monospaced">
16057 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16058 </literallayout>
16059 <para>
16060 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16061 the header name must be terminated by a colon if white space does not follow.
16062 </para>
16063 </listitem></varlistentry>
16064 <varlistentry>
16065 <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>
16066 <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>
16067 <listitem>
16068 <para>
16069 <indexterm role="concept">
16070 <primary>string</primary>
16071 <secondary>comparison</secondary>
16072 </indexterm>
16073 <indexterm role="concept">
16074 <primary>expansion</primary>
16075 <secondary>string comparison</secondary>
16076 </indexterm>
16077 <indexterm role="concept">
16078 <primary><option>eq</option> expansion condition</primary>
16079 </indexterm>
16080 <indexterm role="concept">
16081 <primary><option>eqi</option> expansion condition</primary>
16082 </indexterm>
16083 The two substrings are first expanded. The condition is true if the two
16084 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16085 letters, whereas for <option>eqi</option> the comparison is case-independent.
16086 </para>
16087 </listitem></varlistentry>
16088 <varlistentry>
16089 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16090 <listitem>
16091 <para>
16092 <indexterm role="concept">
16093 <primary>expansion</primary>
16094 <secondary>file existence test</secondary>
16095 </indexterm>
16096 <indexterm role="concept">
16097 <primary>file</primary>
16098 <secondary>existence test</secondary>
16099 </indexterm>
16100 <indexterm role="concept">
16101 <primary><option>exists</option>, expansion condition</primary>
16102 </indexterm>
16103 The substring is first expanded and then interpreted as an absolute path. The
16104 condition is true if the named file (or directory) exists. The existence test
16105 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16106 users&#x2019; filter files may be locked out by the system administrator.
16107 </para>
16108 </listitem></varlistentry>
16109 <varlistentry>
16110 <term><emphasis role="bold">first_delivery</emphasis></term>
16111 <listitem>
16112 <para>
16113 <indexterm role="concept">
16114 <primary>delivery</primary>
16115 <secondary>first</secondary>
16116 </indexterm>
16117 <indexterm role="concept">
16118 <primary>first delivery</primary>
16119 </indexterm>
16120 <indexterm role="concept">
16121 <primary>expansion</primary>
16122 <secondary>first delivery test</secondary>
16123 </indexterm>
16124 <indexterm role="concept">
16125 <primary><option>first_delivery</option> expansion condition</primary>
16126 </indexterm>
16127 This condition, which has no data, is true during a message&#x2019;s first delivery
16128 attempt. It is false during any subsequent delivery attempts.
16129 </para>
16130 </listitem></varlistentry>
16131 <varlistentry>
16132 <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>
16133 <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>
16134 <listitem>
16135 <para>
16136 <indexterm role="concept">
16137 <primary>list</primary>
16138 <secondary>iterative conditions</secondary>
16139 </indexterm>
16140 <indexterm role="concept">
16141 <primary>expansion</primary>
16142 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16143 </indexterm>
16144 <indexterm role="concept">
16145 <primary>expansion</primary>
16146 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16147 </indexterm>
16148 <indexterm role="variable">
16149 <primary><varname>$item</varname></primary>
16150 </indexterm>
16151 These conditions iterate over a list. The first argument is expanded to form
16152 the list. By default, the list separator is a colon, but it can be changed by
16153 the normal method. The second argument is interpreted as a condition that is to
16154 be applied to each item in the list in turn. During the interpretation of the
16155 condition, the current list item is placed in a variable called <varname>$item</varname>.
16156 </para>
16157 <itemizedlist>
16158 <listitem>
16159 <para>
16160 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16161 the result of the whole condition is true. If the condition is false for all
16162 items in the list, the overall condition is false.
16163 </para>
16164 </listitem>
16165 <listitem>
16166 <para>
16167 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16168 and the result of the whole condition is false. If the condition is true for
16169 all items in the list, the overall condition is true.
16170 </para>
16171 </listitem>
16172 </itemizedlist>
16173 <para>
16174 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16175 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16176 that the condition must be false for at least one item. In this example, the
16177 list separator is changed to a comma:
16178 </para>
16179 <literallayout class="monospaced">
16180 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16181 </literallayout>
16182 <para>
16183 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16184 being processed, to enable these expansion items to be nested.
16185 </para>
16186 <para>
16187 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16188 </para>
16189 </listitem></varlistentry>
16190 <varlistentry>
16191 <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>
16192 <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>
16193 <listitem>
16194 <para>
16195 <indexterm role="concept">
16196 <primary>string</primary>
16197 <secondary>comparison</secondary>
16198 </indexterm>
16199 <indexterm role="concept">
16200 <primary>expansion</primary>
16201 <secondary>string comparison</secondary>
16202 </indexterm>
16203 <indexterm role="concept">
16204 <primary><option>ge</option> expansion condition</primary>
16205 </indexterm>
16206 <indexterm role="concept">
16207 <primary><option>gei</option> expansion condition</primary>
16208 </indexterm>
16209 The two substrings are first expanded. The condition is true if the first
16210 string is lexically greater than or equal to the second string. For <option>ge</option> the
16211 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16212 case-independent.
16213 </para>
16214 </listitem></varlistentry>
16215 <varlistentry>
16216 <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>
16217 <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>
16218 <listitem>
16219 <para>
16220 <indexterm role="concept">
16221 <primary>string</primary>
16222 <secondary>comparison</secondary>
16223 </indexterm>
16224 <indexterm role="concept">
16225 <primary>expansion</primary>
16226 <secondary>string comparison</secondary>
16227 </indexterm>
16228 <indexterm role="concept">
16229 <primary><option>gt</option> expansion condition</primary>
16230 </indexterm>
16231 <indexterm role="concept">
16232 <primary><option>gti</option> expansion condition</primary>
16233 </indexterm>
16234 The two substrings are first expanded. The condition is true if the first
16235 string is lexically greater than the second string. For <option>gt</option> the comparison
16236 includes the case of letters, whereas for <option>gti</option> the comparison is
16237 case-independent.
16238 </para>
16239 </listitem></varlistentry>
16240 <varlistentry>
16241 <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>
16242 <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>
16243 <listitem>
16244 <para>
16245 <indexterm role="concept">
16246 <primary>string</primary>
16247 <secondary>comparison</secondary>
16248 </indexterm>
16249 <indexterm role="concept">
16250 <primary>list</primary>
16251 <secondary>iterative conditions</secondary>
16252 </indexterm>
16253 Both strings are expanded; the second string is treated as a list of simple
16254 strings; if the first string is a member of the second, then the condition
16255 is true.
16256 </para>
16257 <para>
16258 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16259 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16260 </para>
16261 <literallayout class="monospaced">
16262 ${if inlist{needle}{foo:needle:bar}}
16263   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16264 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16265   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16266 </literallayout>
16267 </listitem></varlistentry>
16268 <varlistentry>
16269 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16270 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16271 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16272 <listitem>
16273 <para>
16274 <indexterm role="concept">
16275 <primary>IP address</primary>
16276 <secondary>testing string format</secondary>
16277 </indexterm>
16278 <indexterm role="concept">
16279 <primary>string</primary>
16280 <secondary>testing for IP address</secondary>
16281 </indexterm>
16282 <indexterm role="concept">
16283 <primary><option>isip</option> expansion condition</primary>
16284 </indexterm>
16285 <indexterm role="concept">
16286 <primary><option>isip4</option> expansion condition</primary>
16287 </indexterm>
16288 <indexterm role="concept">
16289 <primary><option>isip6</option> expansion condition</primary>
16290 </indexterm>
16291 The substring is first expanded, and then tested to see if it has the form of
16292 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16293 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16294 </para>
16295 <para>
16296 For an IPv4 address, the test is for four dot-separated components, each of
16297 which consists of from one to three digits. For an IPv6 address, up to eight
16298 colon-separated components are permitted, each containing from one to four
16299 hexadecimal digits. There may be fewer than eight components if an empty
16300 component (adjacent colons) is present. Only one empty component is permitted.
16301 </para>
16302 <para>
16303 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16304 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16305 check. The main use of these tests is to distinguish between IP addresses and
16306 host names, or between IPv4 and IPv6 addresses. For example, you could use
16307 </para>
16308 <literallayout class="monospaced">
16309 ${if isip4{$sender_host_address}...
16310 </literallayout>
16311 <para>
16312 to test which IP version an incoming SMTP connection is using.
16313 </para>
16314 </listitem></varlistentry>
16315 <varlistentry>
16316 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16317 <listitem>
16318 <para>
16319 <indexterm role="concept">
16320 <primary>LDAP</primary>
16321 <secondary>use for authentication</secondary>
16322 </indexterm>
16323 <indexterm role="concept">
16324 <primary>expansion</primary>
16325 <secondary>LDAP authentication test</secondary>
16326 </indexterm>
16327 <indexterm role="concept">
16328 <primary><option>ldapauth</option> expansion condition</primary>
16329 </indexterm>
16330 This condition supports user authentication using LDAP. See section
16331 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16332 queries. For this use, the query must contain a user name and password. The
16333 query itself is not used, and can be empty. The condition is true if the
16334 password is not empty, and the user name and password are accepted by the LDAP
16335 server. An empty password is rejected without calling LDAP because LDAP binds
16336 with an empty password are considered anonymous regardless of the username, and
16337 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16338 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16339 this can be used.
16340 </para>
16341 </listitem></varlistentry>
16342 <varlistentry>
16343 <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>
16344 <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>
16345 <listitem>
16346 <para>
16347 <indexterm role="concept">
16348 <primary>string</primary>
16349 <secondary>comparison</secondary>
16350 </indexterm>
16351 <indexterm role="concept">
16352 <primary>expansion</primary>
16353 <secondary>string comparison</secondary>
16354 </indexterm>
16355 <indexterm role="concept">
16356 <primary><option>le</option> expansion condition</primary>
16357 </indexterm>
16358 <indexterm role="concept">
16359 <primary><option>lei</option> expansion condition</primary>
16360 </indexterm>
16361 The two substrings are first expanded. The condition is true if the first
16362 string is lexically less than or equal to the second string. For <option>le</option> the
16363 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16364 case-independent.
16365 </para>
16366 </listitem></varlistentry>
16367 <varlistentry>
16368 <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>
16369 <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>
16370 <listitem>
16371 <para>
16372 <indexterm role="concept">
16373 <primary>string</primary>
16374 <secondary>comparison</secondary>
16375 </indexterm>
16376 <indexterm role="concept">
16377 <primary>expansion</primary>
16378 <secondary>string comparison</secondary>
16379 </indexterm>
16380 <indexterm role="concept">
16381 <primary><option>lt</option> expansion condition</primary>
16382 </indexterm>
16383 <indexterm role="concept">
16384 <primary><option>lti</option> expansion condition</primary>
16385 </indexterm>
16386 The two substrings are first expanded. The condition is true if the first
16387 string is lexically less than the second string. For <option>lt</option> the comparison
16388 includes the case of letters, whereas for <option>lti</option> the comparison is
16389 case-independent.
16390 </para>
16391 </listitem></varlistentry>
16392 <varlistentry>
16393 <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>
16394 <listitem>
16395 <para>
16396 <indexterm role="concept">
16397 <primary>expansion</primary>
16398 <secondary>regular expression comparison</secondary>
16399 </indexterm>
16400 <indexterm role="concept">
16401 <primary>regular expressions</primary>
16402 <secondary>match in expanded string</secondary>
16403 </indexterm>
16404 <indexterm role="concept">
16405 <primary><option>match</option> expansion condition</primary>
16406 </indexterm>
16407 The two substrings are first expanded. The second is then treated as a regular
16408 expression and applied to the first. Because of the pre-expansion, if the
16409 regular expression contains dollar, or backslash characters, they must be
16410 escaped. Care must also be taken if the regular expression contains braces
16411 (curly brackets). A closing brace must be escaped so that it is not taken as a
16412 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16413 <literal>\N</literal> feature to disable expansion of the regular expression.
16414 For example,
16415 </para>
16416 <literallayout class="monospaced">
16417 ${if match {$local_part}{\N^\d{3}\N} ...
16418 </literallayout>
16419 <para>
16420 If the whole expansion string is in double quotes, further escaping of
16421 backslashes is also required.
16422 </para>
16423 <para>
16424 The condition is true if the regular expression match succeeds.
16425 The regular expression is not required to begin with a circumflex
16426 metacharacter, but if there is no circumflex, the expression is not anchored,
16427 and it may match anywhere in the subject, not just at the start. If you want
16428 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16429 metacharacter at an appropriate point.
16430 </para>
16431 <para>
16432 <indexterm role="concept">
16433 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16434 <secondary>in <option>if</option> expansion</secondary>
16435 </indexterm>
16436 At the start of an <option>if</option> expansion the values of the numeric variable
16437 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16438 succeeds causes them to be reset to the substrings of that condition and they
16439 will have these values during the expansion of the success string. At the end
16440 of the <option>if</option> expansion, the previous values are restored. After testing a
16441 combination of conditions using <option>or</option>, the subsequent values of the numeric
16442 variables are those of the condition that succeeded.
16443 </para>
16444 </listitem></varlistentry>
16445 <varlistentry>
16446 <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>
16447 <listitem>
16448 <para>
16449 <indexterm role="concept">
16450 <primary><option>match_address</option> expansion condition</primary>
16451 </indexterm>
16452 See <emphasis role="bold">match_local_part</emphasis>.
16453 </para>
16454 </listitem></varlistentry>
16455 <varlistentry>
16456 <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>
16457 <listitem>
16458 <para>
16459 <indexterm role="concept">
16460 <primary><option>match_domain</option> expansion condition</primary>
16461 </indexterm>
16462 See <emphasis role="bold">match_local_part</emphasis>.
16463 </para>
16464 </listitem></varlistentry>
16465 <varlistentry>
16466 <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>
16467 <listitem>
16468 <para>
16469 <indexterm role="concept">
16470 <primary><option>match_ip</option> expansion condition</primary>
16471 </indexterm>
16472 This condition matches an IP address to a list of IP address patterns. It must
16473 be followed by two argument strings. The first (after expansion) must be an IP
16474 address or an empty string. The second (not expanded) is a restricted host
16475 list that can match only an IP address, not a host name. For example:
16476 </para>
16477 <literallayout class="monospaced">
16478 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16479 </literallayout>
16480 <para>
16481 The specific types of host list item that are permitted in the list are:
16482 </para>
16483 <itemizedlist>
16484 <listitem>
16485 <para>
16486 An IP address, optionally with a CIDR mask.
16487 </para>
16488 </listitem>
16489 <listitem>
16490 <para>
16491 A single asterisk, which matches any IP address.
16492 </para>
16493 </listitem>
16494 <listitem>
16495 <para>
16496 An empty item, which matches only if the IP address is empty. This could be
16497 useful for testing for a locally submitted message or one from specific hosts
16498 in a single test such as
16499 </para>
16500 <literallayout class="monospaced">
16501   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16502 </literallayout>
16503 <para>
16504 where the first item in the list is the empty string.
16505 </para>
16506 </listitem>
16507 <listitem>
16508 <para>
16509 The item @[] matches any of the local host&#x2019;s interface addresses.
16510 </para>
16511 </listitem>
16512 <listitem>
16513 <para>
16514 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16515 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16516 address into a host name. The most common type of linear search for
16517 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16518 masks. For example:
16519 </para>
16520 <literallayout class="monospaced">
16521   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16522 </literallayout>
16523 <para>
16524 It is of course possible to use other kinds of lookup, and in such a case, you
16525 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16526 address mask, for example:
16527 </para>
16528 <literallayout class="monospaced">
16529   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16530 </literallayout>
16531 <para>
16532 However, unless you are combining a <option>match_ip</option> condition with others, it is
16533 just as easy to use the fact that a lookup is itself a condition, and write:
16534 </para>
16535 <literallayout class="monospaced">
16536   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16537 </literallayout>
16538 </listitem>
16539 </itemizedlist>
16540 <para>
16541 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16542 Exim was built with the EXPAND_LISTMATCH_RHS option.
16543 </para>
16544 <para>
16545 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16546 </para>
16547 </listitem></varlistentry>
16548 <varlistentry>
16549 <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>
16550 <listitem>
16551 <para>
16552 <indexterm role="concept">
16553 <primary>domain list</primary>
16554 <secondary>in expansion condition</secondary>
16555 </indexterm>
16556 <indexterm role="concept">
16557 <primary>address list</primary>
16558 <secondary>in expansion condition</secondary>
16559 </indexterm>
16560 <indexterm role="concept">
16561 <primary>local part</primary>
16562 <secondary>list, in expansion condition</secondary>
16563 </indexterm>
16564 <indexterm role="concept">
16565 <primary><option>match_local_part</option> expansion condition</primary>
16566 </indexterm>
16567 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16568 possible to test domain, address, and local part lists within expansions. Each
16569 condition requires two arguments: an item and a list to match. A trivial
16570 example is:
16571 </para>
16572 <literallayout class="monospaced">
16573 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16574 </literallayout>
16575 <para>
16576 In each case, the second argument may contain any of the allowable items for a
16577 list of the appropriate type. Also, because the second argument (after
16578 expansion) is a standard form of list, it is possible to refer to a named list.
16579 Thus, you can use conditions like this:
16580 </para>
16581 <literallayout class="monospaced">
16582 ${if match_domain{$domain}{+local_domains}{...
16583 </literallayout>
16584 <para>
16585 <indexterm role="concept">
16586 <primary><literal>+caseful</literal></primary>
16587 </indexterm>
16588 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16589 item can be used, as in all address lists, to cause subsequent items to
16590 have their local parts matched casefully. Domains are always matched
16591 caselessly.
16592 </para>
16593 <para>
16594 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16595 Exim was built with the EXPAND_LISTMATCH_RHS option.
16596 </para>
16597 <para>
16598 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16599 hosts have two identities: a name and an IP address, and it is not clear
16600 how to specify cleanly how such a test would work. However, IP addresses can be
16601 matched using <option>match_ip</option>.
16602 </para>
16603 </listitem></varlistentry>
16604 <varlistentry>
16605 <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>
16606 <listitem>
16607 <para>
16608 <indexterm role="concept">
16609 <primary>PAM authentication</primary>
16610 </indexterm>
16611 <indexterm role="concept">
16612 <primary>AUTH</primary>
16613 <secondary>with PAM</secondary>
16614 </indexterm>
16615 <indexterm role="concept">
16616 <primary>Solaris</primary>
16617 <secondary>PAM support</secondary>
16618 </indexterm>
16619 <indexterm role="concept">
16620 <primary>expansion</primary>
16621 <secondary>PAM authentication test</secondary>
16622 </indexterm>
16623 <indexterm role="concept">
16624 <primary><option>pam</option> expansion condition</primary>
16625 </indexterm>
16626 <emphasis>Pluggable Authentication Modules</emphasis>
16627 (<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
16628 available in the latest releases of Solaris and in some GNU/Linux
16629 distributions. The Exim support, which is intended for use in conjunction with
16630 the SMTP AUTH command, is available only if Exim is compiled with
16631 </para>
16632 <literallayout class="monospaced">
16633 SUPPORT_PAM=yes
16634 </literallayout>
16635 <para>
16636 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16637 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16638 </para>
16639 <para>
16640 The argument string is first expanded, and the result must be a
16641 colon-separated list of strings. Leading and trailing white space is ignored.
16642 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16643 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16644 The remaining items in the data string are passed over in response to requests
16645 from the authentication function. In the simple case there will only be one
16646 request, for a password, so the data consists of just two strings.
16647 </para>
16648 <para>
16649 There can be problems if any of the strings are permitted to contain colon
16650 characters. In the usual way, these have to be doubled to avoid being taken as
16651 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16652 item can be used to double any existing colons. For example, the configuration
16653 of a LOGIN authenticator might contain this setting:
16654 </para>
16655 <literallayout class="monospaced">
16656 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16657 </literallayout>
16658 <para>
16659 For a PLAIN authenticator you could use:
16660 </para>
16661 <literallayout class="monospaced">
16662 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16663 </literallayout>
16664 <para>
16665 In some operating systems, PAM authentication can be done only from a process
16666 running as root. Since Exim is running as the Exim user when receiving
16667 messages, this means that PAM cannot be used directly in those systems.
16668 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16669 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>.
16670 The patched module allows one special uid/gid combination, in addition to root,
16671 to authenticate. If you build the patched module to allow the Exim user and
16672 group, PAM can then be used from an Exim authenticator.
16673 </para>
16674 </listitem></varlistentry>
16675 <varlistentry>
16676 <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>
16677 <listitem>
16678 <para>
16679 <indexterm role="concept">
16680 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16681 </indexterm>
16682 <indexterm role="concept">
16683 <primary>Cyrus</primary>
16684 </indexterm>
16685 <indexterm role="concept">
16686 <primary>expansion</primary>
16687 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16688 </indexterm>
16689 <indexterm role="concept">
16690 <primary><option>pwcheck</option> expansion condition</primary>
16691 </indexterm>
16692 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16693 This is one way of making it possible for passwords to be checked by a process
16694 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16695 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16696 </para>
16697 <para>
16698 The pwcheck support is not included in Exim by default. You need to specify
16699 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16700 building Exim. For example:
16701 </para>
16702 <literallayout class="monospaced">
16703 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16704 </literallayout>
16705 <para>
16706 You do not need to install the full Cyrus software suite in order to use
16707 the pwcheck daemon. You can compile and install just the daemon alone
16708 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16709 access to the <filename>/var/pwcheck</filename> directory.
16710 </para>
16711 <para>
16712 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16713 password, separated by a colon. For example, in a LOGIN authenticator
16714 configuration, you might have this:
16715 </para>
16716 <literallayout class="monospaced">
16717 server_condition = ${if pwcheck{$auth1:$auth2}}
16718 </literallayout>
16719 <para>
16720 Again, for a PLAIN authenticator configuration, this would be:
16721 </para>
16722 <literallayout class="monospaced">
16723 server_condition = ${if pwcheck{$auth2:$auth3}}
16724 </literallayout>
16725 </listitem></varlistentry>
16726 <varlistentry>
16727 <term><emphasis role="bold">queue_running</emphasis></term>
16728 <listitem>
16729 <para>
16730 <indexterm role="concept">
16731 <primary>queue runner</primary>
16732 <secondary>detecting when delivering from</secondary>
16733 </indexterm>
16734 <indexterm role="concept">
16735 <primary>expansion</primary>
16736 <secondary>queue runner test</secondary>
16737 </indexterm>
16738 <indexterm role="concept">
16739 <primary><option>queue_running</option> expansion condition</primary>
16740 </indexterm>
16741 This condition, which has no data, is true during delivery attempts that are
16742 initiated by queue runner processes, and false otherwise.
16743 </para>
16744 </listitem></varlistentry>
16745 <varlistentry>
16746 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16747 <listitem>
16748 <para>
16749 <indexterm role="concept">
16750 <primary>Radius</primary>
16751 </indexterm>
16752 <indexterm role="concept">
16753 <primary>expansion</primary>
16754 <secondary>Radius authentication</secondary>
16755 </indexterm>
16756 <indexterm role="concept">
16757 <primary><option>radius</option> expansion condition</primary>
16758 </indexterm>
16759 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16760 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16761 the Radius client configuration file in order to build Exim with Radius
16762 support.
16763 </para>
16764 <para>
16765 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16766 library, using the original API. If you are using release 0.4.0 or later of
16767 this library, you need to set
16768 </para>
16769 <literallayout class="monospaced">
16770 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16771 </literallayout>
16772 <para>
16773 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16774 <option>libradius</option> library that comes with FreeBSD. To do this, set
16775 </para>
16776 <literallayout class="monospaced">
16777 RADIUS_LIB_TYPE=RADLIB
16778 </literallayout>
16779 <para>
16780 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16781 You may also have to supply a suitable setting in EXTRALIBS so that the
16782 Radius library can be found when Exim is linked.
16783 </para>
16784 <para>
16785 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16786 Radius client library, which calls the Radius server. The condition is true if
16787 the authentication is successful. For example:
16788 </para>
16789 <literallayout class="monospaced">
16790 server_condition = ${if radius{&lt;arguments&gt;}}
16791 </literallayout>
16792 </listitem></varlistentry>
16793 <varlistentry>
16794 <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>
16795 <listitem>
16796 <para>
16797 <indexterm role="concept">
16798 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16799 </indexterm>
16800 <indexterm role="concept">
16801 <primary>Cyrus</primary>
16802 </indexterm>
16803 <indexterm role="concept">
16804 <primary>expansion</primary>
16805 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16806 </indexterm>
16807 <indexterm role="concept">
16808 <primary><option>saslauthd</option> expansion condition</primary>
16809 </indexterm>
16810 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16811 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16812 Using this daemon is one way of making it possible for passwords to be checked
16813 by a process that is not running as root.
16814 </para>
16815 <para>
16816 The saslauthd support is not included in Exim by default. You need to specify
16817 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16818 building Exim. For example:
16819 </para>
16820 <literallayout class="monospaced">
16821 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16822 </literallayout>
16823 <para>
16824 You do not need to install the full Cyrus software suite in order to use
16825 the saslauthd daemon. You can compile and install just the daemon alone
16826 from the Cyrus SASL library.
16827 </para>
16828 <para>
16829 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16830 two are mandatory. For example:
16831 </para>
16832 <literallayout class="monospaced">
16833 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16834 </literallayout>
16835 <para>
16836 The service and the realm are optional (which is why the arguments are enclosed
16837 in their own set of braces). For details of the meaning of the service and
16838 realm, and how to run the daemon, consult the Cyrus documentation.
16839 </para>
16840 </listitem></varlistentry>
16841 </variablelist>
16842 </section>
16843 <section id="SECID84">
16844 <title>Combining expansion conditions</title>
16845 <para>
16846 <indexterm role="concept">
16847 <primary>expansion</primary>
16848 <secondary>combining conditions</secondary>
16849 </indexterm>
16850 Several conditions can be tested at once by combining them using the <option>and</option>
16851 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16852 conditions on their own, and precede their lists of sub-conditions. Each
16853 sub-condition must be enclosed in braces within the overall braces that contain
16854 the list. No repetition of <option>if</option> is used.
16855 </para>
16856 <variablelist>
16857 <varlistentry>
16858 <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>
16859 <listitem>
16860 <para>
16861 <indexterm role="concept">
16862 <primary><quote>or</quote> expansion condition</primary>
16863 </indexterm>
16864 <indexterm role="concept">
16865 <primary>expansion</primary>
16866 <secondary><quote>or</quote> of conditions</secondary>
16867 </indexterm>
16868 The sub-conditions are evaluated from left to right. The condition is true if
16869 any one of the sub-conditions is true.
16870 For example,
16871 </para>
16872 <literallayout class="monospaced">
16873 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16874 </literallayout>
16875 <para>
16876 When a true sub-condition is found, the following ones are parsed but not
16877 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16878 numeric variables afterwards are taken from the first one that succeeds.
16879 </para>
16880 </listitem></varlistentry>
16881 <varlistentry>
16882 <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>
16883 <listitem>
16884 <para>
16885 <indexterm role="concept">
16886 <primary><quote>and</quote> expansion condition</primary>
16887 </indexterm>
16888 <indexterm role="concept">
16889 <primary>expansion</primary>
16890 <secondary><quote>and</quote> of conditions</secondary>
16891 </indexterm>
16892 The sub-conditions are evaluated from left to right. The condition is true if
16893 all of the sub-conditions are true. If there are several <quote>match</quote>
16894 sub-conditions, the values of the numeric variables afterwards are taken from
16895 the last one. When a false sub-condition is found, the following ones are
16896 parsed but not evaluated.
16897 </para>
16898 </listitem></varlistentry>
16899 </variablelist>
16900 <para>
16901 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16902 </para>
16903 </section>
16904 <section id="SECTexpvar">
16905 <title>Expansion variables</title>
16906 <para>
16907 <indexterm role="concept">
16908 <primary>expansion</primary>
16909 <secondary>variables, list of</secondary>
16910 </indexterm>
16911 This section contains an alphabetical list of all the expansion variables. Some
16912 of them are available only when Exim is compiled with specific options such as
16913 support for TLS or the content scanning extension.
16914 </para>
16915 <variablelist>
16916 <varlistentry>
16917 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16918 <listitem>
16919 <para>
16920 <indexterm role="concept">
16921 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16922 </indexterm>
16923 When a <option>match</option> expansion condition succeeds, these variables contain the
16924 captured substrings identified by the regular expression during subsequent
16925 processing of the success string of the containing <option>if</option> expansion item.
16926 However, they do not retain their values afterwards; in fact, their previous
16927 values are restored at the end of processing an <option>if</option> item. The numerical
16928 variables may also be set externally by some other matching process which
16929 precedes the expansion of the string. For example, the commands available in
16930 Exim filter files include an <option>if</option> command with its own regular expression
16931 matching condition.
16932 </para>
16933 </listitem></varlistentry>
16934 <varlistentry>
16935 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
16936 <listitem>
16937 <para>
16938 Within an acl condition, expansion condition or expansion item
16939 any arguments are copied to these variables,
16940 any unused variables being made empty.
16941 </para>
16942 </listitem></varlistentry>
16943 <varlistentry>
16944 <term><varname>$acl_c...</varname></term>
16945 <listitem>
16946 <para>
16947 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16948 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16949 long, but the sixth character must be either a digit or an underscore. For
16950 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16951 variables persist throughout the lifetime of an SMTP connection. They can be
16952 used to pass information between ACLs and between different invocations of the
16953 same ACL. When a message is received, the values of these variables are saved
16954 with the message, and can be accessed by filters, routers, and transports
16955 during subsequent delivery.
16956 </para>
16957 </listitem></varlistentry>
16958 <varlistentry>
16959 <term><varname>$acl_m...</varname></term>
16960 <listitem>
16961 <para>
16962 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16963 are reset after a message has been received. Thus, if several messages are
16964 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16965 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16966 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16967 message is received, the values of these variables are saved with the message,
16968 and can be accessed by filters, routers, and transports during subsequent
16969 delivery.
16970 </para>
16971 </listitem></varlistentry>
16972 <varlistentry>
16973 <term><varname>$acl_narg</varname></term>
16974 <listitem>
16975 <para>
16976 Within an acl condition, expansion condition or expansion item
16977 this variable has the number of arguments.
16978 </para>
16979 </listitem></varlistentry>
16980 <varlistentry>
16981 <term><varname>$acl_verify_message</varname></term>
16982 <listitem>
16983 <para>
16984 <indexterm role="variable">
16985 <primary><varname>$acl_verify_message</varname></primary>
16986 </indexterm>
16987 After an address verification has failed, this variable contains the failure
16988 message. It retains its value for use in subsequent modifiers. The message can
16989 be preserved by coding like this:
16990 </para>
16991 <literallayout class="monospaced">
16992 warn !verify = sender
16993      set acl_m0 = $acl_verify_message
16994 </literallayout>
16995 <para>
16996 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16997 <option>log_message</option> modifiers, to include information about the verification
16998 failure.
16999 </para>
17000 </listitem></varlistentry>
17001 <varlistentry>
17002 <term><varname>$address_data</varname></term>
17003 <listitem>
17004 <para>
17005 <indexterm role="variable">
17006 <primary><varname>$address_data</varname></primary>
17007 </indexterm>
17008 This variable is set by means of the <option>address_data</option> option in routers. The
17009 value then remains with the address while it is processed by subsequent routers
17010 and eventually a transport. If the transport is handling multiple addresses,
17011 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17012 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17013 user filter files.
17014 </para>
17015 <para>
17016 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17017 a recipient address, the final value is still in the variable for subsequent
17018 conditions and modifiers of the ACL statement. If routing the address caused it
17019 to be redirected to just one address, the child address is also routed as part
17020 of the verification, and in this case the final value of <varname>$address_data</varname> is
17021 from the child&#x2019;s routing.
17022 </para>
17023 <para>
17024 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17025 sender address, the final value is also preserved, but this time in
17026 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17027 address.
17028 </para>
17029 <para>
17030 In both cases (recipient and sender verification), the value does not persist
17031 after the end of the current ACL statement. If you want to preserve
17032 these values for longer, you can save them in ACL variables.
17033 </para>
17034 </listitem></varlistentry>
17035 <varlistentry>
17036 <term><varname>$address_file</varname></term>
17037 <listitem>
17038 <para>
17039 <indexterm role="variable">
17040 <primary><varname>$address_file</varname></primary>
17041 </indexterm>
17042 When, as a result of aliasing, forwarding, or filtering, a message is directed
17043 to a specific file, this variable holds the name of the file when the transport
17044 is running. At other times, the variable is empty. For example, using the
17045 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17046 </para>
17047 <literallayout class="monospaced">
17048 /home/r2d2/savemail
17049 </literallayout>
17050 <para>
17051 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17052 contains the text string <literal>/home/r2d2/savemail</literal>.
17053 <indexterm role="concept">
17054 <primary>Sieve filter</primary>
17055 <secondary>value of <varname>$address_file</varname></secondary>
17056 </indexterm>
17057 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17058 then up to the transport configuration to generate an appropriate absolute path
17059 to the relevant file.
17060 </para>
17061 </listitem></varlistentry>
17062 <varlistentry>
17063 <term><varname>$address_pipe</varname></term>
17064 <listitem>
17065 <para>
17066 <indexterm role="variable">
17067 <primary><varname>$address_pipe</varname></primary>
17068 </indexterm>
17069 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17070 this variable holds the pipe command when the transport is running.
17071 </para>
17072 </listitem></varlistentry>
17073 <varlistentry>
17074 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17075 <listitem>
17076 <para>
17077 <indexterm role="variable">
17078 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17079 </indexterm>
17080 These variables are used in SMTP authenticators (see chapters
17081 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
17082 </para>
17083 </listitem></varlistentry>
17084 <varlistentry>
17085 <term><varname>$authenticated_id</varname></term>
17086 <listitem>
17087 <para>
17088 <indexterm role="concept">
17089 <primary>authentication</primary>
17090 <secondary>id</secondary>
17091 </indexterm>
17092 <indexterm role="variable">
17093 <primary><varname>$authenticated_id</varname></primary>
17094 </indexterm>
17095 When a server successfully authenticates a client it may be configured to
17096 preserve some of the authentication information in the variable
17097 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17098 user/password authenticator configuration might preserve the user name for use
17099 in the routers. Note that this is not the same information that is saved in
17100 <varname>$sender_host_authenticated</varname>.
17101 When a message is submitted locally (that is, not over a TCP connection)
17102 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17103 process. However, a trusted user can override this by means of the <option>-oMai</option>
17104 command line option.
17105 </para>
17106 </listitem></varlistentry>
17107 <varlistentry>
17108 <term><varname>$authenticated_fail_id</varname></term>
17109 <listitem>
17110 <para>
17111 <indexterm role="concept">
17112 <primary>authentication</primary>
17113 <secondary>fail</secondary>
17114 </indexterm>
17115 <indexterm role="variable">
17116 <primary><varname>$authenticated_fail_id</varname></primary>
17117 </indexterm>
17118 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17119 will contain the failed authentication id. If more than one authentication
17120 id is attempted, it will contain only the last one. The variable is
17121 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17122 A message to a local recipient could still be accepted without requiring
17123 authentication, which means this variable could also be visible in all of
17124 the ACL&#x2019;s as well.
17125 </para>
17126 </listitem></varlistentry>
17127 <varlistentry>
17128 <term><varname>$authenticated_sender</varname></term>
17129 <listitem>
17130 <para>
17131 <indexterm role="concept">
17132 <primary>sender</primary>
17133 <secondary>authenticated</secondary>
17134 </indexterm>
17135 <indexterm role="concept">
17136 <primary>authentication</primary>
17137 <secondary>sender</secondary>
17138 </indexterm>
17139 <indexterm role="concept">
17140 <primary>AUTH</primary>
17141 <secondary>on MAIL command</secondary>
17142 </indexterm>
17143 <indexterm role="variable">
17144 <primary><varname>$authenticated_sender</varname></primary>
17145 </indexterm>
17146 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17147 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17148 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17149 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17150 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17151 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17152 </para>
17153 <para>
17154 <indexterm role="variable">
17155 <primary><varname>$qualify_domain</varname></primary>
17156 </indexterm>
17157 When a message is submitted locally (that is, not over a TCP connection), the
17158 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17159 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17160 can override this by means of the <option>-oMas</option> command line option.
17161 </para>
17162 </listitem></varlistentry>
17163 <varlistentry>
17164 <term><varname>$authentication_failed</varname></term>
17165 <listitem>
17166 <para>
17167 <indexterm role="concept">
17168 <primary>authentication</primary>
17169 <secondary>failure</secondary>
17170 </indexterm>
17171 <indexterm role="variable">
17172 <primary><varname>$authentication_failed</varname></primary>
17173 </indexterm>
17174 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17175 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17176 possible to distinguish between <quote>did not try to authenticate</quote>
17177 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17178 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17179 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17180 negative response to an AUTH command, including (for example) an attempt to use
17181 an undefined mechanism.
17182 </para>
17183 </listitem></varlistentry>
17184 <varlistentry>
17185 <term><varname>$av_failed</varname></term>
17186 <listitem>
17187 <para>
17188 <indexterm role="concept">
17189 <primary>content scanning</primary>
17190 <secondary>AV scanner failure</secondary>
17191 </indexterm>
17192 This variable is available when Exim is compiled with the content-scanning
17193 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17194 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17195 the ACL malware condition.
17196 </para>
17197 </listitem></varlistentry>
17198 <varlistentry>
17199 <term><varname>$body_linecount</varname></term>
17200 <listitem>
17201 <para>
17202 <indexterm role="concept">
17203 <primary>message body</primary>
17204 <secondary>line count</secondary>
17205 </indexterm>
17206 <indexterm role="concept">
17207 <primary>body of message</primary>
17208 <secondary>line count</secondary>
17209 </indexterm>
17210 <indexterm role="variable">
17211 <primary><varname>$body_linecount</varname></primary>
17212 </indexterm>
17213 When a message is being received or delivered, this variable contains the
17214 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17215 </para>
17216 </listitem></varlistentry>
17217 <varlistentry>
17218 <term><varname>$body_zerocount</varname></term>
17219 <listitem>
17220 <para>
17221 <indexterm role="concept">
17222 <primary>message body</primary>
17223 <secondary>binary zero count</secondary>
17224 </indexterm>
17225 <indexterm role="concept">
17226 <primary>body of message</primary>
17227 <secondary>binary zero count</secondary>
17228 </indexterm>
17229 <indexterm role="concept">
17230 <primary>binary zero</primary>
17231 <secondary>in message body</secondary>
17232 </indexterm>
17233 <indexterm role="variable">
17234 <primary><varname>$body_zerocount</varname></primary>
17235 </indexterm>
17236 When a message is being received or delivered, this variable contains the
17237 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17238 </para>
17239 </listitem></varlistentry>
17240 <varlistentry>
17241 <term><varname>$bounce_recipient</varname></term>
17242 <listitem>
17243 <para>
17244 <indexterm role="variable">
17245 <primary><varname>$bounce_recipient</varname></primary>
17246 </indexterm>
17247 This is set to the recipient address of a bounce message while Exim is creating
17248 it. It is useful if a customized bounce message text file is in use (see
17249 chapter <xref linkend="CHAPemsgcust"/>).
17250 </para>
17251 </listitem></varlistentry>
17252 <varlistentry>
17253 <term><varname>$bounce_return_size_limit</varname></term>
17254 <listitem>
17255 <para>
17256 <indexterm role="variable">
17257 <primary><varname>$bounce_return_size_limit</varname></primary>
17258 </indexterm>
17259 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17260 up to a multiple of 1000. It is useful when a customized error message text
17261 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17262 </para>
17263 </listitem></varlistentry>
17264 <varlistentry>
17265 <term><varname>$caller_gid</varname></term>
17266 <listitem>
17267 <para>
17268 <indexterm role="concept">
17269 <primary>gid (group id)</primary>
17270 <secondary>caller</secondary>
17271 </indexterm>
17272 <indexterm role="variable">
17273 <primary><varname>$caller_gid</varname></primary>
17274 </indexterm>
17275 The real group id under which the process that called Exim was running. This is
17276 not the same as the group id of the originator of a message (see
17277 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17278 incarnation normally contains the Exim gid.
17279 </para>
17280 </listitem></varlistentry>
17281 <varlistentry>
17282 <term><varname>$caller_uid</varname></term>
17283 <listitem>
17284 <para>
17285 <indexterm role="concept">
17286 <primary>uid (user id)</primary>
17287 <secondary>caller</secondary>
17288 </indexterm>
17289 <indexterm role="variable">
17290 <primary><varname>$caller_uid</varname></primary>
17291 </indexterm>
17292 The real user id under which the process that called Exim was running. This is
17293 not the same as the user id of the originator of a message (see
17294 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17295 incarnation normally contains the Exim uid.
17296 </para>
17297 </listitem></varlistentry>
17298 <varlistentry>
17299 <term><varname>$compile_date</varname></term>
17300 <listitem>
17301 <para>
17302 <indexterm role="variable">
17303 <primary><varname>$compile_date</varname></primary>
17304 </indexterm>
17305 The date on which the Exim binary was compiled.
17306 </para>
17307 </listitem></varlistentry>
17308 <varlistentry>
17309 <term><varname>$compile_number</varname></term>
17310 <listitem>
17311 <para>
17312 <indexterm role="variable">
17313 <primary><varname>$compile_number</varname></primary>
17314 </indexterm>
17315 The building process for Exim keeps a count of the number
17316 of times it has been compiled. This serves to distinguish different
17317 compilations of the same version of the program.
17318 </para>
17319 </listitem></varlistentry>
17320 <varlistentry revisionflag="changed">
17321 <term><varname>$config_dir</varname></term>
17322 <listitem>
17323 <para revisionflag="changed">
17324 <indexterm role="variable">
17325 <primary><varname>$config_dir</varname></primary>
17326 </indexterm>
17327 The directory name of the main configuration file. That is, the content of
17328 <varname>$config_file</varname> with the last component stripped. The value does not
17329 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17330 <varname>$config_dir</varname> is ".".
17331 </para>
17332 </listitem></varlistentry>
17333 <varlistentry revisionflag="changed">
17334 <term><varname>$config_file</varname></term>
17335 <listitem>
17336 <para revisionflag="changed">
17337 <indexterm role="variable">
17338 <primary><varname>$config_file</varname></primary>
17339 </indexterm>
17340 The name of the main configuration file Exim is using.
17341 </para>
17342 </listitem></varlistentry>
17343 <varlistentry>
17344 <term><varname>$demime_errorlevel</varname></term>
17345 <listitem>
17346 <para>
17347 <indexterm role="variable">
17348 <primary><varname>$demime_errorlevel</varname></primary>
17349 </indexterm>
17350 This variable is available when Exim is compiled with
17351 the content-scanning extension and the obsolete <option>demime</option> condition. For
17352 details, see section <xref linkend="SECTdemimecond"/>.
17353 </para>
17354 </listitem></varlistentry>
17355 <varlistentry>
17356 <term><varname>$demime_reason</varname></term>
17357 <listitem>
17358 <para>
17359 <indexterm role="variable">
17360 <primary><varname>$demime_reason</varname></primary>
17361 </indexterm>
17362 This variable is available when Exim is compiled with the
17363 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17364 see section <xref linkend="SECTdemimecond"/>.
17365 </para>
17366 </listitem></varlistentry>
17367 <varlistentry revisionflag="changed">
17368 <term><varname>$dkim_cur_signer</varname></term>
17369 <term><varname>$dkim_verify_status</varname></term>
17370 <term><varname>$dkim_verify_reason</varname></term>
17371 <term><varname>$dkim_domain</varname></term>
17372 <term><varname>$dkim_identity</varname></term>
17373 <term><varname>$dkim_selector</varname></term>
17374 <term><varname>$dkim_algo</varname></term>
17375 <term><varname>$dkim_canon_body</varname></term>
17376 <term><varname>$dkim_canon_headers</varname></term>
17377 <term><varname>$dkim_copiedheaders</varname></term>
17378 <term><varname>$dkim_bodylength</varname></term>
17379 <term><varname>$dkim_created</varname></term>
17380 <term><varname>$dkim_expires</varname></term>
17381 <term><varname>$dkim_headernames</varname></term>
17382 <term><varname>$dkim_key_testing</varname></term>
17383 <term><varname>$dkim_key_nosubdomains</varname></term>
17384 <term><varname>$dkim_key_srvtype</varname></term>
17385 <term><varname>$dkim_key_granularity</varname></term>
17386 <term><varname>$dkim_key_notes</varname></term>
17387 <listitem>
17388 <para revisionflag="changed">
17389 These variables are only available within the DKIM ACL.
17390 For details see chapter <xref linkend="CHAPdkim"/>.
17391 </para>
17392 </listitem></varlistentry>
17393 <varlistentry revisionflag="changed">
17394 <term><varname>$dkim_signers</varname></term>
17395 <listitem>
17396 <para revisionflag="changed">
17397 <indexterm role="variable">
17398 <primary><varname>$dkim_signers</varname></primary>
17399 </indexterm>
17400 When a message has been received this variable contains
17401 a colon-separated list of signer domains and identities for the message.
17402 For details see chapter <xref linkend="CHAPdkim"/>.
17403 </para>
17404 </listitem></varlistentry>
17405 <varlistentry>
17406 <term><varname>$dnslist_domain</varname></term>
17407 <term><varname>$dnslist_matched</varname></term>
17408 <term><varname>$dnslist_text</varname></term>
17409 <term><varname>$dnslist_value</varname></term>
17410 <listitem>
17411 <para>
17412 <indexterm role="variable">
17413 <primary><varname>$dnslist_domain</varname></primary>
17414 </indexterm>
17415 <indexterm role="variable">
17416 <primary><varname>$dnslist_matched</varname></primary>
17417 </indexterm>
17418 <indexterm role="variable">
17419 <primary><varname>$dnslist_text</varname></primary>
17420 </indexterm>
17421 <indexterm role="variable">
17422 <primary><varname>$dnslist_value</varname></primary>
17423 </indexterm>
17424 <indexterm role="concept">
17425 <primary>black list (DNS)</primary>
17426 </indexterm>
17427 When a DNS (black) list lookup succeeds, these variables are set to contain
17428 the following data from the lookup: the list&#x2019;s domain name, the key that was
17429 looked up, the contents of any associated TXT record, and the value from the
17430 main A record. See section <xref linkend="SECID204"/> for more details.
17431 </para>
17432 </listitem></varlistentry>
17433 <varlistentry>
17434 <term><varname>$domain</varname></term>
17435 <listitem>
17436 <para>
17437 <indexterm role="variable">
17438 <primary><varname>$domain</varname></primary>
17439 </indexterm>
17440 When an address is being routed, or delivered on its own, this variable
17441 contains the domain. Uppercase letters in the domain are converted into lower
17442 case for <varname>$domain</varname>.
17443 </para>
17444 <para>
17445 Global address rewriting happens when a message is received, so the value of
17446 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17447 is set during user filtering, but not during system filtering, because a
17448 message may have many recipients and the system filter is called just once.
17449 </para>
17450 <para>
17451 When more than one address is being delivered at once (for example, several
17452 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17453 have the same domain. Transports can be restricted to handling only one domain
17454 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17455 the default for local transports. For further details of the environment in
17456 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17457 </para>
17458 <para>
17459 <indexterm role="option">
17460 <primary><option>delay_warning_condition</option></primary>
17461 </indexterm>
17462 At the end of a delivery, if all deferred addresses have the same domain, it is
17463 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17464 </para>
17465 <para>
17466 The <varname>$domain</varname> variable is also used in some other circumstances:
17467 </para>
17468 <itemizedlist>
17469 <listitem>
17470 <para>
17471 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17472 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17473 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17474 normally set during the running of the MAIL ACL. However, if the sender address
17475 is verified with a callout during the MAIL ACL, the sender domain is placed in
17476 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17477 the <command>smtp</command> transport.
17478 </para>
17479 </listitem>
17480 <listitem>
17481 <para>
17482 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17483 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17484 it can be used in the expansion of the replacement address, for example, to
17485 rewrite domains by file lookup.
17486 </para>
17487 </listitem>
17488 <listitem>
17489 <para>
17490 With one important exception, whenever a domain list is being scanned,
17491 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17492 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17493 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17494 that, in a RCPT ACL, the sender domain list can be dependent on the
17495 recipient domain (which is what is in <varname>$domain</varname> at this time).
17496 </para>
17497 </listitem>
17498 <listitem>
17499 <para>
17500 <indexterm role="concept">
17501 <primary>ETRN</primary>
17502 <secondary>value of <varname>$domain</varname></secondary>
17503 </indexterm>
17504 <indexterm role="option">
17505 <primary><option>smtp_etrn_command</option></primary>
17506 </indexterm>
17507 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17508 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17509 </para>
17510 </listitem>
17511 </itemizedlist>
17512 </listitem></varlistentry>
17513 <varlistentry>
17514 <term><varname>$domain_data</varname></term>
17515 <listitem>
17516 <para>
17517 <indexterm role="variable">
17518 <primary><varname>$domain_data</varname></primary>
17519 </indexterm>
17520 When the <option>domains</option> option on a router matches a domain by
17521 means of a lookup, the data read by the lookup is available during the running
17522 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17523 address to a transport, the value is available in that transport. If the
17524 transport is handling multiple addresses, the value from the first address is
17525 used.
17526 </para>
17527 <para>
17528 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17529 domain by means of a lookup. The data read by the lookup is available during
17530 the rest of the ACL statement. In all other situations, this variable expands
17531 to nothing.
17532 </para>
17533 </listitem></varlistentry>
17534 <varlistentry>
17535 <term><varname>$exim_gid</varname></term>
17536 <listitem>
17537 <para>
17538 <indexterm role="variable">
17539 <primary><varname>$exim_gid</varname></primary>
17540 </indexterm>
17541 This variable contains the numerical value of the Exim group id.
17542 </para>
17543 </listitem></varlistentry>
17544 <varlistentry>
17545 <term><varname>$exim_path</varname></term>
17546 <listitem>
17547 <para>
17548 <indexterm role="variable">
17549 <primary><varname>$exim_path</varname></primary>
17550 </indexterm>
17551 This variable contains the path to the Exim binary.
17552 </para>
17553 </listitem></varlistentry>
17554 <varlistentry>
17555 <term><varname>$exim_uid</varname></term>
17556 <listitem>
17557 <para>
17558 <indexterm role="variable">
17559 <primary><varname>$exim_uid</varname></primary>
17560 </indexterm>
17561 This variable contains the numerical value of the Exim user id.
17562 </para>
17563 </listitem></varlistentry>
17564 <varlistentry revisionflag="changed">
17565 <term><varname>$exim_version</varname></term>
17566 <listitem>
17567 <para revisionflag="changed">
17568 <indexterm role="variable">
17569 <primary><varname>$exim_version</varname></primary>
17570 </indexterm>
17571 This variable contains the version string of the Exim build.
17572 The first character is a major version number, currently 4.
17573 Then after a dot, the next group of digits is a minor version number.
17574 There may be other characters following the minor version.
17575 </para>
17576 </listitem></varlistentry>
17577 <varlistentry>
17578 <term><varname>$found_extension</varname></term>
17579 <listitem>
17580 <para>
17581 <indexterm role="variable">
17582 <primary><varname>$found_extension</varname></primary>
17583 </indexterm>
17584 This variable is available when Exim is compiled with the
17585 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17586 see section <xref linkend="SECTdemimecond"/>.
17587 </para>
17588 </listitem></varlistentry>
17589 <varlistentry>
17590 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17591 <listitem>
17592 <para>
17593 This is not strictly an expansion variable. It is expansion syntax for
17594 inserting the message header line with the given name. Note that the name must
17595 be terminated by colon or white space, because it may contain a wide variety of
17596 characters. Note also that braces must <emphasis>not</emphasis> be used.
17597 </para>
17598 </listitem></varlistentry>
17599 <varlistentry>
17600 <term><varname>$headers_added</varname></term>
17601 <listitem>
17602 <para>
17603 <indexterm role="variable">
17604 <primary><varname>$headers_added</varname></primary>
17605 </indexterm>
17606 Within an ACL this variable contains the headers added so far by
17607 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17608 The headers are a newline-separated list.
17609 </para>
17610 </listitem></varlistentry>
17611 <varlistentry>
17612 <term><varname>$home</varname></term>
17613 <listitem>
17614 <para>
17615 <indexterm role="variable">
17616 <primary><varname>$home</varname></primary>
17617 </indexterm>
17618 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17619 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17620 means it is set during the running of users&#x2019; filter files. A router may also
17621 explicitly set a home directory for use by a transport; this can be overridden
17622 by a setting on the transport itself.
17623 </para>
17624 <para>
17625 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17626 of the environment variable HOME.
17627 </para>
17628 </listitem></varlistentry>
17629 <varlistentry>
17630 <term><varname>$host</varname></term>
17631 <listitem>
17632 <para>
17633 <indexterm role="variable">
17634 <primary><varname>$host</varname></primary>
17635 </indexterm>
17636 If a router assigns an address to a transport (any transport), and passes a
17637 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17638 to run is the name of the first host on the list. Note that this applies both
17639 to local and remote transports.
17640 </para>
17641 <para>
17642 <indexterm role="concept">
17643 <primary>transport</primary>
17644 <secondary>filter</secondary>
17645 </indexterm>
17646 <indexterm role="concept">
17647 <primary>filter</primary>
17648 <secondary>transport filter</secondary>
17649 </indexterm>
17650 For the <command>smtp</command> transport, if there is more than one host, the value of
17651 <varname>$host</varname> changes as the transport works its way through the list. In
17652 particular, when the <command>smtp</command> transport is expanding its options for encryption
17653 using TLS, or for specifying a transport filter (see chapter
17654 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17655 is connected.
17656 </para>
17657 <para>
17658 When used in the client part of an authenticator configuration (see chapter
17659 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17660 client is connected.
17661 </para>
17662 </listitem></varlistentry>
17663 <varlistentry>
17664 <term><varname>$host_address</varname></term>
17665 <listitem>
17666 <para>
17667 <indexterm role="variable">
17668 <primary><varname>$host_address</varname></primary>
17669 </indexterm>
17670 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17671 for a remote connection. It is also set to the IP address that is being checked
17672 when the <option>ignore_target_hosts</option> option is being processed.
17673 </para>
17674 </listitem></varlistentry>
17675 <varlistentry>
17676 <term><varname>$host_data</varname></term>
17677 <listitem>
17678 <para>
17679 <indexterm role="variable">
17680 <primary><varname>$host_data</varname></primary>
17681 </indexterm>
17682 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17683 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17684 allows you, for example, to do things like this:
17685 </para>
17686 <literallayout class="monospaced">
17687 deny  hosts = net-lsearch;/some/file
17688 message = $host_data
17689 </literallayout>
17690 </listitem></varlistentry>
17691 <varlistentry>
17692 <term><varname>$host_lookup_deferred</varname></term>
17693 <listitem>
17694 <para>
17695 <indexterm role="concept">
17696 <primary>host name</primary>
17697 <secondary>lookup, failure of</secondary>
17698 </indexterm>
17699 <indexterm role="variable">
17700 <primary><varname>$host_lookup_deferred</varname></primary>
17701 </indexterm>
17702 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17703 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17704 name from its IP address, and the attempt is not successful, one of these
17705 variables is set to <quote>1</quote>.
17706 </para>
17707 <itemizedlist>
17708 <listitem>
17709 <para>
17710 If the lookup receives a definite negative response (for example, a DNS lookup
17711 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17712 </para>
17713 </listitem>
17714 <listitem>
17715 <para>
17716 If there is any kind of problem during the lookup, such that Exim cannot
17717 tell whether or not the host name is defined (for example, a timeout for a DNS
17718 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17719 </para>
17720 </listitem>
17721 </itemizedlist>
17722 <para>
17723 Looking up a host&#x2019;s name from its IP address consists of more than just a
17724 single reverse lookup. Exim checks that a forward lookup of at least one of the
17725 names it receives from a reverse lookup yields the original IP address. If this
17726 is not the case, Exim does not accept the looked up name(s), and
17727 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17728 IP address (for example, the existence of a PTR record in the DNS) is not
17729 sufficient on its own for the success of a host name lookup. If the reverse
17730 lookup succeeds, but there is a lookup problem such as a timeout when checking
17731 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17732 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17733 </para>
17734 </listitem></varlistentry>
17735 <varlistentry>
17736 <term><varname>$host_lookup_failed</varname></term>
17737 <listitem>
17738 <para>
17739 <indexterm role="variable">
17740 <primary><varname>$host_lookup_failed</varname></primary>
17741 </indexterm>
17742 See <varname>$host_lookup_deferred</varname>.
17743 </para>
17744 </listitem></varlistentry>
17745 <varlistentry>
17746 <term><varname>$host_port</varname></term>
17747 <listitem>
17748 <para>
17749 <indexterm role="variable">
17750 <primary><varname>$host_port</varname></primary>
17751 </indexterm>
17752 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
17753 for an outbound connection.
17754 </para>
17755 </listitem></varlistentry>
17756 <varlistentry>
17757 <term><varname>$inode</varname></term>
17758 <listitem>
17759 <para>
17760 <indexterm role="variable">
17761 <primary><varname>$inode</varname></primary>
17762 </indexterm>
17763 The only time this variable is set is while expanding the <option>directory_file</option>
17764 option in the <command>appendfile</command> transport. The variable contains the inode number
17765 of the temporary file which is about to be renamed. It can be used to construct
17766 a unique name for the file.
17767 </para>
17768 </listitem></varlistentry>
17769 <varlistentry>
17770 <term><varname>$interface_address</varname></term>
17771 <listitem>
17772 <para>
17773 <indexterm role="variable">
17774 <primary><varname>$interface_address</varname></primary>
17775 </indexterm>
17776 This is an obsolete name for <varname>$received_ip_address</varname>.
17777 </para>
17778 </listitem></varlistentry>
17779 <varlistentry>
17780 <term><varname>$interface_port</varname></term>
17781 <listitem>
17782 <para>
17783 <indexterm role="variable">
17784 <primary><varname>$interface_port</varname></primary>
17785 </indexterm>
17786 This is an obsolete name for <varname>$received_port</varname>.
17787 </para>
17788 </listitem></varlistentry>
17789 <varlistentry>
17790 <term><varname>$item</varname></term>
17791 <listitem>
17792 <para>
17793 <indexterm role="variable">
17794 <primary><varname>$item</varname></primary>
17795 </indexterm>
17796 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17797 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17798 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17799 empty.
17800 </para>
17801 </listitem></varlistentry>
17802 <varlistentry>
17803 <term><varname>$ldap_dn</varname></term>
17804 <listitem>
17805 <para>
17806 <indexterm role="variable">
17807 <primary><varname>$ldap_dn</varname></primary>
17808 </indexterm>
17809 This variable, which is available only when Exim is compiled with LDAP support,
17810 contains the DN from the last entry in the most recently successful LDAP
17811 lookup.
17812 </para>
17813 </listitem></varlistentry>
17814 <varlistentry>
17815 <term><varname>$load_average</varname></term>
17816 <listitem>
17817 <para>
17818 <indexterm role="variable">
17819 <primary><varname>$load_average</varname></primary>
17820 </indexterm>
17821 This variable contains the system load average, multiplied by 1000 so that it
17822 is an integer. For example, if the load average is 0.21, the value of the
17823 variable is 210. The value is recomputed every time the variable is referenced.
17824 </para>
17825 </listitem></varlistentry>
17826 <varlistentry>
17827 <term><varname>$local_part</varname></term>
17828 <listitem>
17829 <para>
17830 <indexterm role="variable">
17831 <primary><varname>$local_part</varname></primary>
17832 </indexterm>
17833 When an address is being routed, or delivered on its own, this
17834 variable contains the local part. When a number of addresses are being
17835 delivered together (for example, multiple RCPT commands in an SMTP
17836 session), <varname>$local_part</varname> is not set.
17837 </para>
17838 <para>
17839 Global address rewriting happens when a message is received, so the value of
17840 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17841 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17842 because a message may have many recipients and the system filter is called just
17843 once.
17844 </para>
17845 <para>
17846 <indexterm role="variable">
17847 <primary><varname>$local_part_prefix</varname></primary>
17848 </indexterm>
17849 <indexterm role="variable">
17850 <primary><varname>$local_part_suffix</varname></primary>
17851 </indexterm>
17852 If a local part prefix or suffix has been recognized, it is not included in the
17853 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17854 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17855 <varname>$local_part_suffix</varname>, respectively.
17856 </para>
17857 <para>
17858 When a message is being delivered to a file, pipe, or autoreply transport as a
17859 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17860 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17861 <varname>$address_pipe</varname>).
17862 </para>
17863 <para>
17864 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17865 local part of the recipient address.
17866 </para>
17867 <para>
17868 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17869 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17870 it can be used in the expansion of the replacement address, for example.
17871 </para>
17872 <para>
17873 In all cases, all quoting is removed from the local part. For example, for both
17874 the addresses
17875 </para>
17876 <literallayout class="monospaced">
17877 "abc:xyz"@test.example
17878 abc\:xyz@test.example
17879 </literallayout>
17880 <para>
17881 the value of <varname>$local_part</varname> is
17882 </para>
17883 <literallayout class="monospaced">
17884 abc:xyz
17885 </literallayout>
17886 <para>
17887 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17888 inside a quoting operator. For example, in a <command>redirect</command> router you could
17889 have:
17890 </para>
17891 <literallayout class="monospaced">
17892 data = ${quote_local_part:$local_part}@new.domain.example
17893 </literallayout>
17894 <para>
17895 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17896 to process local parts in a case-dependent manner in a router, you can set the
17897 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17898 </para>
17899 </listitem></varlistentry>
17900 <varlistentry>
17901 <term><varname>$local_part_data</varname></term>
17902 <listitem>
17903 <para>
17904 <indexterm role="variable">
17905 <primary><varname>$local_part_data</varname></primary>
17906 </indexterm>
17907 When the <option>local_parts</option> option on a router matches a local part by means of a
17908 lookup, the data read by the lookup is available during the running of the
17909 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17910 to a transport, the value is available in that transport. If the transport is
17911 handling multiple addresses, the value from the first address is used.
17912 </para>
17913 <para>
17914 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17915 matches a local part by means of a lookup. The data read by the lookup is
17916 available during the rest of the ACL statement. In all other situations, this
17917 variable expands to nothing.
17918 </para>
17919 </listitem></varlistentry>
17920 <varlistentry>
17921 <term><varname>$local_part_prefix</varname></term>
17922 <listitem>
17923 <para>
17924 <indexterm role="variable">
17925 <primary><varname>$local_part_prefix</varname></primary>
17926 </indexterm>
17927 When an address is being routed or delivered, and a
17928 specific prefix for the local part was recognized, it is available in this
17929 variable, having been removed from <varname>$local_part</varname>.
17930 </para>
17931 </listitem></varlistentry>
17932 <varlistentry>
17933 <term><varname>$local_part_suffix</varname></term>
17934 <listitem>
17935 <para>
17936 <indexterm role="variable">
17937 <primary><varname>$local_part_suffix</varname></primary>
17938 </indexterm>
17939 When an address is being routed or delivered, and a
17940 specific suffix for the local part was recognized, it is available in this
17941 variable, having been removed from <varname>$local_part</varname>.
17942 </para>
17943 </listitem></varlistentry>
17944 <varlistentry>
17945 <term><varname>$local_scan_data</varname></term>
17946 <listitem>
17947 <para>
17948 <indexterm role="variable">
17949 <primary><varname>$local_scan_data</varname></primary>
17950 </indexterm>
17951 This variable contains the text returned by the <function>local_scan()</function> function when
17952 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17953 </para>
17954 </listitem></varlistentry>
17955 <varlistentry>
17956 <term><varname>$local_user_gid</varname></term>
17957 <listitem>
17958 <para>
17959 <indexterm role="variable">
17960 <primary><varname>$local_user_gid</varname></primary>
17961 </indexterm>
17962 See <varname>$local_user_uid</varname>.
17963 </para>
17964 </listitem></varlistentry>
17965 <varlistentry>
17966 <term><varname>$local_user_uid</varname></term>
17967 <listitem>
17968 <para>
17969 <indexterm role="variable">
17970 <primary><varname>$local_user_uid</varname></primary>
17971 </indexterm>
17972 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17973 <option>check_local_user</option> router precondition succeeds. This means that their values
17974 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17975 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17976 router-specific expansions. At all other times, the values in these variables
17977 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17978 </para>
17979 </listitem></varlistentry>
17980 <varlistentry>
17981 <term><varname>$localhost_number</varname></term>
17982 <listitem>
17983 <para>
17984 <indexterm role="variable">
17985 <primary><varname>$localhost_number</varname></primary>
17986 </indexterm>
17987 This contains the expanded value of the
17988 <option>localhost_number</option> option. The expansion happens after the main options have
17989 been read.
17990 </para>
17991 </listitem></varlistentry>
17992 <varlistentry>
17993 <term><varname>$log_inodes</varname></term>
17994 <listitem>
17995 <para>
17996 <indexterm role="variable">
17997 <primary><varname>$log_inodes</varname></primary>
17998 </indexterm>
17999 The number of free inodes in the disk partition where Exim&#x2019;s
18000 log files are being written. The value is recalculated whenever the variable is
18001 referenced. If the relevant file system does not have the concept of inodes,
18002 the value of is -1. See also the <option>check_log_inodes</option> option.
18003 </para>
18004 </listitem></varlistentry>
18005 <varlistentry>
18006 <term><varname>$log_space</varname></term>
18007 <listitem>
18008 <para>
18009 <indexterm role="variable">
18010 <primary><varname>$log_space</varname></primary>
18011 </indexterm>
18012 The amount of free space (as a number of kilobytes) in the disk
18013 partition where Exim&#x2019;s log files are being written. The value is recalculated
18014 whenever the variable is referenced. If the operating system does not have the
18015 ability to find the amount of free space (only true for experimental systems),
18016 the space value is -1. See also the <option>check_log_space</option> option.
18017 </para>
18018 </listitem></varlistentry>
18019 <varlistentry>
18020 <term><varname>$lookup_dnssec_authenticated</varname></term>
18021 <listitem>
18022 <para>
18023 <indexterm role="variable">
18024 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18025 </indexterm>
18026 This variable is set after a DNS lookup done by
18027 a dnsdb lookup expansion, dnslookup router or smtp transport.
18028 <indexterm role="concept">
18029 <primary>DNS</primary>
18030 <secondary>DNSSEC</secondary>
18031 </indexterm>
18032 It will be empty if <command>DNSSEC</command> was not requested,
18033 <quote>no</quote> if the result was not labelled as authenticated data
18034 and <quote>yes</quote> if it was.
18035 </para>
18036 <para revisionflag="changed">
18037 Results that are labelled as authoritative answer that match
18038 the <option>dns_trust_aa</option> configuration variable count also
18039 as authenticated data.
18040 </para>
18041 </listitem></varlistentry>
18042 <varlistentry>
18043 <term><varname>$mailstore_basename</varname></term>
18044 <listitem>
18045 <para>
18046 <indexterm role="variable">
18047 <primary><varname>$mailstore_basename</varname></primary>
18048 </indexterm>
18049 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18050 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18051 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18052 contains the basename of the files that are being written, that is, the name
18053 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18054 variable is empty.
18055 </para>
18056 </listitem></varlistentry>
18057 <varlistentry>
18058 <term><varname>$malware_name</varname></term>
18059 <listitem>
18060 <para>
18061 <indexterm role="variable">
18062 <primary><varname>$malware_name</varname></primary>
18063 </indexterm>
18064 This variable is available when Exim is compiled with the
18065 content-scanning extension. It is set to the name of the virus that was found
18066 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18067 </para>
18068 </listitem></varlistentry>
18069 <varlistentry>
18070 <term><varname>$max_received_linelength</varname></term>
18071 <listitem>
18072 <para>
18073 <indexterm role="variable">
18074 <primary><varname>$max_received_linelength</varname></primary>
18075 </indexterm>
18076 <indexterm role="concept">
18077 <primary>maximum</primary>
18078 <secondary>line length</secondary>
18079 </indexterm>
18080 <indexterm role="concept">
18081 <primary>line length</primary>
18082 <secondary>maximum</secondary>
18083 </indexterm>
18084 This variable contains the number of bytes in the longest line that was
18085 received as part of the message, not counting the line termination
18086 character(s).
18087 </para>
18088 </listitem></varlistentry>
18089 <varlistentry>
18090 <term><varname>$message_age</varname></term>
18091 <listitem>
18092 <para>
18093 <indexterm role="concept">
18094 <primary>message</primary>
18095 <secondary>age of</secondary>
18096 </indexterm>
18097 <indexterm role="variable">
18098 <primary><varname>$message_age</varname></primary>
18099 </indexterm>
18100 This variable is set at the start of a delivery attempt to contain the number
18101 of seconds since the message was received. It does not change during a single
18102 delivery attempt.
18103 </para>
18104 </listitem></varlistentry>
18105 <varlistentry>
18106 <term><varname>$message_body</varname></term>
18107 <listitem>
18108 <para>
18109 <indexterm role="concept">
18110 <primary>body of message</primary>
18111 <secondary>expansion variable</secondary>
18112 </indexterm>
18113 <indexterm role="concept">
18114 <primary>message body</primary>
18115 <secondary>in expansion</secondary>
18116 </indexterm>
18117 <indexterm role="concept">
18118 <primary>binary zero</primary>
18119 <secondary>in message body</secondary>
18120 </indexterm>
18121 <indexterm role="variable">
18122 <primary><varname>$message_body</varname></primary>
18123 </indexterm>
18124 <indexterm role="option">
18125 <primary><option>message_body_visible</option></primary>
18126 </indexterm>
18127 This variable contains the initial portion of a message&#x2019;s body while it is
18128 being delivered, and is intended mainly for use in filter files. The maximum
18129 number of characters of the body that are put into the variable is set by the
18130 <option>message_body_visible</option> configuration option; the default is 500.
18131 </para>
18132 <para>
18133 <indexterm role="option">
18134 <primary><option>message_body_newlines</option></primary>
18135 </indexterm>
18136 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18137 easier to search for phrases that might be split over a line break. However,
18138 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18139 zeros are always converted into spaces.
18140 </para>
18141 </listitem></varlistentry>
18142 <varlistentry>
18143 <term><varname>$message_body_end</varname></term>
18144 <listitem>
18145 <para>
18146 <indexterm role="concept">
18147 <primary>body of message</primary>
18148 <secondary>expansion variable</secondary>
18149 </indexterm>
18150 <indexterm role="concept">
18151 <primary>message body</primary>
18152 <secondary>in expansion</secondary>
18153 </indexterm>
18154 <indexterm role="variable">
18155 <primary><varname>$message_body_end</varname></primary>
18156 </indexterm>
18157 This variable contains the final portion of a message&#x2019;s
18158 body while it is being delivered. The format and maximum size are as for
18159 <varname>$message_body</varname>.
18160 </para>
18161 </listitem></varlistentry>
18162 <varlistentry>
18163 <term><varname>$message_body_size</varname></term>
18164 <listitem>
18165 <para>
18166 <indexterm role="concept">
18167 <primary>body of message</primary>
18168 <secondary>size</secondary>
18169 </indexterm>
18170 <indexterm role="concept">
18171 <primary>message body</primary>
18172 <secondary>size</secondary>
18173 </indexterm>
18174 <indexterm role="variable">
18175 <primary><varname>$message_body_size</varname></primary>
18176 </indexterm>
18177 When a message is being delivered, this variable contains the size of the body
18178 in bytes. The count starts from the character after the blank line that
18179 separates the body from the header. Newlines are included in the count. See
18180 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18181 </para>
18182 </listitem></varlistentry>
18183 <varlistentry>
18184 <term><varname>$message_exim_id</varname></term>
18185 <listitem>
18186 <para>
18187 <indexterm role="variable">
18188 <primary><varname>$message_exim_id</varname></primary>
18189 </indexterm>
18190 When a message is being received or delivered, this variable contains the
18191 unique message id that is generated and used by Exim to identify the message.
18192 An id is not created for a message until after its header has been successfully
18193 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18194 line; it is the local id that Exim assigns to the message, for example:
18195 <literal>1BXTIK-0001yO-VA</literal>.
18196 </para>
18197 </listitem></varlistentry>
18198 <varlistentry>
18199 <term><varname>$message_headers</varname></term>
18200 <listitem>
18201 <para>
18202 <indexterm role="variable">
18203 <primary><varname>$message_headers</varname></primary>
18204 </indexterm>
18205 This variable contains a concatenation of all the header lines when a message
18206 is being processed, except for lines added by routers or transports. The header
18207 lines are separated by newline characters. Their contents are decoded in the
18208 same way as a header line that is inserted by <option>bheader</option>.
18209 </para>
18210 </listitem></varlistentry>
18211 <varlistentry>
18212 <term><varname>$message_headers_raw</varname></term>
18213 <listitem>
18214 <para>
18215 <indexterm role="variable">
18216 <primary><varname>$message_headers_raw</varname></primary>
18217 </indexterm>
18218 This variable is like <varname>$message_headers</varname> except that no processing of the
18219 contents of header lines is done.
18220 </para>
18221 </listitem></varlistentry>
18222 <varlistentry>
18223 <term><varname>$message_id</varname></term>
18224 <listitem>
18225 <para>
18226 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18227 </para>
18228 </listitem></varlistentry>
18229 <varlistentry>
18230 <term><varname>$message_linecount</varname></term>
18231 <listitem>
18232 <para>
18233 <indexterm role="variable">
18234 <primary><varname>$message_linecount</varname></primary>
18235 </indexterm>
18236 This variable contains the total number of lines in the header and body of the
18237 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18238 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18239 number of lines received. Before delivery happens (that is, before filters,
18240 routers, and transports run) the count is increased to include the
18241 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18242 lines that are added by ACLs. The blank line that separates the message header
18243 from the body is not counted.
18244 </para>
18245 <para>
18246 As with the special case of <varname>$message_size</varname>, during the expansion of the
18247 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18248 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18249 file that has been written (minus one for the blank line between the
18250 header and the body).
18251 </para>
18252 <para>
18253 Here is an example of the use of this variable in a DATA ACL:
18254 </para>
18255 <literallayout class="monospaced">
18256 deny message   = Too many lines in message header
18257      condition = \
18258       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18259 </literallayout>
18260 <para>
18261 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18262 message has not yet been received.
18263 </para>
18264 </listitem></varlistentry>
18265 <varlistentry>
18266 <term><varname>$message_size</varname></term>
18267 <listitem>
18268 <para>
18269 <indexterm role="concept">
18270 <primary>size</primary>
18271 <secondary>of message</secondary>
18272 </indexterm>
18273 <indexterm role="concept">
18274 <primary>message</primary>
18275 <secondary>size</secondary>
18276 </indexterm>
18277 <indexterm role="variable">
18278 <primary><varname>$message_size</varname></primary>
18279 </indexterm>
18280 When a message is being processed, this variable contains its size in bytes. In
18281 most cases, the size includes those headers that were received with the
18282 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18283 deliveries as they are written. However, there is one special case: during the
18284 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18285 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18286 precise size of the file that has been written. See also
18287 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18288 </para>
18289 <para>
18290 <indexterm role="concept">
18291 <primary>RCPT</primary>
18292 <secondary>value of <varname>$message_size</varname></secondary>
18293 </indexterm>
18294 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18295 contains the size supplied on the MAIL command, or -1 if no size was given. The
18296 value may not, of course, be truthful.
18297 </para>
18298 </listitem></varlistentry>
18299 <varlistentry>
18300 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18301 <listitem>
18302 <para>
18303 A number of variables whose names start with <varname>$mime</varname> are
18304 available when Exim is compiled with the content-scanning extension. For
18305 details, see section <xref linkend="SECTscanmimepart"/>.
18306 </para>
18307 </listitem></varlistentry>
18308 <varlistentry>
18309 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18310 <listitem>
18311 <para>
18312 These variables are counters that can be incremented by means
18313 of the <option>add</option> command in filter files.
18314 </para>
18315 </listitem></varlistentry>
18316 <varlistentry>
18317 <term><varname>$original_domain</varname></term>
18318 <listitem>
18319 <para>
18320 <indexterm role="variable">
18321 <primary><varname>$domain</varname></primary>
18322 </indexterm>
18323 <indexterm role="variable">
18324 <primary><varname>$original_domain</varname></primary>
18325 </indexterm>
18326 When a top-level address is being processed for delivery, this contains the
18327 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18328 generated by an alias, forward, or filter file) is being processed, this
18329 variable contains the domain of the original address (lower cased). This
18330 differs from <varname>$parent_domain</varname> only when there is more than one level of
18331 aliasing or forwarding. When more than one address is being delivered in a
18332 single transport run, <varname>$original_domain</varname> is not set.
18333 </para>
18334 <para>
18335 If a new address is created by means of a <option>deliver</option> command in a system
18336 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18337 part <emphasis>system-filter</emphasis> and the default qualify domain.
18338 </para>
18339 </listitem></varlistentry>
18340 <varlistentry>
18341 <term><varname>$original_local_part</varname></term>
18342 <listitem>
18343 <para>
18344 <indexterm role="variable">
18345 <primary><varname>$local_part</varname></primary>
18346 </indexterm>
18347 <indexterm role="variable">
18348 <primary><varname>$original_local_part</varname></primary>
18349 </indexterm>
18350 When a top-level address is being processed for delivery, this contains the
18351 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18352 local part, because <varname>$original_local_part</varname> always contains the full local
18353 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18354 filter file) is being processed, this variable contains the full local part of
18355 the original address.
18356 </para>
18357 <para>
18358 If the router that did the redirection processed the local part
18359 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18360 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18361 one level of aliasing or forwarding. When more than one address is being
18362 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18363 </para>
18364 <para>
18365 If a new address is created by means of a <option>deliver</option> command in a system
18366 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18367 part <emphasis>system-filter</emphasis> and the default qualify domain.
18368 </para>
18369 </listitem></varlistentry>
18370 <varlistentry>
18371 <term><varname>$originator_gid</varname></term>
18372 <listitem>
18373 <para>
18374 <indexterm role="concept">
18375 <primary>gid (group id)</primary>
18376 <secondary>of originating user</secondary>
18377 </indexterm>
18378 <indexterm role="concept">
18379 <primary>sender</primary>
18380 <secondary>gid</secondary>
18381 </indexterm>
18382 <indexterm role="variable">
18383 <primary><varname>$caller_gid</varname></primary>
18384 </indexterm>
18385 <indexterm role="variable">
18386 <primary><varname>$originator_gid</varname></primary>
18387 </indexterm>
18388 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18389 message was received. For messages received via the command line, this is the
18390 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18391 normally the gid of the Exim user.
18392 </para>
18393 </listitem></varlistentry>
18394 <varlistentry>
18395 <term><varname>$originator_uid</varname></term>
18396 <listitem>
18397 <para>
18398 <indexterm role="concept">
18399 <primary>uid (user id)</primary>
18400 <secondary>of originating user</secondary>
18401 </indexterm>
18402 <indexterm role="concept">
18403 <primary>sender</primary>
18404 <secondary>uid</secondary>
18405 </indexterm>
18406 <indexterm role="variable">
18407 <primary><varname>$caller_uid</varname></primary>
18408 </indexterm>
18409 <indexterm role="variable">
18410 <primary><varname>$originaltor_uid</varname></primary>
18411 </indexterm>
18412 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18413 messages received via the command line, this is the uid of the sending user.
18414 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18415 user.
18416 </para>
18417 </listitem></varlistentry>
18418 <varlistentry>
18419 <term><varname>$parent_domain</varname></term>
18420 <listitem>
18421 <para>
18422 <indexterm role="variable">
18423 <primary><varname>$parent_domain</varname></primary>
18424 </indexterm>
18425 This variable is similar to <varname>$original_domain</varname> (see
18426 above), except that it refers to the immediately preceding parent address.
18427 </para>
18428 </listitem></varlistentry>
18429 <varlistentry>
18430 <term><varname>$parent_local_part</varname></term>
18431 <listitem>
18432 <para>
18433 <indexterm role="variable">
18434 <primary><varname>$parent_local_part</varname></primary>
18435 </indexterm>
18436 This variable is similar to <varname>$original_local_part</varname>
18437 (see above), except that it refers to the immediately preceding parent address.
18438 </para>
18439 </listitem></varlistentry>
18440 <varlistentry>
18441 <term><varname>$pid</varname></term>
18442 <listitem>
18443 <para>
18444 <indexterm role="concept">
18445 <primary>pid (process id)</primary>
18446 <secondary>of current process</secondary>
18447 </indexterm>
18448 <indexterm role="variable">
18449 <primary><varname>$pid</varname></primary>
18450 </indexterm>
18451 This variable contains the current process id.
18452 </para>
18453 </listitem></varlistentry>
18454 <varlistentry>
18455 <term><varname>$pipe_addresses</varname></term>
18456 <listitem>
18457 <para>
18458 <indexterm role="concept">
18459 <primary>filter</primary>
18460 <secondary>transport filter</secondary>
18461 </indexterm>
18462 <indexterm role="concept">
18463 <primary>transport</primary>
18464 <secondary>filter</secondary>
18465 </indexterm>
18466 <indexterm role="variable">
18467 <primary><varname>$pipe_addresses</varname></primary>
18468 </indexterm>
18469 This is not an expansion variable, but is mentioned here because the string
18470 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18471 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18472 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18473 It cannot be used in general expansion strings, and provokes an <quote>unknown
18474 variable</quote> error if encountered.
18475 </para>
18476 </listitem></varlistentry>
18477 <varlistentry>
18478 <term><varname>$primary_hostname</varname></term>
18479 <listitem>
18480 <para>
18481 <indexterm role="variable">
18482 <primary><varname>$primary_hostname</varname></primary>
18483 </indexterm>
18484 This variable contains the value set by <option>primary_hostname</option> in the
18485 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18486 a single-component name, Exim calls <function>gethostbyname()</function> (or
18487 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18488 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18489 </para>
18490 </listitem></varlistentry>
18491 <varlistentry>
18492 <term><varname>$prvscheck_address</varname></term>
18493 <listitem>
18494 <para>
18495 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18496 which is described in sections <xref linkend="SECTexpansionitems"/> and
18497 <xref linkend="SECTverifyPRVS"/>.
18498 </para>
18499 </listitem></varlistentry>
18500 <varlistentry>
18501 <term><varname>$prvscheck_keynum</varname></term>
18502 <listitem>
18503 <para>
18504 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18505 which is described in sections <xref linkend="SECTexpansionitems"/> and
18506 <xref linkend="SECTverifyPRVS"/>.
18507 </para>
18508 </listitem></varlistentry>
18509 <varlistentry>
18510 <term><varname>$prvscheck_result</varname></term>
18511 <listitem>
18512 <para>
18513 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18514 which is described in sections <xref linkend="SECTexpansionitems"/> and
18515 <xref linkend="SECTverifyPRVS"/>.
18516 </para>
18517 </listitem></varlistentry>
18518 <varlistentry>
18519 <term><varname>$qualify_domain</varname></term>
18520 <listitem>
18521 <para>
18522 <indexterm role="variable">
18523 <primary><varname>$qualify_domain</varname></primary>
18524 </indexterm>
18525 The value set for the <option>qualify_domain</option> option in the configuration file.
18526 </para>
18527 </listitem></varlistentry>
18528 <varlistentry>
18529 <term><varname>$qualify_recipient</varname></term>
18530 <listitem>
18531 <para>
18532 <indexterm role="variable">
18533 <primary><varname>$qualify_recipient</varname></primary>
18534 </indexterm>
18535 The value set for the <option>qualify_recipient</option> option in the configuration file,
18536 or if not set, the value of <varname>$qualify_domain</varname>.
18537 </para>
18538 </listitem></varlistentry>
18539 <varlistentry>
18540 <term><varname>$rcpt_count</varname></term>
18541 <listitem>
18542 <para>
18543 <indexterm role="variable">
18544 <primary><varname>$rcpt_count</varname></primary>
18545 </indexterm>
18546 When a message is being received by SMTP, this variable contains the number of
18547 RCPT commands received for the current message. If this variable is used in a
18548 RCPT ACL, its value includes the current command.
18549 </para>
18550 </listitem></varlistentry>
18551 <varlistentry>
18552 <term><varname>$rcpt_defer_count</varname></term>
18553 <listitem>
18554 <para>
18555 <indexterm role="variable">
18556 <primary><varname>$rcpt_defer_count</varname></primary>
18557 </indexterm>
18558 <indexterm role="concept">
18559 <primary>4<emphasis>xx</emphasis> responses</primary>
18560 <secondary>count of</secondary>
18561 </indexterm>
18562 When a message is being received by SMTP, this variable contains the number of
18563 RCPT commands in the current message that have previously been rejected with a
18564 temporary (4<emphasis>xx</emphasis>) response.
18565 </para>
18566 </listitem></varlistentry>
18567 <varlistentry>
18568 <term><varname>$rcpt_fail_count</varname></term>
18569 <listitem>
18570 <para>
18571 <indexterm role="variable">
18572 <primary><varname>$rcpt_fail_count</varname></primary>
18573 </indexterm>
18574 When a message is being received by SMTP, this variable contains the number of
18575 RCPT commands in the current message that have previously been rejected with a
18576 permanent (5<emphasis>xx</emphasis>) response.
18577 </para>
18578 </listitem></varlistentry>
18579 <varlistentry>
18580 <term><varname>$received_count</varname></term>
18581 <listitem>
18582 <para>
18583 <indexterm role="variable">
18584 <primary><varname>$received_count</varname></primary>
18585 </indexterm>
18586 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18587 including the one added by Exim (so its value is always greater than zero). It
18588 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18589 delivering.
18590 </para>
18591 </listitem></varlistentry>
18592 <varlistentry>
18593 <term><varname>$received_for</varname></term>
18594 <listitem>
18595 <para>
18596 <indexterm role="variable">
18597 <primary><varname>$received_for</varname></primary>
18598 </indexterm>
18599 If there is only a single recipient address in an incoming message, this
18600 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18601 built. The value is copied after recipient rewriting has happened, but before
18602 the <function>local_scan()</function> function is run.
18603 </para>
18604 </listitem></varlistentry>
18605 <varlistentry>
18606 <term><varname>$received_ip_address</varname></term>
18607 <listitem>
18608 <para>
18609 <indexterm role="variable">
18610 <primary><varname>$received_ip_address</varname></primary>
18611 </indexterm>
18612 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18613 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18614 is set to the local port number. (The remote IP address and port are in
18615 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18616 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18617 option.
18618 </para>
18619 <para>
18620 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18621 could be used, for example, to make the file name for a TLS certificate depend
18622 on which interface and/or port is being used for the incoming connection. The
18623 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18624 messages that are received, thus making these variables available at delivery
18625 time.
18626 For outbound connections see <varname>$sending_ip_address</varname>.
18627 </para>
18628 </listitem></varlistentry>
18629 <varlistentry>
18630 <term><varname>$received_port</varname></term>
18631 <listitem>
18632 <para>
18633 <indexterm role="variable">
18634 <primary><varname>$received_port</varname></primary>
18635 </indexterm>
18636 See <varname>$received_ip_address</varname>.
18637 </para>
18638 </listitem></varlistentry>
18639 <varlistentry>
18640 <term><varname>$received_protocol</varname></term>
18641 <listitem>
18642 <para>
18643 <indexterm role="variable">
18644 <primary><varname>$received_protocol</varname></primary>
18645 </indexterm>
18646 When a message is being processed, this variable contains the name of the
18647 protocol by which it was received. Most of the names used by Exim are defined
18648 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18649 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18650 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18651 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18652 connection and the client was successfully authenticated.
18653 </para>
18654 <para>
18655 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18656 automatically set up on connection without the use of STARTTLS (see
18657 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18658 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18659 where the client initially uses EHLO, sets up an encrypted connection using
18660 STARTTLS, and then uses HELO afterwards.
18661 </para>
18662 <para>
18663 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18664 messages that are injected locally by trusted callers. This is commonly used to
18665 identify messages that are being re-injected after some kind of scanning.
18666 </para>
18667 </listitem></varlistentry>
18668 <varlistentry>
18669 <term><varname>$received_time</varname></term>
18670 <listitem>
18671 <para>
18672 <indexterm role="variable">
18673 <primary><varname>$received_time</varname></primary>
18674 </indexterm>
18675 This variable contains the date and time when the current message was received,
18676 as a number of seconds since the start of the Unix epoch.
18677 </para>
18678 </listitem></varlistentry>
18679 <varlistentry>
18680 <term><varname>$recipient_data</varname></term>
18681 <listitem>
18682 <para>
18683 <indexterm role="variable">
18684 <primary><varname>$recipient_data</varname></primary>
18685 </indexterm>
18686 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18687 condition. It contains the data from the lookup, and the value remains set
18688 until the next <option>recipients</option> test. Thus, you can do things like this:
18689 </para>
18690 <literallayout>
18691 <literal>require recipients  = cdb*@;/some/file</literal>
18692 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18693 </literallayout>
18694 <para>
18695 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18696 method in the address list, using the semicolon syntax as in the example above.
18697 The variable is not set for a lookup that is used as part of the string
18698 expansion that all such lists undergo before being interpreted.
18699 </para>
18700 </listitem></varlistentry>
18701 <varlistentry>
18702 <term><varname>$recipient_verify_failure</varname></term>
18703 <listitem>
18704 <para>
18705 <indexterm role="variable">
18706 <primary><varname>$recipient_verify_failure</varname></primary>
18707 </indexterm>
18708 In an ACL, when a recipient verification fails, this variable contains
18709 information about the failure. It is set to one of the following words:
18710 </para>
18711 <itemizedlist>
18712 <listitem>
18713 <para>
18714 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18715 was neither local nor came from an exempted host.
18716 </para>
18717 </listitem>
18718 <listitem>
18719 <para>
18720 <quote>route</quote>: Routing failed.
18721 </para>
18722 </listitem>
18723 <listitem>
18724 <para>
18725 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18726 or before the MAIL command (that is, on initial connection, HELO, or
18727 MAIL).
18728 </para>
18729 </listitem>
18730 <listitem>
18731 <para>
18732 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18733 </para>
18734 </listitem>
18735 <listitem>
18736 <para>
18737 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18738 </para>
18739 </listitem>
18740 </itemizedlist>
18741 <para>
18742 The main use of this variable is expected to be to distinguish between
18743 rejections of MAIL and rejections of RCPT.
18744 </para>
18745 </listitem></varlistentry>
18746 <varlistentry>
18747 <term><varname>$recipients</varname></term>
18748 <listitem>
18749 <para>
18750 <indexterm role="variable">
18751 <primary><varname>$recipients</varname></primary>
18752 </indexterm>
18753 This variable contains a list of envelope recipients for a message. A comma and
18754 a space separate the addresses in the replacement text. However, the variable
18755 is not generally available, to prevent exposure of Bcc recipients in
18756 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18757 cases:
18758 </para>
18759 <orderedlist numeration="arabic">
18760 <listitem>
18761 <para>
18762 In a system filter file.
18763 </para>
18764 </listitem>
18765 <listitem>
18766 <para>
18767 In the ACLs associated with the DATA command and with non-SMTP messages, that
18768 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18769 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18770 <option>acl_not_smtp_mime</option>.
18771 </para>
18772 </listitem>
18773 <listitem>
18774 <para>
18775 From within a <function>local_scan()</function> function.
18776 </para>
18777 </listitem>
18778 </orderedlist>
18779 </listitem></varlistentry>
18780 <varlistentry>
18781 <term><varname>$recipients_count</varname></term>
18782 <listitem>
18783 <para>
18784 <indexterm role="variable">
18785 <primary><varname>$recipients_count</varname></primary>
18786 </indexterm>
18787 When a message is being processed, this variable contains the number of
18788 envelope recipients that came with the message. Duplicates are not excluded
18789 from the count. While a message is being received over SMTP, the number
18790 increases for each accepted recipient. It can be referenced in an ACL.
18791 </para>
18792 </listitem></varlistentry>
18793 <varlistentry>
18794 <term><varname>$regex_match_string</varname></term>
18795 <listitem>
18796 <para>
18797 <indexterm role="variable">
18798 <primary><varname>$regex_match_string</varname></primary>
18799 </indexterm>
18800 This variable is set to contain the matching regular expression after a
18801 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18802 </para>
18803 </listitem></varlistentry>
18804 <varlistentry>
18805 <term><varname>$reply_address</varname></term>
18806 <listitem>
18807 <para>
18808 <indexterm role="variable">
18809 <primary><varname>$reply_address</varname></primary>
18810 </indexterm>
18811 When a message is being processed, this variable contains the contents of the
18812 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18813 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18814 white space, the value is not processed in any way. In particular, no RFC 2047
18815 decoding or character code translation takes place.
18816 </para>
18817 </listitem></varlistentry>
18818 <varlistentry>
18819 <term><varname>$return_path</varname></term>
18820 <listitem>
18821 <para>
18822 <indexterm role="variable">
18823 <primary><varname>$return_path</varname></primary>
18824 </indexterm>
18825 When a message is being delivered, this variable contains the return path &ndash;
18826 the sender field that will be sent as part of the envelope. It is not enclosed
18827 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18828 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18829 mailing list has been expanded by a router which specifies a different address
18830 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18831 address, whereas <varname>$sender_address</varname> always contains the original sender address
18832 that was received with the message. In other words, <varname>$sender_address</varname> contains
18833 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18834 envelope sender.
18835 </para>
18836 </listitem></varlistentry>
18837 <varlistentry>
18838 <term><varname>$return_size_limit</varname></term>
18839 <listitem>
18840 <para>
18841 <indexterm role="variable">
18842 <primary><varname>$return_size_limit</varname></primary>
18843 </indexterm>
18844 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18845 </para>
18846 </listitem></varlistentry>
18847 <varlistentry>
18848 <term><varname>$router_name</varname></term>
18849 <listitem>
18850 <para>
18851 <indexterm role="concept">
18852 <primary>router</primary>
18853 <secondary>name</secondary>
18854 </indexterm>
18855 <indexterm role="concept">
18856 <primary>name</primary>
18857 <secondary>of router</secondary>
18858 </indexterm>
18859 <indexterm role="variable">
18860 <primary><varname>$router_name</varname></primary>
18861 </indexterm>
18862 During the running of a router this variable contains its name.
18863 </para>
18864 </listitem></varlistentry>
18865 <varlistentry>
18866 <term><varname>$runrc</varname></term>
18867 <listitem>
18868 <para>
18869 <indexterm role="concept">
18870 <primary>return code</primary>
18871 <secondary>from <option>run</option> expansion</secondary>
18872 </indexterm>
18873 <indexterm role="variable">
18874 <primary><varname>$runrc</varname></primary>
18875 </indexterm>
18876 This variable contains the return code from a command that is run by the
18877 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18878 assume the order in which option values are expanded, except for those
18879 preconditions whose order of testing is documented. Therefore, you cannot
18880 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18881 another.
18882 </para>
18883 </listitem></varlistentry>
18884 <varlistentry>
18885 <term><varname>$self_hostname</varname></term>
18886 <listitem>
18887 <para>
18888 <indexterm role="option">
18889 <primary><option>self</option></primary>
18890 <secondary>value of host name</secondary>
18891 </indexterm>
18892 <indexterm role="variable">
18893 <primary><varname>$self_hostname</varname></primary>
18894 </indexterm>
18895 When an address is routed to a supposedly remote host that turns out to be the
18896 local host, what happens is controlled by the <option>self</option> generic router option.
18897 One of its values causes the address to be passed to another router. When this
18898 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18899 original router encountered. In other circumstances its contents are null.
18900 </para>
18901 </listitem></varlistentry>
18902 <varlistentry>
18903 <term><varname>$sender_address</varname></term>
18904 <listitem>
18905 <para>
18906 <indexterm role="variable">
18907 <primary><varname>$sender_address</varname></primary>
18908 </indexterm>
18909 When a message is being processed, this variable contains the sender&#x2019;s address
18910 that was received in the message&#x2019;s envelope. The case of letters in the address
18911 is retained, in both the local part and the domain. For bounce messages, the
18912 value of this variable is the empty string. See also <varname>$return_path</varname>.
18913 </para>
18914 </listitem></varlistentry>
18915 <varlistentry>
18916 <term><varname>$sender_address_data</varname></term>
18917 <listitem>
18918 <para>
18919 <indexterm role="variable">
18920 <primary><varname>$address_data</varname></primary>
18921 </indexterm>
18922 <indexterm role="variable">
18923 <primary><varname>$sender_address_data</varname></primary>
18924 </indexterm>
18925 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18926 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18927 distinguish it from data from a recipient address. The value does not persist
18928 after the end of the current ACL statement. If you want to preserve it for
18929 longer, you can save it in an ACL variable.
18930 </para>
18931 </listitem></varlistentry>
18932 <varlistentry>
18933 <term><varname>$sender_address_domain</varname></term>
18934 <listitem>
18935 <para>
18936 <indexterm role="variable">
18937 <primary><varname>$sender_address_domain</varname></primary>
18938 </indexterm>
18939 The domain portion of <varname>$sender_address</varname>.
18940 </para>
18941 </listitem></varlistentry>
18942 <varlistentry>
18943 <term><varname>$sender_address_local_part</varname></term>
18944 <listitem>
18945 <para>
18946 <indexterm role="variable">
18947 <primary><varname>$sender_address_local_part</varname></primary>
18948 </indexterm>
18949 The local part portion of <varname>$sender_address</varname>.
18950 </para>
18951 </listitem></varlistentry>
18952 <varlistentry>
18953 <term><varname>$sender_data</varname></term>
18954 <listitem>
18955 <para>
18956 <indexterm role="variable">
18957 <primary><varname>$sender_data</varname></primary>
18958 </indexterm>
18959 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18960 in a router <option>senders</option> option. It contains the data from the lookup, and the
18961 value remains set until the next <option>senders</option> test. Thus, you can do things like
18962 this:
18963 </para>
18964 <literallayout>
18965 <literal>require senders      = cdb*@;/some/file</literal>
18966 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18967 </literallayout>
18968 <para>
18969 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18970 method in the address list, using the semicolon syntax as in the example above.
18971 The variable is not set for a lookup that is used as part of the string
18972 expansion that all such lists undergo before being interpreted.
18973 </para>
18974 </listitem></varlistentry>
18975 <varlistentry>
18976 <term><varname>$sender_fullhost</varname></term>
18977 <listitem>
18978 <para>
18979 <indexterm role="variable">
18980 <primary><varname>$sender_fullhost</varname></primary>
18981 </indexterm>
18982 When a message is received from a remote host, this variable contains the host
18983 name and IP address in a single string. It ends with the IP address in square
18984 brackets, followed by a colon and a port number if the logging of ports is
18985 enabled. The format of the rest of the string depends on whether the host
18986 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18987 looking up its IP address. (Looking up the IP address can be forced by the
18988 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18989 start of the string is a verified host name; if this is not present,
18990 verification either failed or was not requested. A host name in parentheses is
18991 the argument of a HELO or EHLO command. This is omitted if it is identical to
18992 the verified host name or to the host&#x2019;s IP address in square brackets.
18993 </para>
18994 </listitem></varlistentry>
18995 <varlistentry revisionflag="changed">
18996 <term><varname>$sender_helo_dnssec</varname></term>
18997 <listitem>
18998 <para revisionflag="changed">
18999 <indexterm role="variable">
19000 <primary><varname>$sender_helo_dnssec</varname></primary>
19001 </indexterm>
19002 This boolean variable is true if a successful HELO verification was
19003 <indexterm role="concept">
19004 <primary>DNS</primary>
19005 <secondary>DNSSEC</secondary>
19006 </indexterm>
19007 done using DNS information the resolver library stated was authenticated data.
19008 </para>
19009 </listitem></varlistentry>
19010 <varlistentry>
19011 <term><varname>$sender_helo_name</varname></term>
19012 <listitem>
19013 <para>
19014 <indexterm role="variable">
19015 <primary><varname>$sender_helo_name</varname></primary>
19016 </indexterm>
19017 When a message is received from a remote host that has issued a HELO or EHLO
19018 command, the argument of that command is placed in this variable. It is also
19019 set if HELO or EHLO is used when a message is received using SMTP locally via
19020 the <option>-bs</option> or <option>-bS</option> options.
19021 </para>
19022 </listitem></varlistentry>
19023 <varlistentry>
19024 <term><varname>$sender_host_address</varname></term>
19025 <listitem>
19026 <para>
19027 <indexterm role="variable">
19028 <primary><varname>$sender_host_address</varname></primary>
19029 </indexterm>
19030 When a message is received from a remote host using SMTP,
19031 this variable contains that
19032 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19033 </para>
19034 </listitem></varlistentry>
19035 <varlistentry>
19036 <term><varname>$sender_host_authenticated</varname></term>
19037 <listitem>
19038 <para>
19039 <indexterm role="variable">
19040 <primary><varname>$sender_host_authenticated</varname></primary>
19041 </indexterm>
19042 This variable contains the name (not the public name) of the authenticator
19043 driver that successfully authenticated the client from which the message was
19044 received. It is empty if there was no successful authentication. See also
19045 <varname>$authenticated_id</varname>.
19046 </para>
19047 </listitem></varlistentry>
19048 <varlistentry>
19049 <term><varname>$sender_host_dnssec</varname></term>
19050 <listitem>
19051 <para>
19052 <indexterm role="variable">
19053 <primary><varname>$sender_host_dnssec</varname></primary>
19054 </indexterm>
19055 If an attempt to populate <varname>$sender_host_name</varname> has been made
19056 (by reference, <option>hosts_lookup</option> or
19057 otherwise) then this boolean will have been set true if, and only if, the
19058 resolver library states that both
19059 the reverse and forward DNS were authenticated data.  At all
19060 other times, this variable is false.
19061 </para>
19062 <para>
19063 <indexterm role="concept">
19064 <primary>DNS</primary>
19065 <secondary>DNSSEC</secondary>
19066 </indexterm>
19067 It is likely that you will need to coerce DNSSEC support on in the resolver
19068 library, by setting:
19069 </para>
19070 <literallayout class="monospaced">
19071 dns_dnssec_ok = 1
19072 </literallayout>
19073 <para>
19074 Exim does not perform DNSSEC validation itself, instead leaving that to a
19075 validating resolver (e.g. unbound, or bind with suitable configuration).
19076 </para>
19077 <para>
19078 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19079 mechanism in the list, then this variable will be false.
19080 </para>
19081 </listitem></varlistentry>
19082 <varlistentry>
19083 <term><varname>$sender_host_name</varname></term>
19084 <listitem>
19085 <para>
19086 <indexterm role="variable">
19087 <primary><varname>$sender_host_name</varname></primary>
19088 </indexterm>
19089 When a message is received from a remote host, this variable contains the
19090 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19091 other means, this variable is empty.
19092 </para>
19093 <para>
19094 <indexterm role="variable">
19095 <primary><varname>$host_lookup_failed</varname></primary>
19096 </indexterm>
19097 If the host name has not previously been looked up, a reference to
19098 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19099 A looked up name is accepted only if it leads back to the original IP address
19100 via a forward lookup. If either the reverse or the forward lookup fails to find
19101 any data, or if the forward lookup does not yield the original IP address,
19102 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19103 </para>
19104 <para>
19105 <indexterm role="variable">
19106 <primary><varname>$host_lookup_deferred</varname></primary>
19107 </indexterm>
19108 However, if either of the lookups cannot be completed (for example, there is a
19109 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19110 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19111 </para>
19112 <para>
19113 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19114 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19115 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19116 is set to <quote>1</quote>.
19117 </para>
19118 <para>
19119 Exim does not automatically look up every calling host&#x2019;s name. If you want
19120 maximum efficiency, you should arrange your configuration so that it avoids
19121 these lookups altogether. The lookup happens only if one or more of the
19122 following are true:
19123 </para>
19124 <itemizedlist>
19125 <listitem>
19126 <para>
19127 A string containing <varname>$sender_host_name</varname> is expanded.
19128 </para>
19129 </listitem>
19130 <listitem>
19131 <para>
19132 The calling host matches the list in <option>host_lookup</option>. In the default
19133 configuration, this option is set to *, so it must be changed if lookups are
19134 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19135 </para>
19136 </listitem>
19137 <listitem>
19138 <para>
19139 Exim needs the host name in order to test an item in a host list. The items
19140 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19141 <xref linkend="SECThoslispatnamsk"/>.
19142 </para>
19143 </listitem>
19144 <listitem>
19145 <para>
19146 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19147 In this case, the host name is required to compare with the name quoted in any
19148 EHLO or HELO commands that the client issues.
19149 </para>
19150 </listitem>
19151 <listitem>
19152 <para>
19153 The remote host issues a EHLO or HELO command that quotes one of the
19154 domains in <option>helo_lookup_domains</option>. The default value of this option is
19155 </para>
19156 <literallayout class="monospaced">
19157   helo_lookup_domains = @ : @[]
19158 </literallayout>
19159 <para>
19160 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19161 IP address in an EHLO or HELO command.
19162 </para>
19163 </listitem>
19164 </itemizedlist>
19165 </listitem></varlistentry>
19166 <varlistentry>
19167 <term><varname>$sender_host_port</varname></term>
19168 <listitem>
19169 <para>
19170 <indexterm role="variable">
19171 <primary><varname>$sender_host_port</varname></primary>
19172 </indexterm>
19173 When a message is received from a remote host, this variable contains the port
19174 number that was used on the remote host.
19175 </para>
19176 </listitem></varlistentry>
19177 <varlistentry>
19178 <term><varname>$sender_ident</varname></term>
19179 <listitem>
19180 <para>
19181 <indexterm role="variable">
19182 <primary><varname>$sender_ident</varname></primary>
19183 </indexterm>
19184 When a message is received from a remote host, this variable contains the
19185 identification received in response to an RFC 1413 request. When a message has
19186 been received locally, this variable contains the login name of the user that
19187 called Exim.
19188 </para>
19189 </listitem></varlistentry>
19190 <varlistentry>
19191 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19192 <listitem>
19193 <para>
19194 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19195 <option>ratelimit</option> ACL condition. Details are given in section
19196 <xref linkend="SECTratelimiting"/>.
19197 </para>
19198 </listitem></varlistentry>
19199 <varlistentry>
19200 <term><varname>$sender_rcvhost</varname></term>
19201 <listitem>
19202 <para>
19203 <indexterm role="concept">
19204 <primary>DNS</primary>
19205 <secondary>reverse lookup</secondary>
19206 </indexterm>
19207 <indexterm role="concept">
19208 <primary>reverse DNS lookup</primary>
19209 </indexterm>
19210 <indexterm role="variable">
19211 <primary><varname>$sender_rcvhost</varname></primary>
19212 </indexterm>
19213 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19214 either the verified host name (as obtained from a reverse DNS lookup) or, if
19215 there is no verified host name, the IP address in square brackets. After that
19216 there may be text in parentheses. When the first item is a verified host name,
19217 the first thing in the parentheses is the IP address in square brackets,
19218 followed by a colon and a port number if port logging is enabled. When the
19219 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19220 the parentheses.
19221 </para>
19222 <para>
19223 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19224 was used and its argument was not identical to the real host name or IP
19225 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19226 all three items are present in the parentheses, a newline and tab are inserted
19227 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19228 </para>
19229 </listitem></varlistentry>
19230 <varlistentry>
19231 <term><varname>$sender_verify_failure</varname></term>
19232 <listitem>
19233 <para>
19234 <indexterm role="variable">
19235 <primary><varname>$sender_verify_failure</varname></primary>
19236 </indexterm>
19237 In an ACL, when a sender verification fails, this variable contains information
19238 about the failure. The details are the same as for
19239 <varname>$recipient_verify_failure</varname>.
19240 </para>
19241 </listitem></varlistentry>
19242 <varlistentry>
19243 <term><varname>$sending_ip_address</varname></term>
19244 <listitem>
19245 <para>
19246 <indexterm role="variable">
19247 <primary><varname>$sending_ip_address</varname></primary>
19248 </indexterm>
19249 This variable is set whenever an outgoing SMTP connection to another host has
19250 been set up. It contains the IP address of the local interface that is being
19251 used. This is useful if a host that has more than one IP address wants to take
19252 on different personalities depending on which one is being used. For incoming
19253 connections, see <varname>$received_ip_address</varname>.
19254 </para>
19255 </listitem></varlistentry>
19256 <varlistentry>
19257 <term><varname>$sending_port</varname></term>
19258 <listitem>
19259 <para>
19260 <indexterm role="variable">
19261 <primary><varname>$sending_port</varname></primary>
19262 </indexterm>
19263 This variable is set whenever an outgoing SMTP connection to another host has
19264 been set up. It contains the local port that is being used. For incoming
19265 connections, see <varname>$received_port</varname>.
19266 </para>
19267 </listitem></varlistentry>
19268 <varlistentry>
19269 <term><varname>$smtp_active_hostname</varname></term>
19270 <listitem>
19271 <para>
19272 <indexterm role="variable">
19273 <primary><varname>$smtp_active_hostname</varname></primary>
19274 </indexterm>
19275 During an incoming SMTP session, this variable contains the value of the active
19276 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19277 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19278 value can be consulted during routing and delivery.
19279 </para>
19280 </listitem></varlistentry>
19281 <varlistentry>
19282 <term><varname>$smtp_command</varname></term>
19283 <listitem>
19284 <para>
19285 <indexterm role="variable">
19286 <primary><varname>$smtp_command</varname></primary>
19287 </indexterm>
19288 During the processing of an incoming SMTP command, this variable contains the
19289 entire command. This makes it possible to distinguish between HELO and EHLO in
19290 the HELO ACL, and also to distinguish between commands such as these:
19291 </para>
19292 <literallayout class="monospaced">
19293 MAIL FROM:&lt;&gt;
19294 MAIL FROM: &lt;&gt;
19295 </literallayout>
19296 <para>
19297 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19298 command, the address in <varname>$smtp_command</varname> is the original address before any
19299 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19300 the address after SMTP-time rewriting.
19301 </para>
19302 </listitem></varlistentry>
19303 <varlistentry>
19304 <term><varname>$smtp_command_argument</varname></term>
19305 <listitem>
19306 <para>
19307 <indexterm role="concept">
19308 <primary>SMTP</primary>
19309 <secondary>command, argument for</secondary>
19310 </indexterm>
19311 <indexterm role="variable">
19312 <primary><varname>$smtp_command_argument</varname></primary>
19313 </indexterm>
19314 While an ACL is running to check an SMTP command, this variable contains the
19315 argument, that is, the text that follows the command name, with leading white
19316 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19317 somewhat redundant, but is retained for backwards compatibility.
19318 </para>
19319 </listitem></varlistentry>
19320 <varlistentry>
19321 <term><varname>$smtp_count_at_connection_start</varname></term>
19322 <listitem>
19323 <para>
19324 <indexterm role="variable">
19325 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19326 </indexterm>
19327 This variable is set greater than zero only in processes spawned by the Exim
19328 daemon for handling incoming SMTP connections. The name is deliberately long,
19329 in order to emphasize what the contents are. When the daemon accepts a new
19330 connection, it increments this variable. A copy of the variable is passed to
19331 the child process that handles the connection, but its value is fixed, and
19332 never changes. It is only an approximation of how many incoming connections
19333 there actually are, because many other connections may come and go while a
19334 single connection is being processed. When a child process terminates, the
19335 daemon decrements its copy of the variable.
19336 </para>
19337 </listitem></varlistentry>
19338 <varlistentry>
19339 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19340 <listitem>
19341 <para>
19342 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19343 that were current at the end of the system filter file. This allows a system
19344 filter file to set values that can be tested in users&#x2019; filter files. For
19345 example, a system filter could set a value indicating how likely it is that a
19346 message is junk mail.
19347 </para>
19348 </listitem></varlistentry>
19349 <varlistentry>
19350 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19351 <listitem>
19352 <para>
19353 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19354 is compiled with the content-scanning extension. For details, see section
19355 <xref linkend="SECTscanspamass"/>.
19356 </para>
19357 </listitem></varlistentry>
19358 <varlistentry>
19359 <term><varname>$spool_directory</varname></term>
19360 <listitem>
19361 <para>
19362 <indexterm role="variable">
19363 <primary><varname>$spool_directory</varname></primary>
19364 </indexterm>
19365 The name of Exim&#x2019;s spool directory.
19366 </para>
19367 </listitem></varlistentry>
19368 <varlistentry>
19369 <term><varname>$spool_inodes</varname></term>
19370 <listitem>
19371 <para>
19372 <indexterm role="variable">
19373 <primary><varname>$spool_inodes</varname></primary>
19374 </indexterm>
19375 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19376 being written. The value is recalculated whenever the variable is referenced.
19377 If the relevant file system does not have the concept of inodes, the value of
19378 is -1. See also the <option>check_spool_inodes</option> option.
19379 </para>
19380 </listitem></varlistentry>
19381 <varlistentry>
19382 <term><varname>$spool_space</varname></term>
19383 <listitem>
19384 <para>
19385 <indexterm role="variable">
19386 <primary><varname>$spool_space</varname></primary>
19387 </indexterm>
19388 The amount of free space (as a number of kilobytes) in the disk partition where
19389 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19390 variable is referenced. If the operating system does not have the ability to
19391 find the amount of free space (only true for experimental systems), the space
19392 value is -1. For example, to check in an ACL that there is at least 50
19393 megabytes free on the spool, you could write:
19394 </para>
19395 <literallayout class="monospaced">
19396 condition = ${if &gt; {$spool_space}{50000}}
19397 </literallayout>
19398 <para>
19399 See also the <option>check_spool_space</option> option.
19400 </para>
19401 </listitem></varlistentry>
19402 <varlistentry>
19403 <term><varname>$thisaddress</varname></term>
19404 <listitem>
19405 <para>
19406 <indexterm role="variable">
19407 <primary><varname>$thisaddress</varname></primary>
19408 </indexterm>
19409 This variable is set only during the processing of the <option>foranyaddress</option>
19410 command in a filter file. Its use is explained in the description of that
19411 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19412 interfaces to mail filtering</emphasis>.
19413 </para>
19414 </listitem></varlistentry>
19415 <varlistentry>
19416 <term><varname>$tls_in_bits</varname></term>
19417 <listitem>
19418 <para>
19419 <indexterm role="variable">
19420 <primary><varname>$tls_in_bits</varname></primary>
19421 </indexterm>
19422 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19423 on the inbound connection; the meaning of
19424 this depends upon the TLS implementation used.
19425 If TLS has not been negotiated, the value will be 0.
19426 The value of this is automatically fed into the Cyrus SASL authenticator
19427 when acting as a server, to specify the "external SSF" (a SASL term).
19428 </para>
19429 <para>
19430 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19431 except when used in the context of an outbound SMTP delivery, when it refers to
19432 the outbound.
19433 </para>
19434 </listitem></varlistentry>
19435 <varlistentry>
19436 <term><varname>$tls_out_bits</varname></term>
19437 <listitem>
19438 <para>
19439 <indexterm role="variable">
19440 <primary><varname>$tls_out_bits</varname></primary>
19441 </indexterm>
19442 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19443 on an outbound SMTP connection; the meaning of
19444 this depends upon the TLS implementation used.
19445 If TLS has not been negotiated, the value will be 0.
19446 </para>
19447 </listitem></varlistentry>
19448 <varlistentry>
19449 <term><varname>$tls_in_ourcert</varname></term>
19450 <listitem>
19451 <para>
19452 <indexterm role="variable">
19453 <primary><varname>$tls_in_ourcert</varname></primary>
19454 </indexterm>
19455 This variable refers to the certificate presented to the peer of an
19456 inbound connection when the message was received.
19457 It is only useful as the argument of a
19458 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19459 or a <option>def</option> condition.
19460 </para>
19461 </listitem></varlistentry>
19462 <varlistentry>
19463 <term><varname>$tls_in_peercert</varname></term>
19464 <listitem>
19465 <para>
19466 <indexterm role="variable">
19467 <primary><varname>$tls_in_peercert</varname></primary>
19468 </indexterm>
19469 This variable refers to the certificate presented by the peer of an
19470 inbound connection when the message was received.
19471 It is only useful as the argument of a
19472 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19473 or a <option>def</option> condition.
19474 </para>
19475 <para revisionflag="changed">
19476 If certificate verification fails it may refer to a failing chain element
19477 which is not the leaf.
19478 </para>
19479 </listitem></varlistentry>
19480 <varlistentry>
19481 <term><varname>$tls_out_ourcert</varname></term>
19482 <listitem>
19483 <para>
19484 <indexterm role="variable">
19485 <primary><varname>$tls_out_ourcert</varname></primary>
19486 </indexterm>
19487 This variable refers to the certificate presented to the peer of an
19488 outbound connection.  It is only useful as the argument of a
19489 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19490 or a <option>def</option> condition.
19491 </para>
19492 </listitem></varlistentry>
19493 <varlistentry>
19494 <term><varname>$tls_out_peercert</varname></term>
19495 <listitem>
19496 <para>
19497 <indexterm role="variable">
19498 <primary><varname>$tls_out_peercert</varname></primary>
19499 </indexterm>
19500 This variable refers to the certificate presented by the peer of an
19501 outbound connection.  It is only useful as the argument of a
19502 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19503 or a <option>def</option> condition.
19504 </para>
19505 <para revisionflag="changed">
19506 If certificate verification fails it may refer to a failing chain element
19507 which is not the leaf.
19508 </para>
19509 </listitem></varlistentry>
19510 <varlistentry>
19511 <term><varname>$tls_in_certificate_verified</varname></term>
19512 <listitem>
19513 <para>
19514 <indexterm role="variable">
19515 <primary><varname>$tls_in_certificate_verified</varname></primary>
19516 </indexterm>
19517 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19518 message was received, and <quote>0</quote> otherwise.
19519 </para>
19520 <para>
19521 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
19522 except when used in the context of an outbound SMTP delivery, when it refers to
19523 the outbound.
19524 </para>
19525 </listitem></varlistentry>
19526 <varlistentry>
19527 <term><varname>$tls_out_certificate_verified</varname></term>
19528 <listitem>
19529 <para>
19530 <indexterm role="variable">
19531 <primary><varname>$tls_out_certificate_verified</varname></primary>
19532 </indexterm>
19533 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19534 outbound SMTP connection was made,
19535 and <quote>0</quote> otherwise.
19536 </para>
19537 </listitem></varlistentry>
19538 <varlistentry>
19539 <term><varname>$tls_in_cipher</varname></term>
19540 <listitem>
19541 <para>
19542 <indexterm role="variable">
19543 <primary><varname>$tls_in_cipher</varname></primary>
19544 </indexterm>
19545 <indexterm role="variable">
19546 <primary><varname>$tls_cipher</varname></primary>
19547 </indexterm>
19548 When a message is received from a remote host over an encrypted SMTP
19549 connection, this variable is set to the cipher suite that was negotiated, for
19550 example DES-CBC3-SHA. In other circumstances, in particular, for message
19551 received over unencrypted connections, the variable is empty. Testing
19552 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19553 non-encrypted connections during ACL processing.
19554 </para>
19555 <para>
19556 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19557 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19558 becomes the same as <varname>$tls_out_cipher</varname>.
19559 </para>
19560 </listitem></varlistentry>
19561 <varlistentry>
19562 <term><varname>$tls_out_cipher</varname></term>
19563 <listitem>
19564 <para>
19565 <indexterm role="variable">
19566 <primary><varname>$tls_out_cipher</varname></primary>
19567 </indexterm>
19568 This variable is
19569 cleared before any outgoing SMTP connection is made,
19570 and then set to the outgoing cipher suite if one is negotiated. See chapter
19571 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19572 details of the <command>smtp</command> transport.
19573 </para>
19574 </listitem></varlistentry>
19575 <varlistentry>
19576 <term><varname>$tls_in_ocsp</varname></term>
19577 <listitem>
19578 <para>
19579 <indexterm role="variable">
19580 <primary><varname>$tls_in_ocsp</varname></primary>
19581 </indexterm>
19582 When a message is received from a remote client connection
19583 the result of any OCSP request from the client is encoded in this variable:
19584 </para>
19585 <literallayout class="monospaced">
19586 0 OCSP proof was not requested (default value)
19587 1 No response to request
19588 2 Response not verified
19589 3 Verification failed
19590 4 Verification succeeded
19591 </literallayout>
19592 </listitem></varlistentry>
19593 <varlistentry>
19594 <term><varname>$tls_out_ocsp</varname></term>
19595 <listitem>
19596 <para>
19597 <indexterm role="variable">
19598 <primary><varname>$tls_out_ocsp</varname></primary>
19599 </indexterm>
19600 When a message is sent to a remote host connection
19601 the result of any OCSP request made is encoded in this variable.
19602 See <varname>$tls_in_ocsp</varname> for values.
19603 </para>
19604 </listitem></varlistentry>
19605 <varlistentry>
19606 <term><varname>$tls_in_peerdn</varname></term>
19607 <listitem>
19608 <para>
19609 <indexterm role="variable">
19610 <primary><varname>$tls_in_peerdn</varname></primary>
19611 </indexterm>
19612 <indexterm role="variable">
19613 <primary><varname>$tls_peerdn</varname></primary>
19614 </indexterm>
19615 When a message is received from a remote host over an encrypted SMTP
19616 connection, and Exim is configured to request a certificate from the client,
19617 the value of the Distinguished Name of the certificate is made available in the
19618 <varname>$tls_in_peerdn</varname> during subsequent processing.
19619 </para>
19620 <para revisionflag="changed">
19621 If certificate verification fails it may refer to a failing chain element
19622 which is not the leaf.
19623 </para>
19624 <para>
19625 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19626 except when used in the context of an outbound SMTP delivery, when it refers to
19627 the outbound.
19628 </para>
19629 </listitem></varlistentry>
19630 <varlistentry>
19631 <term><varname>$tls_out_peerdn</varname></term>
19632 <listitem>
19633 <para>
19634 <indexterm role="variable">
19635 <primary><varname>$tls_out_peerdn</varname></primary>
19636 </indexterm>
19637 When a message is being delivered to a remote host over an encrypted SMTP
19638 connection, and Exim is configured to request a certificate from the server,
19639 the value of the Distinguished Name of the certificate is made available in the
19640 <varname>$tls_out_peerdn</varname> during subsequent processing.
19641 </para>
19642 <para revisionflag="changed">
19643 If certificate verification fails it may refer to a failing chain element
19644 which is not the leaf.
19645 </para>
19646 </listitem></varlistentry>
19647 <varlistentry>
19648 <term><varname>$tls_in_sni</varname></term>
19649 <listitem>
19650 <para>
19651 <indexterm role="variable">
19652 <primary><varname>$tls_in_sni</varname></primary>
19653 </indexterm>
19654 <indexterm role="variable">
19655 <primary><varname>$tls_sni</varname></primary>
19656 </indexterm>
19657 <indexterm role="concept">
19658 <primary>TLS</primary>
19659 <secondary>Server Name Indication</secondary>
19660 </indexterm>
19661 When a TLS session is being established, if the client sends the Server
19662 Name Indication extension, the value will be placed in this variable.
19663 If the variable appears in <option>tls_certificate</option> then this option and
19664 some others, described in <xref linkend="SECTtlssni"/>,
19665 will be re-expanded early in the TLS session, to permit
19666 a different certificate to be presented (and optionally a different key to be
19667 used) to the client, based upon the value of the SNI extension.
19668 </para>
19669 <para>
19670 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
19671 except when used in the context of an outbound SMTP delivery, when it refers to
19672 the outbound.
19673 </para>
19674 </listitem></varlistentry>
19675 <varlistentry>
19676 <term><varname>$tls_out_sni</varname></term>
19677 <listitem>
19678 <para>
19679 <indexterm role="variable">
19680 <primary><varname>$tls_out_sni</varname></primary>
19681 </indexterm>
19682 <indexterm role="concept">
19683 <primary>TLS</primary>
19684 <secondary>Server Name Indication</secondary>
19685 </indexterm>
19686 During outbound
19687 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
19688 the transport.
19689 </para>
19690 </listitem></varlistentry>
19691 <varlistentry>
19692 <term><varname>$tod_bsdinbox</varname></term>
19693 <listitem>
19694 <para>
19695 <indexterm role="variable">
19696 <primary><varname>$tod_bsdinbox</varname></primary>
19697 </indexterm>
19698 The time of day and the date, in the format required for BSD-style mailbox
19699 files, for example: Thu Oct 17 17:14:09 1995.
19700 </para>
19701 </listitem></varlistentry>
19702 <varlistentry>
19703 <term><varname>$tod_epoch</varname></term>
19704 <listitem>
19705 <para>
19706 <indexterm role="variable">
19707 <primary><varname>$tod_epoch</varname></primary>
19708 </indexterm>
19709 The time and date as a number of seconds since the start of the Unix epoch.
19710 </para>
19711 </listitem></varlistentry>
19712 <varlistentry>
19713 <term><varname>$tod_epoch_l</varname></term>
19714 <listitem>
19715 <para>
19716 <indexterm role="variable">
19717 <primary><varname>$tod_epoch_l</varname></primary>
19718 </indexterm>
19719 The time and date as a number of microseconds since the start of the Unix epoch.
19720 </para>
19721 </listitem></varlistentry>
19722 <varlistentry>
19723 <term><varname>$tod_full</varname></term>
19724 <listitem>
19725 <para>
19726 <indexterm role="variable">
19727 <primary><varname>$tod_full</varname></primary>
19728 </indexterm>
19729 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19730 +0100. The timezone is always given as a numerical offset from UTC, with
19731 positive values used for timezones that are ahead (east) of UTC, and negative
19732 values for those that are behind (west).
19733 </para>
19734 </listitem></varlistentry>
19735 <varlistentry>
19736 <term><varname>$tod_log</varname></term>
19737 <listitem>
19738 <para>
19739 <indexterm role="variable">
19740 <primary><varname>$tod_log</varname></primary>
19741 </indexterm>
19742 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19743 1995-10-12 15:32:29, but without a timezone.
19744 </para>
19745 </listitem></varlistentry>
19746 <varlistentry>
19747 <term><varname>$tod_logfile</varname></term>
19748 <listitem>
19749 <para>
19750 <indexterm role="variable">
19751 <primary><varname>$tod_logfile</varname></primary>
19752 </indexterm>
19753 This variable contains the date in the format yyyymmdd. This is the format that
19754 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19755 flag.
19756 </para>
19757 </listitem></varlistentry>
19758 <varlistentry>
19759 <term><varname>$tod_zone</varname></term>
19760 <listitem>
19761 <para>
19762 <indexterm role="variable">
19763 <primary><varname>$tod_zone</varname></primary>
19764 </indexterm>
19765 This variable contains the numerical value of the local timezone, for example:
19766 -0500.
19767 </para>
19768 </listitem></varlistentry>
19769 <varlistentry>
19770 <term><varname>$tod_zulu</varname></term>
19771 <listitem>
19772 <para>
19773 <indexterm role="variable">
19774 <primary><varname>$tod_zulu</varname></primary>
19775 </indexterm>
19776 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19777 by ISO 8601, for example: 20030221154023Z.
19778 </para>
19779 </listitem></varlistentry>
19780 <varlistentry>
19781 <term><varname>$transport_name</varname></term>
19782 <listitem>
19783 <para>
19784 <indexterm role="concept">
19785 <primary>transport</primary>
19786 <secondary>name</secondary>
19787 </indexterm>
19788 <indexterm role="concept">
19789 <primary>name</primary>
19790 <secondary>of transport</secondary>
19791 </indexterm>
19792 <indexterm role="variable">
19793 <primary><varname>$transport_name</varname></primary>
19794 </indexterm>
19795 During the running of a transport, this variable contains its name.
19796 </para>
19797 </listitem></varlistentry>
19798 <varlistentry>
19799 <term><varname>$value</varname></term>
19800 <listitem>
19801 <para>
19802 <indexterm role="variable">
19803 <primary><varname>$value</varname></primary>
19804 </indexterm>
19805 This variable contains the result of an expansion lookup, extraction operation,
19806 or external command, as described above. It is also used during a
19807 <emphasis role="bold">reduce</emphasis> expansion.
19808 </para>
19809 </listitem></varlistentry>
19810 <varlistentry>
19811 <term><varname>$verify_mode</varname></term>
19812 <listitem>
19813 <para>
19814 <indexterm role="variable">
19815 <primary><varname>$verify_mode</varname></primary>
19816 </indexterm>
19817 While a router or transport is being run in verify mode
19818 or for cutthrough delivery,
19819 contains "S" for sender-verification or "R" for recipient-verification.
19820 Otherwise, empty.
19821 </para>
19822 </listitem></varlistentry>
19823 <varlistentry>
19824 <term><varname>$version_number</varname></term>
19825 <listitem>
19826 <para>
19827 <indexterm role="variable">
19828 <primary><varname>$version_number</varname></primary>
19829 </indexterm>
19830 The version number of Exim.
19831 </para>
19832 </listitem></varlistentry>
19833 <varlistentry>
19834 <term><varname>$warn_message_delay</varname></term>
19835 <listitem>
19836 <para>
19837 <indexterm role="variable">
19838 <primary><varname>$warn_message_delay</varname></primary>
19839 </indexterm>
19840 This variable is set only during the creation of a message warning about a
19841 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19842 </para>
19843 </listitem></varlistentry>
19844 <varlistentry>
19845 <term><varname>$warn_message_recipients</varname></term>
19846 <listitem>
19847 <para>
19848 <indexterm role="variable">
19849 <primary><varname>$warn_message_recipients</varname></primary>
19850 </indexterm>
19851 This variable is set only during the creation of a message warning about a
19852 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19853 </para>
19854 </listitem></varlistentry>
19855 </variablelist>
19856 <para>
19857 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19858 </para>
19859 </section>
19860 </chapter>
19861
19862 <chapter id="CHAPperl">
19863 <title>Embedded Perl</title>
19864 <para>
19865 <indexterm role="concept" id="IIDperl" class="startofrange">
19866 <primary>Perl</primary>
19867 <secondary>calling from Exim</secondary>
19868 </indexterm>
19869 Exim can be built to include an embedded Perl interpreter. When this is done,
19870 Perl subroutines can be called as part of the string expansion process. To make
19871 use of the Perl support, you need version 5.004 or later of Perl installed on
19872 your system. To include the embedded interpreter in the Exim binary, include
19873 the line
19874 </para>
19875 <literallayout class="monospaced">
19876 EXIM_PERL = perl.o
19877 </literallayout>
19878 <para>
19879 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19880 </para>
19881 <section id="SECID85">
19882 <title>Setting up so Perl can be used</title>
19883 <para>
19884 <indexterm role="option">
19885 <primary><option>perl_startup</option></primary>
19886 </indexterm>
19887 Access to Perl subroutines is via a global configuration option called
19888 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19889 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19890 interpreter is started and there is almost no overhead for Exim (since none of
19891 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19892 option then the associated value is taken to be Perl code which is executed in
19893 a newly created Perl interpreter.
19894 </para>
19895 <para>
19896 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19897 need backslashes before any characters to escape special meanings. The option
19898 should usually be something like
19899 </para>
19900 <literallayout class="monospaced">
19901 perl_startup = do '/etc/exim.pl'
19902 </literallayout>
19903 <para>
19904 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19905 use from Exim. Exim can be configured either to start up a Perl interpreter as
19906 soon as it is entered, or to wait until the first time it is needed. Starting
19907 the interpreter at the beginning ensures that it is done while Exim still has
19908 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19909 fact used in a particular run. Also, note that this does not mean that Exim is
19910 necessarily running as root when Perl is called at a later time. By default,
19911 the interpreter is started only when it is needed, but this can be changed in
19912 two ways:
19913 </para>
19914 <itemizedlist>
19915 <listitem>
19916 <para>
19917 <indexterm role="option">
19918 <primary><option>perl_at_start</option></primary>
19919 </indexterm>
19920 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19921 a startup when Exim is entered.
19922 </para>
19923 </listitem>
19924 <listitem>
19925 <para>
19926 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19927 overriding the setting of <option>perl_at_start</option>.
19928 </para>
19929 </listitem>
19930 </itemizedlist>
19931 <para>
19932 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19933 initial startup, even if <option>perl_at_start</option> is set.
19934 </para>
19935 </section>
19936 <section id="SECID86">
19937 <title>Calling Perl subroutines</title>
19938 <para>
19939 When the configuration file includes a <option>perl_startup</option> option you can make use
19940 of the string expansion item to call the Perl subroutines that are defined
19941 by the <option>perl_startup</option> code. The operator is used in any of the following
19942 forms:
19943 </para>
19944 <literallayout class="monospaced">
19945 ${perl{foo}}
19946 ${perl{foo}{argument}}
19947 ${perl{foo}{argument1}{argument2} ... }
19948 </literallayout>
19949 <para>
19950 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19951 arguments may be passed. Passing more than this results in an expansion failure
19952 with an error message of the form
19953 </para>
19954 <literallayout class="monospaced">
19955 Too many arguments passed to Perl subroutine "foo" (max is 8)
19956 </literallayout>
19957 <para>
19958 The return value of the Perl subroutine is evaluated in a scalar context before
19959 it is passed back to Exim to be inserted into the expanded string. If the
19960 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19961 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19962 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19963 that was passed to <option>die</option>.
19964 </para>
19965 </section>
19966 <section id="SECID87">
19967 <title>Calling Exim functions from Perl</title>
19968 <para>
19969 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19970 is available to call back into Exim&#x2019;s string expansion function. For example,
19971 the Perl code
19972 </para>
19973 <literallayout class="monospaced">
19974 my $lp = Exim::expand_string('$local_part');
19975 </literallayout>
19976 <para>
19977 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19978 Note those are single quotes and not double quotes to protect against
19979 <varname>$local_part</varname> being interpolated as a Perl variable.
19980 </para>
19981 <para>
19982 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19983 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19984 expansion string, the Perl call from the original expansion string fails with
19985 an appropriate error message, in the same way as if <option>die</option> were used.
19986 </para>
19987 <para>
19988 <indexterm role="concept">
19989 <primary>debugging</primary>
19990 <secondary>from embedded Perl</secondary>
19991 </indexterm>
19992 <indexterm role="concept">
19993 <primary>log</primary>
19994 <secondary>writing from embedded Perl</secondary>
19995 </indexterm>
19996 Two other Exim functions are available for use from within Perl code.
19997 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19998 debugging is enabled. If you want a newline at the end, you must supply it.
19999 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
20000 timestamp. In this case, you should not supply a terminating newline.
20001 </para>
20002 </section>
20003 <section id="SECID88">
20004 <title>Use of standard output and error by Perl</title>
20005 <para>
20006 <indexterm role="concept">
20007 <primary>Perl</primary>
20008 <secondary>standard output and error</secondary>
20009 </indexterm>
20010 You should not write to the standard error or output streams from within your
20011 Perl code, as it is not defined how these are set up. In versions of Exim
20012 before 4.50, it is possible for the standard output or error to refer to the
20013 SMTP connection during message reception via the daemon. Writing to this stream
20014 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20015 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20016 avoided, but the output is lost.
20017 </para>
20018 <para>
20019 <indexterm role="concept">
20020 <primary>Perl</primary>
20021 <secondary>use of <option>warn</option></secondary>
20022 </indexterm>
20023 The Perl <option>warn</option> statement writes to the standard error stream by default.
20024 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20025 you have no control. When Exim starts up the Perl interpreter, it arranges for
20026 output from the <option>warn</option> statement to be written to the Exim main log. You can
20027 change this by including appropriate Perl magic somewhere in your Perl code.
20028 For example, to discard <option>warn</option> output completely, you need this:
20029 </para>
20030 <literallayout class="monospaced">
20031 $SIG{__WARN__} = sub { };
20032 </literallayout>
20033 <para>
20034 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20035 example, the code for the subroutine is empty, so it does nothing, but you can
20036 include any Perl code that you like. The text of the <option>warn</option> message is passed
20037 as the first subroutine argument.
20038 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20039 </para>
20040 </section>
20041 </chapter>
20042
20043 <chapter id="CHAPinterfaces">
20044 <title>Starting the daemon and the use of network interfaces</title>
20045 <titleabbrev>Starting the daemon</titleabbrev>
20046 <para>
20047 <indexterm role="concept">
20048 <primary>daemon</primary>
20049 <secondary>starting</secondary>
20050 </indexterm>
20051 <indexterm role="concept">
20052 <primary>interface</primary>
20053 <secondary>listening</secondary>
20054 </indexterm>
20055 <indexterm role="concept">
20056 <primary>network interface</primary>
20057 </indexterm>
20058 <indexterm role="concept">
20059 <primary>interface</primary>
20060 <secondary>network</secondary>
20061 </indexterm>
20062 <indexterm role="concept">
20063 <primary>IP address</primary>
20064 <secondary>for listening</secondary>
20065 </indexterm>
20066 <indexterm role="concept">
20067 <primary>daemon</primary>
20068 <secondary>listening IP addresses</secondary>
20069 </indexterm>
20070 <indexterm role="concept">
20071 <primary>TCP/IP</primary>
20072 <secondary>setting listening interfaces</secondary>
20073 </indexterm>
20074 <indexterm role="concept">
20075 <primary>TCP/IP</primary>
20076 <secondary>setting listening ports</secondary>
20077 </indexterm>
20078 A host that is connected to a TCP/IP network may have one or more physical
20079 hardware network interfaces. Each of these interfaces may be configured as one
20080 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20081 works with. Each of these logical interfaces is associated with an IP address.
20082 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20083 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20084 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20085 </para>
20086 <orderedlist numeration="arabic">
20087 <listitem>
20088 <para>
20089 When a listening daemon is started, Exim needs to know which interfaces
20090 and ports to listen on.
20091 </para>
20092 </listitem>
20093 <listitem>
20094 <para>
20095 When Exim is routing an address, it needs to know which IP addresses
20096 are associated with local interfaces. This is required for the correct
20097 processing of MX lists by removing the local host and others with the
20098 same or higher priority values. Also, Exim needs to detect cases
20099 when an address is routed to an IP address that in fact belongs to the
20100 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20101 option of the smtp transport is set (as appropriate), this is treated
20102 as an error situation.
20103 </para>
20104 </listitem>
20105 <listitem>
20106 <para>
20107 When Exim connects to a remote host, it may need to know which interface to use
20108 for the outgoing connection.
20109 </para>
20110 </listitem>
20111 </orderedlist>
20112 <para>
20113 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20114 of cases. If your host has only one interface, and you want all its IP
20115 addresses to be treated in the same way, and you are using only the
20116 standard SMTP port, you should not need to take any special action. The
20117 rest of this chapter does not apply to you.
20118 </para>
20119 <para>
20120 In a more complicated situation you may want to listen only on certain
20121 interfaces, or on different ports, and for this reason there are a number of
20122 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20123 chapter describes how they operate.
20124 </para>
20125 <para>
20126 When a message is received over TCP/IP, the interface and port that were
20127 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20128 </para>
20129 <section id="SECID89">
20130 <title>Starting a listening daemon</title>
20131 <para>
20132 When a listening daemon is started (by means of the <option>-bd</option> command line
20133 option), the interfaces and ports on which it listens are controlled by the
20134 following options:
20135 </para>
20136 <itemizedlist>
20137 <listitem>
20138 <para>
20139 <option>daemon_smtp_ports</option> contains a list of default ports
20140 or service names.
20141 (For backward compatibility, this option can also be specified in the singular.)
20142 </para>
20143 </listitem>
20144 <listitem>
20145 <para>
20146 <option>local_interfaces</option> contains list of interface IP addresses on which to
20147 listen. Each item may optionally also specify a port.
20148 </para>
20149 </listitem>
20150 </itemizedlist>
20151 <para>
20152 The default list separator in both cases is a colon, but this can be changed as
20153 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20154 it is usually best to change the separator to avoid having to double all the
20155 colons. For example:
20156 </para>
20157 <literallayout class="monospaced">
20158 local_interfaces = &lt;; 127.0.0.1 ; \
20159                       192.168.23.65 ; \
20160                       ::1 ; \
20161                       3ffe:ffff:836f::fe86:a061
20162 </literallayout>
20163 <para>
20164 There are two different formats for specifying a port along with an IP address
20165 in <option>local_interfaces</option>:
20166 </para>
20167 <orderedlist numeration="arabic">
20168 <listitem>
20169 <para>
20170 The port is added onto the address with a dot separator. For example, to listen
20171 on port 1234 on two different IP addresses:
20172 </para>
20173 <literallayout class="monospaced">
20174 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20175                       3ffe:ffff:836f::fe86:a061.1234
20176 </literallayout>
20177 </listitem>
20178 <listitem>
20179 <para>
20180 The IP address is enclosed in square brackets, and the port is added
20181 with a colon separator, for example:
20182 </para>
20183 <literallayout class="monospaced">
20184 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20185                       [3ffe:ffff:836f::fe86:a061]:1234
20186 </literallayout>
20187 </listitem>
20188 </orderedlist>
20189 <para>
20190 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20191 default setting contains just one port:
20192 </para>
20193 <literallayout class="monospaced">
20194 daemon_smtp_ports = smtp
20195 </literallayout>
20196 <para>
20197 If more than one port is listed, each interface that does not have its own port
20198 specified listens on all of them. Ports that are listed in
20199 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20200 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20201 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20202 </para>
20203 </section>
20204 <section id="SECID90">
20205 <title>Special IP listening addresses</title>
20206 <para>
20207 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20208 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20209 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20210 instead of setting up separate listening sockets for each interface. The
20211 default value of <option>local_interfaces</option> is
20212 </para>
20213 <literallayout class="monospaced">
20214 local_interfaces = 0.0.0.0
20215 </literallayout>
20216 <para>
20217 when Exim is built without IPv6 support; otherwise it is:
20218 </para>
20219 <literallayout class="monospaced">
20220 local_interfaces = &lt;; ::0 ; 0.0.0.0
20221 </literallayout>
20222 <para>
20223 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20224 </para>
20225 </section>
20226 <section id="SECID91">
20227 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20228 <para>
20229 The <option>-oX</option> command line option can be used to override the values of
20230 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20231 instance. Another way of doing this would be to use macros and the <option>-D</option>
20232 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20233 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20234 exim.
20235 </para>
20236 <para>
20237 The value of <option>-oX</option> is a list of items. The default colon separator can be
20238 changed in the usual way if required. If there are any items that do not
20239 contain dots or colons (that is, are not IP addresses), the value of
20240 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20241 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20242 replaced by those items. Thus, for example,
20243 </para>
20244 <literallayout class="monospaced">
20245 -oX 1225
20246 </literallayout>
20247 <para>
20248 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20249 whereas
20250 </para>
20251 <literallayout class="monospaced">
20252 -oX 192.168.34.5.1125
20253 </literallayout>
20254 <para>
20255 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20256 (However, since <option>local_interfaces</option> now contains no items without ports, the
20257 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20258 </para>
20259 </section>
20260 <section id="SECTsupobssmt">
20261 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20262 <para>
20263 <indexterm role="concept">
20264 <primary>ssmtp protocol</primary>
20265 </indexterm>
20266 <indexterm role="concept">
20267 <primary>smtps protocol</primary>
20268 </indexterm>
20269 <indexterm role="concept">
20270 <primary>SMTP</primary>
20271 <secondary>ssmtp protocol</secondary>
20272 </indexterm>
20273 <indexterm role="concept">
20274 <primary>SMTP</primary>
20275 <secondary>smtps protocol</secondary>
20276 </indexterm>
20277 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20278 before the STARTTLS command was standardized for SMTP. Some legacy clients
20279 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20280 list of port numbers or service names,
20281 connections to those ports must use SSMTP. The most
20282 common use of this option is expected to be
20283 </para>
20284 <literallayout class="monospaced">
20285 tls_on_connect_ports = 465
20286 </literallayout>
20287 <para>
20288 because 465 is the usual port number used by the legacy clients. There is also
20289 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20290 this way when a daemon is started.
20291 </para>
20292 <para>
20293 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20294 daemon to listen on those ports. You must still specify them in
20295 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20296 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20297 connections via the daemon.)
20298 </para>
20299 </section>
20300 <section id="SECID92">
20301 <title>IPv6 address scopes</title>
20302 <para>
20303 <indexterm role="concept">
20304 <primary>IPv6</primary>
20305 <secondary>address scopes</secondary>
20306 </indexterm>
20307 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20308 can, in principle, have the same link-local IPv6 address on different
20309 interfaces. Thus, additional information is needed, over and above the IP
20310 address, to distinguish individual interfaces. A convention of using a
20311 percent sign followed by something (often the interface name) has been
20312 adopted in some cases, leading to addresses like this:
20313 </para>
20314 <literallayout class="monospaced">
20315 fe80::202:b3ff:fe03:45c1%eth0
20316 </literallayout>
20317 <para>
20318 To accommodate this usage, a percent sign followed by an arbitrary string is
20319 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20320 to convert a textual IPv6 address for actual use. This function recognizes the
20321 percent convention in operating systems that support it, and it processes the
20322 address appropriately. Unfortunately, some older libraries have problems with
20323 <function>getaddrinfo()</function>. If
20324 </para>
20325 <literallayout class="monospaced">
20326 IPV6_USE_INET_PTON=yes
20327 </literallayout>
20328 <para>
20329 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20330 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20331 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20332 function.) Of course, this means that the additional functionality of
20333 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20334 </para>
20335 </section>
20336 <section id="SECID93">
20337 <title>Disabling IPv6</title>
20338 <para>
20339 <indexterm role="concept">
20340 <primary>IPv6</primary>
20341 <secondary>disabling</secondary>
20342 </indexterm>
20343 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20344 run on a host whose kernel does not support IPv6. The binary will fall back to
20345 using IPv4, but it may waste resources looking up AAAA records, and trying to
20346 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20347 <indexterm role="option">
20348 <primary><option>disable_ipv6</option></primary>
20349 </indexterm>
20350 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20351 activities take place. AAAA records are never looked up, and any IPv6 addresses
20352 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20353 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20354 to handle IPv6 literal addresses.
20355 </para>
20356 <para>
20357 On the other hand, when IPv6 is in use, there may be times when you want to
20358 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20359 option to globally suppress the lookup of AAAA records for specified domains,
20360 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20361 IPv6 addresses in an individual router.
20362 </para>
20363 </section>
20364 <section id="SECID94">
20365 <title>Examples of starting a listening daemon</title>
20366 <para>
20367 The default case in an IPv6 environment is
20368 </para>
20369 <literallayout class="monospaced">
20370 daemon_smtp_ports = smtp
20371 local_interfaces = &lt;; ::0 ; 0.0.0.0
20372 </literallayout>
20373 <para>
20374 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20375 Either one or two sockets may be used, depending on the characteristics of
20376 the TCP/IP stack. (This is complicated and messy; for more information,
20377 read the comments in the <filename>daemon.c</filename> source file.)
20378 </para>
20379 <para>
20380 To specify listening on ports 25 and 26 on all interfaces:
20381 </para>
20382 <literallayout class="monospaced">
20383 daemon_smtp_ports = 25 : 26
20384 </literallayout>
20385 <para>
20386 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20387 </para>
20388 <literallayout class="monospaced">
20389 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20390                       0.0.0.0.25 ; 0.0.0.0.26
20391 </literallayout>
20392 <para>
20393 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20394 IPv4 loopback address only:
20395 </para>
20396 <literallayout class="monospaced">
20397 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20398 </literallayout>
20399 <para>
20400 To specify listening on the default port on specific interfaces only:
20401 </para>
20402 <literallayout class="monospaced">
20403 local_interfaces = 10.0.0.67 : 192.168.34.67
20404 </literallayout>
20405 <para>
20406 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20407 </para>
20408 </section>
20409 <section id="SECTreclocipadd">
20410 <title>Recognizing the local host</title>
20411 <para>
20412 The <option>local_interfaces</option> option is also used when Exim needs to determine
20413 whether or not an IP address refers to the local host. That is, the IP
20414 addresses of all the interfaces on which a daemon is listening are always
20415 treated as local.
20416 </para>
20417 <para>
20418 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20419 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20420 available interfaces from the operating system, and extracts the relevant
20421 (that is, IPv4 or IPv6) addresses to use for checking.
20422 </para>
20423 <para>
20424 Some systems set up large numbers of virtual interfaces in order to provide
20425 many virtual web servers. In this situation, you may want to listen for
20426 email on only a few of the available interfaces, but nevertheless treat all
20427 interfaces as local when routing. You can do this by setting
20428 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20429 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20430 used for listening. Consider this example:
20431 </para>
20432 <literallayout class="monospaced">
20433 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20434                       192.168.53.235 ; \
20435                       3ffe:2101:12:1:a00:20ff:fe86:a061
20436
20437 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20438 </literallayout>
20439 <para>
20440 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20441 address, but all available interface addresses are treated as local when
20442 Exim is routing.
20443 </para>
20444 <para>
20445 In some environments the local host name may be in an MX list, but with an IP
20446 address that is not assigned to any local interface. In other cases it may be
20447 desirable to treat other host names as if they referred to the local host. Both
20448 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20449 This contains host names rather than IP addresses. When a host is referenced
20450 during routing, either via an MX record or directly, it is treated as the local
20451 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20452 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20453 </para>
20454 </section>
20455 <section id="SECID95">
20456 <title>Delivering to a remote host</title>
20457 <para>
20458 Delivery to a remote host is handled by the smtp transport. By default, it
20459 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20460 there is more than one) when connecting to a remote host. However, the
20461 <option>interface</option> option can be set to specify which interface is used. See the
20462 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20463 details.
20464 </para>
20465 </section>
20466 </chapter>
20467
20468 <chapter id="CHAPmainconfig">
20469 <title>Main configuration</title>
20470 <para>
20471 <indexterm role="concept" id="IIDconfima" class="startofrange">
20472 <primary>configuration file</primary>
20473 <secondary>main section</secondary>
20474 </indexterm>
20475 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20476 <primary>main configuration</primary>
20477 </indexterm>
20478 The first part of the run time configuration file contains three types of item:
20479 </para>
20480 <itemizedlist>
20481 <listitem>
20482 <para>
20483 Macro definitions: These lines start with an upper case letter. See section
20484 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20485 </para>
20486 </listitem>
20487 <listitem>
20488 <para>
20489 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20490 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20491 section <xref linkend="SECTnamedlists"/>.
20492 </para>
20493 </listitem>
20494 <listitem>
20495 <para>
20496 Main configuration settings: Each setting occupies one line of the file
20497 (with possible continuations). If any setting is preceded by the word
20498 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20499 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20500 settings.
20501 </para>
20502 </listitem>
20503 </itemizedlist>
20504 <para>
20505 This chapter specifies all the main configuration options, along with their
20506 types and default values. For ease of finding a particular option, they appear
20507 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20508 are now so many options, they are first listed briefly in functional groups, as
20509 an aid to finding the name of the option you are looking for. Some options are
20510 listed in more than one group.
20511 </para>
20512 <section id="SECID96">
20513 <title>Miscellaneous</title>
20514 <informaltable frame="none">
20515 <tgroup cols="2" colsep="0" rowsep="0">
20516 <colspec colwidth="196pt" align="left"/>
20517 <colspec colwidth="254pt" align="left"/>
20518 <tbody>
20519 <row>
20520 <entry><option>bi_command</option></entry>
20521 <entry>to run for <option>-bi</option> command line option</entry>
20522 </row>
20523 <row>
20524 <entry><option>disable_ipv6</option></entry>
20525 <entry>do no IPv6 processing</entry>
20526 </row>
20527 <row>
20528 <entry><option>keep_malformed</option></entry>
20529 <entry>for broken files &ndash; should not happen</entry>
20530 </row>
20531 <row>
20532 <entry><option>localhost_number</option></entry>
20533 <entry>for unique message ids in clusters</entry>
20534 </row>
20535 <row>
20536 <entry><option>message_body_newlines</option></entry>
20537 <entry>retain newlines in <varname>$message_body</varname></entry>
20538 </row>
20539 <row>
20540 <entry><option>message_body_visible</option></entry>
20541 <entry>how much to show in <varname>$message_body</varname></entry>
20542 </row>
20543 <row>
20544 <entry><option>mua_wrapper</option></entry>
20545 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20546 </row>
20547 <row>
20548 <entry><option>print_topbitchars</option></entry>
20549 <entry>top-bit characters are printing</entry>
20550 </row>
20551 <row>
20552 <entry><option>timezone</option></entry>
20553 <entry>force time zone</entry>
20554 </row>
20555 </tbody>
20556 </tgroup>
20557 </informaltable>
20558 </section>
20559 <section id="SECID97">
20560 <title>Exim parameters</title>
20561 <informaltable frame="none">
20562 <tgroup cols="2" colsep="0" rowsep="0">
20563 <colspec colwidth="196pt" align="left"/>
20564 <colspec colwidth="254pt" align="left"/>
20565 <tbody>
20566 <row>
20567 <entry><option>exim_group</option></entry>
20568 <entry>override compiled-in value</entry>
20569 </row>
20570 <row>
20571 <entry><option>exim_path</option></entry>
20572 <entry>override compiled-in value</entry>
20573 </row>
20574 <row>
20575 <entry><option>exim_user</option></entry>
20576 <entry>override compiled-in value</entry>
20577 </row>
20578 <row>
20579 <entry><option>primary_hostname</option></entry>
20580 <entry>default from <function>uname()</function></entry>
20581 </row>
20582 <row>
20583 <entry><option>split_spool_directory</option></entry>
20584 <entry>use multiple directories</entry>
20585 </row>
20586 <row>
20587 <entry><option>spool_directory</option></entry>
20588 <entry>override compiled-in value</entry>
20589 </row>
20590 </tbody>
20591 </tgroup>
20592 </informaltable>
20593 </section>
20594 <section id="SECID98">
20595 <title>Privilege controls</title>
20596 <informaltable frame="none">
20597 <tgroup cols="2" colsep="0" rowsep="0">
20598 <colspec colwidth="196pt" align="left"/>
20599 <colspec colwidth="254pt" align="left"/>
20600 <tbody>
20601 <row>
20602 <entry><option>admin_groups</option></entry>
20603 <entry>groups that are Exim admin users</entry>
20604 </row>
20605 <row>
20606 <entry><option>deliver_drop_privilege</option></entry>
20607 <entry>drop root for delivery processes</entry>
20608 </row>
20609 <row>
20610 <entry><option>local_from_check</option></entry>
20611 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20612 </row>
20613 <row>
20614 <entry><option>local_from_prefix</option></entry>
20615 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20616 </row>
20617 <row>
20618 <entry><option>local_from_suffix</option></entry>
20619 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20620 </row>
20621 <row>
20622 <entry><option>local_sender_retain</option></entry>
20623 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20624 </row>
20625 <row>
20626 <entry><option>never_users</option></entry>
20627 <entry>do not run deliveries as these</entry>
20628 </row>
20629 <row>
20630 <entry><option>prod_requires_admin</option></entry>
20631 <entry>forced delivery requires admin user</entry>
20632 </row>
20633 <row>
20634 <entry><option>queue_list_requires_admin</option></entry>
20635 <entry>queue listing requires admin user</entry>
20636 </row>
20637 <row>
20638 <entry><option>trusted_groups</option></entry>
20639 <entry>groups that are trusted</entry>
20640 </row>
20641 <row>
20642 <entry><option>trusted_users</option></entry>
20643 <entry>users that are trusted</entry>
20644 </row>
20645 </tbody>
20646 </tgroup>
20647 </informaltable>
20648 </section>
20649 <section id="SECID99">
20650 <title>Logging</title>
20651 <informaltable frame="none">
20652 <tgroup cols="2" colsep="0" rowsep="0">
20653 <colspec colwidth="196pt" align="left"/>
20654 <colspec colwidth="254pt" align="left"/>
20655 <tbody>
20656 <row>
20657 <entry><option>hosts_connection_nolog</option></entry>
20658 <entry>exemption from connect logging</entry>
20659 </row>
20660 <row>
20661 <entry><option>log_file_path</option></entry>
20662 <entry>override compiled-in value</entry>
20663 </row>
20664 <row>
20665 <entry><option>log_selector</option></entry>
20666 <entry>set/unset optional logging</entry>
20667 </row>
20668 <row>
20669 <entry><option>log_timezone</option></entry>
20670 <entry>add timezone to log lines</entry>
20671 </row>
20672 <row>
20673 <entry><option>message_logs</option></entry>
20674 <entry>create per-message logs</entry>
20675 </row>
20676 <row>
20677 <entry><option>preserve_message_logs</option></entry>
20678 <entry>after message completion</entry>
20679 </row>
20680 <row>
20681 <entry><option>process_log_path</option></entry>
20682 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
20683 </row>
20684 <row>
20685 <entry><option>slow_lookup_log</option></entry>
20686 <entry>control logging of slow DNS lookups</entry>
20687 </row>
20688 <row>
20689 <entry><option>syslog_duplication</option></entry>
20690 <entry>controls duplicate log lines on syslog</entry>
20691 </row>
20692 <row>
20693 <entry><option>syslog_facility</option></entry>
20694 <entry>set syslog <quote>facility</quote> field</entry>
20695 </row>
20696 <row>
20697 <entry><option>syslog_processname</option></entry>
20698 <entry>set syslog <quote>ident</quote> field</entry>
20699 </row>
20700 <row>
20701 <entry><option>syslog_timestamp</option></entry>
20702 <entry>timestamp syslog lines</entry>
20703 </row>
20704 <row>
20705 <entry><option>write_rejectlog</option></entry>
20706 <entry>control use of message log</entry>
20707 </row>
20708 </tbody>
20709 </tgroup>
20710 </informaltable>
20711 </section>
20712 <section id="SECID100">
20713 <title>Frozen messages</title>
20714 <informaltable frame="none">
20715 <tgroup cols="2" colsep="0" rowsep="0">
20716 <colspec colwidth="196pt" align="left"/>
20717 <colspec colwidth="254pt" align="left"/>
20718 <tbody>
20719 <row>
20720 <entry><option>auto_thaw</option></entry>
20721 <entry>sets time for retrying frozen messages</entry>
20722 </row>
20723 <row>
20724 <entry><option>freeze_tell</option></entry>
20725 <entry>send message when freezing</entry>
20726 </row>
20727 <row>
20728 <entry><option>move_frozen_messages</option></entry>
20729 <entry>to another directory</entry>
20730 </row>
20731 <row>
20732 <entry><option>timeout_frozen_after</option></entry>
20733 <entry>keep frozen messages only so long</entry>
20734 </row>
20735 </tbody>
20736 </tgroup>
20737 </informaltable>
20738 </section>
20739 <section id="SECID101">
20740 <title>Data lookups</title>
20741 <informaltable frame="none">
20742 <tgroup cols="2" colsep="0" rowsep="0">
20743 <colspec colwidth="196pt" align="left"/>
20744 <colspec colwidth="254pt" align="left"/>
20745 <tbody>
20746 <row>
20747 <entry><option>ibase_servers</option></entry>
20748 <entry>InterBase servers</entry>
20749 </row>
20750 <row>
20751 <entry><option>ldap_ca_cert_dir</option></entry>
20752 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20753 </row>
20754 <row>
20755 <entry><option>ldap_ca_cert_file</option></entry>
20756 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20757 </row>
20758 <row>
20759 <entry><option>ldap_cert_file</option></entry>
20760 <entry>client cert file for LDAP</entry>
20761 </row>
20762 <row>
20763 <entry><option>ldap_cert_key</option></entry>
20764 <entry>client key file for LDAP</entry>
20765 </row>
20766 <row>
20767 <entry><option>ldap_cipher_suite</option></entry>
20768 <entry>TLS negotiation preference control</entry>
20769 </row>
20770 <row>
20771 <entry><option>ldap_default_servers</option></entry>
20772 <entry>used if no server in query</entry>
20773 </row>
20774 <row>
20775 <entry><option>ldap_require_cert</option></entry>
20776 <entry>action to take without LDAP server cert</entry>
20777 </row>
20778 <row>
20779 <entry><option>ldap_start_tls</option></entry>
20780 <entry>require TLS within LDAP</entry>
20781 </row>
20782 <row>
20783 <entry><option>ldap_version</option></entry>
20784 <entry>set protocol version</entry>
20785 </row>
20786 <row>
20787 <entry><option>lookup_open_max</option></entry>
20788 <entry>lookup files held open</entry>
20789 </row>
20790 <row>
20791 <entry><option>mysql_servers</option></entry>
20792 <entry>default MySQL servers</entry>
20793 </row>
20794 <row>
20795 <entry><option>oracle_servers</option></entry>
20796 <entry>Oracle servers</entry>
20797 </row>
20798 <row>
20799 <entry><option>pgsql_servers</option></entry>
20800 <entry>default PostgreSQL servers</entry>
20801 </row>
20802 <row>
20803 <entry><option>sqlite_lock_timeout</option></entry>
20804 <entry>as it says</entry>
20805 </row>
20806 </tbody>
20807 </tgroup>
20808 </informaltable>
20809 </section>
20810 <section id="SECID102">
20811 <title>Message ids</title>
20812 <informaltable frame="none">
20813 <tgroup cols="2" colsep="0" rowsep="0">
20814 <colspec colwidth="196pt" align="left"/>
20815 <colspec colwidth="254pt" align="left"/>
20816 <tbody>
20817 <row>
20818 <entry><option>message_id_header_domain</option></entry>
20819 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20820 </row>
20821 <row>
20822 <entry><option>message_id_header_text</option></entry>
20823 <entry>ditto</entry>
20824 </row>
20825 </tbody>
20826 </tgroup>
20827 </informaltable>
20828 </section>
20829 <section id="SECID103">
20830 <title>Embedded Perl Startup</title>
20831 <informaltable frame="none">
20832 <tgroup cols="2" colsep="0" rowsep="0">
20833 <colspec colwidth="196pt" align="left"/>
20834 <colspec colwidth="254pt" align="left"/>
20835 <tbody>
20836 <row>
20837 <entry><option>perl_at_start</option></entry>
20838 <entry>always start the interpreter</entry>
20839 </row>
20840 <row>
20841 <entry><option>perl_startup</option></entry>
20842 <entry>code to obey when starting Perl</entry>
20843 </row>
20844 </tbody>
20845 </tgroup>
20846 </informaltable>
20847 </section>
20848 <section id="SECID104">
20849 <title>Daemon</title>
20850 <informaltable frame="none">
20851 <tgroup cols="2" colsep="0" rowsep="0">
20852 <colspec colwidth="196pt" align="left"/>
20853 <colspec colwidth="254pt" align="left"/>
20854 <tbody>
20855 <row>
20856 <entry><option>daemon_smtp_ports</option></entry>
20857 <entry>default ports</entry>
20858 </row>
20859 <row>
20860 <entry><option>daemon_startup_retries</option></entry>
20861 <entry>number of times to retry</entry>
20862 </row>
20863 <row>
20864 <entry><option>daemon_startup_sleep</option></entry>
20865 <entry>time to sleep between tries</entry>
20866 </row>
20867 <row>
20868 <entry><option>extra_local_interfaces</option></entry>
20869 <entry>not necessarily listened on</entry>
20870 </row>
20871 <row>
20872 <entry><option>local_interfaces</option></entry>
20873 <entry>on which to listen, with optional ports</entry>
20874 </row>
20875 <row>
20876 <entry><option>pid_file_path</option></entry>
20877 <entry>override compiled-in value</entry>
20878 </row>
20879 <row>
20880 <entry><option>queue_run_max</option></entry>
20881 <entry>maximum simultaneous queue runners</entry>
20882 </row>
20883 </tbody>
20884 </tgroup>
20885 </informaltable>
20886 </section>
20887 <section id="SECID105">
20888 <title>Resource control</title>
20889 <informaltable frame="none">
20890 <tgroup cols="2" colsep="0" rowsep="0">
20891 <colspec colwidth="196pt" align="left"/>
20892 <colspec colwidth="254pt" align="left"/>
20893 <tbody>
20894 <row>
20895 <entry><option>check_log_inodes</option></entry>
20896 <entry>before accepting a message</entry>
20897 </row>
20898 <row>
20899 <entry><option>check_log_space</option></entry>
20900 <entry>before accepting a message</entry>
20901 </row>
20902 <row>
20903 <entry><option>check_spool_inodes</option></entry>
20904 <entry>before accepting a message</entry>
20905 </row>
20906 <row>
20907 <entry><option>check_spool_space</option></entry>
20908 <entry>before accepting a message</entry>
20909 </row>
20910 <row>
20911 <entry><option>deliver_queue_load_max</option></entry>
20912 <entry>no queue deliveries if load high</entry>
20913 </row>
20914 <row>
20915 <entry><option>queue_only_load</option></entry>
20916 <entry>queue incoming if load high</entry>
20917 </row>
20918 <row>
20919 <entry><option>queue_only_load_latch</option></entry>
20920 <entry>don&#x2019;t re-evaluate load for each message</entry>
20921 </row>
20922 <row>
20923 <entry><option>queue_run_max</option></entry>
20924 <entry>maximum simultaneous queue runners</entry>
20925 </row>
20926 <row>
20927 <entry><option>remote_max_parallel</option></entry>
20928 <entry>parallel SMTP delivery per message</entry>
20929 </row>
20930 <row>
20931 <entry><option>smtp_accept_max</option></entry>
20932 <entry>simultaneous incoming connections</entry>
20933 </row>
20934 <row>
20935 <entry><option>smtp_accept_max_nonmail</option></entry>
20936 <entry>non-mail commands</entry>
20937 </row>
20938 <row>
20939 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20940 <entry>hosts to which the limit applies</entry>
20941 </row>
20942 <row>
20943 <entry><option>smtp_accept_max_per_connection</option></entry>
20944 <entry>messages per connection</entry>
20945 </row>
20946 <row>
20947 <entry><option>smtp_accept_max_per_host</option></entry>
20948 <entry>connections from one host</entry>
20949 </row>
20950 <row>
20951 <entry><option>smtp_accept_queue</option></entry>
20952 <entry>queue mail if more connections</entry>
20953 </row>
20954 <row>
20955 <entry><option>smtp_accept_queue_per_connection</option></entry>
20956 <entry>queue if more messages per connection</entry>
20957 </row>
20958 <row>
20959 <entry><option>smtp_accept_reserve</option></entry>
20960 <entry>only reserve hosts if more connections</entry>
20961 </row>
20962 <row>
20963 <entry><option>smtp_check_spool_space</option></entry>
20964 <entry>from SIZE on MAIL command</entry>
20965 </row>
20966 <row>
20967 <entry><option>smtp_connect_backlog</option></entry>
20968 <entry>passed to TCP/IP stack</entry>
20969 </row>
20970 <row>
20971 <entry><option>smtp_load_reserve</option></entry>
20972 <entry>SMTP from reserved hosts if load high</entry>
20973 </row>
20974 <row>
20975 <entry><option>smtp_reserve_hosts</option></entry>
20976 <entry>these are the reserve hosts</entry>
20977 </row>
20978 </tbody>
20979 </tgroup>
20980 </informaltable>
20981 </section>
20982 <section id="SECID106">
20983 <title>Policy controls</title>
20984 <informaltable frame="none">
20985 <tgroup cols="2" colsep="0" rowsep="0">
20986 <colspec colwidth="196pt" align="left"/>
20987 <colspec colwidth="254pt" align="left"/>
20988 <tbody>
20989 <row>
20990 <entry><option>acl_not_smtp</option></entry>
20991 <entry>ACL for non-SMTP messages</entry>
20992 </row>
20993 <row>
20994 <entry><option>acl_not_smtp_mime</option></entry>
20995 <entry>ACL for non-SMTP MIME parts</entry>
20996 </row>
20997 <row>
20998 <entry><option>acl_not_smtp_start</option></entry>
20999 <entry>ACL for start of non-SMTP message</entry>
21000 </row>
21001 <row>
21002 <entry><option>acl_smtp_auth</option></entry>
21003 <entry>ACL for AUTH</entry>
21004 </row>
21005 <row>
21006 <entry><option>acl_smtp_connect</option></entry>
21007 <entry>ACL for connection</entry>
21008 </row>
21009 <row>
21010 <entry><option>acl_smtp_data</option></entry>
21011 <entry>ACL for DATA</entry>
21012 </row>
21013 <row>
21014 <entry><option>acl_smtp_data_prdr</option></entry>
21015 <entry>ACL for DATA, per-recipient</entry>
21016 </row>
21017 <row>
21018 <entry><option>acl_smtp_dkim</option></entry>
21019 <entry>ACL for DKIM verification</entry>
21020 </row>
21021 <row>
21022 <entry><option>acl_smtp_etrn</option></entry>
21023 <entry>ACL for ETRN</entry>
21024 </row>
21025 <row>
21026 <entry><option>acl_smtp_expn</option></entry>
21027 <entry>ACL for EXPN</entry>
21028 </row>
21029 <row>
21030 <entry><option>acl_smtp_helo</option></entry>
21031 <entry>ACL for EHLO or HELO</entry>
21032 </row>
21033 <row>
21034 <entry><option>acl_smtp_mail</option></entry>
21035 <entry>ACL for MAIL</entry>
21036 </row>
21037 <row>
21038 <entry><option>acl_smtp_mailauth</option></entry>
21039 <entry>ACL for AUTH on MAIL command</entry>
21040 </row>
21041 <row>
21042 <entry><option>acl_smtp_mime</option></entry>
21043 <entry>ACL for MIME parts</entry>
21044 </row>
21045 <row>
21046 <entry><option>acl_smtp_notquit</option></entry>
21047 <entry>ACL for non-QUIT terminations</entry>
21048 </row>
21049 <row>
21050 <entry><option>acl_smtp_predata</option></entry>
21051 <entry>ACL for start of data</entry>
21052 </row>
21053 <row>
21054 <entry><option>acl_smtp_quit</option></entry>
21055 <entry>ACL for QUIT</entry>
21056 </row>
21057 <row>
21058 <entry><option>acl_smtp_rcpt</option></entry>
21059 <entry>ACL for RCPT</entry>
21060 </row>
21061 <row>
21062 <entry><option>acl_smtp_starttls</option></entry>
21063 <entry>ACL for STARTTLS</entry>
21064 </row>
21065 <row>
21066 <entry><option>acl_smtp_vrfy</option></entry>
21067 <entry>ACL for VRFY</entry>
21068 </row>
21069 <row>
21070 <entry><option>av_scanner</option></entry>
21071 <entry>specify virus scanner</entry>
21072 </row>
21073 <row>
21074 <entry><option>check_rfc2047_length</option></entry>
21075 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21076 </row>
21077 <row>
21078 <entry><option>dns_csa_search_limit</option></entry>
21079 <entry>control CSA parent search depth</entry>
21080 </row>
21081 <row>
21082 <entry><option>dns_csa_use_reverse</option></entry>
21083 <entry>en/disable CSA IP reverse search</entry>
21084 </row>
21085 <row>
21086 <entry><option>header_maxsize</option></entry>
21087 <entry>total size of message header</entry>
21088 </row>
21089 <row>
21090 <entry><option>header_line_maxsize</option></entry>
21091 <entry>individual header line limit</entry>
21092 </row>
21093 <row>
21094 <entry><option>helo_accept_junk_hosts</option></entry>
21095 <entry>allow syntactic junk from these hosts</entry>
21096 </row>
21097 <row>
21098 <entry><option>helo_allow_chars</option></entry>
21099 <entry>allow illegal chars in HELO names</entry>
21100 </row>
21101 <row>
21102 <entry><option>helo_lookup_domains</option></entry>
21103 <entry>lookup hostname for these HELO names</entry>
21104 </row>
21105 <row>
21106 <entry><option>helo_try_verify_hosts</option></entry>
21107 <entry>HELO soft-checked for these hosts</entry>
21108 </row>
21109 <row>
21110 <entry><option>helo_verify_hosts</option></entry>
21111 <entry>HELO hard-checked for these hosts</entry>
21112 </row>
21113 <row>
21114 <entry><option>host_lookup</option></entry>
21115 <entry>host name looked up for these hosts</entry>
21116 </row>
21117 <row>
21118 <entry><option>host_lookup_order</option></entry>
21119 <entry>order of DNS and local name lookups</entry>
21120 </row>
21121 <row>
21122 <entry><option>host_reject_connection</option></entry>
21123 <entry>reject connection from these hosts</entry>
21124 </row>
21125 <row>
21126 <entry><option>hosts_treat_as_local</option></entry>
21127 <entry>useful in some cluster configurations</entry>
21128 </row>
21129 <row>
21130 <entry><option>local_scan_timeout</option></entry>
21131 <entry>timeout for <function>local_scan()</function></entry>
21132 </row>
21133 <row>
21134 <entry><option>message_size_limit</option></entry>
21135 <entry>for all messages</entry>
21136 </row>
21137 <row>
21138 <entry><option>percent_hack_domains</option></entry>
21139 <entry>recognize %-hack for these domains</entry>
21140 </row>
21141 <row>
21142 <entry><option>spamd_address</option></entry>
21143 <entry>set interface to SpamAssassin</entry>
21144 </row>
21145 <row>
21146 <entry><option>strict_acl_vars</option></entry>
21147 <entry>object to unset ACL variables</entry>
21148 </row>
21149 </tbody>
21150 </tgroup>
21151 </informaltable>
21152 </section>
21153 <section id="SECID107">
21154 <title>Callout cache</title>
21155 <informaltable frame="none">
21156 <tgroup cols="2" colsep="0" rowsep="0">
21157 <colspec colwidth="196pt" align="left"/>
21158 <colspec colwidth="254pt" align="left"/>
21159 <tbody>
21160 <row>
21161 <entry><option>callout_domain_negative_expire</option></entry>
21162 <entry>timeout for negative domain cache item</entry>
21163 </row>
21164 <row>
21165 <entry><option>callout_domain_positive_expire</option></entry>
21166 <entry>timeout for positive domain cache item</entry>
21167 </row>
21168 <row>
21169 <entry><option>callout_negative_expire</option></entry>
21170 <entry>timeout for negative address cache item</entry>
21171 </row>
21172 <row>
21173 <entry><option>callout_positive_expire</option></entry>
21174 <entry>timeout for positive address cache item</entry>
21175 </row>
21176 <row>
21177 <entry><option>callout_random_local_part</option></entry>
21178 <entry>string to use for <quote>random</quote> testing</entry>
21179 </row>
21180 </tbody>
21181 </tgroup>
21182 </informaltable>
21183 </section>
21184 <section id="SECID108">
21185 <title>TLS</title>
21186 <informaltable frame="none">
21187 <tgroup cols="2" colsep="0" rowsep="0">
21188 <colspec colwidth="196pt" align="left"/>
21189 <colspec colwidth="254pt" align="left"/>
21190 <tbody>
21191 <row>
21192 <entry><option>gnutls_compat_mode</option></entry>
21193 <entry>use GnuTLS compatibility mode</entry>
21194 </row>
21195 <row>
21196 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
21197 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
21198 </row>
21199 <row>
21200 <entry><option>openssl_options</option></entry>
21201 <entry>adjust OpenSSL compatibility options</entry>
21202 </row>
21203 <row>
21204 <entry><option>tls_advertise_hosts</option></entry>
21205 <entry>advertise TLS to these hosts</entry>
21206 </row>
21207 <row>
21208 <entry><option>tls_certificate</option></entry>
21209 <entry>location of server certificate</entry>
21210 </row>
21211 <row>
21212 <entry><option>tls_crl</option></entry>
21213 <entry>certificate revocation list</entry>
21214 </row>
21215 <row>
21216 <entry><option>tls_dh_max_bits</option></entry>
21217 <entry>clamp D-H bit count suggestion</entry>
21218 </row>
21219 <row>
21220 <entry><option>tls_dhparam</option></entry>
21221 <entry>DH parameters for server</entry>
21222 </row>
21223 <row>
21224 <entry><option>tls_eccurve</option></entry>
21225 <entry>EC curve selection for server</entry>
21226 </row>
21227 <row>
21228 <entry><option>tls_ocsp_file</option></entry>
21229 <entry>location of server certificate status proof</entry>
21230 </row>
21231 <row>
21232 <entry><option>tls_on_connect_ports</option></entry>
21233 <entry>specify SSMTP (SMTPS) ports</entry>
21234 </row>
21235 <row>
21236 <entry><option>tls_privatekey</option></entry>
21237 <entry>location of server private key</entry>
21238 </row>
21239 <row>
21240 <entry><option>tls_remember_esmtp</option></entry>
21241 <entry>don&#x2019;t reset after starting TLS</entry>
21242 </row>
21243 <row>
21244 <entry><option>tls_require_ciphers</option></entry>
21245 <entry>specify acceptable ciphers</entry>
21246 </row>
21247 <row>
21248 <entry><option>tls_try_verify_hosts</option></entry>
21249 <entry>try to verify client certificate</entry>
21250 </row>
21251 <row>
21252 <entry><option>tls_verify_certificates</option></entry>
21253 <entry>expected client certificates</entry>
21254 </row>
21255 <row>
21256 <entry><option>tls_verify_hosts</option></entry>
21257 <entry>insist on client certificate verify</entry>
21258 </row>
21259 </tbody>
21260 </tgroup>
21261 </informaltable>
21262 </section>
21263 <section id="SECID109">
21264 <title>Local user handling</title>
21265 <informaltable frame="none">
21266 <tgroup cols="2" colsep="0" rowsep="0">
21267 <colspec colwidth="196pt" align="left"/>
21268 <colspec colwidth="254pt" align="left"/>
21269 <tbody>
21270 <row>
21271 <entry><option>finduser_retries</option></entry>
21272 <entry>useful in NIS environments</entry>
21273 </row>
21274 <row>
21275 <entry><option>gecos_name</option></entry>
21276 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21277 </row>
21278 <row>
21279 <entry><option>gecos_pattern</option></entry>
21280 <entry>ditto</entry>
21281 </row>
21282 <row>
21283 <entry><option>max_username_length</option></entry>
21284 <entry>for systems that truncate</entry>
21285 </row>
21286 <row>
21287 <entry><option>unknown_login</option></entry>
21288 <entry>used when no login name found</entry>
21289 </row>
21290 <row>
21291 <entry><option>unknown_username</option></entry>
21292 <entry>ditto</entry>
21293 </row>
21294 <row>
21295 <entry><option>uucp_from_pattern</option></entry>
21296 <entry>for recognizing <quote>From </quote> lines</entry>
21297 </row>
21298 <row>
21299 <entry><option>uucp_from_sender</option></entry>
21300 <entry>ditto</entry>
21301 </row>
21302 </tbody>
21303 </tgroup>
21304 </informaltable>
21305 </section>
21306 <section id="SECID110">
21307 <title>All incoming messages (SMTP and non-SMTP)</title>
21308 <informaltable frame="none">
21309 <tgroup cols="2" colsep="0" rowsep="0">
21310 <colspec colwidth="196pt" align="left"/>
21311 <colspec colwidth="254pt" align="left"/>
21312 <tbody>
21313 <row>
21314 <entry><option>header_maxsize</option></entry>
21315 <entry>total size of message header</entry>
21316 </row>
21317 <row>
21318 <entry><option>header_line_maxsize</option></entry>
21319 <entry>individual header line limit</entry>
21320 </row>
21321 <row>
21322 <entry><option>message_size_limit</option></entry>
21323 <entry>applies to all messages</entry>
21324 </row>
21325 <row>
21326 <entry><option>percent_hack_domains</option></entry>
21327 <entry>recognize %-hack for these domains</entry>
21328 </row>
21329 <row>
21330 <entry><option>received_header_text</option></entry>
21331 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21332 </row>
21333 <row>
21334 <entry><option>received_headers_max</option></entry>
21335 <entry>for mail loop detection</entry>
21336 </row>
21337 <row>
21338 <entry><option>recipients_max</option></entry>
21339 <entry>limit per message</entry>
21340 </row>
21341 <row>
21342 <entry><option>recipients_max_reject</option></entry>
21343 <entry>permanently reject excess recipients</entry>
21344 </row>
21345 </tbody>
21346 </tgroup>
21347 </informaltable>
21348 </section>
21349 <section id="SECID111">
21350 <title>Non-SMTP incoming messages</title>
21351 <informaltable frame="none">
21352 <tgroup cols="2" colsep="0" rowsep="0">
21353 <colspec colwidth="196pt" align="left"/>
21354 <colspec colwidth="254pt" align="left"/>
21355 <tbody>
21356 <row>
21357 <entry><option>receive_timeout</option></entry>
21358 <entry>for non-SMTP messages</entry>
21359 </row>
21360 </tbody>
21361 </tgroup>
21362 </informaltable>
21363 </section>
21364 <section id="SECID112">
21365 <title>Incoming SMTP messages</title>
21366 <para>
21367 See also the <emphasis>Policy controls</emphasis> section above.
21368 </para>
21369 <informaltable frame="none">
21370 <tgroup cols="2" colsep="0" rowsep="0">
21371 <colspec colwidth="196pt" align="left"/>
21372 <colspec colwidth="254pt" align="left"/>
21373 <tbody>
21374 <row>
21375 <entry><option>dkim_verify_signers</option></entry>
21376 <entry>DKIM domain for which DKIM ACL is run</entry>
21377 </row>
21378 <row>
21379 <entry><option>host_lookup</option></entry>
21380 <entry>host name looked up for these hosts</entry>
21381 </row>
21382 <row>
21383 <entry><option>host_lookup_order</option></entry>
21384 <entry>order of DNS and local name lookups</entry>
21385 </row>
21386 <row>
21387 <entry><option>recipient_unqualified_hosts</option></entry>
21388 <entry>may send unqualified recipients</entry>
21389 </row>
21390 <row>
21391 <entry><option>rfc1413_hosts</option></entry>
21392 <entry>make ident calls to these hosts</entry>
21393 </row>
21394 <row>
21395 <entry><option>rfc1413_query_timeout</option></entry>
21396 <entry>zero disables ident calls</entry>
21397 </row>
21398 <row>
21399 <entry><option>sender_unqualified_hosts</option></entry>
21400 <entry>may send unqualified senders</entry>
21401 </row>
21402 <row>
21403 <entry><option>smtp_accept_keepalive</option></entry>
21404 <entry>some TCP/IP magic</entry>
21405 </row>
21406 <row>
21407 <entry><option>smtp_accept_max</option></entry>
21408 <entry>simultaneous incoming connections</entry>
21409 </row>
21410 <row>
21411 <entry><option>smtp_accept_max_nonmail</option></entry>
21412 <entry>non-mail commands</entry>
21413 </row>
21414 <row>
21415 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21416 <entry>hosts to which the limit applies</entry>
21417 </row>
21418 <row>
21419 <entry><option>smtp_accept_max_per_connection</option></entry>
21420 <entry>messages per connection</entry>
21421 </row>
21422 <row>
21423 <entry><option>smtp_accept_max_per_host</option></entry>
21424 <entry>connections from one host</entry>
21425 </row>
21426 <row>
21427 <entry><option>smtp_accept_queue</option></entry>
21428 <entry>queue mail if more connections</entry>
21429 </row>
21430 <row>
21431 <entry><option>smtp_accept_queue_per_connection</option></entry>
21432 <entry>queue if more messages per connection</entry>
21433 </row>
21434 <row>
21435 <entry><option>smtp_accept_reserve</option></entry>
21436 <entry>only reserve hosts if more connections</entry>
21437 </row>
21438 <row>
21439 <entry><option>smtp_active_hostname</option></entry>
21440 <entry>host name to use in messages</entry>
21441 </row>
21442 <row>
21443 <entry><option>smtp_banner</option></entry>
21444 <entry>text for welcome banner</entry>
21445 </row>
21446 <row>
21447 <entry><option>smtp_check_spool_space</option></entry>
21448 <entry>from SIZE on MAIL command</entry>
21449 </row>
21450 <row>
21451 <entry><option>smtp_connect_backlog</option></entry>
21452 <entry>passed to TCP/IP stack</entry>
21453 </row>
21454 <row>
21455 <entry><option>smtp_enforce_sync</option></entry>
21456 <entry>of SMTP command/responses</entry>
21457 </row>
21458 <row>
21459 <entry><option>smtp_etrn_command</option></entry>
21460 <entry>what to run for ETRN</entry>
21461 </row>
21462 <row>
21463 <entry><option>smtp_etrn_serialize</option></entry>
21464 <entry>only one at once</entry>
21465 </row>
21466 <row>
21467 <entry><option>smtp_load_reserve</option></entry>
21468 <entry>only reserve hosts if this load</entry>
21469 </row>
21470 <row>
21471 <entry><option>smtp_max_unknown_commands</option></entry>
21472 <entry>before dropping connection</entry>
21473 </row>
21474 <row>
21475 <entry><option>smtp_ratelimit_hosts</option></entry>
21476 <entry>apply ratelimiting to these hosts</entry>
21477 </row>
21478 <row>
21479 <entry><option>smtp_ratelimit_mail</option></entry>
21480 <entry>ratelimit for MAIL commands</entry>
21481 </row>
21482 <row>
21483 <entry><option>smtp_ratelimit_rcpt</option></entry>
21484 <entry>ratelimit for RCPT commands</entry>
21485 </row>
21486 <row>
21487 <entry><option>smtp_receive_timeout</option></entry>
21488 <entry>per command or data line</entry>
21489 </row>
21490 <row>
21491 <entry><option>smtp_reserve_hosts</option></entry>
21492 <entry>these are the reserve hosts</entry>
21493 </row>
21494 <row>
21495 <entry><option>smtp_return_error_details</option></entry>
21496 <entry>give detail on rejections</entry>
21497 </row>
21498 </tbody>
21499 </tgroup>
21500 </informaltable>
21501 </section>
21502 <section id="SECID113">
21503 <title>SMTP extensions</title>
21504 <informaltable frame="none">
21505 <tgroup cols="2" colsep="0" rowsep="0">
21506 <colspec colwidth="196pt" align="left"/>
21507 <colspec colwidth="254pt" align="left"/>
21508 <tbody>
21509 <row>
21510 <entry><option>accept_8bitmime</option></entry>
21511 <entry>advertise 8BITMIME</entry>
21512 </row>
21513 <row>
21514 <entry><option>auth_advertise_hosts</option></entry>
21515 <entry>advertise AUTH to these hosts</entry>
21516 </row>
21517 <row>
21518 <entry><option>dsn_advertise_hosts</option></entry>
21519 <entry>advertise DSN extensions to these hosts</entry>
21520 </row>
21521 <row>
21522 <entry><option>ignore_fromline_hosts</option></entry>
21523 <entry>allow <quote>From </quote> from these hosts</entry>
21524 </row>
21525 <row>
21526 <entry><option>ignore_fromline_local</option></entry>
21527 <entry>allow <quote>From </quote> from local SMTP</entry>
21528 </row>
21529 <row>
21530 <entry><option>pipelining_advertise_hosts</option></entry>
21531 <entry>advertise pipelining to these hosts</entry>
21532 </row>
21533 <row>
21534 <entry><option>prdr_enable</option></entry>
21535 <entry>advertise PRDR to all hosts</entry>
21536 </row>
21537 <row>
21538 <entry><option>tls_advertise_hosts</option></entry>
21539 <entry>advertise TLS to these hosts</entry>
21540 </row>
21541 </tbody>
21542 </tgroup>
21543 </informaltable>
21544 </section>
21545 <section id="SECID114">
21546 <title>Processing messages</title>
21547 <informaltable frame="none">
21548 <tgroup cols="2" colsep="0" rowsep="0">
21549 <colspec colwidth="196pt" align="left"/>
21550 <colspec colwidth="254pt" align="left"/>
21551 <tbody>
21552 <row>
21553 <entry><option>allow_domain_literals</option></entry>
21554 <entry>recognize domain literal syntax</entry>
21555 </row>
21556 <row>
21557 <entry><option>allow_mx_to_ip</option></entry>
21558 <entry>allow MX to point to IP address</entry>
21559 </row>
21560 <row>
21561 <entry><option>allow_utf8_domains</option></entry>
21562 <entry>in addresses</entry>
21563 </row>
21564 <row>
21565 <entry><option>check_rfc2047_length</option></entry>
21566 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21567 </row>
21568 <row>
21569 <entry><option>delivery_date_remove</option></entry>
21570 <entry>from incoming messages</entry>
21571 </row>
21572 <row>
21573 <entry><option>envelope_to_remove</option></entry>
21574 <entry>from incoming messages</entry>
21575 </row>
21576 <row>
21577 <entry><option>extract_addresses_remove_arguments</option></entry>
21578 <entry>affects <option>-t</option> processing</entry>
21579 </row>
21580 <row>
21581 <entry><option>headers_charset</option></entry>
21582 <entry>default for translations</entry>
21583 </row>
21584 <row>
21585 <entry><option>qualify_domain</option></entry>
21586 <entry>default for senders</entry>
21587 </row>
21588 <row>
21589 <entry><option>qualify_recipient</option></entry>
21590 <entry>default for recipients</entry>
21591 </row>
21592 <row>
21593 <entry><option>return_path_remove</option></entry>
21594 <entry>from incoming messages</entry>
21595 </row>
21596 <row>
21597 <entry><option>strip_excess_angle_brackets</option></entry>
21598 <entry>in addresses</entry>
21599 </row>
21600 <row>
21601 <entry><option>strip_trailing_dot</option></entry>
21602 <entry>at end of addresses</entry>
21603 </row>
21604 <row>
21605 <entry><option>untrusted_set_sender</option></entry>
21606 <entry>untrusted can set envelope sender</entry>
21607 </row>
21608 </tbody>
21609 </tgroup>
21610 </informaltable>
21611 </section>
21612 <section id="SECID115">
21613 <title>System filter</title>
21614 <informaltable frame="none">
21615 <tgroup cols="2" colsep="0" rowsep="0">
21616 <colspec colwidth="196pt" align="left"/>
21617 <colspec colwidth="254pt" align="left"/>
21618 <tbody>
21619 <row>
21620 <entry><option>system_filter</option></entry>
21621 <entry>locate system filter</entry>
21622 </row>
21623 <row>
21624 <entry><option>system_filter_directory_transport</option></entry>
21625 <entry>transport for delivery to a directory</entry>
21626 </row>
21627 <row>
21628 <entry><option>system_filter_file_transport</option></entry>
21629 <entry>transport for delivery to a file</entry>
21630 </row>
21631 <row>
21632 <entry><option>system_filter_group</option></entry>
21633 <entry>group for filter running</entry>
21634 </row>
21635 <row>
21636 <entry><option>system_filter_pipe_transport</option></entry>
21637 <entry>transport for delivery to a pipe</entry>
21638 </row>
21639 <row>
21640 <entry><option>system_filter_reply_transport</option></entry>
21641 <entry>transport for autoreply delivery</entry>
21642 </row>
21643 <row>
21644 <entry><option>system_filter_user</option></entry>
21645 <entry>user for filter running</entry>
21646 </row>
21647 </tbody>
21648 </tgroup>
21649 </informaltable>
21650 </section>
21651 <section id="SECID116">
21652 <title>Routing and delivery</title>
21653 <informaltable frame="none">
21654 <tgroup cols="2" colsep="0" rowsep="0">
21655 <colspec colwidth="196pt" align="left"/>
21656 <colspec colwidth="254pt" align="left"/>
21657 <tbody>
21658 <row>
21659 <entry><option>disable_ipv6</option></entry>
21660 <entry>do no IPv6 processing</entry>
21661 </row>
21662 <row>
21663 <entry><option>dns_again_means_nonexist</option></entry>
21664 <entry>for broken domains</entry>
21665 </row>
21666 <row>
21667 <entry><option>dns_check_names_pattern</option></entry>
21668 <entry>pre-DNS syntax check</entry>
21669 </row>
21670 <row>
21671 <entry><option>dns_dnssec_ok</option></entry>
21672 <entry>parameter for resolver</entry>
21673 </row>
21674 <row>
21675 <entry><option>dns_ipv4_lookup</option></entry>
21676 <entry>only v4 lookup for these domains</entry>
21677 </row>
21678 <row>
21679 <entry><option>dns_retrans</option></entry>
21680 <entry>parameter for resolver</entry>
21681 </row>
21682 <row>
21683 <entry><option>dns_retry</option></entry>
21684 <entry>parameter for resolver</entry>
21685 </row>
21686 <row>
21687 <entry><option>dns_trust_aa</option></entry>
21688 <entry>DNS zones trusted as authentic</entry>
21689 </row>
21690 <row>
21691 <entry><option>dns_use_edns0</option></entry>
21692 <entry>parameter for resolver</entry>
21693 </row>
21694 <row>
21695 <entry><option>hold_domains</option></entry>
21696 <entry>hold delivery for these domains</entry>
21697 </row>
21698 <row>
21699 <entry><option>local_interfaces</option></entry>
21700 <entry>for routing checks</entry>
21701 </row>
21702 <row>
21703 <entry><option>queue_domains</option></entry>
21704 <entry>no immediate delivery for these</entry>
21705 </row>
21706 <row>
21707 <entry><option>queue_only</option></entry>
21708 <entry>no immediate delivery at all</entry>
21709 </row>
21710 <row>
21711 <entry><option>queue_only_file</option></entry>
21712 <entry>no immediate delivery if file exists</entry>
21713 </row>
21714 <row>
21715 <entry><option>queue_only_load</option></entry>
21716 <entry>no immediate delivery if load is high</entry>
21717 </row>
21718 <row>
21719 <entry><option>queue_only_load_latch</option></entry>
21720 <entry>don&#x2019;t re-evaluate load for each message</entry>
21721 </row>
21722 <row>
21723 <entry><option>queue_only_override</option></entry>
21724 <entry>allow command line to override</entry>
21725 </row>
21726 <row>
21727 <entry><option>queue_run_in_order</option></entry>
21728 <entry>order of arrival</entry>
21729 </row>
21730 <row>
21731 <entry><option>queue_run_max</option></entry>
21732 <entry>of simultaneous queue runners</entry>
21733 </row>
21734 <row>
21735 <entry><option>queue_smtp_domains</option></entry>
21736 <entry>no immediate SMTP delivery for these</entry>
21737 </row>
21738 <row>
21739 <entry><option>remote_max_parallel</option></entry>
21740 <entry>parallel SMTP delivery per message</entry>
21741 </row>
21742 <row>
21743 <entry><option>remote_sort_domains</option></entry>
21744 <entry>order of remote deliveries</entry>
21745 </row>
21746 <row>
21747 <entry><option>retry_data_expire</option></entry>
21748 <entry>timeout for retry data</entry>
21749 </row>
21750 <row>
21751 <entry><option>retry_interval_max</option></entry>
21752 <entry>safety net for retry rules</entry>
21753 </row>
21754 </tbody>
21755 </tgroup>
21756 </informaltable>
21757 </section>
21758 <section id="SECID117">
21759 <title>Bounce and warning messages</title>
21760 <informaltable frame="none">
21761 <tgroup cols="2" colsep="0" rowsep="0">
21762 <colspec colwidth="196pt" align="left"/>
21763 <colspec colwidth="254pt" align="left"/>
21764 <tbody>
21765 <row>
21766 <entry><option>bounce_message_file</option></entry>
21767 <entry>content of bounce</entry>
21768 </row>
21769 <row>
21770 <entry><option>bounce_message_text</option></entry>
21771 <entry>content of bounce</entry>
21772 </row>
21773 <row>
21774 <entry><option>bounce_return_body</option></entry>
21775 <entry>include body if returning message</entry>
21776 </row>
21777 <row>
21778 <entry><option>bounce_return_message</option></entry>
21779 <entry>include original message in bounce</entry>
21780 </row>
21781 <row>
21782 <entry><option>bounce_return_size_limit</option></entry>
21783 <entry>limit on returned message</entry>
21784 </row>
21785 <row>
21786 <entry><option>bounce_sender_authentication</option></entry>
21787 <entry>send authenticated sender with bounce</entry>
21788 </row>
21789 <row>
21790 <entry><option>dsn_from</option></entry>
21791 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21792 </row>
21793 <row>
21794 <entry><option>errors_copy</option></entry>
21795 <entry>copy bounce messages</entry>
21796 </row>
21797 <row>
21798 <entry><option>errors_reply_to</option></entry>
21799 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21800 </row>
21801 <row>
21802 <entry><option>delay_warning</option></entry>
21803 <entry>time schedule</entry>
21804 </row>
21805 <row>
21806 <entry><option>delay_warning_condition</option></entry>
21807 <entry>condition for warning messages</entry>
21808 </row>
21809 <row>
21810 <entry><option>ignore_bounce_errors_after</option></entry>
21811 <entry>discard undeliverable bounces</entry>
21812 </row>
21813 <row>
21814 <entry><option>smtp_return_error_details</option></entry>
21815 <entry>give detail on rejections</entry>
21816 </row>
21817 <row>
21818 <entry><option>warn_message_file</option></entry>
21819 <entry>content of warning message</entry>
21820 </row>
21821 </tbody>
21822 </tgroup>
21823 </informaltable>
21824 </section>
21825 <section id="SECTalomo">
21826 <title>Alphabetical list of main options</title>
21827 <para>
21828 Those options that undergo string expansion before use are marked with
21829 &dagger;.
21830 </para>
21831 <para>
21832 <indexterm role="option">
21833 <primary><option>accept_8bitmime</option></primary>
21834 </indexterm>
21835 </para>
21836 <informaltable frame="all">
21837 <tgroup cols="4" colsep="0" rowsep="0">
21838 <colspec colwidth="8*" align="left"/>
21839 <colspec colwidth="6*" align="center"/>
21840 <colspec colwidth="6*" align="center"/>
21841 <colspec colwidth="6*" align="right"/>
21842 <tbody>
21843 <row>
21844 <entry><option>accept_8bitmime</option></entry>
21845 <entry>Use: <emphasis>main</emphasis></entry>
21846 <entry>Type: <emphasis>boolean</emphasis></entry>
21847 <entry>Default: <emphasis>true</emphasis></entry>
21848 </row>
21849 </tbody>
21850 </tgroup>
21851 </informaltable>
21852 <para>
21853 <indexterm role="concept">
21854 <primary>8BITMIME</primary>
21855 </indexterm>
21856 <indexterm role="concept">
21857 <primary>8-bit characters</primary>
21858 </indexterm>
21859 <indexterm role="concept">
21860 <primary>log</primary>
21861 <secondary>selectors</secondary>
21862 </indexterm>
21863 <indexterm role="concept">
21864 <primary>log</primary>
21865 <secondary>8BITMIME</secondary>
21866 </indexterm>
21867 This option causes Exim to send 8BITMIME in its response to an SMTP
21868 EHLO command, and to accept the BODY= parameter on MAIL commands.
21869 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21870 takes no steps to do anything special with messages received by this route.
21871 </para>
21872 <para>
21873 Historically Exim kept this option off by default, but the maintainers
21874 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21875 It now defaults to true.
21876 A more detailed analysis of the issues is provided by Dan Bernstein:
21877 </para>
21878 <literallayout>
21879 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21880 </literallayout>
21881 <para>
21882 To log received 8BITMIME status use
21883 </para>
21884 <literallayout class="monospaced">
21885 log_selector = +8bitmime
21886 </literallayout>
21887 <para>
21888 <indexterm role="option">
21889 <primary><option>acl_not_smtp</option></primary>
21890 </indexterm>
21891 </para>
21892 <informaltable frame="all">
21893 <tgroup cols="4" colsep="0" rowsep="0">
21894 <colspec colwidth="8*" align="left"/>
21895 <colspec colwidth="6*" align="center"/>
21896 <colspec colwidth="6*" align="center"/>
21897 <colspec colwidth="6*" align="right"/>
21898 <tbody>
21899 <row>
21900 <entry><option>acl_not_smtp</option></entry>
21901 <entry>Use: <emphasis>main</emphasis></entry>
21902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21903 <entry>Default: <emphasis>unset</emphasis></entry>
21904 </row>
21905 </tbody>
21906 </tgroup>
21907 </informaltable>
21908 <para>
21909 <indexterm role="concept">
21910 <primary>access control lists (ACLs)</primary>
21911 <secondary>for non-SMTP messages</secondary>
21912 </indexterm>
21913 <indexterm role="concept">
21914 <primary>non-SMTP messages</primary>
21915 <secondary>ACLs for</secondary>
21916 </indexterm>
21917 This option defines the ACL that is run when a non-SMTP message has been
21918 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21919 further details.
21920 </para>
21921 <para>
21922 <indexterm role="option">
21923 <primary><option>acl_not_smtp_mime</option></primary>
21924 </indexterm>
21925 </para>
21926 <informaltable frame="all">
21927 <tgroup cols="4" colsep="0" rowsep="0">
21928 <colspec colwidth="8*" align="left"/>
21929 <colspec colwidth="6*" align="center"/>
21930 <colspec colwidth="6*" align="center"/>
21931 <colspec colwidth="6*" align="right"/>
21932 <tbody>
21933 <row>
21934 <entry><option>acl_not_smtp_mime</option></entry>
21935 <entry>Use: <emphasis>main</emphasis></entry>
21936 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21937 <entry>Default: <emphasis>unset</emphasis></entry>
21938 </row>
21939 </tbody>
21940 </tgroup>
21941 </informaltable>
21942 <para>
21943 This option defines the ACL that is run for individual MIME parts of non-SMTP
21944 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21945 SMTP messages.
21946 </para>
21947 <para>
21948 <indexterm role="option">
21949 <primary><option>acl_not_smtp_start</option></primary>
21950 </indexterm>
21951 </para>
21952 <informaltable frame="all">
21953 <tgroup cols="4" colsep="0" rowsep="0">
21954 <colspec colwidth="8*" align="left"/>
21955 <colspec colwidth="6*" align="center"/>
21956 <colspec colwidth="6*" align="center"/>
21957 <colspec colwidth="6*" align="right"/>
21958 <tbody>
21959 <row>
21960 <entry><option>acl_not_smtp_start</option></entry>
21961 <entry>Use: <emphasis>main</emphasis></entry>
21962 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21963 <entry>Default: <emphasis>unset</emphasis></entry>
21964 </row>
21965 </tbody>
21966 </tgroup>
21967 </informaltable>
21968 <para>
21969 <indexterm role="concept">
21970 <primary>access control lists (ACLs)</primary>
21971 <secondary>at start of non-SMTP message</secondary>
21972 </indexterm>
21973 <indexterm role="concept">
21974 <primary>non-SMTP messages</primary>
21975 <secondary>ACLs for</secondary>
21976 </indexterm>
21977 This option defines the ACL that is run before Exim starts reading a
21978 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21979 </para>
21980 <para>
21981 <indexterm role="option">
21982 <primary><option>acl_smtp_auth</option></primary>
21983 </indexterm>
21984 </para>
21985 <informaltable frame="all">
21986 <tgroup cols="4" colsep="0" rowsep="0">
21987 <colspec colwidth="8*" align="left"/>
21988 <colspec colwidth="6*" align="center"/>
21989 <colspec colwidth="6*" align="center"/>
21990 <colspec colwidth="6*" align="right"/>
21991 <tbody>
21992 <row>
21993 <entry><option>acl_smtp_auth</option></entry>
21994 <entry>Use: <emphasis>main</emphasis></entry>
21995 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21996 <entry>Default: <emphasis>unset</emphasis></entry>
21997 </row>
21998 </tbody>
21999 </tgroup>
22000 </informaltable>
22001 <para>
22002 <indexterm role="concept">
22003 <primary>access control lists (ACLs)</primary>
22004 <secondary>setting up for SMTP commands</secondary>
22005 </indexterm>
22006 <indexterm role="concept">
22007 <primary>AUTH</primary>
22008 <secondary>ACL for</secondary>
22009 </indexterm>
22010 This option defines the ACL that is run when an SMTP AUTH command is
22011 received. See chapter <xref linkend="CHAPACL"/> for further details.
22012 </para>
22013 <para>
22014 <indexterm role="option">
22015 <primary><option>acl_smtp_connect</option></primary>
22016 </indexterm>
22017 </para>
22018 <informaltable frame="all">
22019 <tgroup cols="4" colsep="0" rowsep="0">
22020 <colspec colwidth="8*" align="left"/>
22021 <colspec colwidth="6*" align="center"/>
22022 <colspec colwidth="6*" align="center"/>
22023 <colspec colwidth="6*" align="right"/>
22024 <tbody>
22025 <row>
22026 <entry><option>acl_smtp_connect</option></entry>
22027 <entry>Use: <emphasis>main</emphasis></entry>
22028 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22029 <entry>Default: <emphasis>unset</emphasis></entry>
22030 </row>
22031 </tbody>
22032 </tgroup>
22033 </informaltable>
22034 <para>
22035 <indexterm role="concept">
22036 <primary>access control lists (ACLs)</primary>
22037 <secondary>on SMTP connection</secondary>
22038 </indexterm>
22039 This option defines the ACL that is run when an SMTP connection is received.
22040 See chapter <xref linkend="CHAPACL"/> for further details.
22041 </para>
22042 <para>
22043 <indexterm role="option">
22044 <primary><option>acl_smtp_data</option></primary>
22045 </indexterm>
22046 </para>
22047 <informaltable frame="all">
22048 <tgroup cols="4" colsep="0" rowsep="0">
22049 <colspec colwidth="8*" align="left"/>
22050 <colspec colwidth="6*" align="center"/>
22051 <colspec colwidth="6*" align="center"/>
22052 <colspec colwidth="6*" align="right"/>
22053 <tbody>
22054 <row>
22055 <entry><option>acl_smtp_data</option></entry>
22056 <entry>Use: <emphasis>main</emphasis></entry>
22057 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22058 <entry>Default: <emphasis>unset</emphasis></entry>
22059 </row>
22060 </tbody>
22061 </tgroup>
22062 </informaltable>
22063 <para>
22064 <indexterm role="concept">
22065 <primary>DATA</primary>
22066 <secondary>ACL for</secondary>
22067 </indexterm>
22068 This option defines the ACL that is run after an SMTP DATA command has been
22069 processed and the message itself has been received, but before the final
22070 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22071 </para>
22072 <para revisionflag="changed">
22073 <indexterm role="option">
22074 <primary><option>acl_smtp_data_prdr</option></primary>
22075 </indexterm>
22076 </para>
22077 <informaltable frame="all" revisionflag="changed">
22078 <tgroup cols="4" colsep="0" rowsep="0">
22079 <colspec colwidth="8*" align="left"/>
22080 <colspec colwidth="6*" align="center"/>
22081 <colspec colwidth="6*" align="center"/>
22082 <colspec colwidth="6*" align="right"/>
22083 <tbody>
22084 <row>
22085 <entry><option>acl_smtp_data_prdr</option></entry>
22086 <entry>Use: <emphasis>main</emphasis></entry>
22087 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22088 <entry>Default: <emphasis>accept</emphasis></entry>
22089 </row>
22090 </tbody>
22091 </tgroup>
22092 </informaltable>
22093 <para revisionflag="changed">
22094 <indexterm role="concept">
22095 <primary>PRDR</primary>
22096 <secondary>ACL for</secondary>
22097 </indexterm>
22098 <indexterm role="concept">
22099 <primary>DATA</primary>
22100 <secondary>PRDR ACL for</secondary>
22101 </indexterm>
22102 <indexterm role="concept">
22103 <primary>access control lists (ACLs)</primary>
22104 <secondary>PRDR-related</secondary>
22105 </indexterm>
22106 <indexterm role="concept">
22107 <primary>access control lists (ACLs)</primary>
22108 <secondary>per-user data processing</secondary>
22109 </indexterm>
22110 </para>
22111 <para>
22112 This option defines the ACL that,
22113 if the PRDR feature has been negotiated,
22114 is run for each recipient after an SMTP DATA command has been
22115 processed and the message itself has been received, but before the
22116 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22117 </para>
22118 <para revisionflag="changed">
22119 <indexterm role="option">
22120 <primary><option>acl_smtp_dkim</option></primary>
22121 </indexterm>
22122 </para>
22123 <informaltable frame="all" revisionflag="changed">
22124 <tgroup cols="4" colsep="0" rowsep="0">
22125 <colspec colwidth="8*" align="left"/>
22126 <colspec colwidth="6*" align="center"/>
22127 <colspec colwidth="6*" align="center"/>
22128 <colspec colwidth="6*" align="right"/>
22129 <tbody>
22130 <row>
22131 <entry><option>acl_smtp_dkim</option></entry>
22132 <entry>Use: <emphasis>main</emphasis></entry>
22133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22134 <entry>Default: <emphasis>unset</emphasis></entry>
22135 </row>
22136 </tbody>
22137 </tgroup>
22138 </informaltable>
22139 <para revisionflag="changed">
22140 <indexterm role="concept">
22141 <primary>DKIM</primary>
22142 <secondary>ACL for</secondary>
22143 </indexterm>
22144 This option defines the ACL that is run for each DKIM signature
22145 of a received message.
22146 See chapter <xref linkend="CHAPdkim"/> for further details.
22147 </para>
22148 <para>
22149 <indexterm role="option">
22150 <primary><option>acl_smtp_etrn</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>acl_smtp_etrn</option></entry>
22162 <entry>Use: <emphasis>main</emphasis></entry>
22163 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22164 <entry>Default: <emphasis>unset</emphasis></entry>
22165 </row>
22166 </tbody>
22167 </tgroup>
22168 </informaltable>
22169 <para>
22170 <indexterm role="concept">
22171 <primary>ETRN</primary>
22172 <secondary>ACL for</secondary>
22173 </indexterm>
22174 This option defines the ACL that is run when an SMTP ETRN command is
22175 received. See chapter <xref linkend="CHAPACL"/> for further details.
22176 </para>
22177 <para>
22178 <indexterm role="option">
22179 <primary><option>acl_smtp_expn</option></primary>
22180 </indexterm>
22181 </para>
22182 <informaltable frame="all">
22183 <tgroup cols="4" colsep="0" rowsep="0">
22184 <colspec colwidth="8*" align="left"/>
22185 <colspec colwidth="6*" align="center"/>
22186 <colspec colwidth="6*" align="center"/>
22187 <colspec colwidth="6*" align="right"/>
22188 <tbody>
22189 <row>
22190 <entry><option>acl_smtp_expn</option></entry>
22191 <entry>Use: <emphasis>main</emphasis></entry>
22192 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22193 <entry>Default: <emphasis>unset</emphasis></entry>
22194 </row>
22195 </tbody>
22196 </tgroup>
22197 </informaltable>
22198 <para>
22199 <indexterm role="concept">
22200 <primary>EXPN</primary>
22201 <secondary>ACL for</secondary>
22202 </indexterm>
22203 This option defines the ACL that is run when an SMTP EXPN command is
22204 received. See chapter <xref linkend="CHAPACL"/> for further details.
22205 </para>
22206 <para>
22207 <indexterm role="option">
22208 <primary><option>acl_smtp_helo</option></primary>
22209 </indexterm>
22210 </para>
22211 <informaltable frame="all">
22212 <tgroup cols="4" colsep="0" rowsep="0">
22213 <colspec colwidth="8*" align="left"/>
22214 <colspec colwidth="6*" align="center"/>
22215 <colspec colwidth="6*" align="center"/>
22216 <colspec colwidth="6*" align="right"/>
22217 <tbody>
22218 <row>
22219 <entry><option>acl_smtp_helo</option></entry>
22220 <entry>Use: <emphasis>main</emphasis></entry>
22221 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22222 <entry>Default: <emphasis>unset</emphasis></entry>
22223 </row>
22224 </tbody>
22225 </tgroup>
22226 </informaltable>
22227 <para>
22228 <indexterm role="concept">
22229 <primary>EHLO</primary>
22230 <secondary>ACL for</secondary>
22231 </indexterm>
22232 <indexterm role="concept">
22233 <primary>HELO</primary>
22234 <secondary>ACL for</secondary>
22235 </indexterm>
22236 This option defines the ACL that is run when an SMTP EHLO or HELO
22237 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
22238 </para>
22239 <para>
22240 <indexterm role="option">
22241 <primary><option>acl_smtp_mail</option></primary>
22242 </indexterm>
22243 </para>
22244 <informaltable frame="all">
22245 <tgroup cols="4" colsep="0" rowsep="0">
22246 <colspec colwidth="8*" align="left"/>
22247 <colspec colwidth="6*" align="center"/>
22248 <colspec colwidth="6*" align="center"/>
22249 <colspec colwidth="6*" align="right"/>
22250 <tbody>
22251 <row>
22252 <entry><option>acl_smtp_mail</option></entry>
22253 <entry>Use: <emphasis>main</emphasis></entry>
22254 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22255 <entry>Default: <emphasis>unset</emphasis></entry>
22256 </row>
22257 </tbody>
22258 </tgroup>
22259 </informaltable>
22260 <para>
22261 <indexterm role="concept">
22262 <primary>MAIL</primary>
22263 <secondary>ACL for</secondary>
22264 </indexterm>
22265 This option defines the ACL that is run when an SMTP MAIL command is
22266 received. See chapter <xref linkend="CHAPACL"/> for further details.
22267 </para>
22268 <para>
22269 <indexterm role="option">
22270 <primary><option>acl_smtp_mailauth</option></primary>
22271 </indexterm>
22272 </para>
22273 <informaltable frame="all">
22274 <tgroup cols="4" colsep="0" rowsep="0">
22275 <colspec colwidth="8*" align="left"/>
22276 <colspec colwidth="6*" align="center"/>
22277 <colspec colwidth="6*" align="center"/>
22278 <colspec colwidth="6*" align="right"/>
22279 <tbody>
22280 <row>
22281 <entry><option>acl_smtp_mailauth</option></entry>
22282 <entry>Use: <emphasis>main</emphasis></entry>
22283 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22284 <entry>Default: <emphasis>unset</emphasis></entry>
22285 </row>
22286 </tbody>
22287 </tgroup>
22288 </informaltable>
22289 <para>
22290 <indexterm role="concept">
22291 <primary>AUTH</primary>
22292 <secondary>on MAIL command</secondary>
22293 </indexterm>
22294 This option defines the ACL that is run when there is an AUTH parameter on
22295 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22296 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22297 </para>
22298 <para>
22299 <indexterm role="option">
22300 <primary><option>acl_smtp_mime</option></primary>
22301 </indexterm>
22302 </para>
22303 <informaltable frame="all">
22304 <tgroup cols="4" colsep="0" rowsep="0">
22305 <colspec colwidth="8*" align="left"/>
22306 <colspec colwidth="6*" align="center"/>
22307 <colspec colwidth="6*" align="center"/>
22308 <colspec colwidth="6*" align="right"/>
22309 <tbody>
22310 <row>
22311 <entry><option>acl_smtp_mime</option></entry>
22312 <entry>Use: <emphasis>main</emphasis></entry>
22313 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22314 <entry>Default: <emphasis>unset</emphasis></entry>
22315 </row>
22316 </tbody>
22317 </tgroup>
22318 </informaltable>
22319 <para>
22320 <indexterm role="concept">
22321 <primary>MIME content scanning</primary>
22322 <secondary>ACL for</secondary>
22323 </indexterm>
22324 This option is available when Exim is built with the content-scanning
22325 extension. It defines the ACL that is run for each MIME part in a message. See
22326 section <xref linkend="SECTscanmimepart"/> for details.
22327 </para>
22328 <para revisionflag="changed">
22329 <indexterm role="option">
22330 <primary><option>acl_smtp_notquit</option></primary>
22331 </indexterm>
22332 </para>
22333 <informaltable frame="all" revisionflag="changed">
22334 <tgroup cols="4" colsep="0" rowsep="0">
22335 <colspec colwidth="8*" align="left"/>
22336 <colspec colwidth="6*" align="center"/>
22337 <colspec colwidth="6*" align="center"/>
22338 <colspec colwidth="6*" align="right"/>
22339 <tbody>
22340 <row>
22341 <entry><option>acl_smtp_notquit</option></entry>
22342 <entry>Use: <emphasis>main</emphasis></entry>
22343 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22344 <entry>Default: <emphasis>unset</emphasis></entry>
22345 </row>
22346 </tbody>
22347 </tgroup>
22348 </informaltable>
22349 <para revisionflag="changed">
22350 <indexterm role="concept">
22351 <primary>not-QUIT, ACL for</primary>
22352 </indexterm>
22353 This option defines the ACL that is run when an SMTP session
22354 ends without a QUIT command being received.
22355 See chapter <xref linkend="CHAPACL"/> for further details.
22356 </para>
22357 <para>
22358 <indexterm role="option">
22359 <primary><option>acl_smtp_predata</option></primary>
22360 </indexterm>
22361 </para>
22362 <informaltable frame="all">
22363 <tgroup cols="4" colsep="0" rowsep="0">
22364 <colspec colwidth="8*" align="left"/>
22365 <colspec colwidth="6*" align="center"/>
22366 <colspec colwidth="6*" align="center"/>
22367 <colspec colwidth="6*" align="right"/>
22368 <tbody>
22369 <row>
22370 <entry><option>acl_smtp_predata</option></entry>
22371 <entry>Use: <emphasis>main</emphasis></entry>
22372 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22373 <entry>Default: <emphasis>unset</emphasis></entry>
22374 </row>
22375 </tbody>
22376 </tgroup>
22377 </informaltable>
22378 <para>
22379 This option defines the ACL that is run when an SMTP DATA command is
22380 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22381 further details.
22382 </para>
22383 <para>
22384 <indexterm role="option">
22385 <primary><option>acl_smtp_quit</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>acl_smtp_quit</option></entry>
22397 <entry>Use: <emphasis>main</emphasis></entry>
22398 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22399 <entry>Default: <emphasis>unset</emphasis></entry>
22400 </row>
22401 </tbody>
22402 </tgroup>
22403 </informaltable>
22404 <para>
22405 <indexterm role="concept">
22406 <primary>QUIT, ACL for</primary>
22407 </indexterm>
22408 This option defines the ACL that is run when an SMTP QUIT command is
22409 received. See chapter <xref linkend="CHAPACL"/> for further details.
22410 </para>
22411 <para>
22412 <indexterm role="option">
22413 <primary><option>acl_smtp_rcpt</option></primary>
22414 </indexterm>
22415 </para>
22416 <informaltable frame="all">
22417 <tgroup cols="4" colsep="0" rowsep="0">
22418 <colspec colwidth="8*" align="left"/>
22419 <colspec colwidth="6*" align="center"/>
22420 <colspec colwidth="6*" align="center"/>
22421 <colspec colwidth="6*" align="right"/>
22422 <tbody>
22423 <row>
22424 <entry><option>acl_smtp_rcpt</option></entry>
22425 <entry>Use: <emphasis>main</emphasis></entry>
22426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22427 <entry>Default: <emphasis>unset</emphasis></entry>
22428 </row>
22429 </tbody>
22430 </tgroup>
22431 </informaltable>
22432 <para>
22433 <indexterm role="concept">
22434 <primary>RCPT</primary>
22435 <secondary>ACL for</secondary>
22436 </indexterm>
22437 This option defines the ACL that is run when an SMTP RCPT command is
22438 received. See chapter <xref linkend="CHAPACL"/> for further details.
22439 </para>
22440 <para>
22441 <indexterm role="option">
22442 <primary><option>acl_smtp_starttls</option></primary>
22443 </indexterm>
22444 </para>
22445 <informaltable frame="all">
22446 <tgroup cols="4" colsep="0" rowsep="0">
22447 <colspec colwidth="8*" align="left"/>
22448 <colspec colwidth="6*" align="center"/>
22449 <colspec colwidth="6*" align="center"/>
22450 <colspec colwidth="6*" align="right"/>
22451 <tbody>
22452 <row>
22453 <entry><option>acl_smtp_starttls</option></entry>
22454 <entry>Use: <emphasis>main</emphasis></entry>
22455 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22456 <entry>Default: <emphasis>unset</emphasis></entry>
22457 </row>
22458 </tbody>
22459 </tgroup>
22460 </informaltable>
22461 <para>
22462 <indexterm role="concept">
22463 <primary>STARTTLS, ACL for</primary>
22464 </indexterm>
22465 This option defines the ACL that is run when an SMTP STARTTLS command is
22466 received. See chapter <xref linkend="CHAPACL"/> for further details.
22467 </para>
22468 <para>
22469 <indexterm role="option">
22470 <primary><option>acl_smtp_vrfy</option></primary>
22471 </indexterm>
22472 </para>
22473 <informaltable frame="all">
22474 <tgroup cols="4" colsep="0" rowsep="0">
22475 <colspec colwidth="8*" align="left"/>
22476 <colspec colwidth="6*" align="center"/>
22477 <colspec colwidth="6*" align="center"/>
22478 <colspec colwidth="6*" align="right"/>
22479 <tbody>
22480 <row>
22481 <entry><option>acl_smtp_vrfy</option></entry>
22482 <entry>Use: <emphasis>main</emphasis></entry>
22483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22484 <entry>Default: <emphasis>unset</emphasis></entry>
22485 </row>
22486 </tbody>
22487 </tgroup>
22488 </informaltable>
22489 <para>
22490 <indexterm role="concept">
22491 <primary>VRFY</primary>
22492 <secondary>ACL for</secondary>
22493 </indexterm>
22494 This option defines the ACL that is run when an SMTP VRFY command is
22495 received. See chapter <xref linkend="CHAPACL"/> for further details.
22496 </para>
22497 <para revisionflag="changed">
22498 <indexterm role="option">
22499 <primary><option>add_environment</option></primary>
22500 </indexterm>
22501 </para>
22502 <informaltable frame="all" revisionflag="changed">
22503 <tgroup cols="4" colsep="0" rowsep="0">
22504 <colspec colwidth="8*" align="left"/>
22505 <colspec colwidth="6*" align="center"/>
22506 <colspec colwidth="6*" align="center"/>
22507 <colspec colwidth="6*" align="right"/>
22508 <tbody>
22509 <row>
22510 <entry><option>add_environment</option></entry>
22511 <entry>Use: <emphasis>main</emphasis></entry>
22512 <entry>Type: <emphasis>string list</emphasis></entry>
22513 <entry>Default: <emphasis>empty</emphasis></entry>
22514 </row>
22515 </tbody>
22516 </tgroup>
22517 </informaltable>
22518 <para revisionflag="changed">
22519 <indexterm role="concept">
22520 <primary>environment</primary>
22521 <secondary>inherited</secondary>
22522 </indexterm>
22523 This option allows to set individual environment variables that the
22524 currently linked libraries and programs in child processes use. The
22525 default list is empty,
22526 </para>
22527 <para>
22528 <indexterm role="option">
22529 <primary><option>admin_groups</option></primary>
22530 </indexterm>
22531 </para>
22532 <informaltable frame="all">
22533 <tgroup cols="4" colsep="0" rowsep="0">
22534 <colspec colwidth="8*" align="left"/>
22535 <colspec colwidth="6*" align="center"/>
22536 <colspec colwidth="6*" align="center"/>
22537 <colspec colwidth="6*" align="right"/>
22538 <tbody>
22539 <row>
22540 <entry><option>admin_groups</option></entry>
22541 <entry>Use: <emphasis>main</emphasis></entry>
22542 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22543 <entry>Default: <emphasis>unset</emphasis></entry>
22544 </row>
22545 </tbody>
22546 </tgroup>
22547 </informaltable>
22548 <para>
22549 <indexterm role="concept">
22550 <primary>admin user</primary>
22551 </indexterm>
22552 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22553 current group or any of the supplementary groups of an Exim caller is in this
22554 colon-separated list, the caller has admin privileges. If all your system
22555 programmers are in a specific group, for example, you can give them all Exim
22556 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22557 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22558 To permit this, you have to add individuals to the Exim group.
22559 </para>
22560 <para>
22561 <indexterm role="option">
22562 <primary><option>allow_domain_literals</option></primary>
22563 </indexterm>
22564 </para>
22565 <informaltable frame="all">
22566 <tgroup cols="4" colsep="0" rowsep="0">
22567 <colspec colwidth="8*" align="left"/>
22568 <colspec colwidth="6*" align="center"/>
22569 <colspec colwidth="6*" align="center"/>
22570 <colspec colwidth="6*" align="right"/>
22571 <tbody>
22572 <row>
22573 <entry><option>allow_domain_literals</option></entry>
22574 <entry>Use: <emphasis>main</emphasis></entry>
22575 <entry>Type: <emphasis>boolean</emphasis></entry>
22576 <entry>Default: <emphasis>false</emphasis></entry>
22577 </row>
22578 </tbody>
22579 </tgroup>
22580 </informaltable>
22581 <para>
22582 <indexterm role="concept">
22583 <primary>domain literal</primary>
22584 </indexterm>
22585 If this option is set, the RFC 2822 domain literal format is permitted in
22586 email addresses. The option is not set by default, because the domain literal
22587 format is not normally required these days, and few people know about it. It
22588 has, however, been exploited by mail abusers.
22589 </para>
22590 <para>
22591 Unfortunately, it seems that some DNS black list maintainers are using this
22592 format to report black listing to postmasters. If you want to accept messages
22593 addressed to your hosts by IP address, you need to set
22594 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22595 domains (defined in the named domain list <option>local_domains</option> in the default
22596 configuration). This <quote>magic string</quote> matches the domain literal form of all
22597 the local host&#x2019;s IP addresses.
22598 </para>
22599 <para>
22600 <indexterm role="option">
22601 <primary><option>allow_mx_to_ip</option></primary>
22602 </indexterm>
22603 </para>
22604 <informaltable frame="all">
22605 <tgroup cols="4" colsep="0" rowsep="0">
22606 <colspec colwidth="8*" align="left"/>
22607 <colspec colwidth="6*" align="center"/>
22608 <colspec colwidth="6*" align="center"/>
22609 <colspec colwidth="6*" align="right"/>
22610 <tbody>
22611 <row>
22612 <entry><option>allow_mx_to_ip</option></entry>
22613 <entry>Use: <emphasis>main</emphasis></entry>
22614 <entry>Type: <emphasis>boolean</emphasis></entry>
22615 <entry>Default: <emphasis>false</emphasis></entry>
22616 </row>
22617 </tbody>
22618 </tgroup>
22619 </informaltable>
22620 <para>
22621 <indexterm role="concept">
22622 <primary>MX record</primary>
22623 <secondary>pointing to IP address</secondary>
22624 </indexterm>
22625 It appears that more and more DNS zone administrators are breaking the rules
22626 and putting domain names that look like IP addresses on the right hand side of
22627 MX records. Exim follows the rules and rejects this, giving an error message
22628 that explains the misconfiguration. However, some other MTAs support this
22629 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22630 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22631 recommended, except when you have no other choice.
22632 </para>
22633 <para>
22634 <indexterm role="option">
22635 <primary><option>allow_utf8_domains</option></primary>
22636 </indexterm>
22637 </para>
22638 <informaltable frame="all">
22639 <tgroup cols="4" colsep="0" rowsep="0">
22640 <colspec colwidth="8*" align="left"/>
22641 <colspec colwidth="6*" align="center"/>
22642 <colspec colwidth="6*" align="center"/>
22643 <colspec colwidth="6*" align="right"/>
22644 <tbody>
22645 <row>
22646 <entry><option>allow_utf8_domains</option></entry>
22647 <entry>Use: <emphasis>main</emphasis></entry>
22648 <entry>Type: <emphasis>boolean</emphasis></entry>
22649 <entry>Default: <emphasis>false</emphasis></entry>
22650 </row>
22651 </tbody>
22652 </tgroup>
22653 </informaltable>
22654 <para>
22655 <indexterm role="concept">
22656 <primary>domain</primary>
22657 <secondary>UTF-8 characters in</secondary>
22658 </indexterm>
22659 <indexterm role="concept">
22660 <primary>UTF-8</primary>
22661 <secondary>in domain name</secondary>
22662 </indexterm>
22663 Lots of discussion is going on about internationalized domain names. One
22664 camp is strongly in favour of just using UTF-8 characters, and it seems
22665 that at least two other MTAs permit this. This option allows Exim users to
22666 experiment if they wish.
22667 </para>
22668 <para>
22669 If it is set true, Exim&#x2019;s domain parsing function allows valid
22670 UTF-8 multicharacters to appear in domain name components, in addition to
22671 letters, digits, and hyphens. However, just setting this option is not
22672 enough; if you want to look up these domain names in the DNS, you must also
22673 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
22674 suitable setting is:
22675 </para>
22676 <literallayout class="monospaced">
22677 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
22678   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
22679 </literallayout>
22680 <para>
22681 Alternatively, you can just disable this feature by setting
22682 </para>
22683 <literallayout class="monospaced">
22684 dns_check_names_pattern =
22685 </literallayout>
22686 <para>
22687 That is, set the option to an empty string so that no check is done.
22688 </para>
22689 <para>
22690 <indexterm role="option">
22691 <primary><option>auth_advertise_hosts</option></primary>
22692 </indexterm>
22693 </para>
22694 <informaltable frame="all">
22695 <tgroup cols="4" colsep="0" rowsep="0">
22696 <colspec colwidth="8*" align="left"/>
22697 <colspec colwidth="6*" align="center"/>
22698 <colspec colwidth="6*" align="center"/>
22699 <colspec colwidth="6*" align="right"/>
22700 <tbody>
22701 <row>
22702 <entry><option>auth_advertise_hosts</option></entry>
22703 <entry>Use: <emphasis>main</emphasis></entry>
22704 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22705 <entry>Default: <emphasis>*</emphasis></entry>
22706 </row>
22707 </tbody>
22708 </tgroup>
22709 </informaltable>
22710 <para>
22711 <indexterm role="concept">
22712 <primary>authentication</primary>
22713 <secondary>advertising</secondary>
22714 </indexterm>
22715 <indexterm role="concept">
22716 <primary>AUTH</primary>
22717 <secondary>advertising</secondary>
22718 </indexterm>
22719 If any server authentication mechanisms are configured, Exim advertises them in
22720 response to an EHLO command only if the calling host matches this list.
22721 Otherwise, Exim does not advertise AUTH.
22722 Exim does not accept AUTH commands from clients to which it has not
22723 advertised the availability of AUTH. The advertising of individual
22724 authentication mechanisms can be controlled by the use of the
22725 <option>server_advertise_condition</option> generic authenticator option on the individual
22726 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
22727 </para>
22728 <para>
22729 Certain mail clients (for example, Netscape) require the user to provide a name
22730 and password for authentication if AUTH is advertised, even though it may
22731 not be needed (the host may accept messages from hosts on its local LAN without
22732 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
22733 to make these clients more friendly by excluding them from the set of hosts to
22734 which Exim advertises AUTH.
22735 </para>
22736 <para>
22737 <indexterm role="concept">
22738 <primary>AUTH</primary>
22739 <secondary>advertising when encrypted</secondary>
22740 </indexterm>
22741 If you want to advertise the availability of AUTH only when the connection
22742 is encrypted using TLS, you can make use of the fact that the value of this
22743 option is expanded, with a setting like this:
22744 </para>
22745 <literallayout class="monospaced">
22746 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
22747 </literallayout>
22748 <para>
22749 <indexterm role="variable">
22750 <primary><varname>$tls_in_cipher</varname></primary>
22751 </indexterm>
22752 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
22753 the expansion is empty, thus matching no hosts. Otherwise, the result of the
22754 expansion is *, which matches all hosts.
22755 </para>
22756 <para>
22757 <indexterm role="option">
22758 <primary><option>auto_thaw</option></primary>
22759 </indexterm>
22760 </para>
22761 <informaltable frame="all">
22762 <tgroup cols="4" colsep="0" rowsep="0">
22763 <colspec colwidth="8*" align="left"/>
22764 <colspec colwidth="6*" align="center"/>
22765 <colspec colwidth="6*" align="center"/>
22766 <colspec colwidth="6*" align="right"/>
22767 <tbody>
22768 <row>
22769 <entry><option>auto_thaw</option></entry>
22770 <entry>Use: <emphasis>main</emphasis></entry>
22771 <entry>Type: <emphasis>time</emphasis></entry>
22772 <entry>Default: <emphasis>0s</emphasis></entry>
22773 </row>
22774 </tbody>
22775 </tgroup>
22776 </informaltable>
22777 <para>
22778 <indexterm role="concept">
22779 <primary>thawing messages</primary>
22780 </indexterm>
22781 <indexterm role="concept">
22782 <primary>unfreezing messages</primary>
22783 </indexterm>
22784 If this option is set to a time greater than zero, a queue runner will try a
22785 new delivery attempt on any frozen message, other than a bounce message, if
22786 this much time has passed since it was frozen. This may result in the message
22787 being re-frozen if nothing has changed since the last attempt. It is a way of
22788 saying <quote>keep on trying, even though there are big problems</quote>.
22789 </para>
22790 <para>
22791 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
22792 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
22793 thought to be very useful any more, and its use should probably be avoided.
22794 </para>
22795 <para>
22796 <indexterm role="option">
22797 <primary><option>av_scanner</option></primary>
22798 </indexterm>
22799 </para>
22800 <informaltable frame="all">
22801 <tgroup cols="4" colsep="0" rowsep="0">
22802 <colspec colwidth="8*" align="left"/>
22803 <colspec colwidth="6*" align="center"/>
22804 <colspec colwidth="6*" align="center"/>
22805 <colspec colwidth="6*" align="right"/>
22806 <tbody>
22807 <row>
22808 <entry><option>av_scanner</option></entry>
22809 <entry>Use: <emphasis>main</emphasis></entry>
22810 <entry>Type: <emphasis>string</emphasis></entry>
22811 <entry>Default: <emphasis>see below</emphasis></entry>
22812 </row>
22813 </tbody>
22814 </tgroup>
22815 </informaltable>
22816 <para>
22817 This option is available if Exim is built with the content-scanning extension.
22818 It specifies which anti-virus scanner to use. The default value is:
22819 </para>
22820 <literallayout class="monospaced">
22821 sophie:/var/run/sophie
22822 </literallayout>
22823 <para>
22824 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
22825 before use. See section <xref linkend="SECTscanvirus"/> for further details.
22826 </para>
22827 <para>
22828 <indexterm role="option">
22829 <primary><option>bi_command</option></primary>
22830 </indexterm>
22831 </para>
22832 <informaltable frame="all">
22833 <tgroup cols="4" colsep="0" rowsep="0">
22834 <colspec colwidth="8*" align="left"/>
22835 <colspec colwidth="6*" align="center"/>
22836 <colspec colwidth="6*" align="center"/>
22837 <colspec colwidth="6*" align="right"/>
22838 <tbody>
22839 <row>
22840 <entry><option>bi_command</option></entry>
22841 <entry>Use: <emphasis>main</emphasis></entry>
22842 <entry>Type: <emphasis>string</emphasis></entry>
22843 <entry>Default: <emphasis>unset</emphasis></entry>
22844 </row>
22845 </tbody>
22846 </tgroup>
22847 </informaltable>
22848 <para>
22849 <indexterm role="option">
22850 <primary><option>-bi</option></primary>
22851 </indexterm>
22852 This option supplies the name of a command that is run when Exim is called with
22853 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
22854 just the command name, it is not a complete command line. If an argument is
22855 required, it must come from the <option>-oA</option> command line option.
22856 </para>
22857 <para>
22858 <indexterm role="option">
22859 <primary><option>bounce_message_file</option></primary>
22860 </indexterm>
22861 </para>
22862 <informaltable frame="all">
22863 <tgroup cols="4" colsep="0" rowsep="0">
22864 <colspec colwidth="8*" align="left"/>
22865 <colspec colwidth="6*" align="center"/>
22866 <colspec colwidth="6*" align="center"/>
22867 <colspec colwidth="6*" align="right"/>
22868 <tbody>
22869 <row>
22870 <entry><option>bounce_message_file</option></entry>
22871 <entry>Use: <emphasis>main</emphasis></entry>
22872 <entry>Type: <emphasis>string</emphasis></entry>
22873 <entry>Default: <emphasis>unset</emphasis></entry>
22874 </row>
22875 </tbody>
22876 </tgroup>
22877 </informaltable>
22878 <para>
22879 <indexterm role="concept">
22880 <primary>bounce message</primary>
22881 <secondary>customizing</secondary>
22882 </indexterm>
22883 <indexterm role="concept">
22884 <primary>customizing</primary>
22885 <secondary>bounce message</secondary>
22886 </indexterm>
22887 This option defines a template file containing paragraphs of text to be used
22888 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22889 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22890 </para>
22891 <para>
22892 <indexterm role="option">
22893 <primary><option>bounce_message_text</option></primary>
22894 </indexterm>
22895 </para>
22896 <informaltable frame="all">
22897 <tgroup cols="4" colsep="0" rowsep="0">
22898 <colspec colwidth="8*" align="left"/>
22899 <colspec colwidth="6*" align="center"/>
22900 <colspec colwidth="6*" align="center"/>
22901 <colspec colwidth="6*" align="right"/>
22902 <tbody>
22903 <row>
22904 <entry><option>bounce_message_text</option></entry>
22905 <entry>Use: <emphasis>main</emphasis></entry>
22906 <entry>Type: <emphasis>string</emphasis></entry>
22907 <entry>Default: <emphasis>unset</emphasis></entry>
22908 </row>
22909 </tbody>
22910 </tgroup>
22911 </informaltable>
22912 <para>
22913 When this option is set, its contents are included in the default bounce
22914 message immediately after <quote>This message was created automatically by mail
22915 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22916 </para>
22917 <para>
22918 <indexterm role="option">
22919 <primary><option>bounce_return_body</option></primary>
22920 </indexterm>
22921 </para>
22922 <informaltable frame="all">
22923 <tgroup cols="4" colsep="0" rowsep="0">
22924 <colspec colwidth="8*" align="left"/>
22925 <colspec colwidth="6*" align="center"/>
22926 <colspec colwidth="6*" align="center"/>
22927 <colspec colwidth="6*" align="right"/>
22928 <tbody>
22929 <row>
22930 <entry><option>bounce_return_body</option></entry>
22931 <entry>Use: <emphasis>main</emphasis></entry>
22932 <entry>Type: <emphasis>boolean</emphasis></entry>
22933 <entry>Default: <emphasis>true</emphasis></entry>
22934 </row>
22935 </tbody>
22936 </tgroup>
22937 </informaltable>
22938 <para>
22939 <indexterm role="concept">
22940 <primary>bounce message</primary>
22941 <secondary>including body</secondary>
22942 </indexterm>
22943 This option controls whether the body of an incoming message is included in a
22944 bounce message when <option>bounce_return_message</option> is true. The default setting
22945 causes the entire message, both header and body, to be returned (subject to the
22946 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22947 message header is included. In the case of a non-SMTP message containing an
22948 error that is detected during reception, only those header lines preceding the
22949 point at which the error was detected are returned.
22950 <indexterm role="concept">
22951 <primary>bounce message</primary>
22952 <secondary>including original</secondary>
22953 </indexterm>
22954 </para>
22955 <para>
22956 <indexterm role="option">
22957 <primary><option>bounce_return_message</option></primary>
22958 </indexterm>
22959 </para>
22960 <informaltable frame="all">
22961 <tgroup cols="4" colsep="0" rowsep="0">
22962 <colspec colwidth="8*" align="left"/>
22963 <colspec colwidth="6*" align="center"/>
22964 <colspec colwidth="6*" align="center"/>
22965 <colspec colwidth="6*" align="right"/>
22966 <tbody>
22967 <row>
22968 <entry><option>bounce_return_message</option></entry>
22969 <entry>Use: <emphasis>main</emphasis></entry>
22970 <entry>Type: <emphasis>boolean</emphasis></entry>
22971 <entry>Default: <emphasis>true</emphasis></entry>
22972 </row>
22973 </tbody>
22974 </tgroup>
22975 </informaltable>
22976 <para>
22977 If this option is set false, none of the original message is included in
22978 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22979 <option>bounce_return_body</option>.
22980 </para>
22981 <para>
22982 <indexterm role="option">
22983 <primary><option>bounce_return_size_limit</option></primary>
22984 </indexterm>
22985 </para>
22986 <informaltable frame="all">
22987 <tgroup cols="4" colsep="0" rowsep="0">
22988 <colspec colwidth="8*" align="left"/>
22989 <colspec colwidth="6*" align="center"/>
22990 <colspec colwidth="6*" align="center"/>
22991 <colspec colwidth="6*" align="right"/>
22992 <tbody>
22993 <row>
22994 <entry><option>bounce_return_size_limit</option></entry>
22995 <entry>Use: <emphasis>main</emphasis></entry>
22996 <entry>Type: <emphasis>integer</emphasis></entry>
22997 <entry>Default: <emphasis>100K</emphasis></entry>
22998 </row>
22999 </tbody>
23000 </tgroup>
23001 </informaltable>
23002 <para>
23003 <indexterm role="concept">
23004 <primary>size</primary>
23005 <secondary>of bounce, limit</secondary>
23006 </indexterm>
23007 <indexterm role="concept">
23008 <primary>bounce message</primary>
23009 <secondary>size limit</secondary>
23010 </indexterm>
23011 <indexterm role="concept">
23012 <primary>limit</primary>
23013 <secondary>bounce message size</secondary>
23014 </indexterm>
23015 This option sets a limit in bytes on the size of messages that are returned to
23016 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
23017 limit should be less than the value of the global <option>message_size_limit</option> and of
23018 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
23019 that Exim generates. If this option is set to zero there is no limit.
23020 </para>
23021 <para>
23022 When the body of any message that is to be included in a bounce message is
23023 greater than the limit, it is truncated, and a comment pointing this out is
23024 added at the top. The actual cutoff may be greater than the value given, owing
23025 to the use of buffering for transferring the message in chunks (typically 8K in
23026 size). The idea is to save bandwidth on those undeliverable 15-megabyte
23027 messages.
23028 </para>
23029 <para>
23030 <indexterm role="option">
23031 <primary><option>bounce_sender_authentication</option></primary>
23032 </indexterm>
23033 </para>
23034 <informaltable frame="all">
23035 <tgroup cols="4" colsep="0" rowsep="0">
23036 <colspec colwidth="8*" align="left"/>
23037 <colspec colwidth="6*" align="center"/>
23038 <colspec colwidth="6*" align="center"/>
23039 <colspec colwidth="6*" align="right"/>
23040 <tbody>
23041 <row>
23042 <entry><option>bounce_sender_authentication</option></entry>
23043 <entry>Use: <emphasis>main</emphasis></entry>
23044 <entry>Type: <emphasis>string</emphasis></entry>
23045 <entry>Default: <emphasis>unset</emphasis></entry>
23046 </row>
23047 </tbody>
23048 </tgroup>
23049 </informaltable>
23050 <para>
23051 <indexterm role="concept">
23052 <primary>bounce message</primary>
23053 <secondary>sender authentication</secondary>
23054 </indexterm>
23055 <indexterm role="concept">
23056 <primary>authentication</primary>
23057 <secondary>bounce message</secondary>
23058 </indexterm>
23059 <indexterm role="concept">
23060 <primary>AUTH</primary>
23061 <secondary>on bounce message</secondary>
23062 </indexterm>
23063 This option provides an authenticated sender address that is sent with any
23064 bounce messages generated by Exim that are sent over an authenticated SMTP
23065 connection. A typical setting might be:
23066 </para>
23067 <literallayout class="monospaced">
23068 bounce_sender_authentication = mailer-daemon@my.domain.example
23069 </literallayout>
23070 <para>
23071 which would cause bounce messages to be sent using the SMTP command:
23072 </para>
23073 <literallayout class="monospaced">
23074 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23075 </literallayout>
23076 <para>
23077 The value of <option>bounce_sender_authentication</option> must always be a complete email
23078 address.
23079 </para>
23080 <para>
23081 <indexterm role="option">
23082 <primary><option>callout_domain_negative_expire</option></primary>
23083 </indexterm>
23084 </para>
23085 <informaltable frame="all">
23086 <tgroup cols="4" colsep="0" rowsep="0">
23087 <colspec colwidth="8*" align="left"/>
23088 <colspec colwidth="6*" align="center"/>
23089 <colspec colwidth="6*" align="center"/>
23090 <colspec colwidth="6*" align="right"/>
23091 <tbody>
23092 <row>
23093 <entry><option>callout_domain_negative_expire</option></entry>
23094 <entry>Use: <emphasis>main</emphasis></entry>
23095 <entry>Type: <emphasis>time</emphasis></entry>
23096 <entry>Default: <emphasis>3h</emphasis></entry>
23097 </row>
23098 </tbody>
23099 </tgroup>
23100 </informaltable>
23101 <para>
23102 <indexterm role="concept">
23103 <primary>caching</primary>
23104 <secondary>callout timeouts</secondary>
23105 </indexterm>
23106 <indexterm role="concept">
23107 <primary>callout</primary>
23108 <secondary>caching timeouts</secondary>
23109 </indexterm>
23110 This option specifies the expiry time for negative callout cache data for a
23111 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23112 section <xref linkend="SECTcallvercache"/> for details of the caching.
23113 </para>
23114 <para>
23115 <indexterm role="option">
23116 <primary><option>callout_domain_positive_expire</option></primary>
23117 </indexterm>
23118 </para>
23119 <informaltable frame="all">
23120 <tgroup cols="4" colsep="0" rowsep="0">
23121 <colspec colwidth="8*" align="left"/>
23122 <colspec colwidth="6*" align="center"/>
23123 <colspec colwidth="6*" align="center"/>
23124 <colspec colwidth="6*" align="right"/>
23125 <tbody>
23126 <row>
23127 <entry><option>callout_domain_positive_expire</option></entry>
23128 <entry>Use: <emphasis>main</emphasis></entry>
23129 <entry>Type: <emphasis>time</emphasis></entry>
23130 <entry>Default: <emphasis>7d</emphasis></entry>
23131 </row>
23132 </tbody>
23133 </tgroup>
23134 </informaltable>
23135 <para>
23136 This option specifies the expiry time for positive callout cache data for a
23137 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23138 section <xref linkend="SECTcallvercache"/> for details of the caching.
23139 </para>
23140 <para>
23141 <indexterm role="option">
23142 <primary><option>callout_negative_expire</option></primary>
23143 </indexterm>
23144 </para>
23145 <informaltable frame="all">
23146 <tgroup cols="4" colsep="0" rowsep="0">
23147 <colspec colwidth="8*" align="left"/>
23148 <colspec colwidth="6*" align="center"/>
23149 <colspec colwidth="6*" align="center"/>
23150 <colspec colwidth="6*" align="right"/>
23151 <tbody>
23152 <row>
23153 <entry><option>callout_negative_expire</option></entry>
23154 <entry>Use: <emphasis>main</emphasis></entry>
23155 <entry>Type: <emphasis>time</emphasis></entry>
23156 <entry>Default: <emphasis>2h</emphasis></entry>
23157 </row>
23158 </tbody>
23159 </tgroup>
23160 </informaltable>
23161 <para>
23162 This option specifies the expiry time for negative callout cache data for an
23163 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23164 section <xref linkend="SECTcallvercache"/> for details of the caching.
23165 </para>
23166 <para>
23167 <indexterm role="option">
23168 <primary><option>callout_positive_expire</option></primary>
23169 </indexterm>
23170 </para>
23171 <informaltable frame="all">
23172 <tgroup cols="4" colsep="0" rowsep="0">
23173 <colspec colwidth="8*" align="left"/>
23174 <colspec colwidth="6*" align="center"/>
23175 <colspec colwidth="6*" align="center"/>
23176 <colspec colwidth="6*" align="right"/>
23177 <tbody>
23178 <row>
23179 <entry><option>callout_positive_expire</option></entry>
23180 <entry>Use: <emphasis>main</emphasis></entry>
23181 <entry>Type: <emphasis>time</emphasis></entry>
23182 <entry>Default: <emphasis>24h</emphasis></entry>
23183 </row>
23184 </tbody>
23185 </tgroup>
23186 </informaltable>
23187 <para>
23188 This option specifies the expiry time for positive callout cache data for an
23189 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23190 section <xref linkend="SECTcallvercache"/> for details of the caching.
23191 </para>
23192 <para>
23193 <indexterm role="option">
23194 <primary><option>callout_random_local_part</option></primary>
23195 </indexterm>
23196 </para>
23197 <informaltable frame="all">
23198 <tgroup cols="4" colsep="0" rowsep="0">
23199 <colspec colwidth="8*" align="left"/>
23200 <colspec colwidth="6*" align="center"/>
23201 <colspec colwidth="6*" align="center"/>
23202 <colspec colwidth="6*" align="right"/>
23203 <tbody>
23204 <row>
23205 <entry><option>callout_random_local_part</option></entry>
23206 <entry>Use: <emphasis>main</emphasis></entry>
23207 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23208 <entry>Default: <emphasis>see below</emphasis></entry>
23209 </row>
23210 </tbody>
23211 </tgroup>
23212 </informaltable>
23213 <para>
23214 This option defines the <quote>random</quote> local part that can be used as part of
23215 callout verification. The default value is
23216 </para>
23217 <literallayout class="monospaced">
23218 $primary_hostname-$tod_epoch-testing
23219 </literallayout>
23220 <para>
23221 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
23222 </para>
23223 <para>
23224 <indexterm role="option">
23225 <primary><option>check_log_inodes</option></primary>
23226 </indexterm>
23227 </para>
23228 <informaltable frame="all">
23229 <tgroup cols="4" colsep="0" rowsep="0">
23230 <colspec colwidth="8*" align="left"/>
23231 <colspec colwidth="6*" align="center"/>
23232 <colspec colwidth="6*" align="center"/>
23233 <colspec colwidth="6*" align="right"/>
23234 <tbody>
23235 <row>
23236 <entry><option>check_log_inodes</option></entry>
23237 <entry>Use: <emphasis>main</emphasis></entry>
23238 <entry>Type: <emphasis>integer</emphasis></entry>
23239 <entry>Default: <emphasis>0</emphasis></entry>
23240 </row>
23241 </tbody>
23242 </tgroup>
23243 </informaltable>
23244 <para>
23245 See <option>check_spool_space</option> below.
23246 </para>
23247 <para>
23248 <indexterm role="option">
23249 <primary><option>check_log_space</option></primary>
23250 </indexterm>
23251 </para>
23252 <informaltable frame="all">
23253 <tgroup cols="4" colsep="0" rowsep="0">
23254 <colspec colwidth="8*" align="left"/>
23255 <colspec colwidth="6*" align="center"/>
23256 <colspec colwidth="6*" align="center"/>
23257 <colspec colwidth="6*" align="right"/>
23258 <tbody>
23259 <row>
23260 <entry><option>check_log_space</option></entry>
23261 <entry>Use: <emphasis>main</emphasis></entry>
23262 <entry>Type: <emphasis>integer</emphasis></entry>
23263 <entry>Default: <emphasis>0</emphasis></entry>
23264 </row>
23265 </tbody>
23266 </tgroup>
23267 </informaltable>
23268 <para>
23269 See <option>check_spool_space</option> below.
23270 </para>
23271 <para>
23272 <indexterm role="option">
23273 <primary><option>check_rfc2047_length</option></primary>
23274 </indexterm>
23275 <indexterm role="concept">
23276 <primary>RFC 2047</primary>
23277 <secondary>disabling length check</secondary>
23278 </indexterm>
23279 <indexterm role="option">
23280 <primary><option>check_rfc2047_length</option></primary>
23281 </indexterm>
23282 </para>
23283 <informaltable frame="all">
23284 <tgroup cols="4" colsep="0" rowsep="0">
23285 <colspec colwidth="8*" align="left"/>
23286 <colspec colwidth="6*" align="center"/>
23287 <colspec colwidth="6*" align="center"/>
23288 <colspec colwidth="6*" align="right"/>
23289 <tbody>
23290 <row>
23291 <entry><option>check_rfc2047_length</option></entry>
23292 <entry>Use: <emphasis>main</emphasis></entry>
23293 <entry>Type: <emphasis>boolean</emphasis></entry>
23294 <entry>Default: <emphasis>true</emphasis></entry>
23295 </row>
23296 </tbody>
23297 </tgroup>
23298 </informaltable>
23299 <para>
23300 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
23301 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
23302 word; strings to be encoded that exceed this length are supposed to use
23303 multiple encoded words. By default, Exim does not recognize encoded words that
23304 exceed the maximum length. However, it seems that some software, in violation
23305 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
23306 set false, Exim recognizes encoded words of any length.
23307 </para>
23308 <para>
23309 <indexterm role="option">
23310 <primary><option>check_spool_inodes</option></primary>
23311 </indexterm>
23312 </para>
23313 <informaltable frame="all">
23314 <tgroup cols="4" colsep="0" rowsep="0">
23315 <colspec colwidth="8*" align="left"/>
23316 <colspec colwidth="6*" align="center"/>
23317 <colspec colwidth="6*" align="center"/>
23318 <colspec colwidth="6*" align="right"/>
23319 <tbody>
23320 <row>
23321 <entry><option>check_spool_inodes</option></entry>
23322 <entry>Use: <emphasis>main</emphasis></entry>
23323 <entry>Type: <emphasis>integer</emphasis></entry>
23324 <entry>Default: <emphasis>0</emphasis></entry>
23325 </row>
23326 </tbody>
23327 </tgroup>
23328 </informaltable>
23329 <para>
23330 See <option>check_spool_space</option> below.
23331 </para>
23332 <para>
23333 <indexterm role="option">
23334 <primary><option>check_spool_space</option></primary>
23335 </indexterm>
23336 </para>
23337 <informaltable frame="all">
23338 <tgroup cols="4" colsep="0" rowsep="0">
23339 <colspec colwidth="8*" align="left"/>
23340 <colspec colwidth="6*" align="center"/>
23341 <colspec colwidth="6*" align="center"/>
23342 <colspec colwidth="6*" align="right"/>
23343 <tbody>
23344 <row>
23345 <entry><option>check_spool_space</option></entry>
23346 <entry>Use: <emphasis>main</emphasis></entry>
23347 <entry>Type: <emphasis>integer</emphasis></entry>
23348 <entry>Default: <emphasis>0</emphasis></entry>
23349 </row>
23350 </tbody>
23351 </tgroup>
23352 </informaltable>
23353 <para>
23354 <indexterm role="concept">
23355 <primary>checking disk space</primary>
23356 </indexterm>
23357 <indexterm role="concept">
23358 <primary>disk space, checking</primary>
23359 </indexterm>
23360 <indexterm role="concept">
23361 <primary>spool directory</primary>
23362 <secondary>checking space</secondary>
23363 </indexterm>
23364 The four <option>check_...</option> options allow for checking of disk resources before a
23365 message is accepted.
23366 </para>
23367 <para>
23368 <indexterm role="variable">
23369 <primary><varname>$log_inodes</varname></primary>
23370 </indexterm>
23371 <indexterm role="variable">
23372 <primary><varname>$log_space</varname></primary>
23373 </indexterm>
23374 <indexterm role="variable">
23375 <primary><varname>$spool_inodes</varname></primary>
23376 </indexterm>
23377 <indexterm role="variable">
23378 <primary><varname>$spool_space</varname></primary>
23379 </indexterm>
23380 When any of these options are set, they apply to all incoming messages. If you
23381 want to apply different checks to different kinds of message, you can do so by
23382 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
23383 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
23384 </para>
23385 <para>
23386 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
23387 either value is greater than zero, for example:
23388 </para>
23389 <literallayout class="monospaced">
23390 check_spool_space = 10M
23391 check_spool_inodes = 100
23392 </literallayout>
23393 <para>
23394 The spool partition is the one that contains the directory defined by
23395 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
23396 transit.
23397 </para>
23398 <para>
23399 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
23400 files are written if either is greater than zero. These should be set only if
23401 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
23402 </para>
23403 <para>
23404 If there is less space or fewer inodes than requested, Exim refuses to accept
23405 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
23406 error response to the MAIL command. If ESMTP is in use and there was a
23407 SIZE parameter on the MAIL command, its value is added to the
23408 <option>check_spool_space</option> value, and the check is performed even if
23409 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
23410 </para>
23411 <para>
23412 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
23413 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
23414 </para>
23415 <para>
23416 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
23417 failure a message is written to stderr and Exim exits with a non-zero code, as
23418 it obviously cannot send an error message of any kind.
23419 </para>
23420 <para>
23421 <indexterm role="option">
23422 <primary><option>daemon_smtp_ports</option></primary>
23423 </indexterm>
23424 </para>
23425 <informaltable frame="all">
23426 <tgroup cols="4" colsep="0" rowsep="0">
23427 <colspec colwidth="8*" align="left"/>
23428 <colspec colwidth="6*" align="center"/>
23429 <colspec colwidth="6*" align="center"/>
23430 <colspec colwidth="6*" align="right"/>
23431 <tbody>
23432 <row>
23433 <entry><option>daemon_smtp_ports</option></entry>
23434 <entry>Use: <emphasis>main</emphasis></entry>
23435 <entry>Type: <emphasis>string</emphasis></entry>
23436 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
23437 </row>
23438 </tbody>
23439 </tgroup>
23440 </informaltable>
23441 <para>
23442 <indexterm role="concept">
23443 <primary>port</primary>
23444 <secondary>for daemon</secondary>
23445 </indexterm>
23446 <indexterm role="concept">
23447 <primary>TCP/IP</primary>
23448 <secondary>setting listening ports</secondary>
23449 </indexterm>
23450 This option specifies one or more default SMTP ports on which the Exim daemon
23451 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
23452 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23453 </para>
23454 <para>
23455 <indexterm role="option">
23456 <primary><option>daemon_startup_retries</option></primary>
23457 </indexterm>
23458 </para>
23459 <informaltable frame="all">
23460 <tgroup cols="4" colsep="0" rowsep="0">
23461 <colspec colwidth="8*" align="left"/>
23462 <colspec colwidth="6*" align="center"/>
23463 <colspec colwidth="6*" align="center"/>
23464 <colspec colwidth="6*" align="right"/>
23465 <tbody>
23466 <row>
23467 <entry><option>daemon_startup_retries</option></entry>
23468 <entry>Use: <emphasis>main</emphasis></entry>
23469 <entry>Type: <emphasis>integer</emphasis></entry>
23470 <entry>Default: <emphasis>9</emphasis></entry>
23471 </row>
23472 </tbody>
23473 </tgroup>
23474 </informaltable>
23475 <para>
23476 <indexterm role="concept">
23477 <primary>daemon startup, retrying</primary>
23478 </indexterm>
23479 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23480 the daemon at startup when it cannot immediately bind a listening socket
23481 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23482 defines the number of retries after the first failure, and
23483 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23484 </para>
23485 <para>
23486 <indexterm role="option">
23487 <primary><option>daemon_startup_sleep</option></primary>
23488 </indexterm>
23489 </para>
23490 <informaltable frame="all">
23491 <tgroup cols="4" colsep="0" rowsep="0">
23492 <colspec colwidth="8*" align="left"/>
23493 <colspec colwidth="6*" align="center"/>
23494 <colspec colwidth="6*" align="center"/>
23495 <colspec colwidth="6*" align="right"/>
23496 <tbody>
23497 <row>
23498 <entry><option>daemon_startup_sleep</option></entry>
23499 <entry>Use: <emphasis>main</emphasis></entry>
23500 <entry>Type: <emphasis>time</emphasis></entry>
23501 <entry>Default: <emphasis>30s</emphasis></entry>
23502 </row>
23503 </tbody>
23504 </tgroup>
23505 </informaltable>
23506 <para>
23507 See <option>daemon_startup_retries</option>.
23508 </para>
23509 <para>
23510 <indexterm role="option">
23511 <primary><option>delay_warning</option></primary>
23512 </indexterm>
23513 </para>
23514 <informaltable frame="all">
23515 <tgroup cols="4" colsep="0" rowsep="0">
23516 <colspec colwidth="8*" align="left"/>
23517 <colspec colwidth="6*" align="center"/>
23518 <colspec colwidth="6*" align="center"/>
23519 <colspec colwidth="6*" align="right"/>
23520 <tbody>
23521 <row>
23522 <entry><option>delay_warning</option></entry>
23523 <entry>Use: <emphasis>main</emphasis></entry>
23524 <entry>Type: <emphasis>time list</emphasis></entry>
23525 <entry>Default: <emphasis>24h</emphasis></entry>
23526 </row>
23527 </tbody>
23528 </tgroup>
23529 </informaltable>
23530 <para>
23531 <indexterm role="concept">
23532 <primary>warning of delay</primary>
23533 </indexterm>
23534 <indexterm role="concept">
23535 <primary>delay warning, specifying</primary>
23536 </indexterm>
23537 When a message is delayed, Exim sends a warning message to the sender at
23538 intervals specified by this option. The data is a colon-separated list of times
23539 after which to send warning messages. If the value of the option is an empty
23540 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23541 message has been on the queue for longer than the last time, the last interval
23542 between the times is used to compute subsequent warning times. For example,
23543 with
23544 </para>
23545 <literallayout class="monospaced">
23546 delay_warning = 4h:8h:24h
23547 </literallayout>
23548 <para>
23549 the first message is sent after 4 hours, the second after 8 hours, and
23550 the third one after 24 hours. After that, messages are sent every 16 hours,
23551 because that is the interval between the last two times on the list. If you set
23552 just one time, it specifies the repeat interval. For example, with:
23553 </para>
23554 <literallayout class="monospaced">
23555 delay_warning = 6h
23556 </literallayout>
23557 <para>
23558 messages are repeated every six hours. To stop warnings after a given time, set
23559 a very large time at the end of the list. For example:
23560 </para>
23561 <literallayout class="monospaced">
23562 delay_warning = 2h:12h:99d
23563 </literallayout>
23564 <para>
23565 Note that the option is only evaluated at the time a delivery attempt fails,
23566 which depends on retry and queue-runner configuration.
23567 Typically retries will be configured more frequently than warning messages.
23568 </para>
23569 <para>
23570 <indexterm role="option">
23571 <primary><option>delay_warning_condition</option></primary>
23572 </indexterm>
23573 </para>
23574 <informaltable frame="all">
23575 <tgroup cols="4" colsep="0" rowsep="0">
23576 <colspec colwidth="8*" align="left"/>
23577 <colspec colwidth="6*" align="center"/>
23578 <colspec colwidth="6*" align="center"/>
23579 <colspec colwidth="6*" align="right"/>
23580 <tbody>
23581 <row>
23582 <entry><option>delay_warning_condition</option></entry>
23583 <entry>Use: <emphasis>main</emphasis></entry>
23584 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23585 <entry>Default: <emphasis>see below</emphasis></entry>
23586 </row>
23587 </tbody>
23588 </tgroup>
23589 </informaltable>
23590 <para>
23591 <indexterm role="variable">
23592 <primary><varname>$domain</varname></primary>
23593 </indexterm>
23594 The string is expanded at the time a warning message might be sent. If all the
23595 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
23596 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
23597 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
23598 <quote>false</quote> (the comparison being done caselessly) then the warning message is
23599 not sent. The default is:
23600 </para>
23601 <literallayout class="monospaced">
23602 delay_warning_condition = ${if or {\
23603   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
23604   { match{$h_precedence:}{(?i)bulk|list|junk} }\
23605   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
23606   } {no}{yes}}
23607 </literallayout>
23608 <para>
23609 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
23610 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
23611 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
23612 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
23613 </para>
23614 <para>
23615 <indexterm role="option">
23616 <primary><option>deliver_drop_privilege</option></primary>
23617 </indexterm>
23618 </para>
23619 <informaltable frame="all">
23620 <tgroup cols="4" colsep="0" rowsep="0">
23621 <colspec colwidth="8*" align="left"/>
23622 <colspec colwidth="6*" align="center"/>
23623 <colspec colwidth="6*" align="center"/>
23624 <colspec colwidth="6*" align="right"/>
23625 <tbody>
23626 <row>
23627 <entry><option>deliver_drop_privilege</option></entry>
23628 <entry>Use: <emphasis>main</emphasis></entry>
23629 <entry>Type: <emphasis>boolean</emphasis></entry>
23630 <entry>Default: <emphasis>false</emphasis></entry>
23631 </row>
23632 </tbody>
23633 </tgroup>
23634 </informaltable>
23635 <para>
23636 <indexterm role="concept">
23637 <primary>unprivileged delivery</primary>
23638 </indexterm>
23639 <indexterm role="concept">
23640 <primary>delivery</primary>
23641 <secondary>unprivileged</secondary>
23642 </indexterm>
23643 If this option is set true, Exim drops its root privilege at the start of a
23644 delivery process, and runs as the Exim user throughout. This severely restricts
23645 the kinds of local delivery that are possible, but is viable in certain types
23646 of configuration. There is a discussion about the use of root privilege in
23647 chapter <xref linkend="CHAPsecurity"/>.
23648 </para>
23649 <para>
23650 <indexterm role="option">
23651 <primary><option>deliver_queue_load_max</option></primary>
23652 </indexterm>
23653 </para>
23654 <informaltable frame="all">
23655 <tgroup cols="4" colsep="0" rowsep="0">
23656 <colspec colwidth="8*" align="left"/>
23657 <colspec colwidth="6*" align="center"/>
23658 <colspec colwidth="6*" align="center"/>
23659 <colspec colwidth="6*" align="right"/>
23660 <tbody>
23661 <row>
23662 <entry><option>deliver_queue_load_max</option></entry>
23663 <entry>Use: <emphasis>main</emphasis></entry>
23664 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23665 <entry>Default: <emphasis>unset</emphasis></entry>
23666 </row>
23667 </tbody>
23668 </tgroup>
23669 </informaltable>
23670 <para>
23671 <indexterm role="concept">
23672 <primary>load average</primary>
23673 </indexterm>
23674 <indexterm role="concept">
23675 <primary>queue runner</primary>
23676 <secondary>abandoning</secondary>
23677 </indexterm>
23678 When this option is set, a queue run is abandoned if the system load average
23679 becomes greater than the value of the option. The option has no effect on
23680 ancient operating systems on which Exim cannot determine the load average.
23681 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
23682 </para>
23683 <para>
23684 <indexterm role="option">
23685 <primary><option>delivery_date_remove</option></primary>
23686 </indexterm>
23687 </para>
23688 <informaltable frame="all">
23689 <tgroup cols="4" colsep="0" rowsep="0">
23690 <colspec colwidth="8*" align="left"/>
23691 <colspec colwidth="6*" align="center"/>
23692 <colspec colwidth="6*" align="center"/>
23693 <colspec colwidth="6*" align="right"/>
23694 <tbody>
23695 <row>
23696 <entry><option>delivery_date_remove</option></entry>
23697 <entry>Use: <emphasis>main</emphasis></entry>
23698 <entry>Type: <emphasis>boolean</emphasis></entry>
23699 <entry>Default: <emphasis>true</emphasis></entry>
23700 </row>
23701 </tbody>
23702 </tgroup>
23703 </informaltable>
23704 <para>
23705 <indexterm role="concept">
23706 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
23707 </indexterm>
23708 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
23709 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23710 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
23711 should not be present in incoming messages, and this option causes them to be
23712 removed at the time the message is received, to avoid any problems that might
23713 occur when a delivered message is subsequently sent on to some other recipient.
23714 </para>
23715 <para>
23716 <indexterm role="option">
23717 <primary><option>disable_fsync</option></primary>
23718 </indexterm>
23719 </para>
23720 <informaltable frame="all">
23721 <tgroup cols="4" colsep="0" rowsep="0">
23722 <colspec colwidth="8*" align="left"/>
23723 <colspec colwidth="6*" align="center"/>
23724 <colspec colwidth="6*" align="center"/>
23725 <colspec colwidth="6*" align="right"/>
23726 <tbody>
23727 <row>
23728 <entry><option>disable_fsync</option></entry>
23729 <entry>Use: <emphasis>main</emphasis></entry>
23730 <entry>Type: <emphasis>boolean</emphasis></entry>
23731 <entry>Default: <emphasis>false</emphasis></entry>
23732 </row>
23733 </tbody>
23734 </tgroup>
23735 </informaltable>
23736 <para>
23737 <indexterm role="concept">
23738 <primary><function>fsync()</function>, disabling</primary>
23739 </indexterm>
23740 This option is available only if Exim was built with the compile-time option
23741 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
23742 a runtime configuration generates an <quote>unknown option</quote> error. You should not
23743 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
23744 really, really, really understand what you are doing. <emphasis>No pre-compiled
23745 distributions of Exim should ever make this option available.</emphasis>
23746 </para>
23747 <para>
23748 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
23749 updated files&#x2019; data to be written to disc before continuing. Unexpected events
23750 such as crashes and power outages may cause data to be lost or scrambled.
23751 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
23752 </para>
23753 <para>
23754 <indexterm role="option">
23755 <primary><option>disable_ipv6</option></primary>
23756 </indexterm>
23757 </para>
23758 <informaltable frame="all">
23759 <tgroup cols="4" colsep="0" rowsep="0">
23760 <colspec colwidth="8*" align="left"/>
23761 <colspec colwidth="6*" align="center"/>
23762 <colspec colwidth="6*" align="center"/>
23763 <colspec colwidth="6*" align="right"/>
23764 <tbody>
23765 <row>
23766 <entry><option>disable_ipv6</option></entry>
23767 <entry>Use: <emphasis>main</emphasis></entry>
23768 <entry>Type: <emphasis>boolean</emphasis></entry>
23769 <entry>Default: <emphasis>false</emphasis></entry>
23770 </row>
23771 </tbody>
23772 </tgroup>
23773 </informaltable>
23774 <para>
23775 <indexterm role="concept">
23776 <primary>IPv6</primary>
23777 <secondary>disabling</secondary>
23778 </indexterm>
23779 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
23780 activities take place. AAAA records are never looked up, and any IPv6 addresses
23781 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
23782 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23783 to handle IPv6 literal addresses.
23784 </para>
23785 <para revisionflag="changed">
23786 <indexterm role="option">
23787 <primary><option>dkim_verify_signers</option></primary>
23788 </indexterm>
23789 </para>
23790 <informaltable frame="all" revisionflag="changed">
23791 <tgroup cols="4" colsep="0" rowsep="0">
23792 <colspec colwidth="8*" align="left"/>
23793 <colspec colwidth="6*" align="center"/>
23794 <colspec colwidth="6*" align="center"/>
23795 <colspec colwidth="6*" align="right"/>
23796 <tbody>
23797 <row>
23798 <entry><option>dkim_verify_signers</option></entry>
23799 <entry>Use: <emphasis>main</emphasis></entry>
23800 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23801 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
23802 </row>
23803 </tbody>
23804 </tgroup>
23805 </informaltable>
23806 <para revisionflag="changed">
23807 <indexterm role="concept">
23808 <primary>DKIM</primary>
23809 <secondary>controlling calls to the ACL</secondary>
23810 </indexterm>
23811 This option gives a list of DKIM domains for which the DKIM ACL is run.
23812 It is expanded after the message is received; by default it runs
23813 the ACL once for each signature in the message.
23814 See chapter <xref linkend="CHAPdkim"/>.
23815 </para>
23816 <para>
23817 <indexterm role="option">
23818 <primary><option>dns_again_means_nonexist</option></primary>
23819 </indexterm>
23820 </para>
23821 <informaltable frame="all">
23822 <tgroup cols="4" colsep="0" rowsep="0">
23823 <colspec colwidth="8*" align="left"/>
23824 <colspec colwidth="6*" align="center"/>
23825 <colspec colwidth="6*" align="center"/>
23826 <colspec colwidth="6*" align="right"/>
23827 <tbody>
23828 <row>
23829 <entry><option>dns_again_means_nonexist</option></entry>
23830 <entry>Use: <emphasis>main</emphasis></entry>
23831 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23832 <entry>Default: <emphasis>unset</emphasis></entry>
23833 </row>
23834 </tbody>
23835 </tgroup>
23836 </informaltable>
23837 <para>
23838 <indexterm role="concept">
23839 <primary>DNS</primary>
23840 <secondary><quote>try again</quote> response; overriding</secondary>
23841 </indexterm>
23842 DNS lookups give a <quote>try again</quote> response for the DNS errors
23843 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
23844 keep trying to deliver a message, or to give repeated temporary errors to
23845 incoming mail. Sometimes the effect is caused by a badly set up name server and
23846 may persist for a long time. If a domain which exhibits this problem matches
23847 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
23848 This option should be used with care. You can make it apply to reverse lookups
23849 by a setting such as this:
23850 </para>
23851 <literallayout class="monospaced">
23852 dns_again_means_nonexist = *.in-addr.arpa
23853 </literallayout>
23854 <para>
23855 This option applies to all DNS lookups that Exim does. It also applies when the
23856 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
23857 since these are most likely to be caused by DNS lookup problems. The
23858 <command>dnslookup</command> router has some options of its own for controlling what happens
23859 when lookups for MX or SRV records give temporary errors. These more specific
23860 options are applied after this global option.
23861 </para>
23862 <para>
23863 <indexterm role="option">
23864 <primary><option>dns_check_names_pattern</option></primary>
23865 </indexterm>
23866 </para>
23867 <informaltable frame="all">
23868 <tgroup cols="4" colsep="0" rowsep="0">
23869 <colspec colwidth="8*" align="left"/>
23870 <colspec colwidth="6*" align="center"/>
23871 <colspec colwidth="6*" align="center"/>
23872 <colspec colwidth="6*" align="right"/>
23873 <tbody>
23874 <row>
23875 <entry><option>dns_check_names_pattern</option></entry>
23876 <entry>Use: <emphasis>main</emphasis></entry>
23877 <entry>Type: <emphasis>string</emphasis></entry>
23878 <entry>Default: <emphasis>see below</emphasis></entry>
23879 </row>
23880 </tbody>
23881 </tgroup>
23882 </informaltable>
23883 <para>
23884 <indexterm role="concept">
23885 <primary>DNS</primary>
23886 <secondary>pre-check of name syntax</secondary>
23887 </indexterm>
23888 When this option is set to a non-empty string, it causes Exim to check domain
23889 names for characters that are not allowed in host names before handing them to
23890 the DNS resolver, because some resolvers give temporary errors for names that
23891 contain unusual characters. If a domain name contains any unwanted characters,
23892 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
23893 done by matching the domain name against a regular expression, which is the
23894 value of this option. The default pattern is
23895 </para>
23896 <literallayout class="monospaced">
23897 dns_check_names_pattern = \
23898   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
23899 </literallayout>
23900 <para>
23901 which permits only letters, digits, slashes, and hyphens in components, but
23902 they must start and end with a letter or digit. Slashes are not, in fact,
23903 permitted in host names, but they are found in certain NS records (which can be
23904 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
23905 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
23906 empty string.
23907 </para>
23908 <para>
23909 <indexterm role="option">
23910 <primary><option>dns_csa_search_limit</option></primary>
23911 </indexterm>
23912 </para>
23913 <informaltable frame="all">
23914 <tgroup cols="4" colsep="0" rowsep="0">
23915 <colspec colwidth="8*" align="left"/>
23916 <colspec colwidth="6*" align="center"/>
23917 <colspec colwidth="6*" align="center"/>
23918 <colspec colwidth="6*" align="right"/>
23919 <tbody>
23920 <row>
23921 <entry><option>dns_csa_search_limit</option></entry>
23922 <entry>Use: <emphasis>main</emphasis></entry>
23923 <entry>Type: <emphasis>integer</emphasis></entry>
23924 <entry>Default: <emphasis>5</emphasis></entry>
23925 </row>
23926 </tbody>
23927 </tgroup>
23928 </informaltable>
23929 <para>
23930 This option controls the depth of parental searching for CSA SRV records in the
23931 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23932 </para>
23933 <para>
23934 <indexterm role="option">
23935 <primary><option>dns_csa_use_reverse</option></primary>
23936 </indexterm>
23937 </para>
23938 <informaltable frame="all">
23939 <tgroup cols="4" colsep="0" rowsep="0">
23940 <colspec colwidth="8*" align="left"/>
23941 <colspec colwidth="6*" align="center"/>
23942 <colspec colwidth="6*" align="center"/>
23943 <colspec colwidth="6*" align="right"/>
23944 <tbody>
23945 <row>
23946 <entry><option>dns_csa_use_reverse</option></entry>
23947 <entry>Use: <emphasis>main</emphasis></entry>
23948 <entry>Type: <emphasis>boolean</emphasis></entry>
23949 <entry>Default: <emphasis>true</emphasis></entry>
23950 </row>
23951 </tbody>
23952 </tgroup>
23953 </informaltable>
23954 <para>
23955 This option controls whether or not an IP address, given as a CSA domain, is
23956 reversed and looked up in the reverse DNS, as described in more detail in
23957 section <xref linkend="SECTverifyCSA"/>.
23958 </para>
23959 <para>
23960 <indexterm role="option">
23961 <primary><option>dns_dnssec_ok</option></primary>
23962 </indexterm>
23963 </para>
23964 <informaltable frame="all">
23965 <tgroup cols="4" colsep="0" rowsep="0">
23966 <colspec colwidth="8*" align="left"/>
23967 <colspec colwidth="6*" align="center"/>
23968 <colspec colwidth="6*" align="center"/>
23969 <colspec colwidth="6*" align="right"/>
23970 <tbody>
23971 <row>
23972 <entry><option>dns_dnssec_ok</option></entry>
23973 <entry>Use: <emphasis>main</emphasis></entry>
23974 <entry>Type: <emphasis>integer</emphasis></entry>
23975 <entry>Default: <emphasis>-1</emphasis></entry>
23976 </row>
23977 </tbody>
23978 </tgroup>
23979 </informaltable>
23980 <para>
23981 <indexterm role="concept">
23982 <primary>DNS</primary>
23983 <secondary>resolver options</secondary>
23984 </indexterm>
23985 <indexterm role="concept">
23986 <primary>DNS</primary>
23987 <secondary>DNSSEC</secondary>
23988 </indexterm>
23989 If this option is set to a non-negative number then Exim will initialise the
23990 DNS resolver library to either use or not use DNSSEC, overriding the system
23991 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23992 </para>
23993 <para>
23994 If the resolver library does not support DNSSEC then this option has no effect.
23995 </para>
23996 <para>
23997 <indexterm role="option">
23998 <primary><option>dns_ipv4_lookup</option></primary>
23999 </indexterm>
24000 </para>
24001 <informaltable frame="all">
24002 <tgroup cols="4" colsep="0" rowsep="0">
24003 <colspec colwidth="8*" align="left"/>
24004 <colspec colwidth="6*" align="center"/>
24005 <colspec colwidth="6*" align="center"/>
24006 <colspec colwidth="6*" align="right"/>
24007 <tbody>
24008 <row>
24009 <entry><option>dns_ipv4_lookup</option></entry>
24010 <entry>Use: <emphasis>main</emphasis></entry>
24011 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24012 <entry>Default: <emphasis>unset</emphasis></entry>
24013 </row>
24014 </tbody>
24015 </tgroup>
24016 </informaltable>
24017 <para>
24018 <indexterm role="concept">
24019 <primary>IPv6</primary>
24020 <secondary>DNS lookup for AAAA records</secondary>
24021 </indexterm>
24022 <indexterm role="concept">
24023 <primary>DNS</primary>
24024 <secondary>IPv6 lookup for AAAA records</secondary>
24025 </indexterm>
24026 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
24027 looks for IPv6 address records (AAAA records) as well as IPv4 address records
24028 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
24029 domain matches this list.
24030 </para>
24031 <para>
24032 This is a fudge to help with name servers that give big delays or otherwise do
24033 not work for the AAAA record type. In due course, when the world&#x2019;s name
24034 servers have all been upgraded, there should be no need for this option.
24035 </para>
24036 <para>
24037 <indexterm role="option">
24038 <primary><option>dns_retrans</option></primary>
24039 </indexterm>
24040 </para>
24041 <informaltable frame="all">
24042 <tgroup cols="4" colsep="0" rowsep="0">
24043 <colspec colwidth="8*" align="left"/>
24044 <colspec colwidth="6*" align="center"/>
24045 <colspec colwidth="6*" align="center"/>
24046 <colspec colwidth="6*" align="right"/>
24047 <tbody>
24048 <row>
24049 <entry><option>dns_retrans</option></entry>
24050 <entry>Use: <emphasis>main</emphasis></entry>
24051 <entry>Type: <emphasis>time</emphasis></entry>
24052 <entry>Default: <emphasis>0s</emphasis></entry>
24053 </row>
24054 </tbody>
24055 </tgroup>
24056 </informaltable>
24057 <para>
24058 <indexterm role="concept">
24059 <primary>DNS</primary>
24060 <secondary>resolver options</secondary>
24061 </indexterm>
24062 <indexterm role="concept">
24063 <primary>timeout</primary>
24064 <secondary>dns lookup</secondary>
24065 </indexterm>
24066 <indexterm role="concept">
24067 <primary>DNS</primary>
24068 <secondary>timeout</secondary>
24069 </indexterm>
24070 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
24071 retransmission and retry parameters for DNS lookups. Values of zero (the
24072 defaults) leave the system default settings unchanged. The first value is the
24073 time between retries, and the second is the number of retries. It isn&#x2019;t
24074 totally clear exactly how these settings affect the total time a DNS lookup may
24075 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
24076 parameter values are available in the external resolver interface structure,
24077 but nowhere does it seem to describe how they are used or what you might want
24078 to set in them.
24079 </para>
24080 <para revisionflag="changed">
24081 See also the <option>slow_lookup_log</option> option.
24082 </para>
24083 <para>
24084 <indexterm role="option">
24085 <primary><option>dns_retry</option></primary>
24086 </indexterm>
24087 </para>
24088 <informaltable frame="all">
24089 <tgroup cols="4" colsep="0" rowsep="0">
24090 <colspec colwidth="8*" align="left"/>
24091 <colspec colwidth="6*" align="center"/>
24092 <colspec colwidth="6*" align="center"/>
24093 <colspec colwidth="6*" align="right"/>
24094 <tbody>
24095 <row>
24096 <entry><option>dns_retry</option></entry>
24097 <entry>Use: <emphasis>main</emphasis></entry>
24098 <entry>Type: <emphasis>integer</emphasis></entry>
24099 <entry>Default: <emphasis>0</emphasis></entry>
24100 </row>
24101 </tbody>
24102 </tgroup>
24103 </informaltable>
24104 <para>
24105 See <option>dns_retrans</option> above.
24106 </para>
24107 <para revisionflag="changed">
24108 <indexterm role="option">
24109 <primary><option>dns_trust_aa</option></primary>
24110 </indexterm>
24111 </para>
24112 <informaltable frame="all" revisionflag="changed">
24113 <tgroup cols="4" colsep="0" rowsep="0">
24114 <colspec colwidth="8*" align="left"/>
24115 <colspec colwidth="6*" align="center"/>
24116 <colspec colwidth="6*" align="center"/>
24117 <colspec colwidth="6*" align="right"/>
24118 <tbody>
24119 <row>
24120 <entry><option>dns_trust_aa</option></entry>
24121 <entry>Use: <emphasis>main</emphasis></entry>
24122 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24123 <entry>Default: <emphasis>unset</emphasis></entry>
24124 </row>
24125 </tbody>
24126 </tgroup>
24127 </informaltable>
24128 <para revisionflag="changed">
24129 <indexterm role="concept">
24130 <primary>DNS</primary>
24131 <secondary>resolver options</secondary>
24132 </indexterm>
24133 <indexterm role="concept">
24134 <primary>DNS</primary>
24135 <secondary>DNSSEC</secondary>
24136 </indexterm>
24137 If this option is set then lookup results marked with the AA bit
24138 (Authoritative Answer) are trusted the same way as if they were
24139 DNSSEC-verified. The authority section&#x2019;s name of the answer must
24140 match with this expanded domain list.
24141 </para>
24142 <para revisionflag="changed">
24143 Use this option only if you talk directly to a resolver that is
24144 authoritative for some zones and does not set the AD (Authentic Data)
24145 bit in the answer. Some DNS servers may have an configuration option to
24146 mark the answers from their own zones as verified (they set the AD bit).
24147 Others do not have this option. It is considered as poor practice using
24148 a resolver that is an authoritative server for some zones.
24149 </para>
24150 <para revisionflag="changed">
24151 Use this option only if you really have to (e.g. if you want
24152 to use DANE for remote delivery to a server that is listed in the DNS
24153 zones that your resolver is authoritative for).
24154 </para>
24155 <para revisionflag="changed">
24156 If the DNS answer packet has the AA bit set and contains resource record
24157 in the answer section, the name of the first NS record appearing in the
24158 authority section is compared against the list. If the answer packet is
24159 authoritative but the answer section is empty, the name of the first SOA
24160 record in the authoritative section is used instead.
24161 </para>
24162 <para>
24163 <indexterm role="concept">
24164 <primary>DNS</primary>
24165 <secondary>resolver options</secondary>
24166 </indexterm>
24167 <indexterm role="option">
24168 <primary><option>dns_use_edns0</option></primary>
24169 </indexterm>
24170 </para>
24171 <informaltable frame="all">
24172 <tgroup cols="4" colsep="0" rowsep="0">
24173 <colspec colwidth="8*" align="left"/>
24174 <colspec colwidth="6*" align="center"/>
24175 <colspec colwidth="6*" align="center"/>
24176 <colspec colwidth="6*" align="right"/>
24177 <tbody>
24178 <row>
24179 <entry><option>dns_use_edns0</option></entry>
24180 <entry>Use: <emphasis>main</emphasis></entry>
24181 <entry>Type: <emphasis>integer</emphasis></entry>
24182 <entry>Default: <emphasis>-1</emphasis></entry>
24183 </row>
24184 </tbody>
24185 </tgroup>
24186 </informaltable>
24187 <para>
24188 <indexterm role="concept">
24189 <primary>DNS</primary>
24190 <secondary>resolver options</secondary>
24191 </indexterm>
24192 <indexterm role="concept">
24193 <primary>DNS</primary>
24194 <secondary>EDNS0</secondary>
24195 </indexterm>
24196 If this option is set to a non-negative number then Exim will initialise the
24197 DNS resolver library to either use or not use EDNS0 extensions, overriding
24198 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
24199 on.
24200 </para>
24201 <para>
24202 If the resolver library does not support EDNS0 then this option has no effect.
24203 </para>
24204 <para>
24205 <indexterm role="option">
24206 <primary><option>drop_cr</option></primary>
24207 </indexterm>
24208 </para>
24209 <informaltable frame="all">
24210 <tgroup cols="4" colsep="0" rowsep="0">
24211 <colspec colwidth="8*" align="left"/>
24212 <colspec colwidth="6*" align="center"/>
24213 <colspec colwidth="6*" align="center"/>
24214 <colspec colwidth="6*" align="right"/>
24215 <tbody>
24216 <row>
24217 <entry><option>drop_cr</option></entry>
24218 <entry>Use: <emphasis>main</emphasis></entry>
24219 <entry>Type: <emphasis>boolean</emphasis></entry>
24220 <entry>Default: <emphasis>false</emphasis></entry>
24221 </row>
24222 </tbody>
24223 </tgroup>
24224 </informaltable>
24225 <para>
24226 This is an obsolete option that is now a no-op. It used to affect the way Exim
24227 handled CR and LF characters in incoming messages. What happens now is
24228 described in section <xref linkend="SECTlineendings"/>.
24229 </para>
24230 <para revisionflag="changed">
24231 <indexterm role="option">
24232 <primary><option>dsn_advertise_hosts</option></primary>
24233 </indexterm>
24234 </para>
24235 <informaltable frame="all" revisionflag="changed">
24236 <tgroup cols="4" colsep="0" rowsep="0">
24237 <colspec colwidth="8*" align="left"/>
24238 <colspec colwidth="6*" align="center"/>
24239 <colspec colwidth="6*" align="center"/>
24240 <colspec colwidth="6*" align="right"/>
24241 <tbody>
24242 <row>
24243 <entry><option>dsn_advertise_hosts</option></entry>
24244 <entry>Use: <emphasis>main</emphasis></entry>
24245 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24246 <entry>Default: <emphasis>unset</emphasis></entry>
24247 </row>
24248 </tbody>
24249 </tgroup>
24250 </informaltable>
24251 <para revisionflag="changed">
24252 <indexterm role="concept">
24253 <primary>bounce messages</primary>
24254 <secondary>success</secondary>
24255 </indexterm>
24256 <indexterm role="concept">
24257 <primary>DSN</primary>
24258 <secondary>success</secondary>
24259 </indexterm>
24260 <indexterm role="concept">
24261 <primary>Delivery Status Notification</primary>
24262 <secondary>success</secondary>
24263 </indexterm>
24264 DSN extensions (RFC3461) will be advertised in the EHLO message to,
24265 and accepted from, these hosts.
24266 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
24267 and RET and ORCPT options on MAIL FROM commands.
24268 A NOTIFY=SUCCESS option requests success-DSN messages.
24269 A NOTIFY= option with no argument requests that no delay or failure DSNs
24270 are sent.
24271 </para>
24272 <para>
24273 <indexterm role="option">
24274 <primary><option>dsn_from</option></primary>
24275 </indexterm>
24276 </para>
24277 <informaltable frame="all">
24278 <tgroup cols="4" colsep="0" rowsep="0">
24279 <colspec colwidth="8*" align="left"/>
24280 <colspec colwidth="6*" align="center"/>
24281 <colspec colwidth="6*" align="center"/>
24282 <colspec colwidth="6*" align="right"/>
24283 <tbody>
24284 <row>
24285 <entry><option>dsn_from</option></entry>
24286 <entry>Use: <emphasis>main</emphasis></entry>
24287 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24288 <entry>Default: <emphasis>see below</emphasis></entry>
24289 </row>
24290 </tbody>
24291 </tgroup>
24292 </informaltable>
24293 <para>
24294 <indexterm role="concept">
24295 <primary><emphasis>From:</emphasis> header line</primary>
24296 <secondary>in bounces</secondary>
24297 </indexterm>
24298 <indexterm role="concept">
24299 <primary>bounce messages</primary>
24300 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
24301 </indexterm>
24302 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
24303 bounces and other automatically generated messages (<quote>Delivery Status
24304 Notifications</quote> &ndash; hence the name of the option). The default setting is:
24305 </para>
24306 <literallayout class="monospaced">
24307 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
24308 </literallayout>
24309 <para>
24310 The value is expanded every time it is needed. If the expansion fails, a
24311 panic is logged, and the default value is used.
24312 </para>
24313 <para>
24314 <indexterm role="option">
24315 <primary><option>envelope_to_remove</option></primary>
24316 </indexterm>
24317 </para>
24318 <informaltable frame="all">
24319 <tgroup cols="4" colsep="0" rowsep="0">
24320 <colspec colwidth="8*" align="left"/>
24321 <colspec colwidth="6*" align="center"/>
24322 <colspec colwidth="6*" align="center"/>
24323 <colspec colwidth="6*" align="right"/>
24324 <tbody>
24325 <row>
24326 <entry><option>envelope_to_remove</option></entry>
24327 <entry>Use: <emphasis>main</emphasis></entry>
24328 <entry>Type: <emphasis>boolean</emphasis></entry>
24329 <entry>Default: <emphasis>true</emphasis></entry>
24330 </row>
24331 </tbody>
24332 </tgroup>
24333 </informaltable>
24334 <para>
24335 <indexterm role="concept">
24336 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
24337 </indexterm>
24338 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
24339 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24340 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
24341 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
24342 be present in incoming messages, and this option causes them to be removed at
24343 the time the message is received, to avoid any problems that might occur when a
24344 delivered message is subsequently sent on to some other recipient.
24345 </para>
24346 <para>
24347 <indexterm role="option">
24348 <primary><option>errors_copy</option></primary>
24349 </indexterm>
24350 </para>
24351 <informaltable frame="all">
24352 <tgroup cols="4" colsep="0" rowsep="0">
24353 <colspec colwidth="8*" align="left"/>
24354 <colspec colwidth="6*" align="center"/>
24355 <colspec colwidth="6*" align="center"/>
24356 <colspec colwidth="6*" align="right"/>
24357 <tbody>
24358 <row>
24359 <entry><option>errors_copy</option></entry>
24360 <entry>Use: <emphasis>main</emphasis></entry>
24361 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24362 <entry>Default: <emphasis>unset</emphasis></entry>
24363 </row>
24364 </tbody>
24365 </tgroup>
24366 </informaltable>
24367 <para>
24368 <indexterm role="concept">
24369 <primary>bounce message</primary>
24370 <secondary>copy to other address</secondary>
24371 </indexterm>
24372 <indexterm role="concept">
24373 <primary>copy of bounce message</primary>
24374 </indexterm>
24375 Setting this option causes Exim to send bcc copies of bounce messages that it
24376 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
24377 coming from elsewhere. The value of the option is a colon-separated list of
24378 items. Each item consists of a pattern, terminated by white space, followed by
24379 a comma-separated list of email addresses. If a pattern contains spaces, it
24380 must be enclosed in double quotes.
24381 </para>
24382 <para>
24383 Each pattern is processed in the same way as a single item in an address list
24384 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
24385 the bounce message, the message is copied to the addresses on the list. The
24386 items are scanned in order, and once a matching one is found, no further items
24387 are examined. For example:
24388 </para>
24389 <literallayout class="monospaced">
24390 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
24391               rqps@mydomain   hostmaster@mydomain.example,\
24392                               postmaster@mydomain.example
24393 </literallayout>
24394 <para>
24395 <indexterm role="variable">
24396 <primary><varname>$domain</varname></primary>
24397 </indexterm>
24398 <indexterm role="variable">
24399 <primary><varname>$local_part</varname></primary>
24400 </indexterm>
24401 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
24402 and <varname>$domain</varname> are set from the original recipient of the error message, and if
24403 there was any wildcard matching in the pattern, the expansion
24404 <indexterm role="concept">
24405 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24406 <secondary>in <option>errors_copy</option></secondary>
24407 </indexterm>
24408 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
24409 </para>
24410 <para>
24411 <indexterm role="option">
24412 <primary><option>errors_reply_to</option></primary>
24413 </indexterm>
24414 </para>
24415 <informaltable frame="all">
24416 <tgroup cols="4" colsep="0" rowsep="0">
24417 <colspec colwidth="8*" align="left"/>
24418 <colspec colwidth="6*" align="center"/>
24419 <colspec colwidth="6*" align="center"/>
24420 <colspec colwidth="6*" align="right"/>
24421 <tbody>
24422 <row>
24423 <entry><option>errors_reply_to</option></entry>
24424 <entry>Use: <emphasis>main</emphasis></entry>
24425 <entry>Type: <emphasis>string</emphasis></entry>
24426 <entry>Default: <emphasis>unset</emphasis></entry>
24427 </row>
24428 </tbody>
24429 </tgroup>
24430 </informaltable>
24431 <para>
24432 <indexterm role="concept">
24433 <primary>bounce message</primary>
24434 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
24435 </indexterm>
24436 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
24437 </para>
24438 <literallayout>
24439 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
24440 </literallayout>
24441 <para>
24442 <indexterm role="option">
24443 <primary><option>quota_warn_message</option></primary>
24444 </indexterm>
24445 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
24446 A warning message that is generated by the <option>quota_warn_message</option> option in an
24447 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
24448 overrides the default.
24449 </para>
24450 <para>
24451 Experience shows that people reply to bounce messages. If the
24452 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
24453 and warning messages. For example:
24454 </para>
24455 <literallayout class="monospaced">
24456 errors_reply_to = postmaster@my.domain.example
24457 </literallayout>
24458 <para>
24459 The value of the option is not expanded. It must specify a valid RFC 2822
24460 address. However, if a warning message that is generated by the
24461 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
24462 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
24463 not used.
24464 </para>
24465 <para>
24466 <indexterm role="option">
24467 <primary><option>exim_group</option></primary>
24468 </indexterm>
24469 </para>
24470 <informaltable frame="all">
24471 <tgroup cols="4" colsep="0" rowsep="0">
24472 <colspec colwidth="8*" align="left"/>
24473 <colspec colwidth="6*" align="center"/>
24474 <colspec colwidth="6*" align="center"/>
24475 <colspec colwidth="6*" align="right"/>
24476 <tbody>
24477 <row>
24478 <entry><option>exim_group</option></entry>
24479 <entry>Use: <emphasis>main</emphasis></entry>
24480 <entry>Type: <emphasis>string</emphasis></entry>
24481 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24482 </row>
24483 </tbody>
24484 </tgroup>
24485 </informaltable>
24486 <para>
24487 <indexterm role="concept">
24488 <primary>gid (group id)</primary>
24489 <secondary>Exim&#x2019;s own</secondary>
24490 </indexterm>
24491 <indexterm role="concept">
24492 <primary>Exim group</primary>
24493 </indexterm>
24494 This option changes the gid under which Exim runs when it gives up root
24495 privilege. The default value is compiled into the binary. The value of this
24496 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
24497 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
24498 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
24499 security issues.
24500 </para>
24501 <para>
24502 <indexterm role="option">
24503 <primary><option>exim_path</option></primary>
24504 </indexterm>
24505 </para>
24506 <informaltable frame="all">
24507 <tgroup cols="4" colsep="0" rowsep="0">
24508 <colspec colwidth="8*" align="left"/>
24509 <colspec colwidth="6*" align="center"/>
24510 <colspec colwidth="6*" align="center"/>
24511 <colspec colwidth="6*" align="right"/>
24512 <tbody>
24513 <row>
24514 <entry><option>exim_path</option></entry>
24515 <entry>Use: <emphasis>main</emphasis></entry>
24516 <entry>Type: <emphasis>string</emphasis></entry>
24517 <entry>Default: <emphasis>see below</emphasis></entry>
24518 </row>
24519 </tbody>
24520 </tgroup>
24521 </informaltable>
24522 <para>
24523 <indexterm role="concept">
24524 <primary>Exim binary, path name</primary>
24525 </indexterm>
24526 This option specifies the path name of the Exim binary, which is used when Exim
24527 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
24528 the directory configured at compile time by the BIN_DIRECTORY setting. It
24529 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
24530 other place.
24531 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
24532 you will break those Exim utilities that scan the configuration file to find
24533 where the binary is. (They then use the <option>-bP</option> option to extract option
24534 settings such as the value of <option>spool_directory</option>.)
24535 </para>
24536 <para>
24537 <indexterm role="option">
24538 <primary><option>exim_user</option></primary>
24539 </indexterm>
24540 </para>
24541 <informaltable frame="all">
24542 <tgroup cols="4" colsep="0" rowsep="0">
24543 <colspec colwidth="8*" align="left"/>
24544 <colspec colwidth="6*" align="center"/>
24545 <colspec colwidth="6*" align="center"/>
24546 <colspec colwidth="6*" align="right"/>
24547 <tbody>
24548 <row>
24549 <entry><option>exim_user</option></entry>
24550 <entry>Use: <emphasis>main</emphasis></entry>
24551 <entry>Type: <emphasis>string</emphasis></entry>
24552 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24553 </row>
24554 </tbody>
24555 </tgroup>
24556 </informaltable>
24557 <para>
24558 <indexterm role="concept">
24559 <primary>uid (user id)</primary>
24560 <secondary>Exim&#x2019;s own</secondary>
24561 </indexterm>
24562 <indexterm role="concept">
24563 <primary>Exim user</primary>
24564 </indexterm>
24565 This option changes the uid under which Exim runs when it gives up root
24566 privilege. The default value is compiled into the binary. Ownership of the run
24567 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
24568 options is checked against the values in the binary, not what is set here.
24569 </para>
24570 <para>
24571 Unless it consists entirely of digits, the string is looked up using
24572 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
24573 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
24574 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
24575 </para>
24576 <para>
24577 <indexterm role="option">
24578 <primary><option>extra_local_interfaces</option></primary>
24579 </indexterm>
24580 </para>
24581 <informaltable frame="all">
24582 <tgroup cols="4" colsep="0" rowsep="0">
24583 <colspec colwidth="8*" align="left"/>
24584 <colspec colwidth="6*" align="center"/>
24585 <colspec colwidth="6*" align="center"/>
24586 <colspec colwidth="6*" align="right"/>
24587 <tbody>
24588 <row>
24589 <entry><option>extra_local_interfaces</option></entry>
24590 <entry>Use: <emphasis>main</emphasis></entry>
24591 <entry>Type: <emphasis>string list</emphasis></entry>
24592 <entry>Default: <emphasis>unset</emphasis></entry>
24593 </row>
24594 </tbody>
24595 </tgroup>
24596 </informaltable>
24597 <para>
24598 This option defines network interfaces that are to be considered local when
24599 routing, but which are not used for listening by the daemon. See section
24600 <xref linkend="SECTreclocipadd"/> for details.
24601 </para>
24602 <para>
24603 <indexterm role="option">
24604 <primary><option>extract_addresses_remove_arguments</option></primary>
24605 </indexterm>
24606 </para>
24607 <informaltable frame="all">
24608 <tgroup cols="4" colsep="0" rowsep="0">
24609 <colspec colwidth="8*" align="left"/>
24610 <colspec colwidth="6*" align="center"/>
24611 <colspec colwidth="6*" align="center"/>
24612 <colspec colwidth="6*" align="right"/>
24613 <tbody>
24614 <row>
24615 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
24616 <entry>Use: <emphasis>main</emphasis></entry>
24617 <entry>Type: <emphasis>boolean</emphasis></entry>
24618 <entry>Default: <emphasis>true</emphasis></entry>
24619 </row>
24620 </tbody>
24621 </tgroup>
24622 </informaltable>
24623 <para>
24624 <indexterm role="option">
24625 <primary><option>-t</option></primary>
24626 </indexterm>
24627 <indexterm role="concept">
24628 <primary>command line</primary>
24629 <secondary>addresses with <option>-t</option></secondary>
24630 </indexterm>
24631 <indexterm role="concept">
24632 <primary>Sendmail compatibility</primary>
24633 <secondary><option>-t</option> option</secondary>
24634 </indexterm>
24635 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
24636 are present on the command line when the <option>-t</option> option is used to build an
24637 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
24638 line addresses are removed from the recipients list. This is also how Smail
24639 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
24640 command line addresses are added to those obtained from the header lines. When
24641 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
24642 argument headers. If it is set false, Exim adds rather than removes argument
24643 addresses.
24644 </para>
24645 <para>
24646 <indexterm role="option">
24647 <primary><option>finduser_retries</option></primary>
24648 </indexterm>
24649 </para>
24650 <informaltable frame="all">
24651 <tgroup cols="4" colsep="0" rowsep="0">
24652 <colspec colwidth="8*" align="left"/>
24653 <colspec colwidth="6*" align="center"/>
24654 <colspec colwidth="6*" align="center"/>
24655 <colspec colwidth="6*" align="right"/>
24656 <tbody>
24657 <row>
24658 <entry><option>finduser_retries</option></entry>
24659 <entry>Use: <emphasis>main</emphasis></entry>
24660 <entry>Type: <emphasis>integer</emphasis></entry>
24661 <entry>Default: <emphasis>0</emphasis></entry>
24662 </row>
24663 </tbody>
24664 </tgroup>
24665 </informaltable>
24666 <para>
24667 <indexterm role="concept">
24668 <primary>NIS, retrying user lookups</primary>
24669 </indexterm>
24670 On systems running NIS or other schemes in which user and group information is
24671 distributed from a remote system, there can be times when <function>getpwnam()</function> and
24672 related functions fail, even when given valid data, because things time out.
24673 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
24674 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
24675 many extra times to find a user or a group, waiting for one second between
24676 retries.
24677 </para>
24678 <para>
24679 <indexterm role="concept">
24680 <primary><filename>/etc/passwd</filename></primary>
24681 <secondary>multiple reading of</secondary>
24682 </indexterm>
24683 You should not set this option greater than zero if your user information is in
24684 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
24685 search the file multiple times for non-existent users, and also cause delay.
24686 </para>
24687 <para>
24688 <indexterm role="option">
24689 <primary><option>freeze_tell</option></primary>
24690 </indexterm>
24691 </para>
24692 <informaltable frame="all">
24693 <tgroup cols="4" colsep="0" rowsep="0">
24694 <colspec colwidth="8*" align="left"/>
24695 <colspec colwidth="6*" align="center"/>
24696 <colspec colwidth="6*" align="center"/>
24697 <colspec colwidth="6*" align="right"/>
24698 <tbody>
24699 <row>
24700 <entry><option>freeze_tell</option></entry>
24701 <entry>Use: <emphasis>main</emphasis></entry>
24702 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
24703 <entry>Default: <emphasis>unset</emphasis></entry>
24704 </row>
24705 </tbody>
24706 </tgroup>
24707 </informaltable>
24708 <para>
24709 <indexterm role="concept">
24710 <primary>freezing messages</primary>
24711 <secondary>sending a message when freezing</secondary>
24712 </indexterm>
24713 On encountering certain errors, or when configured to do so in a system filter,
24714 ACL, or special router, Exim freezes a message. This means that no further
24715 delivery attempts take place until an administrator thaws the message, or the
24716 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
24717 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
24718 warning message whenever it freezes something, unless the message it is
24719 freezing is a locally-generated bounce message. (Without this exception there
24720 is the possibility of looping.) The warning message is sent to the addresses
24721 supplied as the comma-separated value of this option. If several of the
24722 message&#x2019;s addresses cause freezing, only a single message is sent. If the
24723 freezing was automatic, the reason(s) for freezing can be found in the message
24724 log. If you configure freezing in a filter or ACL, you must arrange for any
24725 logging that you require.
24726 </para>
24727 <para>
24728 <indexterm role="option">
24729 <primary><option>gecos_name</option></primary>
24730 </indexterm>
24731 </para>
24732 <informaltable frame="all">
24733 <tgroup cols="4" colsep="0" rowsep="0">
24734 <colspec colwidth="8*" align="left"/>
24735 <colspec colwidth="6*" align="center"/>
24736 <colspec colwidth="6*" align="center"/>
24737 <colspec colwidth="6*" align="right"/>
24738 <tbody>
24739 <row>
24740 <entry><option>gecos_name</option></entry>
24741 <entry>Use: <emphasis>main</emphasis></entry>
24742 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24743 <entry>Default: <emphasis>unset</emphasis></entry>
24744 </row>
24745 </tbody>
24746 </tgroup>
24747 </informaltable>
24748 <para>
24749 <indexterm role="concept">
24750 <primary>HP-UX</primary>
24751 </indexterm>
24752 <indexterm role="concept">
24753 <primary><quote>gecos</quote> field, parsing</primary>
24754 </indexterm>
24755 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
24756 password file to hold other information in addition to users&#x2019; real names. Exim
24757 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
24758 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
24759 of the field are used unchanged, except that, if an ampersand is encountered,
24760 it is replaced by the user&#x2019;s login name with the first character forced to
24761 upper case, since this is a convention that is observed on many systems.
24762 </para>
24763 <para>
24764 When these options are set, <option>gecos_pattern</option> is treated as a regular
24765 expression that is to be applied to the field (again with &amp; replaced by the
24766 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
24767 user&#x2019;s name.
24768 </para>
24769 <para>
24770 <indexterm role="concept">
24771 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24772 <secondary>in <option>gecos_name</option></secondary>
24773 </indexterm>
24774 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
24775 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
24776 name terminates at the first comma, the following can be used:
24777 </para>
24778 <literallayout class="monospaced">
24779 gecos_pattern = ([^,]*)
24780 gecos_name = $1
24781 </literallayout>
24782 <para>
24783 <indexterm role="option">
24784 <primary><option>gecos_pattern</option></primary>
24785 </indexterm>
24786 </para>
24787 <informaltable frame="all">
24788 <tgroup cols="4" colsep="0" rowsep="0">
24789 <colspec colwidth="8*" align="left"/>
24790 <colspec colwidth="6*" align="center"/>
24791 <colspec colwidth="6*" align="center"/>
24792 <colspec colwidth="6*" align="right"/>
24793 <tbody>
24794 <row>
24795 <entry><option>gecos_pattern</option></entry>
24796 <entry>Use: <emphasis>main</emphasis></entry>
24797 <entry>Type: <emphasis>string</emphasis></entry>
24798 <entry>Default: <emphasis>unset</emphasis></entry>
24799 </row>
24800 </tbody>
24801 </tgroup>
24802 </informaltable>
24803 <para>
24804 See <option>gecos_name</option> above.
24805 </para>
24806 <para>
24807 <indexterm role="option">
24808 <primary><option>gnutls_compat_mode</option></primary>
24809 </indexterm>
24810 </para>
24811 <informaltable frame="all">
24812 <tgroup cols="4" colsep="0" rowsep="0">
24813 <colspec colwidth="8*" align="left"/>
24814 <colspec colwidth="6*" align="center"/>
24815 <colspec colwidth="6*" align="center"/>
24816 <colspec colwidth="6*" align="right"/>
24817 <tbody>
24818 <row>
24819 <entry><option>gnutls_compat_mode</option></entry>
24820 <entry>Use: <emphasis>main</emphasis></entry>
24821 <entry>Type: <emphasis>boolean</emphasis></entry>
24822 <entry>Default: <emphasis>unset</emphasis></entry>
24823 </row>
24824 </tbody>
24825 </tgroup>
24826 </informaltable>
24827 <para>
24828 This option controls whether GnuTLS is used in compatibility mode in an Exim
24829 server. This reduces security slightly, but improves interworking with older
24830 implementations of TLS.
24831 </para>
24832 <para>
24833 option gnutls_allow_auto_pkcs11 main boolean unset
24834 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
24835 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
24836 </para>
24837 <para>
24838 See
24839 <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>
24840 for documentation.
24841 </para>
24842 <para>
24843 <indexterm role="option">
24844 <primary><option>headers_charset</option></primary>
24845 </indexterm>
24846 </para>
24847 <informaltable frame="all">
24848 <tgroup cols="4" colsep="0" rowsep="0">
24849 <colspec colwidth="8*" align="left"/>
24850 <colspec colwidth="6*" align="center"/>
24851 <colspec colwidth="6*" align="center"/>
24852 <colspec colwidth="6*" align="right"/>
24853 <tbody>
24854 <row>
24855 <entry><option>headers_charset</option></entry>
24856 <entry>Use: <emphasis>main</emphasis></entry>
24857 <entry>Type: <emphasis>string</emphasis></entry>
24858 <entry>Default: <emphasis>see below</emphasis></entry>
24859 </row>
24860 </tbody>
24861 </tgroup>
24862 </informaltable>
24863 <para>
24864 This option sets a default character set for translating from encoded MIME
24865 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
24866 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
24867 ultimate default is ISO-8859-1. For more details see the description of header
24868 insertions in section <xref linkend="SECTexpansionitems"/>.
24869 </para>
24870 <para>
24871 <indexterm role="option">
24872 <primary><option>header_maxsize</option></primary>
24873 </indexterm>
24874 </para>
24875 <informaltable frame="all">
24876 <tgroup cols="4" colsep="0" rowsep="0">
24877 <colspec colwidth="8*" align="left"/>
24878 <colspec colwidth="6*" align="center"/>
24879 <colspec colwidth="6*" align="center"/>
24880 <colspec colwidth="6*" align="right"/>
24881 <tbody>
24882 <row>
24883 <entry><option>header_maxsize</option></entry>
24884 <entry>Use: <emphasis>main</emphasis></entry>
24885 <entry>Type: <emphasis>integer</emphasis></entry>
24886 <entry>Default: <emphasis>see below</emphasis></entry>
24887 </row>
24888 </tbody>
24889 </tgroup>
24890 </informaltable>
24891 <para>
24892 <indexterm role="concept">
24893 <primary>header section</primary>
24894 <secondary>maximum size of</secondary>
24895 </indexterm>
24896 <indexterm role="concept">
24897 <primary>limit</primary>
24898 <secondary>size of message header section</secondary>
24899 </indexterm>
24900 This option controls the overall maximum size of a message&#x2019;s header
24901 section. The default is the value of HEADER_MAXSIZE in
24902 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
24903 sections are rejected.
24904 </para>
24905 <para>
24906 <indexterm role="option">
24907 <primary><option>header_line_maxsize</option></primary>
24908 </indexterm>
24909 </para>
24910 <informaltable frame="all">
24911 <tgroup cols="4" colsep="0" rowsep="0">
24912 <colspec colwidth="8*" align="left"/>
24913 <colspec colwidth="6*" align="center"/>
24914 <colspec colwidth="6*" align="center"/>
24915 <colspec colwidth="6*" align="right"/>
24916 <tbody>
24917 <row>
24918 <entry><option>header_line_maxsize</option></entry>
24919 <entry>Use: <emphasis>main</emphasis></entry>
24920 <entry>Type: <emphasis>integer</emphasis></entry>
24921 <entry>Default: <emphasis>0</emphasis></entry>
24922 </row>
24923 </tbody>
24924 </tgroup>
24925 </informaltable>
24926 <para>
24927 <indexterm role="concept">
24928 <primary>header lines</primary>
24929 <secondary>maximum size of</secondary>
24930 </indexterm>
24931 <indexterm role="concept">
24932 <primary>limit</primary>
24933 <secondary>size of one header line</secondary>
24934 </indexterm>
24935 This option limits the length of any individual header line in a message, after
24936 all the continuations have been joined together. Messages with individual
24937 header lines that are longer than the limit are rejected. The default value of
24938 zero means <quote>no limit</quote>.
24939 </para>
24940 <para>
24941 <indexterm role="option">
24942 <primary><option>helo_accept_junk_hosts</option></primary>
24943 </indexterm>
24944 </para>
24945 <informaltable frame="all">
24946 <tgroup cols="4" colsep="0" rowsep="0">
24947 <colspec colwidth="8*" align="left"/>
24948 <colspec colwidth="6*" align="center"/>
24949 <colspec colwidth="6*" align="center"/>
24950 <colspec colwidth="6*" align="right"/>
24951 <tbody>
24952 <row>
24953 <entry><option>helo_accept_junk_hosts</option></entry>
24954 <entry>Use: <emphasis>main</emphasis></entry>
24955 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24956 <entry>Default: <emphasis>unset</emphasis></entry>
24957 </row>
24958 </tbody>
24959 </tgroup>
24960 </informaltable>
24961 <para>
24962 <indexterm role="concept">
24963 <primary>HELO</primary>
24964 <secondary>accepting junk data</secondary>
24965 </indexterm>
24966 <indexterm role="concept">
24967 <primary>EHLO</primary>
24968 <secondary>accepting junk data</secondary>
24969 </indexterm>
24970 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
24971 mail, and gives an error response for invalid data. Unfortunately, there are
24972 some SMTP clients that send syntactic junk. They can be accommodated by setting
24973 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
24974 if you want to do semantic checking.
24975 See also <option>helo_allow_chars</option> for a way of extending the permitted character
24976 set.
24977 </para>
24978 <para>
24979 <indexterm role="option">
24980 <primary><option>helo_allow_chars</option></primary>
24981 </indexterm>
24982 </para>
24983 <informaltable frame="all">
24984 <tgroup cols="4" colsep="0" rowsep="0">
24985 <colspec colwidth="8*" align="left"/>
24986 <colspec colwidth="6*" align="center"/>
24987 <colspec colwidth="6*" align="center"/>
24988 <colspec colwidth="6*" align="right"/>
24989 <tbody>
24990 <row>
24991 <entry><option>helo_allow_chars</option></entry>
24992 <entry>Use: <emphasis>main</emphasis></entry>
24993 <entry>Type: <emphasis>string</emphasis></entry>
24994 <entry>Default: <emphasis>unset</emphasis></entry>
24995 </row>
24996 </tbody>
24997 </tgroup>
24998 </informaltable>
24999 <para>
25000 <indexterm role="concept">
25001 <primary>HELO</primary>
25002 <secondary>underscores in</secondary>
25003 </indexterm>
25004 <indexterm role="concept">
25005 <primary>EHLO</primary>
25006 <secondary>underscores in</secondary>
25007 </indexterm>
25008 <indexterm role="concept">
25009 <primary>underscore in EHLO/HELO</primary>
25010 </indexterm>
25011 This option can be set to a string of rogue characters that are permitted in
25012 all EHLO and HELO names in addition to the standard letters, digits,
25013 hyphens, and dots. If you really must allow underscores, you can set
25014 </para>
25015 <literallayout class="monospaced">
25016 helo_allow_chars = _
25017 </literallayout>
25018 <para>
25019 Note that the value is one string, not a list.
25020 </para>
25021 <para>
25022 <indexterm role="option">
25023 <primary><option>helo_lookup_domains</option></primary>
25024 </indexterm>
25025 </para>
25026 <informaltable frame="all">
25027 <tgroup cols="4" colsep="0" rowsep="0">
25028 <colspec colwidth="8*" align="left"/>
25029 <colspec colwidth="6*" align="center"/>
25030 <colspec colwidth="6*" align="center"/>
25031 <colspec colwidth="6*" align="right"/>
25032 <tbody>
25033 <row>
25034 <entry><option>helo_lookup_domains</option></entry>
25035 <entry>Use: <emphasis>main</emphasis></entry>
25036 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25037 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
25038 </row>
25039 </tbody>
25040 </tgroup>
25041 </informaltable>
25042 <para>
25043 <indexterm role="concept">
25044 <primary>HELO</primary>
25045 <secondary>forcing reverse lookup</secondary>
25046 </indexterm>
25047 <indexterm role="concept">
25048 <primary>EHLO</primary>
25049 <secondary>forcing reverse lookup</secondary>
25050 </indexterm>
25051 If the domain given by a client in a HELO or EHLO command matches this
25052 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
25053 default forces a lookup if the client host gives the server&#x2019;s name or any of
25054 its IP addresses (in brackets), something that broken clients have been seen to
25055 do.
25056 </para>
25057 <para>
25058 <indexterm role="option">
25059 <primary><option>helo_try_verify_hosts</option></primary>
25060 </indexterm>
25061 </para>
25062 <informaltable frame="all">
25063 <tgroup cols="4" colsep="0" rowsep="0">
25064 <colspec colwidth="8*" align="left"/>
25065 <colspec colwidth="6*" align="center"/>
25066 <colspec colwidth="6*" align="center"/>
25067 <colspec colwidth="6*" align="right"/>
25068 <tbody>
25069 <row>
25070 <entry><option>helo_try_verify_hosts</option></entry>
25071 <entry>Use: <emphasis>main</emphasis></entry>
25072 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25073 <entry>Default: <emphasis>unset</emphasis></entry>
25074 </row>
25075 </tbody>
25076 </tgroup>
25077 </informaltable>
25078 <para>
25079 <indexterm role="concept">
25080 <primary>HELO verifying</primary>
25081 <secondary>optional</secondary>
25082 </indexterm>
25083 <indexterm role="concept">
25084 <primary>EHLO</primary>
25085 <secondary>verifying, optional</secondary>
25086 </indexterm>
25087 By default, Exim just checks the syntax of HELO and EHLO commands (see
25088 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
25089 to do more extensive checking of the data supplied by these commands. The ACL
25090 condition <literal>verify = helo</literal> is provided to make this possible.
25091 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
25092 to force the check to occur. From release 4.53 onwards, this is no longer
25093 necessary. If the check has not been done before <literal>verify = helo</literal> is
25094 encountered, it is done at that time. Consequently, this option is obsolete.
25095 Its specification is retained here for backwards compatibility.
25096 </para>
25097 <para>
25098 When an EHLO or HELO command is received, if the calling host matches
25099 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
25100 EHLO command either:
25101 </para>
25102 <itemizedlist>
25103 <listitem>
25104 <para>
25105 is an IP literal matching the calling address of the host, or
25106 </para>
25107 </listitem>
25108 <listitem>
25109 <para>
25110 <indexterm role="concept">
25111 <primary>DNS</primary>
25112 <secondary>reverse lookup</secondary>
25113 </indexterm>
25114 <indexterm role="concept">
25115 <primary>reverse DNS lookup</primary>
25116 </indexterm>
25117 matches the host name that Exim obtains by doing a reverse lookup of the
25118 calling host address, or
25119 </para>
25120 </listitem>
25121 <listitem>
25122 <para>
25123 when looked up in DNS yields the calling host address.
25124 </para>
25125 </listitem>
25126 </itemizedlist>
25127 <para>
25128 However, the EHLO or HELO command is not rejected if any of the checks
25129 fail. Processing continues, but the result of the check is remembered, and can
25130 be detected later in an ACL by the <literal>verify = helo</literal> condition.
25131 </para>
25132 <para>
25133 If DNS was used for successful verification, the variable
25134 <indexterm role="concept">
25135 <primary>DNS</primary>
25136 <secondary>DNSSEC</secondary>
25137 </indexterm>
25138 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
25139 </para>
25140 <para>
25141 <indexterm role="option">
25142 <primary><option>helo_verify_hosts</option></primary>
25143 </indexterm>
25144 </para>
25145 <informaltable frame="all">
25146 <tgroup cols="4" colsep="0" rowsep="0">
25147 <colspec colwidth="8*" align="left"/>
25148 <colspec colwidth="6*" align="center"/>
25149 <colspec colwidth="6*" align="center"/>
25150 <colspec colwidth="6*" align="right"/>
25151 <tbody>
25152 <row>
25153 <entry><option>helo_verify_hosts</option></entry>
25154 <entry>Use: <emphasis>main</emphasis></entry>
25155 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25156 <entry>Default: <emphasis>unset</emphasis></entry>
25157 </row>
25158 </tbody>
25159 </tgroup>
25160 </informaltable>
25161 <para>
25162 <indexterm role="concept">
25163 <primary>HELO verifying</primary>
25164 <secondary>mandatory</secondary>
25165 </indexterm>
25166 <indexterm role="concept">
25167 <primary>EHLO</primary>
25168 <secondary>verifying, mandatory</secondary>
25169 </indexterm>
25170 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
25171 backwards compatibility. For hosts that match this option, Exim checks the host
25172 name given in the HELO or EHLO in the same way as for
25173 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
25174 rejected with a 550 error, and entries are written to the main and reject logs.
25175 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
25176 error.
25177 </para>
25178 <para>
25179 <indexterm role="option">
25180 <primary><option>hold_domains</option></primary>
25181 </indexterm>
25182 </para>
25183 <informaltable frame="all">
25184 <tgroup cols="4" colsep="0" rowsep="0">
25185 <colspec colwidth="8*" align="left"/>
25186 <colspec colwidth="6*" align="center"/>
25187 <colspec colwidth="6*" align="center"/>
25188 <colspec colwidth="6*" align="right"/>
25189 <tbody>
25190 <row>
25191 <entry><option>hold_domains</option></entry>
25192 <entry>Use: <emphasis>main</emphasis></entry>
25193 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25194 <entry>Default: <emphasis>unset</emphasis></entry>
25195 </row>
25196 </tbody>
25197 </tgroup>
25198 </informaltable>
25199 <para>
25200 <indexterm role="concept">
25201 <primary>domain</primary>
25202 <secondary>delaying delivery</secondary>
25203 </indexterm>
25204 <indexterm role="concept">
25205 <primary>delivery</primary>
25206 <secondary>delaying certain domains</secondary>
25207 </indexterm>
25208 This option allows mail for particular domains to be held on the queue
25209 manually. The option is overridden if a message delivery is forced with the
25210 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
25211 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
25212 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
25213 it is deferred every time the message is looked at.
25214 </para>
25215 <para>
25216 This option is intended as a temporary operational measure for delaying the
25217 delivery of mail while some problem is being sorted out, or some new
25218 configuration tested. If you just want to delay the processing of some
25219 domains until a queue run occurs, you should use <option>queue_domains</option> or
25220 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
25221 </para>
25222 <para>
25223 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
25224 messages from the queue if they have been there longer than the longest retry
25225 time in any retry rule. If you want to hold messages for longer than the normal
25226 retry times, insert a dummy retry rule with a long retry time.
25227 </para>
25228 <para>
25229 <indexterm role="option">
25230 <primary><option>host_lookup</option></primary>
25231 </indexterm>
25232 </para>
25233 <informaltable frame="all">
25234 <tgroup cols="4" colsep="0" rowsep="0">
25235 <colspec colwidth="8*" align="left"/>
25236 <colspec colwidth="6*" align="center"/>
25237 <colspec colwidth="6*" align="center"/>
25238 <colspec colwidth="6*" align="right"/>
25239 <tbody>
25240 <row>
25241 <entry><option>host_lookup</option></entry>
25242 <entry>Use: <emphasis>main</emphasis></entry>
25243 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25244 <entry>Default: <emphasis>unset</emphasis></entry>
25245 </row>
25246 </tbody>
25247 </tgroup>
25248 </informaltable>
25249 <para>
25250 <indexterm role="concept">
25251 <primary>host name</primary>
25252 <secondary>lookup, forcing</secondary>
25253 </indexterm>
25254 Exim does not look up the name of a calling host from its IP address unless it
25255 is required to compare against some host list, or the host matches
25256 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
25257 option (which normally contains IP addresses rather than host names). The
25258 default configuration file contains
25259 </para>
25260 <literallayout class="monospaced">
25261 host_lookup = *
25262 </literallayout>
25263 <para>
25264 which causes a lookup to happen for all hosts. If the expense of these lookups
25265 is felt to be too great, the setting can be changed or removed.
25266 </para>
25267 <para>
25268 After a successful reverse lookup, Exim does a forward lookup on the name it
25269 has obtained, to verify that it yields the IP address that it started with. If
25270 this check fails, Exim behaves as if the name lookup failed.
25271 </para>
25272 <para>
25273 <indexterm role="variable">
25274 <primary><varname>$host_lookup_failed</varname></primary>
25275 </indexterm>
25276 <indexterm role="variable">
25277 <primary><varname>$sender_host_name</varname></primary>
25278 </indexterm>
25279 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
25280 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
25281 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
25282 <literal>verify = reverse_host_lookup</literal> in ACLs.
25283 </para>
25284 <para>
25285 <indexterm role="option">
25286 <primary><option>host_lookup_order</option></primary>
25287 </indexterm>
25288 </para>
25289 <informaltable frame="all">
25290 <tgroup cols="4" colsep="0" rowsep="0">
25291 <colspec colwidth="8*" align="left"/>
25292 <colspec colwidth="6*" align="center"/>
25293 <colspec colwidth="6*" align="center"/>
25294 <colspec colwidth="6*" align="right"/>
25295 <tbody>
25296 <row>
25297 <entry><option>host_lookup_order</option></entry>
25298 <entry>Use: <emphasis>main</emphasis></entry>
25299 <entry>Type: <emphasis>string list</emphasis></entry>
25300 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
25301 </row>
25302 </tbody>
25303 </tgroup>
25304 </informaltable>
25305 <para>
25306 This option specifies the order of different lookup methods when Exim is trying
25307 to find a host name from an IP address. The default is to do a DNS lookup
25308 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
25309 if that fails. You can change the order of these lookups, or omit one entirely,
25310 if you want.
25311 </para>
25312 <para>
25313 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
25314 multiple PTR records in the DNS and the IP address is not listed in
25315 <filename>/etc/hosts</filename>. Different operating systems give different results in this
25316 case. That is why the default tries a DNS lookup first.
25317 </para>
25318 <para>
25319 <indexterm role="option">
25320 <primary><option>host_reject_connection</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>host_reject_connection</option></entry>
25332 <entry>Use: <emphasis>main</emphasis></entry>
25333 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25334 <entry>Default: <emphasis>unset</emphasis></entry>
25335 </row>
25336 </tbody>
25337 </tgroup>
25338 </informaltable>
25339 <para>
25340 <indexterm role="concept">
25341 <primary>host</primary>
25342 <secondary>rejecting connections from</secondary>
25343 </indexterm>
25344 If this option is set, incoming SMTP calls from the hosts listed are rejected
25345 as soon as the connection is made.
25346 This option is obsolete, and retained only for backward compatibility, because
25347 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
25348 connections immediately.
25349 </para>
25350 <para>
25351 The ability to give an immediate rejection (either by this option or using an
25352 ACL) is provided for use in unusual cases. Many hosts will just try again,
25353 sometimes without much delay. Normally, it is better to use an ACL to reject
25354 incoming messages at a later stage, such as after RCPT commands. See
25355 chapter <xref linkend="CHAPACL"/>.
25356 </para>
25357 <para>
25358 <indexterm role="option">
25359 <primary><option>hosts_connection_nolog</option></primary>
25360 </indexterm>
25361 </para>
25362 <informaltable frame="all">
25363 <tgroup cols="4" colsep="0" rowsep="0">
25364 <colspec colwidth="8*" align="left"/>
25365 <colspec colwidth="6*" align="center"/>
25366 <colspec colwidth="6*" align="center"/>
25367 <colspec colwidth="6*" align="right"/>
25368 <tbody>
25369 <row>
25370 <entry><option>hosts_connection_nolog</option></entry>
25371 <entry>Use: <emphasis>main</emphasis></entry>
25372 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25373 <entry>Default: <emphasis>unset</emphasis></entry>
25374 </row>
25375 </tbody>
25376 </tgroup>
25377 </informaltable>
25378 <para>
25379 <indexterm role="concept">
25380 <primary>host</primary>
25381 <secondary>not logging connections from</secondary>
25382 </indexterm>
25383 This option defines a list of hosts for which connection logging does not
25384 happen, even though the <option>smtp_connection</option> log selector is set. For example,
25385 you might want not to log SMTP connections from local processes, or from
25386 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
25387 the daemon; you should therefore strive to restrict its value to a short inline
25388 list of IP addresses and networks. To disable logging SMTP connections from
25389 local processes, you must create a host list with an empty item. For example:
25390 </para>
25391 <literallayout class="monospaced">
25392 hosts_connection_nolog = :
25393 </literallayout>
25394 <para>
25395 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
25396 </para>
25397 <para>
25398 <indexterm role="option">
25399 <primary><option>hosts_treat_as_local</option></primary>
25400 </indexterm>
25401 </para>
25402 <informaltable frame="all">
25403 <tgroup cols="4" colsep="0" rowsep="0">
25404 <colspec colwidth="8*" align="left"/>
25405 <colspec colwidth="6*" align="center"/>
25406 <colspec colwidth="6*" align="center"/>
25407 <colspec colwidth="6*" align="right"/>
25408 <tbody>
25409 <row>
25410 <entry><option>hosts_treat_as_local</option></entry>
25411 <entry>Use: <emphasis>main</emphasis></entry>
25412 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25413 <entry>Default: <emphasis>unset</emphasis></entry>
25414 </row>
25415 </tbody>
25416 </tgroup>
25417 </informaltable>
25418 <para>
25419 <indexterm role="concept">
25420 <primary>local host</primary>
25421 <secondary>domains treated as</secondary>
25422 </indexterm>
25423 <indexterm role="concept">
25424 <primary>host</primary>
25425 <secondary>treated as local</secondary>
25426 </indexterm>
25427 If this option is set, any host names that match the domain list are treated as
25428 if they were the local host when Exim is scanning host lists obtained from MX
25429 records
25430 or other sources. Note that the value of this option is a domain list, not a
25431 host list, because it is always used to check host names, not IP addresses.
25432 </para>
25433 <para>
25434 This option also applies when Exim is matching the special items
25435 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
25436 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
25437 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
25438 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
25439 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
25440 interfaces and recognizing the local host.
25441 </para>
25442 <para>
25443 <indexterm role="option">
25444 <primary><option>ibase_servers</option></primary>
25445 </indexterm>
25446 </para>
25447 <informaltable frame="all">
25448 <tgroup cols="4" colsep="0" rowsep="0">
25449 <colspec colwidth="8*" align="left"/>
25450 <colspec colwidth="6*" align="center"/>
25451 <colspec colwidth="6*" align="center"/>
25452 <colspec colwidth="6*" align="right"/>
25453 <tbody>
25454 <row>
25455 <entry><option>ibase_servers</option></entry>
25456 <entry>Use: <emphasis>main</emphasis></entry>
25457 <entry>Type: <emphasis>string list</emphasis></entry>
25458 <entry>Default: <emphasis>unset</emphasis></entry>
25459 </row>
25460 </tbody>
25461 </tgroup>
25462 </informaltable>
25463 <para>
25464 <indexterm role="concept">
25465 <primary>InterBase</primary>
25466 <secondary>server list</secondary>
25467 </indexterm>
25468 This option provides a list of InterBase servers and associated connection data,
25469 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
25470 The option is available only if Exim has been built with InterBase support.
25471 </para>
25472 <para>
25473 <indexterm role="option">
25474 <primary><option>ignore_bounce_errors_after</option></primary>
25475 </indexterm>
25476 </para>
25477 <informaltable frame="all">
25478 <tgroup cols="4" colsep="0" rowsep="0">
25479 <colspec colwidth="8*" align="left"/>
25480 <colspec colwidth="6*" align="center"/>
25481 <colspec colwidth="6*" align="center"/>
25482 <colspec colwidth="6*" align="right"/>
25483 <tbody>
25484 <row>
25485 <entry><option>ignore_bounce_errors_after</option></entry>
25486 <entry>Use: <emphasis>main</emphasis></entry>
25487 <entry>Type: <emphasis>time</emphasis></entry>
25488 <entry>Default: <emphasis>10w</emphasis></entry>
25489 </row>
25490 </tbody>
25491 </tgroup>
25492 </informaltable>
25493 <para>
25494 <indexterm role="concept">
25495 <primary>bounce message</primary>
25496 <secondary>discarding</secondary>
25497 </indexterm>
25498 <indexterm role="concept">
25499 <primary>discarding bounce message</primary>
25500 </indexterm>
25501 This option affects the processing of bounce messages that cannot be delivered,
25502 that is, those that suffer a permanent delivery failure. (Bounce messages that
25503 suffer temporary delivery failures are of course retried in the usual way.)
25504 </para>
25505 <para>
25506 After a permanent delivery failure, bounce messages are frozen,
25507 because there is no sender to whom they can be returned. When a frozen bounce
25508 message has been on the queue for more than the given time, it is unfrozen at
25509 the next queue run, and a further delivery is attempted. If delivery fails
25510 again, the bounce message is discarded. This makes it possible to keep failed
25511 bounce messages around for a shorter time than the normal maximum retry time
25512 for frozen messages. For example,
25513 </para>
25514 <literallayout class="monospaced">
25515 ignore_bounce_errors_after = 12h
25516 </literallayout>
25517 <para>
25518 retries failed bounce message deliveries after 12 hours, discarding any further
25519 failures. If the value of this option is set to a zero time period, bounce
25520 failures are discarded immediately. Setting a very long time (as in the default
25521 value) has the effect of disabling this option. For ways of automatically
25522 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
25523 <option>timeout_frozen_after</option>.
25524 </para>
25525 <para>
25526 <indexterm role="option">
25527 <primary><option>ignore_fromline_hosts</option></primary>
25528 </indexterm>
25529 </para>
25530 <informaltable frame="all">
25531 <tgroup cols="4" colsep="0" rowsep="0">
25532 <colspec colwidth="8*" align="left"/>
25533 <colspec colwidth="6*" align="center"/>
25534 <colspec colwidth="6*" align="center"/>
25535 <colspec colwidth="6*" align="right"/>
25536 <tbody>
25537 <row>
25538 <entry><option>ignore_fromline_hosts</option></entry>
25539 <entry>Use: <emphasis>main</emphasis></entry>
25540 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25541 <entry>Default: <emphasis>unset</emphasis></entry>
25542 </row>
25543 </tbody>
25544 </tgroup>
25545 </informaltable>
25546 <para>
25547 <indexterm role="concept">
25548 <primary><quote>From</quote> line</primary>
25549 </indexterm>
25550 <indexterm role="concept">
25551 <primary>UUCP</primary>
25552 <secondary><quote>From</quote> line</secondary>
25553 </indexterm>
25554 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
25555 the headers of a message. By default this is treated as the start of the
25556 message&#x2019;s body, which means that any following headers are not recognized as
25557 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
25558 match those hosts that insist on sending it. If the sender is actually a local
25559 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
25560 <option>ignore_fromline_local</option> must be set to achieve this effect.
25561 </para>
25562 <para>
25563 <indexterm role="option">
25564 <primary><option>ignore_fromline_local</option></primary>
25565 </indexterm>
25566 </para>
25567 <informaltable frame="all">
25568 <tgroup cols="4" colsep="0" rowsep="0">
25569 <colspec colwidth="8*" align="left"/>
25570 <colspec colwidth="6*" align="center"/>
25571 <colspec colwidth="6*" align="center"/>
25572 <colspec colwidth="6*" align="right"/>
25573 <tbody>
25574 <row>
25575 <entry><option>ignore_fromline_local</option></entry>
25576 <entry>Use: <emphasis>main</emphasis></entry>
25577 <entry>Type: <emphasis>boolean</emphasis></entry>
25578 <entry>Default: <emphasis>false</emphasis></entry>
25579 </row>
25580 </tbody>
25581 </tgroup>
25582 </informaltable>
25583 <para>
25584 See <option>ignore_fromline_hosts</option> above.
25585 </para>
25586 <para revisionflag="changed">
25587 <indexterm role="option">
25588 <primary><option>keep_environment</option></primary>
25589 </indexterm>
25590 </para>
25591 <informaltable frame="all" revisionflag="changed">
25592 <tgroup cols="4" colsep="0" rowsep="0">
25593 <colspec colwidth="8*" align="left"/>
25594 <colspec colwidth="6*" align="center"/>
25595 <colspec colwidth="6*" align="center"/>
25596 <colspec colwidth="6*" align="right"/>
25597 <tbody>
25598 <row>
25599 <entry><option>keep_environment</option></entry>
25600 <entry>Use: <emphasis>main</emphasis></entry>
25601 <entry>Type: <emphasis>string list</emphasis></entry>
25602 <entry>Default: <emphasis>unset</emphasis></entry>
25603 </row>
25604 </tbody>
25605 </tgroup>
25606 </informaltable>
25607 <para revisionflag="changed">
25608 <indexterm role="concept">
25609 <primary>environment</primary>
25610 <secondary>inherited</secondary>
25611 </indexterm>
25612 This option contains a string list of environment variables to keep.
25613 You have to trust these variables or you have to be sure that
25614 these variables do not impose any security risk. Keep in mind that
25615 during the startup phase Exim is running with an effective UID 0 in most
25616 installations. As the default value is an empty list, the default
25617 environment for using libraries, running embedded Perl code, or running
25618 external binaries is empty, and does not not even contain PATH or HOME.
25619 </para>
25620 <para revisionflag="changed">
25621 Actually the list is interpreted as a list of patterns
25622 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
25623 </para>
25624 <para revisionflag="changed">
25625 WARNING: Macro substitution is still done first, so having a macro
25626 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
25627 unexpected results. You may work around this using a regular expression
25628 that does not match the macro name: ^[F]OO_HOME$.
25629 </para>
25630 <para revisionflag="changed">
25631 Current versions of Exim issue a warning during startupif you do not mention
25632 <option>keep_environment</option> or <option>add_environment</option> in your runtime configuration
25633 file.
25634 </para>
25635 <para>
25636 <indexterm role="option">
25637 <primary><option>keep_malformed</option></primary>
25638 </indexterm>
25639 </para>
25640 <informaltable frame="all">
25641 <tgroup cols="4" colsep="0" rowsep="0">
25642 <colspec colwidth="8*" align="left"/>
25643 <colspec colwidth="6*" align="center"/>
25644 <colspec colwidth="6*" align="center"/>
25645 <colspec colwidth="6*" align="right"/>
25646 <tbody>
25647 <row>
25648 <entry><option>keep_malformed</option></entry>
25649 <entry>Use: <emphasis>main</emphasis></entry>
25650 <entry>Type: <emphasis>time</emphasis></entry>
25651 <entry>Default: <emphasis>4d</emphasis></entry>
25652 </row>
25653 </tbody>
25654 </tgroup>
25655 </informaltable>
25656 <para>
25657 This option specifies the length of time to keep messages whose spool files
25658 have been corrupted in some way. This should, of course, never happen. At the
25659 next attempt to deliver such a message, it gets removed. The incident is
25660 logged.
25661 </para>
25662 <para>
25663 <indexterm role="option">
25664 <primary><option>ldap_ca_cert_dir</option></primary>
25665 </indexterm>
25666 </para>
25667 <informaltable frame="all">
25668 <tgroup cols="4" colsep="0" rowsep="0">
25669 <colspec colwidth="8*" align="left"/>
25670 <colspec colwidth="6*" align="center"/>
25671 <colspec colwidth="6*" align="center"/>
25672 <colspec colwidth="6*" align="right"/>
25673 <tbody>
25674 <row>
25675 <entry><option>ldap_ca_cert_dir</option></entry>
25676 <entry>Use: <emphasis>main</emphasis></entry>
25677 <entry>Type: <emphasis>string</emphasis></entry>
25678 <entry>Default: <emphasis>unset</emphasis></entry>
25679 </row>
25680 </tbody>
25681 </tgroup>
25682 </informaltable>
25683 <para>
25684 <indexterm role="concept">
25685 <primary>LDAP</primary>
25686 <secondary>,</secondary>
25687 </indexterm>
25688 This option indicates which directory contains CA certificates for verifying
25689 a TLS certificate presented by an LDAP server.
25690 While Exim does not provide a default value, your SSL library may.
25691 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25692 and constrained to be a directory.
25693 </para>
25694 <para>
25695 <indexterm role="option">
25696 <primary><option>ldap_ca_cert_file</option></primary>
25697 </indexterm>
25698 </para>
25699 <informaltable frame="all">
25700 <tgroup cols="4" colsep="0" rowsep="0">
25701 <colspec colwidth="8*" align="left"/>
25702 <colspec colwidth="6*" align="center"/>
25703 <colspec colwidth="6*" align="center"/>
25704 <colspec colwidth="6*" align="right"/>
25705 <tbody>
25706 <row>
25707 <entry><option>ldap_ca_cert_file</option></entry>
25708 <entry>Use: <emphasis>main</emphasis></entry>
25709 <entry>Type: <emphasis>string</emphasis></entry>
25710 <entry>Default: <emphasis>unset</emphasis></entry>
25711 </row>
25712 </tbody>
25713 </tgroup>
25714 </informaltable>
25715 <para>
25716 <indexterm role="concept">
25717 <primary>LDAP</primary>
25718 <secondary>,</secondary>
25719 </indexterm>
25720 This option indicates which file contains CA certificates for verifying
25721 a TLS certificate presented by an LDAP server.
25722 While Exim does not provide a default value, your SSL library may.
25723 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25724 and constrained to be a file.
25725 </para>
25726 <para>
25727 <indexterm role="option">
25728 <primary><option>ldap_cert_file</option></primary>
25729 </indexterm>
25730 </para>
25731 <informaltable frame="all">
25732 <tgroup cols="4" colsep="0" rowsep="0">
25733 <colspec colwidth="8*" align="left"/>
25734 <colspec colwidth="6*" align="center"/>
25735 <colspec colwidth="6*" align="center"/>
25736 <colspec colwidth="6*" align="right"/>
25737 <tbody>
25738 <row>
25739 <entry><option>ldap_cert_file</option></entry>
25740 <entry>Use: <emphasis>main</emphasis></entry>
25741 <entry>Type: <emphasis>string</emphasis></entry>
25742 <entry>Default: <emphasis>unset</emphasis></entry>
25743 </row>
25744 </tbody>
25745 </tgroup>
25746 </informaltable>
25747 <para>
25748 <indexterm role="concept">
25749 <primary>LDAP</primary>
25750 <secondary>TLS client certificate file</secondary>
25751 </indexterm>
25752 This option indicates which file contains an TLS client certificate which
25753 Exim should present to the LDAP server during TLS negotiation.
25754 Should be used together with <option>ldap_cert_key</option>.
25755 </para>
25756 <para>
25757 <indexterm role="option">
25758 <primary><option>ldap_cert_key</option></primary>
25759 </indexterm>
25760 </para>
25761 <informaltable frame="all">
25762 <tgroup cols="4" colsep="0" rowsep="0">
25763 <colspec colwidth="8*" align="left"/>
25764 <colspec colwidth="6*" align="center"/>
25765 <colspec colwidth="6*" align="center"/>
25766 <colspec colwidth="6*" align="right"/>
25767 <tbody>
25768 <row>
25769 <entry><option>ldap_cert_key</option></entry>
25770 <entry>Use: <emphasis>main</emphasis></entry>
25771 <entry>Type: <emphasis>string</emphasis></entry>
25772 <entry>Default: <emphasis>unset</emphasis></entry>
25773 </row>
25774 </tbody>
25775 </tgroup>
25776 </informaltable>
25777 <para>
25778 <indexterm role="concept">
25779 <primary>LDAP</primary>
25780 <secondary>TLS client key file</secondary>
25781 </indexterm>
25782 This option indicates which file contains the secret/private key to use
25783 to prove identity to the LDAP server during TLS negotiation.
25784 Should be used together with <option>ldap_cert_file</option>, which contains the
25785 identity to be proven.
25786 </para>
25787 <para>
25788 <indexterm role="option">
25789 <primary><option>ldap_cipher_suite</option></primary>
25790 </indexterm>
25791 </para>
25792 <informaltable frame="all">
25793 <tgroup cols="4" colsep="0" rowsep="0">
25794 <colspec colwidth="8*" align="left"/>
25795 <colspec colwidth="6*" align="center"/>
25796 <colspec colwidth="6*" align="center"/>
25797 <colspec colwidth="6*" align="right"/>
25798 <tbody>
25799 <row>
25800 <entry><option>ldap_cipher_suite</option></entry>
25801 <entry>Use: <emphasis>main</emphasis></entry>
25802 <entry>Type: <emphasis>string</emphasis></entry>
25803 <entry>Default: <emphasis>unset</emphasis></entry>
25804 </row>
25805 </tbody>
25806 </tgroup>
25807 </informaltable>
25808 <para>
25809 <indexterm role="concept">
25810 <primary>LDAP</primary>
25811 <secondary>TLS cipher suite</secondary>
25812 </indexterm>
25813 This controls the TLS cipher-suite negotiation during TLS negotiation with
25814 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
25815 cipher-suite options with OpenSSL (as used by LDAP client libraries).
25816 </para>
25817 <para>
25818 <indexterm role="option">
25819 <primary><option>ldap_default_servers</option></primary>
25820 </indexterm>
25821 </para>
25822 <informaltable frame="all">
25823 <tgroup cols="4" colsep="0" rowsep="0">
25824 <colspec colwidth="8*" align="left"/>
25825 <colspec colwidth="6*" align="center"/>
25826 <colspec colwidth="6*" align="center"/>
25827 <colspec colwidth="6*" align="right"/>
25828 <tbody>
25829 <row>
25830 <entry><option>ldap_default_servers</option></entry>
25831 <entry>Use: <emphasis>main</emphasis></entry>
25832 <entry>Type: <emphasis>string list</emphasis></entry>
25833 <entry>Default: <emphasis>unset</emphasis></entry>
25834 </row>
25835 </tbody>
25836 </tgroup>
25837 </informaltable>
25838 <para>
25839 <indexterm role="concept">
25840 <primary>LDAP</primary>
25841 <secondary>default servers</secondary>
25842 </indexterm>
25843 This option provides a list of LDAP servers which are tried in turn when an
25844 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
25845 details of LDAP queries. This option is available only when Exim has been built
25846 with LDAP support.
25847 </para>
25848 <para>
25849 <indexterm role="option">
25850 <primary><option>ldap_require_cert</option></primary>
25851 </indexterm>
25852 </para>
25853 <informaltable frame="all">
25854 <tgroup cols="4" colsep="0" rowsep="0">
25855 <colspec colwidth="8*" align="left"/>
25856 <colspec colwidth="6*" align="center"/>
25857 <colspec colwidth="6*" align="center"/>
25858 <colspec colwidth="6*" align="right"/>
25859 <tbody>
25860 <row>
25861 <entry><option>ldap_require_cert</option></entry>
25862 <entry>Use: <emphasis>main</emphasis></entry>
25863 <entry>Type: <emphasis>string</emphasis></entry>
25864 <entry>Default: <emphasis>unset.</emphasis></entry>
25865 </row>
25866 </tbody>
25867 </tgroup>
25868 </informaltable>
25869 <para>
25870 <indexterm role="concept">
25871 <primary>LDAP</primary>
25872 <secondary>policy for LDAP server TLS cert presentation</secondary>
25873 </indexterm>
25874 This should be one of the values "hard", "demand", "allow", "try" or "never".
25875 A value other than one of these is interpreted as "never".
25876 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
25877 Although Exim does not set a default, the LDAP library probably defaults
25878 to hard/demand.
25879 </para>
25880 <para>
25881 <indexterm role="option">
25882 <primary><option>ldap_start_tls</option></primary>
25883 </indexterm>
25884 </para>
25885 <informaltable frame="all">
25886 <tgroup cols="4" colsep="0" rowsep="0">
25887 <colspec colwidth="8*" align="left"/>
25888 <colspec colwidth="6*" align="center"/>
25889 <colspec colwidth="6*" align="center"/>
25890 <colspec colwidth="6*" align="right"/>
25891 <tbody>
25892 <row>
25893 <entry><option>ldap_start_tls</option></entry>
25894 <entry>Use: <emphasis>main</emphasis></entry>
25895 <entry>Type: <emphasis>boolean</emphasis></entry>
25896 <entry>Default: <emphasis>false</emphasis></entry>
25897 </row>
25898 </tbody>
25899 </tgroup>
25900 </informaltable>
25901 <para>
25902 <indexterm role="concept">
25903 <primary>LDAP</primary>
25904 <secondary>whether or not to negotiate TLS</secondary>
25905 </indexterm>
25906 If set, Exim will attempt to negotiate TLS with the LDAP server when
25907 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
25908 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
25909 of SSL-on-connect.
25910 In the event of failure to negotiate TLS, the action taken is controlled
25911 by <option>ldap_require_cert</option>.
25912 </para>
25913 <para>
25914 <indexterm role="option">
25915 <primary><option>ldap_version</option></primary>
25916 </indexterm>
25917 </para>
25918 <informaltable frame="all">
25919 <tgroup cols="4" colsep="0" rowsep="0">
25920 <colspec colwidth="8*" align="left"/>
25921 <colspec colwidth="6*" align="center"/>
25922 <colspec colwidth="6*" align="center"/>
25923 <colspec colwidth="6*" align="right"/>
25924 <tbody>
25925 <row>
25926 <entry><option>ldap_version</option></entry>
25927 <entry>Use: <emphasis>main</emphasis></entry>
25928 <entry>Type: <emphasis>integer</emphasis></entry>
25929 <entry>Default: <emphasis>unset</emphasis></entry>
25930 </row>
25931 </tbody>
25932 </tgroup>
25933 </informaltable>
25934 <para>
25935 <indexterm role="concept">
25936 <primary>LDAP</primary>
25937 <secondary>protocol version, forcing</secondary>
25938 </indexterm>
25939 This option can be used to force Exim to set a specific protocol version for
25940 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
25941 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
25942 the LDAP headers; otherwise it is 2. This option is available only when Exim
25943 has been built with LDAP support.
25944 </para>
25945 <para>
25946 <indexterm role="option">
25947 <primary><option>local_from_check</option></primary>
25948 </indexterm>
25949 </para>
25950 <informaltable frame="all">
25951 <tgroup cols="4" colsep="0" rowsep="0">
25952 <colspec colwidth="8*" align="left"/>
25953 <colspec colwidth="6*" align="center"/>
25954 <colspec colwidth="6*" align="center"/>
25955 <colspec colwidth="6*" align="right"/>
25956 <tbody>
25957 <row>
25958 <entry><option>local_from_check</option></entry>
25959 <entry>Use: <emphasis>main</emphasis></entry>
25960 <entry>Type: <emphasis>boolean</emphasis></entry>
25961 <entry>Default: <emphasis>true</emphasis></entry>
25962 </row>
25963 </tbody>
25964 </tgroup>
25965 </informaltable>
25966 <para>
25967 <indexterm role="concept">
25968 <primary><emphasis>Sender:</emphasis> header line</primary>
25969 <secondary>disabling addition of</secondary>
25970 </indexterm>
25971 <indexterm role="concept">
25972 <primary><emphasis>From:</emphasis> header line</primary>
25973 <secondary>disabling checking of</secondary>
25974 </indexterm>
25975 When a message is submitted locally (that is, not over a TCP/IP connection) by
25976 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
25977 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
25978 the domain specified by <option>qualify_domain</option>.
25979 </para>
25980 <para>
25981 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
25982 locally submitted message is automatically qualified by Exim, unless the
25983 <option>-bnq</option> command line option is used.
25984 </para>
25985 <para>
25986 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
25987 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
25988 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
25989 and the default qualify domain.
25990 </para>
25991 <para>
25992 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
25993 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
25994 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
25995 <option>local_sender_retain</option> to be true.
25996 </para>
25997 <para>
25998 <indexterm role="concept">
25999 <primary>envelope sender</primary>
26000 </indexterm>
26001 These options affect only the header lines in the message. The envelope sender
26002 is still forced to be the login id at the qualify domain unless
26003 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
26004 </para>
26005 <para>
26006 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
26007 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
26008 has more details about <emphasis>Sender:</emphasis> processing.
26009 </para>
26010 <para>
26011 <indexterm role="option">
26012 <primary><option>local_from_prefix</option></primary>
26013 </indexterm>
26014 </para>
26015 <informaltable frame="all">
26016 <tgroup cols="4" colsep="0" rowsep="0">
26017 <colspec colwidth="8*" align="left"/>
26018 <colspec colwidth="6*" align="center"/>
26019 <colspec colwidth="6*" align="center"/>
26020 <colspec colwidth="6*" align="right"/>
26021 <tbody>
26022 <row>
26023 <entry><option>local_from_prefix</option></entry>
26024 <entry>Use: <emphasis>main</emphasis></entry>
26025 <entry>Type: <emphasis>string</emphasis></entry>
26026 <entry>Default: <emphasis>unset</emphasis></entry>
26027 </row>
26028 </tbody>
26029 </tgroup>
26030 </informaltable>
26031 <para>
26032 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
26033 matching the login id (see <option>local_from_check</option> above), it can be configured to
26034 ignore certain prefixes and suffixes in the local part of the address. This is
26035 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
26036 appropriate lists, in the same form as the <option>local_part_prefix</option> and
26037 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
26038 example, if
26039 </para>
26040 <literallayout class="monospaced">
26041 local_from_prefix = *-
26042 </literallayout>
26043 <para>
26044 is set, a <emphasis>From:</emphasis> line containing
26045 </para>
26046 <literallayout class="monospaced">
26047 From: anything-user@your.domain.example
26048 </literallayout>
26049 <para>
26050 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
26051 matches the actual sender address that is constructed from the login name and
26052 qualify domain.
26053 </para>
26054 <para>
26055 <indexterm role="option">
26056 <primary><option>local_from_suffix</option></primary>
26057 </indexterm>
26058 </para>
26059 <informaltable frame="all">
26060 <tgroup cols="4" colsep="0" rowsep="0">
26061 <colspec colwidth="8*" align="left"/>
26062 <colspec colwidth="6*" align="center"/>
26063 <colspec colwidth="6*" align="center"/>
26064 <colspec colwidth="6*" align="right"/>
26065 <tbody>
26066 <row>
26067 <entry><option>local_from_suffix</option></entry>
26068 <entry>Use: <emphasis>main</emphasis></entry>
26069 <entry>Type: <emphasis>string</emphasis></entry>
26070 <entry>Default: <emphasis>unset</emphasis></entry>
26071 </row>
26072 </tbody>
26073 </tgroup>
26074 </informaltable>
26075 <para>
26076 See <option>local_from_prefix</option> above.
26077 </para>
26078 <para>
26079 <indexterm role="option">
26080 <primary><option>local_interfaces</option></primary>
26081 </indexterm>
26082 </para>
26083 <informaltable frame="all">
26084 <tgroup cols="4" colsep="0" rowsep="0">
26085 <colspec colwidth="8*" align="left"/>
26086 <colspec colwidth="6*" align="center"/>
26087 <colspec colwidth="6*" align="center"/>
26088 <colspec colwidth="6*" align="right"/>
26089 <tbody>
26090 <row>
26091 <entry><option>local_interfaces</option></entry>
26092 <entry>Use: <emphasis>main</emphasis></entry>
26093 <entry>Type: <emphasis>string list</emphasis></entry>
26094 <entry>Default: <emphasis>see below</emphasis></entry>
26095 </row>
26096 </tbody>
26097 </tgroup>
26098 </informaltable>
26099 <para>
26100 This option controls which network interfaces are used by the daemon for
26101 listening; they are also used to identify the local host when routing. Chapter
26102 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
26103 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
26104 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
26105 <option>local_interfaces</option> is
26106 </para>
26107 <literallayout class="monospaced">
26108 local_interfaces = 0.0.0.0
26109 </literallayout>
26110 <para>
26111 when Exim is built without IPv6 support; otherwise it is
26112 </para>
26113 <literallayout class="monospaced">
26114 local_interfaces = &lt;; ::0 ; 0.0.0.0
26115 </literallayout>
26116 <para>
26117 <indexterm role="option">
26118 <primary><option>local_scan_timeout</option></primary>
26119 </indexterm>
26120 </para>
26121 <informaltable frame="all">
26122 <tgroup cols="4" colsep="0" rowsep="0">
26123 <colspec colwidth="8*" align="left"/>
26124 <colspec colwidth="6*" align="center"/>
26125 <colspec colwidth="6*" align="center"/>
26126 <colspec colwidth="6*" align="right"/>
26127 <tbody>
26128 <row>
26129 <entry><option>local_scan_timeout</option></entry>
26130 <entry>Use: <emphasis>main</emphasis></entry>
26131 <entry>Type: <emphasis>time</emphasis></entry>
26132 <entry>Default: <emphasis>5m</emphasis></entry>
26133 </row>
26134 </tbody>
26135 </tgroup>
26136 </informaltable>
26137 <para>
26138 <indexterm role="concept">
26139 <primary>timeout</primary>
26140 <secondary>for <function>local_scan()</function> function</secondary>
26141 </indexterm>
26142 <indexterm role="concept">
26143 <primary><function>local_scan()</function> function</primary>
26144 <secondary>timeout</secondary>
26145 </indexterm>
26146 This timeout applies to the <function>local_scan()</function> function (see chapter
26147 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
26148 the incoming message is rejected with a temporary error if it is an SMTP
26149 message. For a non-SMTP message, the message is dropped and Exim ends with a
26150 non-zero code. The incident is logged on the main and reject logs.
26151 </para>
26152 <para>
26153 <indexterm role="option">
26154 <primary><option>local_sender_retain</option></primary>
26155 </indexterm>
26156 </para>
26157 <informaltable frame="all">
26158 <tgroup cols="4" colsep="0" rowsep="0">
26159 <colspec colwidth="8*" align="left"/>
26160 <colspec colwidth="6*" align="center"/>
26161 <colspec colwidth="6*" align="center"/>
26162 <colspec colwidth="6*" align="right"/>
26163 <tbody>
26164 <row>
26165 <entry><option>local_sender_retain</option></entry>
26166 <entry>Use: <emphasis>main</emphasis></entry>
26167 <entry>Type: <emphasis>boolean</emphasis></entry>
26168 <entry>Default: <emphasis>false</emphasis></entry>
26169 </row>
26170 </tbody>
26171 </tgroup>
26172 </informaltable>
26173 <para>
26174 <indexterm role="concept">
26175 <primary><emphasis>Sender:</emphasis> header line</primary>
26176 <secondary>retaining from local submission</secondary>
26177 </indexterm>
26178 When a message is submitted locally (that is, not over a TCP/IP connection) by
26179 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
26180 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
26181 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
26182 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
26183 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
26184 </para>
26185 <para>
26186 <indexterm role="option">
26187 <primary><option>localhost_number</option></primary>
26188 </indexterm>
26189 </para>
26190 <informaltable frame="all">
26191 <tgroup cols="4" colsep="0" rowsep="0">
26192 <colspec colwidth="8*" align="left"/>
26193 <colspec colwidth="6*" align="center"/>
26194 <colspec colwidth="6*" align="center"/>
26195 <colspec colwidth="6*" align="right"/>
26196 <tbody>
26197 <row>
26198 <entry><option>localhost_number</option></entry>
26199 <entry>Use: <emphasis>main</emphasis></entry>
26200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26201 <entry>Default: <emphasis>unset</emphasis></entry>
26202 </row>
26203 </tbody>
26204 </tgroup>
26205 </informaltable>
26206 <para>
26207 <indexterm role="concept">
26208 <primary>host</primary>
26209 <secondary>locally unique number for</secondary>
26210 </indexterm>
26211 <indexterm role="concept">
26212 <primary>message ids</primary>
26213 <secondary>with multiple hosts</secondary>
26214 </indexterm>
26215 <indexterm role="variable">
26216 <primary><varname>$localhost_number</varname></primary>
26217 </indexterm>
26218 Exim&#x2019;s message ids are normally unique only within the local host. If
26219 uniqueness among a set of hosts is required, each host must set a different
26220 value for the <option>localhost_number</option> option. The string is expanded immediately
26221 after reading the configuration file (so that a number can be computed from the
26222 host name, for example) and the result of the expansion must be a number in the
26223 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
26224 systems). This is available in subsequent string expansions via the variable
26225 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
26226 characters of the message id, instead of just being a fractional part of the
26227 time, are computed from the time and the local host number as described in
26228 section <xref linkend="SECTmessiden"/>.
26229 </para>
26230 <para>
26231 <indexterm role="option">
26232 <primary><option>log_file_path</option></primary>
26233 </indexterm>
26234 </para>
26235 <informaltable frame="all">
26236 <tgroup cols="4" colsep="0" rowsep="0">
26237 <colspec colwidth="8*" align="left"/>
26238 <colspec colwidth="6*" align="center"/>
26239 <colspec colwidth="6*" align="center"/>
26240 <colspec colwidth="6*" align="right"/>
26241 <tbody>
26242 <row>
26243 <entry><option>log_file_path</option></entry>
26244 <entry>Use: <emphasis>main</emphasis></entry>
26245 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26246 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26247 </row>
26248 </tbody>
26249 </tgroup>
26250 </informaltable>
26251 <para>
26252 <indexterm role="concept">
26253 <primary>log</primary>
26254 <secondary>file path for</secondary>
26255 </indexterm>
26256 This option sets the path which is used to determine the names of Exim&#x2019;s log
26257 files, or indicates that logging is to be to syslog, or both. It is expanded
26258 when Exim is entered, so it can, for example, contain a reference to the host
26259 name. If no specific path is set for the log files at compile or run time,
26260 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
26261 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
26262 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
26263 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
26264 used. If this string is fixed at your installation (contains no expansion
26265 variables) it is recommended that you do not set this option in the
26266 configuration file, but instead supply the path using LOG_FILE_PATH in
26267 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
26268 early on &ndash; in particular, failure to read the configuration file.
26269 </para>
26270 <para>
26271 <indexterm role="option">
26272 <primary><option>log_selector</option></primary>
26273 </indexterm>
26274 </para>
26275 <informaltable frame="all">
26276 <tgroup cols="4" colsep="0" rowsep="0">
26277 <colspec colwidth="8*" align="left"/>
26278 <colspec colwidth="6*" align="center"/>
26279 <colspec colwidth="6*" align="center"/>
26280 <colspec colwidth="6*" align="right"/>
26281 <tbody>
26282 <row>
26283 <entry><option>log_selector</option></entry>
26284 <entry>Use: <emphasis>main</emphasis></entry>
26285 <entry>Type: <emphasis>string</emphasis></entry>
26286 <entry>Default: <emphasis>unset</emphasis></entry>
26287 </row>
26288 </tbody>
26289 </tgroup>
26290 </informaltable>
26291 <para>
26292 <indexterm role="concept">
26293 <primary>log</primary>
26294 <secondary>selectors</secondary>
26295 </indexterm>
26296 This option can be used to reduce or increase the number of things that Exim
26297 writes to its log files. Its argument is made up of names preceded by plus or
26298 minus characters. For example:
26299 </para>
26300 <literallayout class="monospaced">
26301 log_selector = +arguments -retry_defer
26302 </literallayout>
26303 <para>
26304 A list of possible names and what they control is given in the chapter on
26305 logging, in section <xref linkend="SECTlogselector"/>.
26306 </para>
26307 <para>
26308 <indexterm role="option">
26309 <primary><option>log_timezone</option></primary>
26310 </indexterm>
26311 </para>
26312 <informaltable frame="all">
26313 <tgroup cols="4" colsep="0" rowsep="0">
26314 <colspec colwidth="8*" align="left"/>
26315 <colspec colwidth="6*" align="center"/>
26316 <colspec colwidth="6*" align="center"/>
26317 <colspec colwidth="6*" align="right"/>
26318 <tbody>
26319 <row>
26320 <entry><option>log_timezone</option></entry>
26321 <entry>Use: <emphasis>main</emphasis></entry>
26322 <entry>Type: <emphasis>boolean</emphasis></entry>
26323 <entry>Default: <emphasis>false</emphasis></entry>
26324 </row>
26325 </tbody>
26326 </tgroup>
26327 </informaltable>
26328 <para>
26329 <indexterm role="concept">
26330 <primary>log</primary>
26331 <secondary>timezone for entries</secondary>
26332 </indexterm>
26333 <indexterm role="variable">
26334 <primary><varname>$tod_log</varname></primary>
26335 </indexterm>
26336 <indexterm role="variable">
26337 <primary><varname>$tod_zone</varname></primary>
26338 </indexterm>
26339 By default, the timestamps on log lines are in local time without the
26340 timezone. This means that if your timezone changes twice a year, the timestamps
26341 in log lines are ambiguous for an hour when the clocks go back. One way of
26342 avoiding this problem is to set the timezone to UTC. An alternative is to set
26343 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
26344 timestamps in log lines. Turning on this option can add quite a lot to the size
26345 of log files because each line is extended by 6 characters. Note that the
26346 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
26347 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
26348 </para>
26349 <para>
26350 <indexterm role="option">
26351 <primary><option>lookup_open_max</option></primary>
26352 </indexterm>
26353 </para>
26354 <informaltable frame="all">
26355 <tgroup cols="4" colsep="0" rowsep="0">
26356 <colspec colwidth="8*" align="left"/>
26357 <colspec colwidth="6*" align="center"/>
26358 <colspec colwidth="6*" align="center"/>
26359 <colspec colwidth="6*" align="right"/>
26360 <tbody>
26361 <row>
26362 <entry><option>lookup_open_max</option></entry>
26363 <entry>Use: <emphasis>main</emphasis></entry>
26364 <entry>Type: <emphasis>integer</emphasis></entry>
26365 <entry>Default: <emphasis>25</emphasis></entry>
26366 </row>
26367 </tbody>
26368 </tgroup>
26369 </informaltable>
26370 <para>
26371 <indexterm role="concept">
26372 <primary>too many open files</primary>
26373 </indexterm>
26374 <indexterm role="concept">
26375 <primary>open files, too many</primary>
26376 </indexterm>
26377 <indexterm role="concept">
26378 <primary>file</primary>
26379 <secondary>too many open</secondary>
26380 </indexterm>
26381 <indexterm role="concept">
26382 <primary>lookup</primary>
26383 <secondary>maximum open files</secondary>
26384 </indexterm>
26385 <indexterm role="concept">
26386 <primary>limit</primary>
26387 <secondary>open files for lookups</secondary>
26388 </indexterm>
26389 This option limits the number of simultaneously open files for single-key
26390 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
26391 Exim normally keeps these files open during routing, because often the same
26392 file is required several times. If the limit is reached, Exim closes the least
26393 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
26394 actually opens two files for each logical DBM database, though it still counts
26395 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
26396 open files</quote> errors with NDBM, you need to reduce the value of
26397 <option>lookup_open_max</option>.
26398 </para>
26399 <para>
26400 <indexterm role="option">
26401 <primary><option>max_username_length</option></primary>
26402 </indexterm>
26403 </para>
26404 <informaltable frame="all">
26405 <tgroup cols="4" colsep="0" rowsep="0">
26406 <colspec colwidth="8*" align="left"/>
26407 <colspec colwidth="6*" align="center"/>
26408 <colspec colwidth="6*" align="center"/>
26409 <colspec colwidth="6*" align="right"/>
26410 <tbody>
26411 <row>
26412 <entry><option>max_username_length</option></entry>
26413 <entry>Use: <emphasis>main</emphasis></entry>
26414 <entry>Type: <emphasis>integer</emphasis></entry>
26415 <entry>Default: <emphasis>0</emphasis></entry>
26416 </row>
26417 </tbody>
26418 </tgroup>
26419 </informaltable>
26420 <para>
26421 <indexterm role="concept">
26422 <primary>length of login name</primary>
26423 </indexterm>
26424 <indexterm role="concept">
26425 <primary>user name</primary>
26426 <secondary>maximum length</secondary>
26427 </indexterm>
26428 <indexterm role="concept">
26429 <primary>limit</primary>
26430 <secondary>user name length</secondary>
26431 </indexterm>
26432 Some operating systems are broken in that they truncate long arguments to
26433 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
26434 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
26435 an argument that is longer behaves as if <function>getpwnam()</function> failed.
26436 </para>
26437 <para>
26438 <indexterm role="option">
26439 <primary><option>message_body_newlines</option></primary>
26440 </indexterm>
26441 </para>
26442 <informaltable frame="all">
26443 <tgroup cols="4" colsep="0" rowsep="0">
26444 <colspec colwidth="8*" align="left"/>
26445 <colspec colwidth="6*" align="center"/>
26446 <colspec colwidth="6*" align="center"/>
26447 <colspec colwidth="6*" align="right"/>
26448 <tbody>
26449 <row>
26450 <entry><option>message_body_newlines</option></entry>
26451 <entry>Use: <emphasis>main</emphasis></entry>
26452 <entry>Type: <emphasis>bool</emphasis></entry>
26453 <entry>Default: <emphasis>false</emphasis></entry>
26454 </row>
26455 </tbody>
26456 </tgroup>
26457 </informaltable>
26458 <para>
26459 <indexterm role="concept">
26460 <primary>message body</primary>
26461 <secondary>newlines in variables</secondary>
26462 </indexterm>
26463 <indexterm role="concept">
26464 <primary>newline</primary>
26465 <secondary>in message body variables</secondary>
26466 </indexterm>
26467 <indexterm role="variable">
26468 <primary><varname>$message_body</varname></primary>
26469 </indexterm>
26470 <indexterm role="variable">
26471 <primary><varname>$message_body_end</varname></primary>
26472 </indexterm>
26473 By default, newlines in the message body are replaced by spaces when setting
26474 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
26475 option is set true, this no longer happens.
26476 </para>
26477 <para>
26478 <indexterm role="option">
26479 <primary><option>message_body_visible</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>message_body_visible</option></entry>
26491 <entry>Use: <emphasis>main</emphasis></entry>
26492 <entry>Type: <emphasis>integer</emphasis></entry>
26493 <entry>Default: <emphasis>500</emphasis></entry>
26494 </row>
26495 </tbody>
26496 </tgroup>
26497 </informaltable>
26498 <para>
26499 <indexterm role="concept">
26500 <primary>body of message</primary>
26501 <secondary>visible size</secondary>
26502 </indexterm>
26503 <indexterm role="concept">
26504 <primary>message body</primary>
26505 <secondary>visible size</secondary>
26506 </indexterm>
26507 <indexterm role="variable">
26508 <primary><varname>$message_body</varname></primary>
26509 </indexterm>
26510 <indexterm role="variable">
26511 <primary><varname>$message_body_end</varname></primary>
26512 </indexterm>
26513 This option specifies how much of a message&#x2019;s body is to be included in the
26514 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
26515 </para>
26516 <para>
26517 <indexterm role="option">
26518 <primary><option>message_id_header_domain</option></primary>
26519 </indexterm>
26520 </para>
26521 <informaltable frame="all">
26522 <tgroup cols="4" colsep="0" rowsep="0">
26523 <colspec colwidth="8*" align="left"/>
26524 <colspec colwidth="6*" align="center"/>
26525 <colspec colwidth="6*" align="center"/>
26526 <colspec colwidth="6*" align="right"/>
26527 <tbody>
26528 <row>
26529 <entry><option>message_id_header_domain</option></entry>
26530 <entry>Use: <emphasis>main</emphasis></entry>
26531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26532 <entry>Default: <emphasis>unset</emphasis></entry>
26533 </row>
26534 </tbody>
26535 </tgroup>
26536 </informaltable>
26537 <para>
26538 <indexterm role="concept">
26539 <primary><emphasis>Message-ID:</emphasis> header line</primary>
26540 </indexterm>
26541 If this option is set, the string is expanded and used as the right hand side
26542 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
26543 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
26544 means <quote>not received over TCP/IP.</quote>
26545 Otherwise, the primary host name is used.
26546 Only letters, digits, dot and hyphen are accepted; any other characters are
26547 replaced by hyphens. If the expansion is forced to fail, or if the result is an
26548 empty string, the option is ignored.
26549 </para>
26550 <para>
26551 <indexterm role="option">
26552 <primary><option>message_id_header_text</option></primary>
26553 </indexterm>
26554 </para>
26555 <informaltable frame="all">
26556 <tgroup cols="4" colsep="0" rowsep="0">
26557 <colspec colwidth="8*" align="left"/>
26558 <colspec colwidth="6*" align="center"/>
26559 <colspec colwidth="6*" align="center"/>
26560 <colspec colwidth="6*" align="right"/>
26561 <tbody>
26562 <row>
26563 <entry><option>message_id_header_text</option></entry>
26564 <entry>Use: <emphasis>main</emphasis></entry>
26565 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26566 <entry>Default: <emphasis>unset</emphasis></entry>
26567 </row>
26568 </tbody>
26569 </tgroup>
26570 </informaltable>
26571 <para>
26572 If this variable is set, the string is expanded and used to augment the text of
26573 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
26574 message does not have one. The text of this header is required by RFC 2822 to
26575 take the form of an address. By default, Exim uses its internal message id as
26576 the local part, and the primary host name as the domain. If this option is set,
26577 it is expanded, and provided the expansion is not forced to fail, and does not
26578 yield an empty string, the result is inserted into the header immediately
26579 before the @, separated from the internal message id by a dot. Any characters
26580 that are illegal in an address are automatically converted into hyphens. This
26581 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
26582 colons will become hyphens.
26583 </para>
26584 <para>
26585 <indexterm role="option">
26586 <primary><option>message_logs</option></primary>
26587 </indexterm>
26588 </para>
26589 <informaltable frame="all">
26590 <tgroup cols="4" colsep="0" rowsep="0">
26591 <colspec colwidth="8*" align="left"/>
26592 <colspec colwidth="6*" align="center"/>
26593 <colspec colwidth="6*" align="center"/>
26594 <colspec colwidth="6*" align="right"/>
26595 <tbody>
26596 <row>
26597 <entry><option>message_logs</option></entry>
26598 <entry>Use: <emphasis>main</emphasis></entry>
26599 <entry>Type: <emphasis>boolean</emphasis></entry>
26600 <entry>Default: <emphasis>true</emphasis></entry>
26601 </row>
26602 </tbody>
26603 </tgroup>
26604 </informaltable>
26605 <para>
26606 <indexterm role="concept">
26607 <primary>message logs</primary>
26608 <secondary>disabling</secondary>
26609 </indexterm>
26610 <indexterm role="concept">
26611 <primary>log</primary>
26612 <secondary>message log; disabling</secondary>
26613 </indexterm>
26614 If this option is turned off, per-message log files are not created in the
26615 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
26616 Exim, by reducing the number of files involved in handling a message from a
26617 minimum of four (header spool file, body spool file, delivery journal, and
26618 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
26619 which is not affected by this option.
26620 </para>
26621 <para>
26622 <indexterm role="option">
26623 <primary><option>message_size_limit</option></primary>
26624 </indexterm>
26625 </para>
26626 <informaltable frame="all">
26627 <tgroup cols="4" colsep="0" rowsep="0">
26628 <colspec colwidth="8*" align="left"/>
26629 <colspec colwidth="6*" align="center"/>
26630 <colspec colwidth="6*" align="center"/>
26631 <colspec colwidth="6*" align="right"/>
26632 <tbody>
26633 <row>
26634 <entry><option>message_size_limit</option></entry>
26635 <entry>Use: <emphasis>main</emphasis></entry>
26636 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26637 <entry>Default: <emphasis>50M</emphasis></entry>
26638 </row>
26639 </tbody>
26640 </tgroup>
26641 </informaltable>
26642 <para>
26643 <indexterm role="concept">
26644 <primary>message</primary>
26645 <secondary>size limit</secondary>
26646 </indexterm>
26647 <indexterm role="concept">
26648 <primary>limit</primary>
26649 <secondary>message size</secondary>
26650 </indexterm>
26651 <indexterm role="concept">
26652 <primary>size</primary>
26653 <secondary>of message, limit</secondary>
26654 </indexterm>
26655 This option limits the maximum size of message that Exim will process. The
26656 value is expanded for each incoming connection so, for example, it can be made
26657 to depend on the IP address of the remote host for messages arriving via
26658 TCP/IP. After expansion, the value must be a sequence of decimal digits,
26659 optionally followed by K or M.
26660 </para>
26661 <para>
26662 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
26663 other properties of an individual message, because it has to be advertised in
26664 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
26665 error. A value of zero means no limit, but its use is not recommended. See also
26666 <option>bounce_return_size_limit</option>.
26667 </para>
26668 <para>
26669 Incoming SMTP messages are failed with a 552 error if the limit is
26670 exceeded; locally-generated messages either get a stderr message or a delivery
26671 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
26672 an oversized message is logged in both the main and the reject logs. See also
26673 the generic transport option <option>message_size_limit</option>, which limits the size of
26674 message that an individual transport can process.
26675 </para>
26676 <para>
26677 If you use a virus-scanner and set this option to to a value larger than the
26678 maximum size that your virus-scanner is configured to support, you may get
26679 failures triggered by large mails.  The right size to configure for the
26680 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
26681 probably safest to just set it to a little larger than this value.  E.g., with a
26682 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
26683 some problems may result.
26684 </para>
26685 <para>
26686 A value of 0 will disable size limit checking; Exim will still advertise the
26687 SIZE extension in an EHLO response, but without a limit, so as to permit
26688 SMTP clients to still indicate the message size along with the MAIL verb.
26689 </para>
26690 <para>
26691 <indexterm role="option">
26692 <primary><option>move_frozen_messages</option></primary>
26693 </indexterm>
26694 </para>
26695 <informaltable frame="all">
26696 <tgroup cols="4" colsep="0" rowsep="0">
26697 <colspec colwidth="8*" align="left"/>
26698 <colspec colwidth="6*" align="center"/>
26699 <colspec colwidth="6*" align="center"/>
26700 <colspec colwidth="6*" align="right"/>
26701 <tbody>
26702 <row>
26703 <entry><option>move_frozen_messages</option></entry>
26704 <entry>Use: <emphasis>main</emphasis></entry>
26705 <entry>Type: <emphasis>boolean</emphasis></entry>
26706 <entry>Default: <emphasis>false</emphasis></entry>
26707 </row>
26708 </tbody>
26709 </tgroup>
26710 </informaltable>
26711 <para>
26712 <indexterm role="concept">
26713 <primary>frozen messages</primary>
26714 <secondary>moving</secondary>
26715 </indexterm>
26716 This option, which is available only if Exim has been built with the setting
26717 </para>
26718 <literallayout class="monospaced">
26719 SUPPORT_MOVE_FROZEN_MESSAGES=yes
26720 </literallayout>
26721 <para>
26722 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
26723 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
26724 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
26725 standard utilities for handling such moved messages, and they do not show up in
26726 lists generated by <option>-bp</option> or by the Exim monitor.
26727 </para>
26728 <para>
26729 <indexterm role="option">
26730 <primary><option>mua_wrapper</option></primary>
26731 </indexterm>
26732 </para>
26733 <informaltable frame="all">
26734 <tgroup cols="4" colsep="0" rowsep="0">
26735 <colspec colwidth="8*" align="left"/>
26736 <colspec colwidth="6*" align="center"/>
26737 <colspec colwidth="6*" align="center"/>
26738 <colspec colwidth="6*" align="right"/>
26739 <tbody>
26740 <row>
26741 <entry><option>mua_wrapper</option></entry>
26742 <entry>Use: <emphasis>main</emphasis></entry>
26743 <entry>Type: <emphasis>boolean</emphasis></entry>
26744 <entry>Default: <emphasis>false</emphasis></entry>
26745 </row>
26746 </tbody>
26747 </tgroup>
26748 </informaltable>
26749 <para>
26750 Setting this option true causes Exim to run in a very restrictive mode in which
26751 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
26752 contains a full description of this facility.
26753 </para>
26754 <para>
26755 <indexterm role="option">
26756 <primary><option>mysql_servers</option></primary>
26757 </indexterm>
26758 </para>
26759 <informaltable frame="all">
26760 <tgroup cols="4" colsep="0" rowsep="0">
26761 <colspec colwidth="8*" align="left"/>
26762 <colspec colwidth="6*" align="center"/>
26763 <colspec colwidth="6*" align="center"/>
26764 <colspec colwidth="6*" align="right"/>
26765 <tbody>
26766 <row>
26767 <entry><option>mysql_servers</option></entry>
26768 <entry>Use: <emphasis>main</emphasis></entry>
26769 <entry>Type: <emphasis>string list</emphasis></entry>
26770 <entry>Default: <emphasis>unset</emphasis></entry>
26771 </row>
26772 </tbody>
26773 </tgroup>
26774 </informaltable>
26775 <para>
26776 <indexterm role="concept">
26777 <primary>MySQL</primary>
26778 <secondary>server list</secondary>
26779 </indexterm>
26780 This option provides a list of MySQL servers and associated connection data, to
26781 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
26782 option is available only if Exim has been built with MySQL support.
26783 </para>
26784 <para>
26785 <indexterm role="option">
26786 <primary><option>never_users</option></primary>
26787 </indexterm>
26788 </para>
26789 <informaltable frame="all">
26790 <tgroup cols="4" colsep="0" rowsep="0">
26791 <colspec colwidth="8*" align="left"/>
26792 <colspec colwidth="6*" align="center"/>
26793 <colspec colwidth="6*" align="center"/>
26794 <colspec colwidth="6*" align="right"/>
26795 <tbody>
26796 <row>
26797 <entry><option>never_users</option></entry>
26798 <entry>Use: <emphasis>main</emphasis></entry>
26799 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26800 <entry>Default: <emphasis>unset</emphasis></entry>
26801 </row>
26802 </tbody>
26803 </tgroup>
26804 </informaltable>
26805 <para>
26806 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
26807 message deliveries are normally run in processes that are setuid to the
26808 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
26809 It is usually desirable to prevent any deliveries from running as root, as a
26810 safety precaution.
26811 </para>
26812 <para>
26813 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
26814 list of users that must not be used for local deliveries. This list is fixed in
26815 the binary and cannot be overridden by the configuration file. By default, it
26816 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
26817 can be used to add more users to the fixed list.
26818 </para>
26819 <para>
26820 If a message is to be delivered as one of the users on the fixed list or the
26821 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
26822 example is
26823 </para>
26824 <literallayout class="monospaced">
26825 never_users = root:daemon:bin
26826 </literallayout>
26827 <para>
26828 Including root is redundant if it is also on the fixed list, but it does no
26829 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
26830 transport driver.
26831 </para>
26832 <para>
26833 <indexterm role="option">
26834 <primary><option>openssl_options</option></primary>
26835 </indexterm>
26836 </para>
26837 <informaltable frame="all">
26838 <tgroup cols="4" colsep="0" rowsep="0">
26839 <colspec colwidth="8*" align="left"/>
26840 <colspec colwidth="6*" align="center"/>
26841 <colspec colwidth="6*" align="center"/>
26842 <colspec colwidth="6*" align="right"/>
26843 <tbody>
26844 <row>
26845 <entry><option>openssl_options</option></entry>
26846 <entry>Use: <emphasis>main</emphasis></entry>
26847 <entry>Type: <emphasis>string list</emphasis></entry>
26848 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
26849 </row>
26850 </tbody>
26851 </tgroup>
26852 </informaltable>
26853 <para>
26854 <indexterm role="concept">
26855 <primary>OpenSSL </primary>
26856 <secondary>compatibility</secondary>
26857 </indexterm>
26858 This option allows an administrator to adjust the SSL options applied
26859 by OpenSSL to connections.  It is given as a space-separated list of items,
26860 each one to be +added or -subtracted from the current value.
26861 </para>
26862 <para>
26863 This option is only available if Exim is built against OpenSSL.  The values
26864 available for this option vary according to the age of your OpenSSL install.
26865 The <quote>all</quote> value controls a subset of flags which are available, typically
26866 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
26867 list the values known on your system and Exim should support all the
26868 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
26869 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
26870 </para>
26871 <para>
26872 Note that adjusting the options can have severe impact upon the security of
26873 SSL as used by Exim.  It is possible to disable safety checks and shoot
26874 yourself in the foot in various unpleasant ways.  This option should not be
26875 adjusted lightly.  An unrecognised item will be detected at startup, by
26876 invoking Exim with the <option>-bV</option> flag.
26877 </para>
26878 <para>
26879 The option affects Exim operating both as a server and as a client.
26880 </para>
26881 <para>
26882 Historical note: prior to release 4.80, Exim defaulted this value to
26883 "+dont_insert_empty_fragments", which may still be needed for compatibility
26884 with some clients, but which lowers security by increasing exposure to
26885 some now infamous attacks.
26886 </para>
26887 <para>
26888 Examples:
26889 </para>
26890 <literallayout class="monospaced">
26891 # Make both old MS and old Eudora happy:
26892 openssl_options = -all +microsoft_big_sslv3_buffer \
26893                        +dont_insert_empty_fragments
26894
26895 # Disable older protocol versions:
26896 openssl_options = +no_sslv2 +no_sslv3
26897 </literallayout>
26898 <para>
26899 Possible options may include:
26900 </para>
26901 <itemizedlist>
26902 <listitem>
26903 <para>
26904 <literal>all</literal>
26905 </para>
26906 </listitem>
26907 <listitem>
26908 <para>
26909 <literal>allow_unsafe_legacy_renegotiation</literal>
26910 </para>
26911 </listitem>
26912 <listitem>
26913 <para>
26914 <literal>cipher_server_preference</literal>
26915 </para>
26916 </listitem>
26917 <listitem>
26918 <para>
26919 <literal>dont_insert_empty_fragments</literal>
26920 </para>
26921 </listitem>
26922 <listitem>
26923 <para>
26924 <literal>ephemeral_rsa</literal>
26925 </para>
26926 </listitem>
26927 <listitem>
26928 <para>
26929 <literal>legacy_server_connect</literal>
26930 </para>
26931 </listitem>
26932 <listitem>
26933 <para>
26934 <literal>microsoft_big_sslv3_buffer</literal>
26935 </para>
26936 </listitem>
26937 <listitem>
26938 <para>
26939 <literal>microsoft_sess_id_bug</literal>
26940 </para>
26941 </listitem>
26942 <listitem>
26943 <para>
26944 <literal>msie_sslv2_rsa_padding</literal>
26945 </para>
26946 </listitem>
26947 <listitem>
26948 <para>
26949 <literal>netscape_challenge_bug</literal>
26950 </para>
26951 </listitem>
26952 <listitem>
26953 <para>
26954 <literal>netscape_reuse_cipher_change_bug</literal>
26955 </para>
26956 </listitem>
26957 <listitem>
26958 <para>
26959 <literal>no_compression</literal>
26960 </para>
26961 </listitem>
26962 <listitem>
26963 <para>
26964 <literal>no_session_resumption_on_renegotiation</literal>
26965 </para>
26966 </listitem>
26967 <listitem>
26968 <para>
26969 <literal>no_sslv2</literal>
26970 </para>
26971 </listitem>
26972 <listitem>
26973 <para>
26974 <literal>no_sslv3</literal>
26975 </para>
26976 </listitem>
26977 <listitem>
26978 <para>
26979 <literal>no_ticket</literal>
26980 </para>
26981 </listitem>
26982 <listitem>
26983 <para>
26984 <literal>no_tlsv1</literal>
26985 </para>
26986 </listitem>
26987 <listitem>
26988 <para>
26989 <literal>no_tlsv1_1</literal>
26990 </para>
26991 </listitem>
26992 <listitem>
26993 <para>
26994 <literal>no_tlsv1_2</literal>
26995 </para>
26996 </listitem>
26997 <listitem>
26998 <para>
26999 <literal>safari_ecdhe_ecdsa_bug</literal>
27000 </para>
27001 </listitem>
27002 <listitem>
27003 <para>
27004 <literal>single_dh_use</literal>
27005 </para>
27006 </listitem>
27007 <listitem>
27008 <para>
27009 <literal>single_ecdh_use</literal>
27010 </para>
27011 </listitem>
27012 <listitem>
27013 <para>
27014 <literal>ssleay_080_client_dh_bug</literal>
27015 </para>
27016 </listitem>
27017 <listitem>
27018 <para>
27019 <literal>sslref2_reuse_cert_type_bug</literal>
27020 </para>
27021 </listitem>
27022 <listitem>
27023 <para>
27024 <literal>tls_block_padding_bug</literal>
27025 </para>
27026 </listitem>
27027 <listitem>
27028 <para>
27029 <literal>tls_d5_bug</literal>
27030 </para>
27031 </listitem>
27032 <listitem>
27033 <para>
27034 <literal>tls_rollback_bug</literal>
27035 </para>
27036 </listitem>
27037 </itemizedlist>
27038 <para>
27039 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
27040 all clients connecting using the MacOS SecureTransport TLS facility prior
27041 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
27042 to negotiate TLS then this option value might help, provided that your OpenSSL
27043 release is new enough to contain this work-around.  This may be a situation
27044 where you have to upgrade OpenSSL to get buggy clients working.
27045 </para>
27046 <para>
27047 <indexterm role="option">
27048 <primary><option>oracle_servers</option></primary>
27049 </indexterm>
27050 </para>
27051 <informaltable frame="all">
27052 <tgroup cols="4" colsep="0" rowsep="0">
27053 <colspec colwidth="8*" align="left"/>
27054 <colspec colwidth="6*" align="center"/>
27055 <colspec colwidth="6*" align="center"/>
27056 <colspec colwidth="6*" align="right"/>
27057 <tbody>
27058 <row>
27059 <entry><option>oracle_servers</option></entry>
27060 <entry>Use: <emphasis>main</emphasis></entry>
27061 <entry>Type: <emphasis>string list</emphasis></entry>
27062 <entry>Default: <emphasis>unset</emphasis></entry>
27063 </row>
27064 </tbody>
27065 </tgroup>
27066 </informaltable>
27067 <para>
27068 <indexterm role="concept">
27069 <primary>Oracle</primary>
27070 <secondary>server list</secondary>
27071 </indexterm>
27072 This option provides a list of Oracle servers and associated connection data,
27073 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
27074 The option is available only if Exim has been built with Oracle support.
27075 </para>
27076 <para>
27077 <indexterm role="option">
27078 <primary><option>percent_hack_domains</option></primary>
27079 </indexterm>
27080 </para>
27081 <informaltable frame="all">
27082 <tgroup cols="4" colsep="0" rowsep="0">
27083 <colspec colwidth="8*" align="left"/>
27084 <colspec colwidth="6*" align="center"/>
27085 <colspec colwidth="6*" align="center"/>
27086 <colspec colwidth="6*" align="right"/>
27087 <tbody>
27088 <row>
27089 <entry><option>percent_hack_domains</option></entry>
27090 <entry>Use: <emphasis>main</emphasis></entry>
27091 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27092 <entry>Default: <emphasis>unset</emphasis></entry>
27093 </row>
27094 </tbody>
27095 </tgroup>
27096 </informaltable>
27097 <para>
27098 <indexterm role="concept">
27099 <primary><quote>percent hack</quote></primary>
27100 </indexterm>
27101 <indexterm role="concept">
27102 <primary>source routing</primary>
27103 <secondary>in email address</secondary>
27104 </indexterm>
27105 <indexterm role="concept">
27106 <primary>address</primary>
27107 <secondary>source-routed</secondary>
27108 </indexterm>
27109 The <quote>percent hack</quote> is the convention whereby a local part containing a
27110 percent sign is re-interpreted as a new email address, with the percent
27111 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
27112 also applied to RFC 2822 addresses that begin with an @ character. If this
27113 option is set, Exim implements the percent facility for those domains listed,
27114 but no others. This happens before an incoming SMTP address is tested against
27115 an ACL.
27116 </para>
27117 <para>
27118 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
27119 trying to get round relaying restrictions. For this reason, it is best avoided
27120 if at all possible. Unfortunately, a number of less security-conscious MTAs
27121 implement it unconditionally. If you are running Exim on a gateway host, and
27122 routing mail through to internal MTAs without processing the local parts, it is
27123 a good idea to reject recipient addresses with percent characters in their
27124 local parts. Exim&#x2019;s default configuration does this.
27125 </para>
27126 <para>
27127 <indexterm role="option">
27128 <primary><option>perl_at_start</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>perl_at_start</option></entry>
27140 <entry>Use: <emphasis>main</emphasis></entry>
27141 <entry>Type: <emphasis>boolean</emphasis></entry>
27142 <entry>Default: <emphasis>false</emphasis></entry>
27143 </row>
27144 </tbody>
27145 </tgroup>
27146 </informaltable>
27147 <para>
27148 This option is available only when Exim is built with an embedded Perl
27149 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27150 </para>
27151 <para>
27152 <indexterm role="option">
27153 <primary><option>perl_startup</option></primary>
27154 </indexterm>
27155 </para>
27156 <informaltable frame="all">
27157 <tgroup cols="4" colsep="0" rowsep="0">
27158 <colspec colwidth="8*" align="left"/>
27159 <colspec colwidth="6*" align="center"/>
27160 <colspec colwidth="6*" align="center"/>
27161 <colspec colwidth="6*" align="right"/>
27162 <tbody>
27163 <row>
27164 <entry><option>perl_startup</option></entry>
27165 <entry>Use: <emphasis>main</emphasis></entry>
27166 <entry>Type: <emphasis>string</emphasis></entry>
27167 <entry>Default: <emphasis>unset</emphasis></entry>
27168 </row>
27169 </tbody>
27170 </tgroup>
27171 </informaltable>
27172 <para>
27173 This option is available only when Exim is built with an embedded Perl
27174 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27175 </para>
27176 <para>
27177 <indexterm role="option">
27178 <primary><option>pgsql_servers</option></primary>
27179 </indexterm>
27180 </para>
27181 <informaltable frame="all">
27182 <tgroup cols="4" colsep="0" rowsep="0">
27183 <colspec colwidth="8*" align="left"/>
27184 <colspec colwidth="6*" align="center"/>
27185 <colspec colwidth="6*" align="center"/>
27186 <colspec colwidth="6*" align="right"/>
27187 <tbody>
27188 <row>
27189 <entry><option>pgsql_servers</option></entry>
27190 <entry>Use: <emphasis>main</emphasis></entry>
27191 <entry>Type: <emphasis>string list</emphasis></entry>
27192 <entry>Default: <emphasis>unset</emphasis></entry>
27193 </row>
27194 </tbody>
27195 </tgroup>
27196 </informaltable>
27197 <para>
27198 <indexterm role="concept">
27199 <primary>PostgreSQL lookup type</primary>
27200 <secondary>server list</secondary>
27201 </indexterm>
27202 This option provides a list of PostgreSQL servers and associated connection
27203 data, to be used in conjunction with <command>pgsql</command> lookups (see section
27204 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
27205 PostgreSQL support.
27206 </para>
27207 <para>
27208 <indexterm role="option">
27209 <primary><option>pid_file_path</option></primary>
27210 </indexterm>
27211 </para>
27212 <informaltable frame="all">
27213 <tgroup cols="4" colsep="0" rowsep="0">
27214 <colspec colwidth="8*" align="left"/>
27215 <colspec colwidth="6*" align="center"/>
27216 <colspec colwidth="6*" align="center"/>
27217 <colspec colwidth="6*" align="right"/>
27218 <tbody>
27219 <row>
27220 <entry><option>pid_file_path</option></entry>
27221 <entry>Use: <emphasis>main</emphasis></entry>
27222 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27223 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27224 </row>
27225 </tbody>
27226 </tgroup>
27227 </informaltable>
27228 <para>
27229 <indexterm role="concept">
27230 <primary>daemon</primary>
27231 <secondary>pid file path</secondary>
27232 </indexterm>
27233 <indexterm role="concept">
27234 <primary>pid file, path for</primary>
27235 </indexterm>
27236 This option sets the name of the file to which the Exim daemon writes its
27237 process id. The string is expanded, so it can contain, for example, references
27238 to the host name:
27239 </para>
27240 <literallayout class="monospaced">
27241 pid_file_path = /var/log/$primary_hostname/exim.pid
27242 </literallayout>
27243 <para>
27244 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
27245 spool directory.
27246 The value set by the option can be overridden by the <option>-oP</option> command line
27247 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
27248 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
27249 </para>
27250 <para>
27251 <indexterm role="option">
27252 <primary><option>pipelining_advertise_hosts</option></primary>
27253 </indexterm>
27254 </para>
27255 <informaltable frame="all">
27256 <tgroup cols="4" colsep="0" rowsep="0">
27257 <colspec colwidth="8*" align="left"/>
27258 <colspec colwidth="6*" align="center"/>
27259 <colspec colwidth="6*" align="center"/>
27260 <colspec colwidth="6*" align="right"/>
27261 <tbody>
27262 <row>
27263 <entry><option>pipelining_advertise_hosts</option></entry>
27264 <entry>Use: <emphasis>main</emphasis></entry>
27265 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27266 <entry>Default: <emphasis>*</emphasis></entry>
27267 </row>
27268 </tbody>
27269 </tgroup>
27270 </informaltable>
27271 <para>
27272 <indexterm role="concept">
27273 <primary>PIPELINING</primary>
27274 <secondary>suppressing advertising</secondary>
27275 </indexterm>
27276 This option can be used to suppress the advertisement of the SMTP
27277 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
27278 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
27279 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
27280 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
27281 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
27282 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
27283 </para>
27284 <para>
27285 <indexterm role="option">
27286 <primary><option>prdr_enable</option></primary>
27287 </indexterm>
27288 </para>
27289 <informaltable frame="all">
27290 <tgroup cols="4" colsep="0" rowsep="0">
27291 <colspec colwidth="8*" align="left"/>
27292 <colspec colwidth="6*" align="center"/>
27293 <colspec colwidth="6*" align="center"/>
27294 <colspec colwidth="6*" align="right"/>
27295 <tbody>
27296 <row>
27297 <entry><option>prdr_enable</option></entry>
27298 <entry>Use: <emphasis>main</emphasis></entry>
27299 <entry>Type: <emphasis>boolean</emphasis></entry>
27300 <entry>Default: <emphasis>false</emphasis></entry>
27301 </row>
27302 </tbody>
27303 </tgroup>
27304 </informaltable>
27305 <para>
27306 <indexterm role="concept">
27307 <primary>PRDR</primary>
27308 <secondary>enabling on server</secondary>
27309 </indexterm>
27310 This option can be used to enable the Per-Recipient Data Response extension
27311 to SMTP, defined by Eric Hall.
27312 If the option is set, PRDR is advertised by Exim when operating as a server.
27313 If the client requests PRDR, and more than one recipient, for a message
27314 an additional ACL is called for each recipient after the message content
27315 is received.  See section <xref linkend="SECTPRDRACL"/>.
27316 </para>
27317 <para>
27318 <indexterm role="option">
27319 <primary><option>preserve_message_logs</option></primary>
27320 </indexterm>
27321 </para>
27322 <informaltable frame="all">
27323 <tgroup cols="4" colsep="0" rowsep="0">
27324 <colspec colwidth="8*" align="left"/>
27325 <colspec colwidth="6*" align="center"/>
27326 <colspec colwidth="6*" align="center"/>
27327 <colspec colwidth="6*" align="right"/>
27328 <tbody>
27329 <row>
27330 <entry><option>preserve_message_logs</option></entry>
27331 <entry>Use: <emphasis>main</emphasis></entry>
27332 <entry>Type: <emphasis>boolean</emphasis></entry>
27333 <entry>Default: <emphasis>false</emphasis></entry>
27334 </row>
27335 </tbody>
27336 </tgroup>
27337 </informaltable>
27338 <para>
27339 <indexterm role="concept">
27340 <primary>message logs</primary>
27341 <secondary>preserving</secondary>
27342 </indexterm>
27343 If this option is set, message log files are not deleted when messages are
27344 completed. Instead, they are moved to a sub-directory of the spool directory
27345 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
27346 purposes. This is a dangerous option to set on systems with any appreciable
27347 volume of mail. Use with care!
27348 </para>
27349 <para>
27350 <indexterm role="option">
27351 <primary><option>primary_hostname</option></primary>
27352 </indexterm>
27353 </para>
27354 <informaltable frame="all">
27355 <tgroup cols="4" colsep="0" rowsep="0">
27356 <colspec colwidth="8*" align="left"/>
27357 <colspec colwidth="6*" align="center"/>
27358 <colspec colwidth="6*" align="center"/>
27359 <colspec colwidth="6*" align="right"/>
27360 <tbody>
27361 <row>
27362 <entry><option>primary_hostname</option></entry>
27363 <entry>Use: <emphasis>main</emphasis></entry>
27364 <entry>Type: <emphasis>string</emphasis></entry>
27365 <entry>Default: <emphasis>see below</emphasis></entry>
27366 </row>
27367 </tbody>
27368 </tgroup>
27369 </informaltable>
27370 <para>
27371 <indexterm role="concept">
27372 <primary>name</primary>
27373 <secondary>of local host</secondary>
27374 </indexterm>
27375 <indexterm role="concept">
27376 <primary>host</primary>
27377 <secondary>name of local</secondary>
27378 </indexterm>
27379 <indexterm role="concept">
27380 <primary>local host</primary>
27381 <secondary>name of</secondary>
27382 </indexterm>
27383 <indexterm role="variable">
27384 <primary><varname>$primary_hostname</varname></primary>
27385 </indexterm>
27386 This specifies the name of the current host. It is used in the default EHLO or
27387 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
27388 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
27389 The value is also used by default in some SMTP response messages from an Exim
27390 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
27391 </para>
27392 <para>
27393 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
27394 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
27395 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
27396 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
27397 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
27398 explicitly by this option, or defaulted.
27399 </para>
27400 <para>
27401 <indexterm role="option">
27402 <primary><option>print_topbitchars</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>print_topbitchars</option></entry>
27414 <entry>Use: <emphasis>main</emphasis></entry>
27415 <entry>Type: <emphasis>boolean</emphasis></entry>
27416 <entry>Default: <emphasis>false</emphasis></entry>
27417 </row>
27418 </tbody>
27419 </tgroup>
27420 </informaltable>
27421 <para>
27422 <indexterm role="concept">
27423 <primary>printing characters</primary>
27424 </indexterm>
27425 <indexterm role="concept">
27426 <primary>8-bit characters</primary>
27427 </indexterm>
27428 By default, Exim considers only those characters whose codes lie in the range
27429 32&ndash;126 to be printing characters. In a number of circumstances (for example,
27430 when writing log entries) non-printing characters are converted into escape
27431 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
27432 is set, code values of 128 and above are also considered to be printing
27433 characters.
27434 </para>
27435 <para>
27436 This option also affects the header syntax checks performed by the
27437 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
27438 the user&#x2019;s full name when constructing From: and Sender: addresses (as
27439 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
27440 Exim to generate eight bit message headers that do not conform to the
27441 standards.
27442 </para>
27443 <para>
27444 <indexterm role="option">
27445 <primary><option>process_log_path</option></primary>
27446 </indexterm>
27447 </para>
27448 <informaltable frame="all">
27449 <tgroup cols="4" colsep="0" rowsep="0">
27450 <colspec colwidth="8*" align="left"/>
27451 <colspec colwidth="6*" align="center"/>
27452 <colspec colwidth="6*" align="center"/>
27453 <colspec colwidth="6*" align="right"/>
27454 <tbody>
27455 <row>
27456 <entry><option>process_log_path</option></entry>
27457 <entry>Use: <emphasis>main</emphasis></entry>
27458 <entry>Type: <emphasis>string</emphasis></entry>
27459 <entry>Default: <emphasis>unset</emphasis></entry>
27460 </row>
27461 </tbody>
27462 </tgroup>
27463 </informaltable>
27464 <para>
27465 <indexterm role="concept">
27466 <primary>process log path</primary>
27467 </indexterm>
27468 <indexterm role="concept">
27469 <primary>log</primary>
27470 <secondary>process log</secondary>
27471 </indexterm>
27472 <indexterm role="concept">
27473 <primary><emphasis>exiwhat</emphasis></primary>
27474 </indexterm>
27475 This option sets the name of the file to which an Exim process writes its
27476 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
27477 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
27478 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
27479 can be useful in environments where two different Exims are running, using
27480 different spool directories.
27481 </para>
27482 <para>
27483 <indexterm role="option">
27484 <primary><option>prod_requires_admin</option></primary>
27485 </indexterm>
27486 </para>
27487 <informaltable frame="all">
27488 <tgroup cols="4" colsep="0" rowsep="0">
27489 <colspec colwidth="8*" align="left"/>
27490 <colspec colwidth="6*" align="center"/>
27491 <colspec colwidth="6*" align="center"/>
27492 <colspec colwidth="6*" align="right"/>
27493 <tbody>
27494 <row>
27495 <entry><option>prod_requires_admin</option></entry>
27496 <entry>Use: <emphasis>main</emphasis></entry>
27497 <entry>Type: <emphasis>boolean</emphasis></entry>
27498 <entry>Default: <emphasis>true</emphasis></entry>
27499 </row>
27500 </tbody>
27501 </tgroup>
27502 </informaltable>
27503 <para>
27504 <indexterm role="option">
27505 <primary><option>-M</option></primary>
27506 </indexterm>
27507 <indexterm role="option">
27508 <primary><option>-R</option></primary>
27509 </indexterm>
27510 <indexterm role="option">
27511 <primary><option>-q</option></primary>
27512 </indexterm>
27513 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
27514 admin user unless <option>prod_requires_admin</option> is set false. See also
27515 <option>queue_list_requires_admin</option>.
27516 </para>
27517 <para>
27518 <indexterm role="option">
27519 <primary><option>qualify_domain</option></primary>
27520 </indexterm>
27521 </para>
27522 <informaltable frame="all">
27523 <tgroup cols="4" colsep="0" rowsep="0">
27524 <colspec colwidth="8*" align="left"/>
27525 <colspec colwidth="6*" align="center"/>
27526 <colspec colwidth="6*" align="center"/>
27527 <colspec colwidth="6*" align="right"/>
27528 <tbody>
27529 <row>
27530 <entry><option>qualify_domain</option></entry>
27531 <entry>Use: <emphasis>main</emphasis></entry>
27532 <entry>Type: <emphasis>string</emphasis></entry>
27533 <entry>Default: <emphasis>see below</emphasis></entry>
27534 </row>
27535 </tbody>
27536 </tgroup>
27537 </informaltable>
27538 <para>
27539 <indexterm role="concept">
27540 <primary>domain</primary>
27541 <secondary>for qualifying addresses</secondary>
27542 </indexterm>
27543 <indexterm role="concept">
27544 <primary>address</primary>
27545 <secondary>qualification</secondary>
27546 </indexterm>
27547 This option specifies the domain name that is added to any envelope sender
27548 addresses that do not have a domain qualification. It also applies to
27549 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
27550 are accepted by default only for locally-generated messages. Qualification is
27551 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
27552 locally-generated messages, unless the <option>-bnq</option> command line option is used.
27553 </para>
27554 <para>
27555 Messages from external sources must always contain fully qualified addresses,
27556 unless the sending host matches <option>sender_unqualified_hosts</option> or
27557 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
27558 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
27559 necessary. Internally, Exim always works with fully qualified envelope
27560 addresses. If <option>qualify_domain</option> is not set, it defaults to the
27561 <option>primary_hostname</option> value.
27562 </para>
27563 <para>
27564 <indexterm role="option">
27565 <primary><option>qualify_recipient</option></primary>
27566 </indexterm>
27567 </para>
27568 <informaltable frame="all">
27569 <tgroup cols="4" colsep="0" rowsep="0">
27570 <colspec colwidth="8*" align="left"/>
27571 <colspec colwidth="6*" align="center"/>
27572 <colspec colwidth="6*" align="center"/>
27573 <colspec colwidth="6*" align="right"/>
27574 <tbody>
27575 <row>
27576 <entry><option>qualify_recipient</option></entry>
27577 <entry>Use: <emphasis>main</emphasis></entry>
27578 <entry>Type: <emphasis>string</emphasis></entry>
27579 <entry>Default: <emphasis>see below</emphasis></entry>
27580 </row>
27581 </tbody>
27582 </tgroup>
27583 </informaltable>
27584 <para>
27585 This option allows you to specify a different domain for qualifying recipient
27586 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
27587 </para>
27588 <para>
27589 <indexterm role="option">
27590 <primary><option>queue_domains</option></primary>
27591 </indexterm>
27592 </para>
27593 <informaltable frame="all">
27594 <tgroup cols="4" colsep="0" rowsep="0">
27595 <colspec colwidth="8*" align="left"/>
27596 <colspec colwidth="6*" align="center"/>
27597 <colspec colwidth="6*" align="center"/>
27598 <colspec colwidth="6*" align="right"/>
27599 <tbody>
27600 <row>
27601 <entry><option>queue_domains</option></entry>
27602 <entry>Use: <emphasis>main</emphasis></entry>
27603 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27604 <entry>Default: <emphasis>unset</emphasis></entry>
27605 </row>
27606 </tbody>
27607 </tgroup>
27608 </informaltable>
27609 <para>
27610 <indexterm role="concept">
27611 <primary>domain</primary>
27612 <secondary>specifying non-immediate delivery</secondary>
27613 </indexterm>
27614 <indexterm role="concept">
27615 <primary>queueing incoming messages</primary>
27616 </indexterm>
27617 <indexterm role="concept">
27618 <primary>message</primary>
27619 <secondary>queueing certain domains</secondary>
27620 </indexterm>
27621 This option lists domains for which immediate delivery is not required.
27622 A delivery process is started whenever a message is received, but only those
27623 domains that do not match are processed. All other deliveries wait until the
27624 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
27625 </para>
27626 <para>
27627 <indexterm role="option">
27628 <primary><option>queue_list_requires_admin</option></primary>
27629 </indexterm>
27630 </para>
27631 <informaltable frame="all">
27632 <tgroup cols="4" colsep="0" rowsep="0">
27633 <colspec colwidth="8*" align="left"/>
27634 <colspec colwidth="6*" align="center"/>
27635 <colspec colwidth="6*" align="center"/>
27636 <colspec colwidth="6*" align="right"/>
27637 <tbody>
27638 <row>
27639 <entry><option>queue_list_requires_admin</option></entry>
27640 <entry>Use: <emphasis>main</emphasis></entry>
27641 <entry>Type: <emphasis>boolean</emphasis></entry>
27642 <entry>Default: <emphasis>true</emphasis></entry>
27643 </row>
27644 </tbody>
27645 </tgroup>
27646 </informaltable>
27647 <para>
27648 <indexterm role="option">
27649 <primary><option>-bp</option></primary>
27650 </indexterm>
27651 The <option>-bp</option> command-line option, which lists the messages that are on the
27652 queue, requires the caller to be an admin user unless
27653 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
27654 </para>
27655 <para>
27656 <indexterm role="option">
27657 <primary><option>queue_only</option></primary>
27658 </indexterm>
27659 </para>
27660 <informaltable frame="all">
27661 <tgroup cols="4" colsep="0" rowsep="0">
27662 <colspec colwidth="8*" align="left"/>
27663 <colspec colwidth="6*" align="center"/>
27664 <colspec colwidth="6*" align="center"/>
27665 <colspec colwidth="6*" align="right"/>
27666 <tbody>
27667 <row>
27668 <entry><option>queue_only</option></entry>
27669 <entry>Use: <emphasis>main</emphasis></entry>
27670 <entry>Type: <emphasis>boolean</emphasis></entry>
27671 <entry>Default: <emphasis>false</emphasis></entry>
27672 </row>
27673 </tbody>
27674 </tgroup>
27675 </informaltable>
27676 <para>
27677 <indexterm role="concept">
27678 <primary>queueing incoming messages</primary>
27679 </indexterm>
27680 <indexterm role="concept">
27681 <primary>message</primary>
27682 <secondary>queueing unconditionally</secondary>
27683 </indexterm>
27684 If <option>queue_only</option> is set, a delivery process is not automatically started
27685 whenever a message is received. Instead, the message waits on the queue for the
27686 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
27687 delivered immediately when certain conditions (such as heavy load) occur.
27688 </para>
27689 <para>
27690 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
27691 and <option>-odi</option> command line options override <option>queue_only</option> unless
27692 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
27693 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
27694 </para>
27695 <para>
27696 <indexterm role="option">
27697 <primary><option>queue_only_file</option></primary>
27698 </indexterm>
27699 </para>
27700 <informaltable frame="all">
27701 <tgroup cols="4" colsep="0" rowsep="0">
27702 <colspec colwidth="8*" align="left"/>
27703 <colspec colwidth="6*" align="center"/>
27704 <colspec colwidth="6*" align="center"/>
27705 <colspec colwidth="6*" align="right"/>
27706 <tbody>
27707 <row>
27708 <entry><option>queue_only_file</option></entry>
27709 <entry>Use: <emphasis>main</emphasis></entry>
27710 <entry>Type: <emphasis>string</emphasis></entry>
27711 <entry>Default: <emphasis>unset</emphasis></entry>
27712 </row>
27713 </tbody>
27714 </tgroup>
27715 </informaltable>
27716 <para>
27717 <indexterm role="concept">
27718 <primary>queueing incoming messages</primary>
27719 </indexterm>
27720 <indexterm role="concept">
27721 <primary>message</primary>
27722 <secondary>queueing by file existence</secondary>
27723 </indexterm>
27724 This option can be set to a colon-separated list of absolute path names, each
27725 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
27726 it tests for the existence of each listed path using a call to <function>stat()</function>. For
27727 each path that exists, the corresponding queueing option is set.
27728 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
27729 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
27730 </para>
27731 <literallayout class="monospaced">
27732 queue_only_file = smtp/some/file
27733 </literallayout>
27734 <para>
27735 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
27736 <filename>/some/file</filename> exists.
27737 </para>
27738 <para>
27739 <indexterm role="option">
27740 <primary><option>queue_only_load</option></primary>
27741 </indexterm>
27742 </para>
27743 <informaltable frame="all">
27744 <tgroup cols="4" colsep="0" rowsep="0">
27745 <colspec colwidth="8*" align="left"/>
27746 <colspec colwidth="6*" align="center"/>
27747 <colspec colwidth="6*" align="center"/>
27748 <colspec colwidth="6*" align="right"/>
27749 <tbody>
27750 <row>
27751 <entry><option>queue_only_load</option></entry>
27752 <entry>Use: <emphasis>main</emphasis></entry>
27753 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27754 <entry>Default: <emphasis>unset</emphasis></entry>
27755 </row>
27756 </tbody>
27757 </tgroup>
27758 </informaltable>
27759 <para>
27760 <indexterm role="concept">
27761 <primary>load average</primary>
27762 </indexterm>
27763 <indexterm role="concept">
27764 <primary>queueing incoming messages</primary>
27765 </indexterm>
27766 <indexterm role="concept">
27767 <primary>message</primary>
27768 <secondary>queueing by load</secondary>
27769 </indexterm>
27770 If the system load average is higher than this value, incoming messages from
27771 all sources are queued, and no automatic deliveries are started. If this
27772 happens during local or remote SMTP input, all subsequent messages received on
27773 the same SMTP connection are queued by default, whatever happens to the load in
27774 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
27775 false.
27776 </para>
27777 <para>
27778 Deliveries will subsequently be performed by queue runner processes. This
27779 option has no effect on ancient operating systems on which Exim cannot
27780 determine the load average. See also <option>deliver_queue_load_max</option> and
27781 <option>smtp_load_reserve</option>.
27782 </para>
27783 <para>
27784 <indexterm role="option">
27785 <primary><option>queue_only_load_latch</option></primary>
27786 </indexterm>
27787 </para>
27788 <informaltable frame="all">
27789 <tgroup cols="4" colsep="0" rowsep="0">
27790 <colspec colwidth="8*" align="left"/>
27791 <colspec colwidth="6*" align="center"/>
27792 <colspec colwidth="6*" align="center"/>
27793 <colspec colwidth="6*" align="right"/>
27794 <tbody>
27795 <row>
27796 <entry><option>queue_only_load_latch</option></entry>
27797 <entry>Use: <emphasis>main</emphasis></entry>
27798 <entry>Type: <emphasis>boolean</emphasis></entry>
27799 <entry>Default: <emphasis>true</emphasis></entry>
27800 </row>
27801 </tbody>
27802 </tgroup>
27803 </informaltable>
27804 <para>
27805 <indexterm role="concept">
27806 <primary>load average</primary>
27807 <secondary>re-evaluating per message</secondary>
27808 </indexterm>
27809 When this option is true (the default), once one message has been queued
27810 because the load average is higher than the value set by <option>queue_only_load</option>,
27811 all subsequent messages received on the same SMTP connection are also queued.
27812 This is a deliberate choice; even though the load average may fall below the
27813 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
27814 connection when not delivering earlier ones. However, there are special
27815 circumstances such as very long-lived connections from scanning appliances
27816 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
27817 should be set false. This causes the value of the load average to be
27818 re-evaluated for each message.
27819 </para>
27820 <para>
27821 <indexterm role="option">
27822 <primary><option>queue_only_override</option></primary>
27823 </indexterm>
27824 </para>
27825 <informaltable frame="all">
27826 <tgroup cols="4" colsep="0" rowsep="0">
27827 <colspec colwidth="8*" align="left"/>
27828 <colspec colwidth="6*" align="center"/>
27829 <colspec colwidth="6*" align="center"/>
27830 <colspec colwidth="6*" align="right"/>
27831 <tbody>
27832 <row>
27833 <entry><option>queue_only_override</option></entry>
27834 <entry>Use: <emphasis>main</emphasis></entry>
27835 <entry>Type: <emphasis>boolean</emphasis></entry>
27836 <entry>Default: <emphasis>true</emphasis></entry>
27837 </row>
27838 </tbody>
27839 </tgroup>
27840 </informaltable>
27841 <para>
27842 <indexterm role="concept">
27843 <primary>queueing incoming messages</primary>
27844 </indexterm>
27845 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
27846 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
27847 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
27848 to override; they are accepted, but ignored.
27849 </para>
27850 <para>
27851 <indexterm role="option">
27852 <primary><option>queue_run_in_order</option></primary>
27853 </indexterm>
27854 </para>
27855 <informaltable frame="all">
27856 <tgroup cols="4" colsep="0" rowsep="0">
27857 <colspec colwidth="8*" align="left"/>
27858 <colspec colwidth="6*" align="center"/>
27859 <colspec colwidth="6*" align="center"/>
27860 <colspec colwidth="6*" align="right"/>
27861 <tbody>
27862 <row>
27863 <entry><option>queue_run_in_order</option></entry>
27864 <entry>Use: <emphasis>main</emphasis></entry>
27865 <entry>Type: <emphasis>boolean</emphasis></entry>
27866 <entry>Default: <emphasis>false</emphasis></entry>
27867 </row>
27868 </tbody>
27869 </tgroup>
27870 </informaltable>
27871 <para>
27872 <indexterm role="concept">
27873 <primary>queue runner</primary>
27874 <secondary>processing messages in order</secondary>
27875 </indexterm>
27876 If this option is set, queue runs happen in order of message arrival instead of
27877 in an arbitrary order. For this to happen, a complete list of the entire queue
27878 must be set up before the deliveries start. When the queue is all held in a
27879 single directory (the default), a single list is created for both the ordered
27880 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
27881 single list is not created when <option>queue_run_in_order</option> is false. In this case,
27882 the sub-directories are processed one at a time (in a random order), and this
27883 avoids setting up one huge list for the whole queue. Thus, setting
27884 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
27885 when the queue is large, because of the extra work in setting up the single,
27886 large list. In most situations, <option>queue_run_in_order</option> should not be set.
27887 </para>
27888 <para>
27889 <indexterm role="option">
27890 <primary><option>queue_run_max</option></primary>
27891 </indexterm>
27892 </para>
27893 <informaltable frame="all">
27894 <tgroup cols="4" colsep="0" rowsep="0">
27895 <colspec colwidth="8*" align="left"/>
27896 <colspec colwidth="6*" align="center"/>
27897 <colspec colwidth="6*" align="center"/>
27898 <colspec colwidth="6*" align="right"/>
27899 <tbody>
27900 <row>
27901 <entry><option>queue_run_max</option></entry>
27902 <entry>Use: <emphasis>main</emphasis></entry>
27903 <entry>Type: <emphasis>integer</emphasis></entry>
27904 <entry>Default: <emphasis>5</emphasis></entry>
27905 </row>
27906 </tbody>
27907 </tgroup>
27908 </informaltable>
27909 <para>
27910 <indexterm role="concept">
27911 <primary>queue runner</primary>
27912 <secondary>maximum number of</secondary>
27913 </indexterm>
27914 This controls the maximum number of queue runner processes that an Exim daemon
27915 can run simultaneously. This does not mean that it starts them all at once,
27916 but rather that if the maximum number are still running when the time comes to
27917 start another one, it refrains from starting another one. This can happen with
27918 very large queues and/or very sluggish deliveries. This option does not,
27919 however, interlock with other processes, so additional queue runners can be
27920 started by other means, or by killing and restarting the daemon.
27921 </para>
27922 <para>
27923 Setting this option to zero does not suppress queue runs; rather, it disables
27924 the limit, allowing any number of simultaneous queue runner processes to be
27925 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
27926 the daemon&#x2019;s command line.
27927 </para>
27928 <para>
27929 <indexterm role="option">
27930 <primary><option>queue_smtp_domains</option></primary>
27931 </indexterm>
27932 </para>
27933 <informaltable frame="all">
27934 <tgroup cols="4" colsep="0" rowsep="0">
27935 <colspec colwidth="8*" align="left"/>
27936 <colspec colwidth="6*" align="center"/>
27937 <colspec colwidth="6*" align="center"/>
27938 <colspec colwidth="6*" align="right"/>
27939 <tbody>
27940 <row>
27941 <entry><option>queue_smtp_domains</option></entry>
27942 <entry>Use: <emphasis>main</emphasis></entry>
27943 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27944 <entry>Default: <emphasis>unset</emphasis></entry>
27945 </row>
27946 </tbody>
27947 </tgroup>
27948 </informaltable>
27949 <para>
27950 <indexterm role="concept">
27951 <primary>queueing incoming messages</primary>
27952 </indexterm>
27953 <indexterm role="concept">
27954 <primary>message</primary>
27955 <secondary>queueing remote deliveries</secondary>
27956 </indexterm>
27957 When this option is set, a delivery process is started whenever a message is
27958 received, routing is performed, and local deliveries take place.
27959 However, if any SMTP deliveries are required for domains that match
27960 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
27961 message waits on the queue for the next queue run. Since routing of the message
27962 has taken place, Exim knows to which remote hosts it must be delivered, and so
27963 when the queue run happens, multiple messages for the same host are delivered
27964 over a single SMTP connection. The <option>-odqs</option> command line option causes all
27965 SMTP deliveries to be queued in this way, and is equivalent to setting
27966 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
27967 <option>queue_domains</option>.
27968 </para>
27969 <para>
27970 <indexterm role="option">
27971 <primary><option>receive_timeout</option></primary>
27972 </indexterm>
27973 </para>
27974 <informaltable frame="all">
27975 <tgroup cols="4" colsep="0" rowsep="0">
27976 <colspec colwidth="8*" align="left"/>
27977 <colspec colwidth="6*" align="center"/>
27978 <colspec colwidth="6*" align="center"/>
27979 <colspec colwidth="6*" align="right"/>
27980 <tbody>
27981 <row>
27982 <entry><option>receive_timeout</option></entry>
27983 <entry>Use: <emphasis>main</emphasis></entry>
27984 <entry>Type: <emphasis>time</emphasis></entry>
27985 <entry>Default: <emphasis>0s</emphasis></entry>
27986 </row>
27987 </tbody>
27988 </tgroup>
27989 </informaltable>
27990 <para>
27991 <indexterm role="concept">
27992 <primary>timeout</primary>
27993 <secondary>for non-SMTP input</secondary>
27994 </indexterm>
27995 This option sets the timeout for accepting a non-SMTP message, that is, the
27996 maximum time that Exim waits when reading a message on the standard input. If
27997 the value is zero, it will wait for ever. This setting is overridden by the
27998 <option>-or</option> command line option. The timeout for incoming SMTP messages is
27999 controlled by <option>smtp_receive_timeout</option>.
28000 </para>
28001 <para>
28002 <indexterm role="option">
28003 <primary><option>received_header_text</option></primary>
28004 </indexterm>
28005 </para>
28006 <informaltable frame="all">
28007 <tgroup cols="4" colsep="0" rowsep="0">
28008 <colspec colwidth="8*" align="left"/>
28009 <colspec colwidth="6*" align="center"/>
28010 <colspec colwidth="6*" align="center"/>
28011 <colspec colwidth="6*" align="right"/>
28012 <tbody>
28013 <row>
28014 <entry><option>received_header_text</option></entry>
28015 <entry>Use: <emphasis>main</emphasis></entry>
28016 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28017 <entry>Default: <emphasis>see below</emphasis></entry>
28018 </row>
28019 </tbody>
28020 </tgroup>
28021 </informaltable>
28022 <para>
28023 <indexterm role="concept">
28024 <primary>customizing</primary>
28025 <secondary><emphasis>Received:</emphasis> header</secondary>
28026 </indexterm>
28027 <indexterm role="concept">
28028 <primary><emphasis>Received:</emphasis> header line</primary>
28029 <secondary>customizing</secondary>
28030 </indexterm>
28031 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
28032 added to each message, except for the timestamp, which is automatically added
28033 on at the end (preceded by a semicolon). The string is expanded each time it is
28034 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
28035 added to the message. Otherwise, the string should start with the text
28036 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
28037 header lines. The default setting is:
28038 </para>
28039 <literallayout class="monospaced">
28040 received_header_text = Received: \
28041   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
28042   {${if def:sender_ident \
28043   {from ${quote_local_part:$sender_ident} }}\
28044   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
28045   by $primary_hostname \
28046   ${if def:received_protocol {with $received_protocol}} \
28047   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
28048   (Exim $version_number)\n\t\
28049   ${if def:sender_address \
28050   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
28051   id $message_exim_id\
28052   ${if def:received_for {\n\tfor $received_for}}
28053 </literallayout>
28054 <para>
28055 The reference to the TLS cipher is omitted when Exim is built without TLS
28056 support. The use of conditional expansions ensures that this works for both
28057 locally generated messages and messages received from remote hosts, giving
28058 header lines such as the following:
28059 </para>
28060 <literallayout class="monospaced">
28061 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
28062 by marley.carol.example with esmtp (Exim 4.00)
28063 (envelope-from &lt;bob@carol.example&gt;)
28064 id 16IOWa-00019l-00
28065 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
28066 Received: by scrooge.carol.example with local (Exim 4.00)
28067 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
28068 </literallayout>
28069 <para>
28070 Until the body of the message has been received, the timestamp is the time when
28071 the message started to be received. Once the body has arrived, and all policy
28072 checks have taken place, the timestamp is updated to the time at which the
28073 message was accepted.
28074 </para>
28075 <para>
28076 <indexterm role="option">
28077 <primary><option>received_headers_max</option></primary>
28078 </indexterm>
28079 </para>
28080 <informaltable frame="all">
28081 <tgroup cols="4" colsep="0" rowsep="0">
28082 <colspec colwidth="8*" align="left"/>
28083 <colspec colwidth="6*" align="center"/>
28084 <colspec colwidth="6*" align="center"/>
28085 <colspec colwidth="6*" align="right"/>
28086 <tbody>
28087 <row>
28088 <entry><option>received_headers_max</option></entry>
28089 <entry>Use: <emphasis>main</emphasis></entry>
28090 <entry>Type: <emphasis>integer</emphasis></entry>
28091 <entry>Default: <emphasis>30</emphasis></entry>
28092 </row>
28093 </tbody>
28094 </tgroup>
28095 </informaltable>
28096 <para>
28097 <indexterm role="concept">
28098 <primary>loop</primary>
28099 <secondary>prevention</secondary>
28100 </indexterm>
28101 <indexterm role="concept">
28102 <primary>mail loop prevention</primary>
28103 </indexterm>
28104 <indexterm role="concept">
28105 <primary><emphasis>Received:</emphasis> header line</primary>
28106 <secondary>counting</secondary>
28107 </indexterm>
28108 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
28109 counted, and if it is greater than this parameter, a mail loop is assumed to
28110 have occurred, the delivery is abandoned, and an error message is generated.
28111 This applies to both local and remote deliveries.
28112 </para>
28113 <para>
28114 <indexterm role="option">
28115 <primary><option>recipient_unqualified_hosts</option></primary>
28116 </indexterm>
28117 </para>
28118 <informaltable frame="all">
28119 <tgroup cols="4" colsep="0" rowsep="0">
28120 <colspec colwidth="8*" align="left"/>
28121 <colspec colwidth="6*" align="center"/>
28122 <colspec colwidth="6*" align="center"/>
28123 <colspec colwidth="6*" align="right"/>
28124 <tbody>
28125 <row>
28126 <entry><option>recipient_unqualified_hosts</option></entry>
28127 <entry>Use: <emphasis>main</emphasis></entry>
28128 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28129 <entry>Default: <emphasis>unset</emphasis></entry>
28130 </row>
28131 </tbody>
28132 </tgroup>
28133 </informaltable>
28134 <para>
28135 <indexterm role="concept">
28136 <primary>unqualified addresses</primary>
28137 </indexterm>
28138 <indexterm role="concept">
28139 <primary>host</primary>
28140 <secondary>unqualified addresses from</secondary>
28141 </indexterm>
28142 This option lists those hosts from which Exim is prepared to accept unqualified
28143 recipient addresses in message envelopes. The addresses are made fully
28144 qualified by the addition of the <option>qualify_recipient</option> value. This option also
28145 affects message header lines. Exim does not reject unqualified recipient
28146 addresses in headers, but it qualifies them only if the message came from a
28147 host that matches <option>recipient_unqualified_hosts</option>,
28148 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
28149 option was not set.
28150 </para>
28151 <para>
28152 <indexterm role="option">
28153 <primary><option>recipients_max</option></primary>
28154 </indexterm>
28155 </para>
28156 <informaltable frame="all">
28157 <tgroup cols="4" colsep="0" rowsep="0">
28158 <colspec colwidth="8*" align="left"/>
28159 <colspec colwidth="6*" align="center"/>
28160 <colspec colwidth="6*" align="center"/>
28161 <colspec colwidth="6*" align="right"/>
28162 <tbody>
28163 <row>
28164 <entry><option>recipients_max</option></entry>
28165 <entry>Use: <emphasis>main</emphasis></entry>
28166 <entry>Type: <emphasis>integer</emphasis></entry>
28167 <entry>Default: <emphasis>0</emphasis></entry>
28168 </row>
28169 </tbody>
28170 </tgroup>
28171 </informaltable>
28172 <para>
28173 <indexterm role="concept">
28174 <primary>limit</primary>
28175 <secondary>number of recipients</secondary>
28176 </indexterm>
28177 <indexterm role="concept">
28178 <primary>recipient</primary>
28179 <secondary>maximum number</secondary>
28180 </indexterm>
28181 If this option is set greater than zero, it specifies the maximum number of
28182 original recipients for any message. Additional recipients that are generated
28183 by aliasing or forwarding do not count. SMTP messages get a 452 response for
28184 all recipients over the limit; earlier recipients are delivered as normal.
28185 Non-SMTP messages with too many recipients are failed, and no deliveries are
28186 done.
28187 </para>
28188 <para>
28189 <indexterm role="concept">
28190 <primary>RCPT</primary>
28191 <secondary>maximum number of incoming</secondary>
28192 </indexterm>
28193 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
28194 RCPT commands in a single message.
28195 </para>
28196 <para>
28197 <indexterm role="option">
28198 <primary><option>recipients_max_reject</option></primary>
28199 </indexterm>
28200 </para>
28201 <informaltable frame="all">
28202 <tgroup cols="4" colsep="0" rowsep="0">
28203 <colspec colwidth="8*" align="left"/>
28204 <colspec colwidth="6*" align="center"/>
28205 <colspec colwidth="6*" align="center"/>
28206 <colspec colwidth="6*" align="right"/>
28207 <tbody>
28208 <row>
28209 <entry><option>recipients_max_reject</option></entry>
28210 <entry>Use: <emphasis>main</emphasis></entry>
28211 <entry>Type: <emphasis>boolean</emphasis></entry>
28212 <entry>Default: <emphasis>false</emphasis></entry>
28213 </row>
28214 </tbody>
28215 </tgroup>
28216 </informaltable>
28217 <para>
28218 If this option is set true, Exim rejects SMTP messages containing too many
28219 recipients by giving 552 errors to the surplus RCPT commands, and a 554
28220 error to the eventual DATA command. Otherwise (the default) it gives a 452
28221 error to the surplus RCPT commands and accepts the message on behalf of the
28222 initial set of recipients. The remote server should then re-send the message
28223 for the remaining recipients at a later time.
28224 </para>
28225 <para>
28226 <indexterm role="option">
28227 <primary><option>remote_max_parallel</option></primary>
28228 </indexterm>
28229 </para>
28230 <informaltable frame="all">
28231 <tgroup cols="4" colsep="0" rowsep="0">
28232 <colspec colwidth="8*" align="left"/>
28233 <colspec colwidth="6*" align="center"/>
28234 <colspec colwidth="6*" align="center"/>
28235 <colspec colwidth="6*" align="right"/>
28236 <tbody>
28237 <row>
28238 <entry><option>remote_max_parallel</option></entry>
28239 <entry>Use: <emphasis>main</emphasis></entry>
28240 <entry>Type: <emphasis>integer</emphasis></entry>
28241 <entry>Default: <emphasis>2</emphasis></entry>
28242 </row>
28243 </tbody>
28244 </tgroup>
28245 </informaltable>
28246 <para>
28247 <indexterm role="concept">
28248 <primary>delivery</primary>
28249 <secondary>parallelism for remote</secondary>
28250 </indexterm>
28251 This option controls parallel delivery of one message to a number of remote
28252 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
28253 does all the remote deliveries for a message one by one. Otherwise, if a single
28254 message has to be delivered to more than one remote host, or if several copies
28255 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
28256 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
28257 deliveries are required, the maximum number of processes are started, and as
28258 each one finishes, another is begun. The order of starting processes is the
28259 same as if sequential delivery were being done, and can be controlled by the
28260 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
28261 with debugging turned on, the debugging output from each delivery process is
28262 tagged with its process id.
28263 </para>
28264 <para>
28265 This option controls only the maximum number of parallel deliveries for one
28266 message in one Exim delivery process. Because Exim has no central queue
28267 manager, there is no way of controlling the total number of simultaneous
28268 deliveries if the configuration allows a delivery attempt as soon as a message
28269 is received.
28270 </para>
28271 <para>
28272 <indexterm role="concept">
28273 <primary>number of deliveries</primary>
28274 </indexterm>
28275 <indexterm role="concept">
28276 <primary>delivery</primary>
28277 <secondary>maximum number of</secondary>
28278 </indexterm>
28279 If you want to control the total number of deliveries on the system, you
28280 need to set the <option>queue_only</option> option. This ensures that all incoming messages
28281 are added to the queue without starting a delivery process. Then set up an Exim
28282 daemon to start queue runner processes at appropriate intervals (probably
28283 fairly often, for example, every minute), and limit the total number of queue
28284 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
28285 delivers only one message at a time, the maximum number of deliveries that can
28286 then take place at once is <option>queue_run_max</option> multiplied by
28287 <option>remote_max_parallel</option>.
28288 </para>
28289 <para>
28290 If it is purely remote deliveries you want to control, use
28291 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
28292 doing the SMTP routing before queueing, so that several messages for the same
28293 host will eventually get delivered down the same connection.
28294 </para>
28295 <para>
28296 <indexterm role="option">
28297 <primary><option>remote_sort_domains</option></primary>
28298 </indexterm>
28299 </para>
28300 <informaltable frame="all">
28301 <tgroup cols="4" colsep="0" rowsep="0">
28302 <colspec colwidth="8*" align="left"/>
28303 <colspec colwidth="6*" align="center"/>
28304 <colspec colwidth="6*" align="center"/>
28305 <colspec colwidth="6*" align="right"/>
28306 <tbody>
28307 <row>
28308 <entry><option>remote_sort_domains</option></entry>
28309 <entry>Use: <emphasis>main</emphasis></entry>
28310 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28311 <entry>Default: <emphasis>unset</emphasis></entry>
28312 </row>
28313 </tbody>
28314 </tgroup>
28315 </informaltable>
28316 <para>
28317 <indexterm role="concept">
28318 <primary>sorting remote deliveries</primary>
28319 </indexterm>
28320 <indexterm role="concept">
28321 <primary>delivery</primary>
28322 <secondary>sorting remote</secondary>
28323 </indexterm>
28324 When there are a number of remote deliveries for a message, they are sorted by
28325 domain into the order given by this list. For example,
28326 </para>
28327 <literallayout class="monospaced">
28328 remote_sort_domains = *.cam.ac.uk:*.uk
28329 </literallayout>
28330 <para>
28331 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
28332 then to those in the <option>uk</option> domain, then to any others.
28333 </para>
28334 <para>
28335 <indexterm role="option">
28336 <primary><option>retry_data_expire</option></primary>
28337 </indexterm>
28338 </para>
28339 <informaltable frame="all">
28340 <tgroup cols="4" colsep="0" rowsep="0">
28341 <colspec colwidth="8*" align="left"/>
28342 <colspec colwidth="6*" align="center"/>
28343 <colspec colwidth="6*" align="center"/>
28344 <colspec colwidth="6*" align="right"/>
28345 <tbody>
28346 <row>
28347 <entry><option>retry_data_expire</option></entry>
28348 <entry>Use: <emphasis>main</emphasis></entry>
28349 <entry>Type: <emphasis>time</emphasis></entry>
28350 <entry>Default: <emphasis>7d</emphasis></entry>
28351 </row>
28352 </tbody>
28353 </tgroup>
28354 </informaltable>
28355 <para>
28356 <indexterm role="concept">
28357 <primary>hints database</primary>
28358 <secondary>data expiry</secondary>
28359 </indexterm>
28360 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
28361 database. Any older retry data is ignored. This means that, for example, once a
28362 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
28363 past failures.
28364 </para>
28365 <para>
28366 <indexterm role="option">
28367 <primary><option>retry_interval_max</option></primary>
28368 </indexterm>
28369 </para>
28370 <informaltable frame="all">
28371 <tgroup cols="4" colsep="0" rowsep="0">
28372 <colspec colwidth="8*" align="left"/>
28373 <colspec colwidth="6*" align="center"/>
28374 <colspec colwidth="6*" align="center"/>
28375 <colspec colwidth="6*" align="right"/>
28376 <tbody>
28377 <row>
28378 <entry><option>retry_interval_max</option></entry>
28379 <entry>Use: <emphasis>main</emphasis></entry>
28380 <entry>Type: <emphasis>time</emphasis></entry>
28381 <entry>Default: <emphasis>24h</emphasis></entry>
28382 </row>
28383 </tbody>
28384 </tgroup>
28385 </informaltable>
28386 <para>
28387 <indexterm role="concept">
28388 <primary>retry</primary>
28389 <secondary>limit on interval</secondary>
28390 </indexterm>
28391 <indexterm role="concept">
28392 <primary>limit</primary>
28393 <secondary>on retry interval</secondary>
28394 </indexterm>
28395 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
28396 intervals between delivery attempts for messages that cannot be delivered
28397 straight away. This option sets an overall limit to the length of time between
28398 retries. It cannot be set greater than 24 hours; any attempt to do so forces
28399 the default value.
28400 </para>
28401 <para>
28402 <indexterm role="option">
28403 <primary><option>return_path_remove</option></primary>
28404 </indexterm>
28405 </para>
28406 <informaltable frame="all">
28407 <tgroup cols="4" colsep="0" rowsep="0">
28408 <colspec colwidth="8*" align="left"/>
28409 <colspec colwidth="6*" align="center"/>
28410 <colspec colwidth="6*" align="center"/>
28411 <colspec colwidth="6*" align="right"/>
28412 <tbody>
28413 <row>
28414 <entry><option>return_path_remove</option></entry>
28415 <entry>Use: <emphasis>main</emphasis></entry>
28416 <entry>Type: <emphasis>boolean</emphasis></entry>
28417 <entry>Default: <emphasis>true</emphasis></entry>
28418 </row>
28419 </tbody>
28420 </tgroup>
28421 </informaltable>
28422 <para>
28423 <indexterm role="concept">
28424 <primary><emphasis>Return-path:</emphasis> header line</primary>
28425 <secondary>removing</secondary>
28426 </indexterm>
28427 RFC 2821, section 4.4, states that an SMTP server must insert a
28428 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
28429 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
28430 MAIL command. This description implies that this header should not be present
28431 in an incoming message. If <option>return_path_remove</option> is true, any existing
28432 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
28433 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
28434 the time of delivery. They are normally used only for final local deliveries.
28435 </para>
28436 <para>
28437 <indexterm role="option">
28438 <primary><option>return_size_limit</option></primary>
28439 </indexterm>
28440 </para>
28441 <informaltable frame="all">
28442 <tgroup cols="4" colsep="0" rowsep="0">
28443 <colspec colwidth="8*" align="left"/>
28444 <colspec colwidth="6*" align="center"/>
28445 <colspec colwidth="6*" align="center"/>
28446 <colspec colwidth="6*" align="right"/>
28447 <tbody>
28448 <row>
28449 <entry><option>return_size_limit</option></entry>
28450 <entry>Use: <emphasis>main</emphasis></entry>
28451 <entry>Type: <emphasis>integer</emphasis></entry>
28452 <entry>Default: <emphasis>100K</emphasis></entry>
28453 </row>
28454 </tbody>
28455 </tgroup>
28456 </informaltable>
28457 <para>
28458 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
28459 </para>
28460 <para revisionflag="changed">
28461 <indexterm role="option">
28462 <primary><option>rfc1413_hosts</option></primary>
28463 </indexterm>
28464 </para>
28465 <informaltable frame="all" revisionflag="changed">
28466 <tgroup cols="4" colsep="0" rowsep="0">
28467 <colspec colwidth="8*" align="left"/>
28468 <colspec colwidth="6*" align="center"/>
28469 <colspec colwidth="6*" align="center"/>
28470 <colspec colwidth="6*" align="right"/>
28471 <tbody>
28472 <row>
28473 <entry><option>rfc1413_hosts</option></entry>
28474 <entry>Use: <emphasis>main</emphasis></entry>
28475 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28476 <entry>Default: <emphasis>@[]</emphasis></entry>
28477 </row>
28478 </tbody>
28479 </tgroup>
28480 </informaltable>
28481 <para revisionflag="changed">
28482 <indexterm role="concept">
28483 <primary>RFC 1413</primary>
28484 </indexterm>
28485 <indexterm role="concept">
28486 <primary>host</primary>
28487 <secondary>for RFC 1413 calls</secondary>
28488 </indexterm>
28489 RFC 1413 identification calls are made to any client host which matches
28490 an item in the list.
28491 The default value specifies just this host, being any local interface
28492 for the system.
28493 </para>
28494 <para revisionflag="changed">
28495 <indexterm role="option">
28496 <primary><option>rfc1413_query_timeout</option></primary>
28497 </indexterm>
28498 </para>
28499 <informaltable frame="all" revisionflag="changed">
28500 <tgroup cols="4" colsep="0" rowsep="0">
28501 <colspec colwidth="8*" align="left"/>
28502 <colspec colwidth="6*" align="center"/>
28503 <colspec colwidth="6*" align="center"/>
28504 <colspec colwidth="6*" align="right"/>
28505 <tbody>
28506 <row>
28507 <entry><option>rfc1413_query_timeout</option></entry>
28508 <entry>Use: <emphasis>main</emphasis></entry>
28509 <entry>Type: <emphasis>time</emphasis></entry>
28510 <entry>Default: <emphasis>0s</emphasis></entry>
28511 </row>
28512 </tbody>
28513 </tgroup>
28514 </informaltable>
28515 <para>
28516 <indexterm role="concept">
28517 <primary>RFC 1413</primary>
28518 <secondary>query timeout</secondary>
28519 </indexterm>
28520 <indexterm role="concept">
28521 <primary>timeout</primary>
28522 <secondary>for RFC 1413 call</secondary>
28523 </indexterm>
28524 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
28525 no RFC 1413 calls are ever made.
28526 </para>
28527 <para>
28528 <indexterm role="option">
28529 <primary><option>sender_unqualified_hosts</option></primary>
28530 </indexterm>
28531 </para>
28532 <informaltable frame="all">
28533 <tgroup cols="4" colsep="0" rowsep="0">
28534 <colspec colwidth="8*" align="left"/>
28535 <colspec colwidth="6*" align="center"/>
28536 <colspec colwidth="6*" align="center"/>
28537 <colspec colwidth="6*" align="right"/>
28538 <tbody>
28539 <row>
28540 <entry><option>sender_unqualified_hosts</option></entry>
28541 <entry>Use: <emphasis>main</emphasis></entry>
28542 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28543 <entry>Default: <emphasis>unset</emphasis></entry>
28544 </row>
28545 </tbody>
28546 </tgroup>
28547 </informaltable>
28548 <para>
28549 <indexterm role="concept">
28550 <primary>unqualified addresses</primary>
28551 </indexterm>
28552 <indexterm role="concept">
28553 <primary>host</primary>
28554 <secondary>unqualified addresses from</secondary>
28555 </indexterm>
28556 This option lists those hosts from which Exim is prepared to accept unqualified
28557 sender addresses. The addresses are made fully qualified by the addition of
28558 <option>qualify_domain</option>. This option also affects message header lines. Exim does
28559 not reject unqualified addresses in headers that contain sender addresses, but
28560 it qualifies them only if the message came from a host that matches
28561 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
28562 using TCP/IP), and the <option>-bnq</option> option was not set.
28563 </para>
28564 <para>
28565 <indexterm role="option">
28566 <primary><option>set_environment</option></primary>
28567 </indexterm>
28568 </para>
28569 <informaltable frame="all">
28570 <tgroup cols="4" colsep="0" rowsep="0">
28571 <colspec colwidth="8*" align="left"/>
28572 <colspec colwidth="6*" align="center"/>
28573 <colspec colwidth="6*" align="center"/>
28574 <colspec colwidth="6*" align="right"/>
28575 <tbody>
28576 <row>
28577 <entry><option>set_environment</option></entry>
28578 <entry>Use: <emphasis>main</emphasis></entry>
28579 <entry>Type: <emphasis>string list</emphasis></entry>
28580 <entry>Default: <emphasis>empty</emphasis></entry>
28581 </row>
28582 </tbody>
28583 </tgroup>
28584 </informaltable>
28585 <para>
28586 <indexterm role="concept">
28587 <primary>environment</primary>
28588 </indexterm>
28589 This option allows to set individual environment variables that the
28590 currently linked libraries and programs in child processes use. The
28591 default list is empty,
28592 </para>
28593 <para revisionflag="changed">
28594 <indexterm role="option">
28595 <primary><option>slow_lookup_log</option></primary>
28596 </indexterm>
28597 </para>
28598 <informaltable frame="all" revisionflag="changed">
28599 <tgroup cols="4" colsep="0" rowsep="0">
28600 <colspec colwidth="8*" align="left"/>
28601 <colspec colwidth="6*" align="center"/>
28602 <colspec colwidth="6*" align="center"/>
28603 <colspec colwidth="6*" align="right"/>
28604 <tbody>
28605 <row>
28606 <entry><option>slow_lookup_log</option></entry>
28607 <entry>Use: <emphasis>main</emphasis></entry>
28608 <entry>Type: <emphasis>integer</emphasis></entry>
28609 <entry>Default: <emphasis>0</emphasis></entry>
28610 </row>
28611 </tbody>
28612 </tgroup>
28613 </informaltable>
28614 <para revisionflag="changed">
28615 <indexterm role="concept">
28616 <primary>logging</primary>
28617 <secondary>slow lookups</secondary>
28618 </indexterm>
28619 <indexterm role="concept">
28620 <primary>dns</primary>
28621 <secondary>logging slow lookups</secondary>
28622 </indexterm>
28623 This option controls logging of slow lookups.
28624 If the value is nonzero it is taken as a number of milliseconds
28625 and lookups taking longer than this are logged.
28626 Currently this applies only to DNS lookups.
28627 </para>
28628 <para>
28629 <indexterm role="option">
28630 <primary><option>smtp_accept_keepalive</option></primary>
28631 </indexterm>
28632 </para>
28633 <informaltable frame="all">
28634 <tgroup cols="4" colsep="0" rowsep="0">
28635 <colspec colwidth="8*" align="left"/>
28636 <colspec colwidth="6*" align="center"/>
28637 <colspec colwidth="6*" align="center"/>
28638 <colspec colwidth="6*" align="right"/>
28639 <tbody>
28640 <row>
28641 <entry><option>smtp_accept_keepalive</option></entry>
28642 <entry>Use: <emphasis>main</emphasis></entry>
28643 <entry>Type: <emphasis>boolean</emphasis></entry>
28644 <entry>Default: <emphasis>true</emphasis></entry>
28645 </row>
28646 </tbody>
28647 </tgroup>
28648 </informaltable>
28649 <para>
28650 <indexterm role="concept">
28651 <primary>keepalive</primary>
28652 <secondary>on incoming connection</secondary>
28653 </indexterm>
28654 This option controls the setting of the SO_KEEPALIVE option on incoming
28655 TCP/IP socket connections. When set, it causes the kernel to probe idle
28656 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
28657 other end of the connection should send an acknowledgment if the connection is
28658 still okay or a reset if the connection has been aborted. The reason for doing
28659 this is that it has the beneficial effect of freeing up certain types of
28660 connection that can get stuck when the remote host is disconnected without
28661 tidying up the TCP/IP call properly. The keepalive mechanism takes several
28662 hours to detect unreachable hosts.
28663 </para>
28664 <para>
28665 <indexterm role="option">
28666 <primary><option>smtp_accept_max</option></primary>
28667 </indexterm>
28668 </para>
28669 <informaltable frame="all">
28670 <tgroup cols="4" colsep="0" rowsep="0">
28671 <colspec colwidth="8*" align="left"/>
28672 <colspec colwidth="6*" align="center"/>
28673 <colspec colwidth="6*" align="center"/>
28674 <colspec colwidth="6*" align="right"/>
28675 <tbody>
28676 <row>
28677 <entry><option>smtp_accept_max</option></entry>
28678 <entry>Use: <emphasis>main</emphasis></entry>
28679 <entry>Type: <emphasis>integer</emphasis></entry>
28680 <entry>Default: <emphasis>20</emphasis></entry>
28681 </row>
28682 </tbody>
28683 </tgroup>
28684 </informaltable>
28685 <para>
28686 <indexterm role="concept">
28687 <primary>limit</primary>
28688 <secondary>incoming SMTP connections</secondary>
28689 </indexterm>
28690 <indexterm role="concept">
28691 <primary>SMTP</primary>
28692 <secondary>incoming connection count</secondary>
28693 </indexterm>
28694 <indexterm role="concept">
28695 <primary>inetd</primary>
28696 </indexterm>
28697 This option specifies the maximum number of simultaneous incoming SMTP calls
28698 that Exim will accept. It applies only to the listening daemon; there is no
28699 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
28700 value is set to zero, no limit is applied. However, it is required to be
28701 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
28702 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
28703 </para>
28704 <para>
28705 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
28706 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
28707 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
28708 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
28709 </para>
28710 <para>
28711 <indexterm role="option">
28712 <primary><option>smtp_accept_max_nonmail</option></primary>
28713 </indexterm>
28714 </para>
28715 <informaltable frame="all">
28716 <tgroup cols="4" colsep="0" rowsep="0">
28717 <colspec colwidth="8*" align="left"/>
28718 <colspec colwidth="6*" align="center"/>
28719 <colspec colwidth="6*" align="center"/>
28720 <colspec colwidth="6*" align="right"/>
28721 <tbody>
28722 <row>
28723 <entry><option>smtp_accept_max_nonmail</option></entry>
28724 <entry>Use: <emphasis>main</emphasis></entry>
28725 <entry>Type: <emphasis>integer</emphasis></entry>
28726 <entry>Default: <emphasis>10</emphasis></entry>
28727 </row>
28728 </tbody>
28729 </tgroup>
28730 </informaltable>
28731 <para>
28732 <indexterm role="concept">
28733 <primary>limit</primary>
28734 <secondary>non-mail SMTP commands</secondary>
28735 </indexterm>
28736 <indexterm role="concept">
28737 <primary>SMTP</primary>
28738 <secondary>limiting non-mail commands</secondary>
28739 </indexterm>
28740 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
28741 the connection if there are too many. This option defines <quote>too many</quote>. The
28742 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
28743 client looping sending EHLO, for example. The check is applied only if the
28744 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
28745 </para>
28746 <para>
28747 When a new message is expected, one occurrence of RSET is not counted. This
28748 allows a client to send one RSET between messages (this is not necessary,
28749 but some clients do it). Exim also allows one uncounted occurrence of HELO
28750 or EHLO, and one occurrence of STARTTLS between messages. After
28751 starting up a TLS session, another EHLO is expected, and so it too is not
28752 counted. The first occurrence of AUTH in a connection, or immediately
28753 following STARTTLS is not counted. Otherwise, all commands other than
28754 MAIL, RCPT, DATA, and QUIT are counted.
28755 </para>
28756 <para>
28757 <indexterm role="option">
28758 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
28759 </indexterm>
28760 </para>
28761 <informaltable frame="all">
28762 <tgroup cols="4" colsep="0" rowsep="0">
28763 <colspec colwidth="8*" align="left"/>
28764 <colspec colwidth="6*" align="center"/>
28765 <colspec colwidth="6*" align="center"/>
28766 <colspec colwidth="6*" align="right"/>
28767 <tbody>
28768 <row>
28769 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
28770 <entry>Use: <emphasis>main</emphasis></entry>
28771 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28772 <entry>Default: <emphasis>*</emphasis></entry>
28773 </row>
28774 </tbody>
28775 </tgroup>
28776 </informaltable>
28777 <para>
28778 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
28779 check by setting this option. The default value makes it apply to all hosts. By
28780 changing the value, you can exclude any badly-behaved hosts that you have to
28781 live with.
28782 </para>
28783 <para>
28784 <indexterm role="option">
28785 <primary><option>smtp_accept_max_per_connection</option></primary>
28786 </indexterm>
28787 </para>
28788 <informaltable frame="all">
28789 <tgroup cols="4" colsep="0" rowsep="0">
28790 <colspec colwidth="8*" align="left"/>
28791 <colspec colwidth="6*" align="center"/>
28792 <colspec colwidth="6*" align="center"/>
28793 <colspec colwidth="6*" align="right"/>
28794 <tbody>
28795 <row>
28796 <entry><option>smtp_accept_max_per_connection</option></entry>
28797 <entry>Use: <emphasis>main</emphasis></entry>
28798 <entry>Type: <emphasis>integer</emphasis></entry>
28799 <entry>Default: <emphasis>1000</emphasis></entry>
28800 </row>
28801 </tbody>
28802 </tgroup>
28803 </informaltable>
28804 <para>
28805 <indexterm role="concept">
28806 <primary>SMTP</primary>
28807 <secondary>limiting incoming message count</secondary>
28808 </indexterm>
28809 <indexterm role="concept">
28810 <primary>limit</primary>
28811 <secondary>messages per SMTP connection</secondary>
28812 </indexterm>
28813 The value of this option limits the number of MAIL commands that Exim is
28814 prepared to accept over a single SMTP connection, whether or not each command
28815 results in the transfer of a message. After the limit is reached, a 421
28816 response is given to subsequent MAIL commands. This limit is a safety
28817 precaution against a client that goes mad (incidents of this type have been
28818 seen).
28819 </para>
28820 <para>
28821 <indexterm role="option">
28822 <primary><option>smtp_accept_max_per_host</option></primary>
28823 </indexterm>
28824 </para>
28825 <informaltable frame="all">
28826 <tgroup cols="4" colsep="0" rowsep="0">
28827 <colspec colwidth="8*" align="left"/>
28828 <colspec colwidth="6*" align="center"/>
28829 <colspec colwidth="6*" align="center"/>
28830 <colspec colwidth="6*" align="right"/>
28831 <tbody>
28832 <row>
28833 <entry><option>smtp_accept_max_per_host</option></entry>
28834 <entry>Use: <emphasis>main</emphasis></entry>
28835 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28836 <entry>Default: <emphasis>unset</emphasis></entry>
28837 </row>
28838 </tbody>
28839 </tgroup>
28840 </informaltable>
28841 <para>
28842 <indexterm role="concept">
28843 <primary>limit</primary>
28844 <secondary>SMTP connections from one host</secondary>
28845 </indexterm>
28846 <indexterm role="concept">
28847 <primary>host</primary>
28848 <secondary>limiting SMTP connections from</secondary>
28849 </indexterm>
28850 This option restricts the number of simultaneous IP connections from a single
28851 host (strictly, from a single IP address) to the Exim daemon. The option is
28852 expanded, to enable different limits to be applied to different hosts by
28853 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
28854 connection attempts from the same host are rejected with error code 421. This
28855 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
28856 of zero imposes no limit. If this option is set greater than zero, it is
28857 required that <option>smtp_accept_max</option> be non-zero.
28858 </para>
28859 <para>
28860 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
28861 constructions that take an appreciable amount of time. The expansion and test
28862 happen in the main daemon loop, in order to reject additional connections
28863 without forking additional processes (otherwise a denial-of-service attack
28864 could cause a vast number or processes to be created). While the daemon is
28865 doing this processing, it cannot accept any other incoming connections.
28866 </para>
28867 <para>
28868 <indexterm role="option">
28869 <primary><option>smtp_accept_queue</option></primary>
28870 </indexterm>
28871 </para>
28872 <informaltable frame="all">
28873 <tgroup cols="4" colsep="0" rowsep="0">
28874 <colspec colwidth="8*" align="left"/>
28875 <colspec colwidth="6*" align="center"/>
28876 <colspec colwidth="6*" align="center"/>
28877 <colspec colwidth="6*" align="right"/>
28878 <tbody>
28879 <row>
28880 <entry><option>smtp_accept_queue</option></entry>
28881 <entry>Use: <emphasis>main</emphasis></entry>
28882 <entry>Type: <emphasis>integer</emphasis></entry>
28883 <entry>Default: <emphasis>0</emphasis></entry>
28884 </row>
28885 </tbody>
28886 </tgroup>
28887 </informaltable>
28888 <para>
28889 <indexterm role="concept">
28890 <primary>SMTP</primary>
28891 <secondary>incoming connection count</secondary>
28892 </indexterm>
28893 <indexterm role="concept">
28894 <primary>queueing incoming messages</primary>
28895 </indexterm>
28896 <indexterm role="concept">
28897 <primary>message</primary>
28898 <secondary>queueing by SMTP connection count</secondary>
28899 </indexterm>
28900 If the number of simultaneous incoming SMTP connections being handled via the
28901 listening daemon exceeds this value, messages received by SMTP are just placed
28902 on the queue; no delivery processes are started automatically. The count is
28903 fixed at the start of an SMTP connection. It cannot be updated in the
28904 subprocess that receives messages, and so the queueing or not queueing applies
28905 to all messages received in the same connection.
28906 </para>
28907 <para>
28908 A value of zero implies no limit, and clearly any non-zero value is useful only
28909 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
28910 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
28911 various <option>-od</option><emphasis>x</emphasis> command line options.
28912 </para>
28913 <para>
28914 <indexterm role="option">
28915 <primary><option>smtp_accept_queue_per_connection</option></primary>
28916 </indexterm>
28917 </para>
28918 <informaltable frame="all">
28919 <tgroup cols="4" colsep="0" rowsep="0">
28920 <colspec colwidth="8*" align="left"/>
28921 <colspec colwidth="6*" align="center"/>
28922 <colspec colwidth="6*" align="center"/>
28923 <colspec colwidth="6*" align="right"/>
28924 <tbody>
28925 <row>
28926 <entry><option>smtp_accept_queue_per_connection</option></entry>
28927 <entry>Use: <emphasis>main</emphasis></entry>
28928 <entry>Type: <emphasis>integer</emphasis></entry>
28929 <entry>Default: <emphasis>10</emphasis></entry>
28930 </row>
28931 </tbody>
28932 </tgroup>
28933 </informaltable>
28934 <para>
28935 <indexterm role="concept">
28936 <primary>queueing incoming messages</primary>
28937 </indexterm>
28938 <indexterm role="concept">
28939 <primary>message</primary>
28940 <secondary>queueing by message count</secondary>
28941 </indexterm>
28942 This option limits the number of delivery processes that Exim starts
28943 automatically when receiving messages via SMTP, whether via the daemon or by
28944 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
28945 and the number of messages received in a single SMTP session exceeds this
28946 number, subsequent messages are placed on the queue, but no delivery processes
28947 are started. This helps to limit the number of Exim processes when a server
28948 restarts after downtime and there is a lot of mail waiting for it on other
28949 systems. On large systems, the default should probably be increased, and on
28950 dial-in client systems it should probably be set to zero (that is, disabled).
28951 </para>
28952 <para>
28953 <indexterm role="option">
28954 <primary><option>smtp_accept_reserve</option></primary>
28955 </indexterm>
28956 </para>
28957 <informaltable frame="all">
28958 <tgroup cols="4" colsep="0" rowsep="0">
28959 <colspec colwidth="8*" align="left"/>
28960 <colspec colwidth="6*" align="center"/>
28961 <colspec colwidth="6*" align="center"/>
28962 <colspec colwidth="6*" align="right"/>
28963 <tbody>
28964 <row>
28965 <entry><option>smtp_accept_reserve</option></entry>
28966 <entry>Use: <emphasis>main</emphasis></entry>
28967 <entry>Type: <emphasis>integer</emphasis></entry>
28968 <entry>Default: <emphasis>0</emphasis></entry>
28969 </row>
28970 </tbody>
28971 </tgroup>
28972 </informaltable>
28973 <para>
28974 <indexterm role="concept">
28975 <primary>SMTP</primary>
28976 <secondary>incoming call count</secondary>
28977 </indexterm>
28978 <indexterm role="concept">
28979 <primary>host</primary>
28980 <secondary>reserved</secondary>
28981 </indexterm>
28982 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
28983 number of SMTP connections that are reserved for connections from the hosts
28984 that are specified in <option>smtp_reserve_hosts</option>. The value set in
28985 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
28986 restricted to this number of connections; the option specifies a minimum number
28987 of connection slots for them, not a maximum. It is a guarantee that this group
28988 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
28989 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
28990 individual host.
28991 </para>
28992 <para>
28993 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
28994 set to 5, once there are 45 active connections (from any hosts), new
28995 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
28996 provided the other criteria for acceptance are met.
28997 </para>
28998 <para>
28999 <indexterm role="option">
29000 <primary><option>smtp_active_hostname</option></primary>
29001 </indexterm>
29002 </para>
29003 <informaltable frame="all">
29004 <tgroup cols="4" colsep="0" rowsep="0">
29005 <colspec colwidth="8*" align="left"/>
29006 <colspec colwidth="6*" align="center"/>
29007 <colspec colwidth="6*" align="center"/>
29008 <colspec colwidth="6*" align="right"/>
29009 <tbody>
29010 <row>
29011 <entry><option>smtp_active_hostname</option></entry>
29012 <entry>Use: <emphasis>main</emphasis></entry>
29013 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29014 <entry>Default: <emphasis>unset</emphasis></entry>
29015 </row>
29016 </tbody>
29017 </tgroup>
29018 </informaltable>
29019 <para>
29020 <indexterm role="concept">
29021 <primary>host</primary>
29022 <secondary>name in SMTP responses</secondary>
29023 </indexterm>
29024 <indexterm role="concept">
29025 <primary>SMTP</primary>
29026 <secondary>host name in responses</secondary>
29027 </indexterm>
29028 <indexterm role="variable">
29029 <primary><varname>$primary_hostname</varname></primary>
29030 </indexterm>
29031 This option is provided for multi-homed servers that want to masquerade as
29032 several different hosts. At the start of an incoming SMTP connection, its value
29033 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
29034 responses. For example, it is used as domain name in the response to an
29035 incoming HELO or EHLO command.
29036 </para>
29037 <para>
29038 <indexterm role="variable">
29039 <primary><varname>$smtp_active_hostname</varname></primary>
29040 </indexterm>
29041 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
29042 is saved with any messages that are received. It is therefore available for use
29043 in routers and transports when the message is later delivered.
29044 </para>
29045 <para>
29046 If this option is unset, or if its expansion is forced to fail, or if the
29047 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
29048 used. Other expansion failures cause a message to be written to the main and
29049 panic logs, and the SMTP command receives a temporary error. Typically, the
29050 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
29051 For example:
29052 </para>
29053 <literallayout class="monospaced">
29054 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
29055   {cox.mydomain}{box.mydomain}}
29056 </literallayout>
29057 <para>
29058 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
29059 messages, it is also used as the default for HELO commands in callout
29060 verification if there is no remote transport from which to obtain a
29061 <option>helo_data</option> value.
29062 </para>
29063 <para>
29064 <indexterm role="option">
29065 <primary><option>smtp_banner</option></primary>
29066 </indexterm>
29067 </para>
29068 <informaltable frame="all">
29069 <tgroup cols="4" colsep="0" rowsep="0">
29070 <colspec colwidth="8*" align="left"/>
29071 <colspec colwidth="6*" align="center"/>
29072 <colspec colwidth="6*" align="center"/>
29073 <colspec colwidth="6*" align="right"/>
29074 <tbody>
29075 <row>
29076 <entry><option>smtp_banner</option></entry>
29077 <entry>Use: <emphasis>main</emphasis></entry>
29078 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29079 <entry>Default: <emphasis>see below</emphasis></entry>
29080 </row>
29081 </tbody>
29082 </tgroup>
29083 </informaltable>
29084 <para>
29085 <indexterm role="concept">
29086 <primary>SMTP</primary>
29087 <secondary>welcome banner</secondary>
29088 </indexterm>
29089 <indexterm role="concept">
29090 <primary>banner for SMTP</primary>
29091 </indexterm>
29092 <indexterm role="concept">
29093 <primary>welcome banner for SMTP</primary>
29094 </indexterm>
29095 <indexterm role="concept">
29096 <primary>customizing</primary>
29097 <secondary>SMTP banner</secondary>
29098 </indexterm>
29099 This string, which is expanded every time it is used, is output as the initial
29100 positive response to an SMTP connection. The default setting is:
29101 </para>
29102 <literallayout class="monospaced">
29103 smtp_banner = $smtp_active_hostname ESMTP Exim \
29104   $version_number $tod_full
29105 </literallayout>
29106 <para>
29107 Failure to expand the string causes a panic error. If you want to create a
29108 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
29109 appropriate points, but not at the end. Note that the 220 code is not included
29110 in this string. Exim adds it automatically (several times in the case of a
29111 multiline response).
29112 </para>
29113 <para>
29114 <indexterm role="option">
29115 <primary><option>smtp_check_spool_space</option></primary>
29116 </indexterm>
29117 </para>
29118 <informaltable frame="all">
29119 <tgroup cols="4" colsep="0" rowsep="0">
29120 <colspec colwidth="8*" align="left"/>
29121 <colspec colwidth="6*" align="center"/>
29122 <colspec colwidth="6*" align="center"/>
29123 <colspec colwidth="6*" align="right"/>
29124 <tbody>
29125 <row>
29126 <entry><option>smtp_check_spool_space</option></entry>
29127 <entry>Use: <emphasis>main</emphasis></entry>
29128 <entry>Type: <emphasis>boolean</emphasis></entry>
29129 <entry>Default: <emphasis>true</emphasis></entry>
29130 </row>
29131 </tbody>
29132 </tgroup>
29133 </informaltable>
29134 <para>
29135 <indexterm role="concept">
29136 <primary>checking disk space</primary>
29137 </indexterm>
29138 <indexterm role="concept">
29139 <primary>disk space, checking</primary>
29140 </indexterm>
29141 <indexterm role="concept">
29142 <primary>spool directory</primary>
29143 <secondary>checking space</secondary>
29144 </indexterm>
29145 When this option is set, if an incoming SMTP session encounters the SIZE
29146 option on a MAIL command, it checks that there is enough space in the
29147 spool directory&#x2019;s partition to accept a message of that size, while still
29148 leaving free the amount specified by <option>check_spool_space</option> (even if that value
29149 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
29150 </para>
29151 <para>
29152 <indexterm role="option">
29153 <primary><option>smtp_connect_backlog</option></primary>
29154 </indexterm>
29155 </para>
29156 <informaltable frame="all">
29157 <tgroup cols="4" colsep="0" rowsep="0">
29158 <colspec colwidth="8*" align="left"/>
29159 <colspec colwidth="6*" align="center"/>
29160 <colspec colwidth="6*" align="center"/>
29161 <colspec colwidth="6*" align="right"/>
29162 <tbody>
29163 <row>
29164 <entry><option>smtp_connect_backlog</option></entry>
29165 <entry>Use: <emphasis>main</emphasis></entry>
29166 <entry>Type: <emphasis>integer</emphasis></entry>
29167 <entry>Default: <emphasis>20</emphasis></entry>
29168 </row>
29169 </tbody>
29170 </tgroup>
29171 </informaltable>
29172 <para>
29173 <indexterm role="concept">
29174 <primary>connection backlog</primary>
29175 </indexterm>
29176 <indexterm role="concept">
29177 <primary>SMTP</primary>
29178 <secondary>connection backlog</secondary>
29179 </indexterm>
29180 <indexterm role="concept">
29181 <primary>backlog of connections</primary>
29182 </indexterm>
29183 This option specifies a maximum number of waiting SMTP connections. Exim passes
29184 this value to the TCP/IP system when it sets up its listener. Once this number
29185 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
29186 attempts are refused at the TCP/IP level. At least, that is what the manuals
29187 say; in some circumstances such connection attempts have been observed to time
29188 out instead. For large systems it is probably a good idea to increase the
29189 value (to 50, say). It also gives some protection against denial-of-service
29190 attacks by SYN flooding.
29191 </para>
29192 <para>
29193 <indexterm role="option">
29194 <primary><option>smtp_enforce_sync</option></primary>
29195 </indexterm>
29196 </para>
29197 <informaltable frame="all">
29198 <tgroup cols="4" colsep="0" rowsep="0">
29199 <colspec colwidth="8*" align="left"/>
29200 <colspec colwidth="6*" align="center"/>
29201 <colspec colwidth="6*" align="center"/>
29202 <colspec colwidth="6*" align="right"/>
29203 <tbody>
29204 <row>
29205 <entry><option>smtp_enforce_sync</option></entry>
29206 <entry>Use: <emphasis>main</emphasis></entry>
29207 <entry>Type: <emphasis>boolean</emphasis></entry>
29208 <entry>Default: <emphasis>true</emphasis></entry>
29209 </row>
29210 </tbody>
29211 </tgroup>
29212 </informaltable>
29213 <para>
29214 <indexterm role="concept">
29215 <primary>SMTP</primary>
29216 <secondary>synchronization checking</secondary>
29217 </indexterm>
29218 <indexterm role="concept">
29219 <primary>synchronization checking in SMTP</primary>
29220 </indexterm>
29221 The SMTP protocol specification requires the client to wait for a response from
29222 the server at certain points in the dialogue. Without PIPELINING these
29223 synchronization points are after every command; with PIPELINING they are
29224 fewer, but they still exist.
29225 </para>
29226 <para>
29227 Some spamming sites send out a complete set of SMTP commands without waiting
29228 for any response. Exim protects against this by rejecting a message if the
29229 client has sent further input when it should not have. The error response <quote>554
29230 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
29231 for this error cannot be perfect because of transmission delays (unexpected
29232 input may be on its way but not yet received when Exim checks). However, it
29233 does detect many instances.
29234 </para>
29235 <para>
29236 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
29237 If you want to disable the check selectively (for example, only for certain
29238 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
29239 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
29240 </para>
29241 <para>
29242 <indexterm role="option">
29243 <primary><option>smtp_etrn_command</option></primary>
29244 </indexterm>
29245 </para>
29246 <informaltable frame="all">
29247 <tgroup cols="4" colsep="0" rowsep="0">
29248 <colspec colwidth="8*" align="left"/>
29249 <colspec colwidth="6*" align="center"/>
29250 <colspec colwidth="6*" align="center"/>
29251 <colspec colwidth="6*" align="right"/>
29252 <tbody>
29253 <row>
29254 <entry><option>smtp_etrn_command</option></entry>
29255 <entry>Use: <emphasis>main</emphasis></entry>
29256 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29257 <entry>Default: <emphasis>unset</emphasis></entry>
29258 </row>
29259 </tbody>
29260 </tgroup>
29261 </informaltable>
29262 <para>
29263 <indexterm role="concept">
29264 <primary>ETRN</primary>
29265 <secondary>command to be run</secondary>
29266 </indexterm>
29267 <indexterm role="variable">
29268 <primary><varname>$domain</varname></primary>
29269 </indexterm>
29270 If this option is set, the given command is run whenever an SMTP ETRN
29271 command is received from a host that is permitted to issue such commands (see
29272 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
29273 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
29274 argument of the ETRN command, and no syntax checking is done on it. For
29275 example:
29276 </para>
29277 <literallayout class="monospaced">
29278 smtp_etrn_command = /etc/etrn_command $domain \
29279                     $sender_host_address
29280 </literallayout>
29281 <para>
29282 A new process is created to run the command, but Exim does not wait for it to
29283 complete. Consequently, its status cannot be checked. If the command cannot be
29284 run, a line is written to the panic log, but the ETRN caller still receives
29285 a 250 success response. Exim is normally running under its own uid when
29286 receiving SMTP, so it is not possible for it to change the uid before running
29287 the command.
29288 </para>
29289 <para>
29290 <indexterm role="option">
29291 <primary><option>smtp_etrn_serialize</option></primary>
29292 </indexterm>
29293 </para>
29294 <informaltable frame="all">
29295 <tgroup cols="4" colsep="0" rowsep="0">
29296 <colspec colwidth="8*" align="left"/>
29297 <colspec colwidth="6*" align="center"/>
29298 <colspec colwidth="6*" align="center"/>
29299 <colspec colwidth="6*" align="right"/>
29300 <tbody>
29301 <row>
29302 <entry><option>smtp_etrn_serialize</option></entry>
29303 <entry>Use: <emphasis>main</emphasis></entry>
29304 <entry>Type: <emphasis>boolean</emphasis></entry>
29305 <entry>Default: <emphasis>true</emphasis></entry>
29306 </row>
29307 </tbody>
29308 </tgroup>
29309 </informaltable>
29310 <para>
29311 <indexterm role="concept">
29312 <primary>ETRN</primary>
29313 <secondary>serializing</secondary>
29314 </indexterm>
29315 When this option is set, it prevents the simultaneous execution of more than
29316 one identical command as a result of ETRN in an SMTP connection. See
29317 section <xref linkend="SECTETRN"/> for details.
29318 </para>
29319 <para>
29320 <indexterm role="option">
29321 <primary><option>smtp_load_reserve</option></primary>
29322 </indexterm>
29323 </para>
29324 <informaltable frame="all">
29325 <tgroup cols="4" colsep="0" rowsep="0">
29326 <colspec colwidth="8*" align="left"/>
29327 <colspec colwidth="6*" align="center"/>
29328 <colspec colwidth="6*" align="center"/>
29329 <colspec colwidth="6*" align="right"/>
29330 <tbody>
29331 <row>
29332 <entry><option>smtp_load_reserve</option></entry>
29333 <entry>Use: <emphasis>main</emphasis></entry>
29334 <entry>Type: <emphasis>fixed-point</emphasis></entry>
29335 <entry>Default: <emphasis>unset</emphasis></entry>
29336 </row>
29337 </tbody>
29338 </tgroup>
29339 </informaltable>
29340 <para>
29341 <indexterm role="concept">
29342 <primary>load average</primary>
29343 </indexterm>
29344 If the system load average ever gets higher than this, incoming SMTP calls are
29345 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
29346 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
29347 the load is over the limit. The option has no effect on ancient operating
29348 systems on which Exim cannot determine the load average. See also
29349 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
29350 </para>
29351 <para>
29352 <indexterm role="option">
29353 <primary><option>smtp_max_synprot_errors</option></primary>
29354 </indexterm>
29355 </para>
29356 <informaltable frame="all">
29357 <tgroup cols="4" colsep="0" rowsep="0">
29358 <colspec colwidth="8*" align="left"/>
29359 <colspec colwidth="6*" align="center"/>
29360 <colspec colwidth="6*" align="center"/>
29361 <colspec colwidth="6*" align="right"/>
29362 <tbody>
29363 <row>
29364 <entry><option>smtp_max_synprot_errors</option></entry>
29365 <entry>Use: <emphasis>main</emphasis></entry>
29366 <entry>Type: <emphasis>integer</emphasis></entry>
29367 <entry>Default: <emphasis>3</emphasis></entry>
29368 </row>
29369 </tbody>
29370 </tgroup>
29371 </informaltable>
29372 <para>
29373 <indexterm role="concept">
29374 <primary>SMTP</primary>
29375 <secondary>limiting syntax and protocol errors</secondary>
29376 </indexterm>
29377 <indexterm role="concept">
29378 <primary>limit</primary>
29379 <secondary>SMTP syntax and protocol errors</secondary>
29380 </indexterm>
29381 Exim rejects SMTP commands that contain syntax or protocol errors. In
29382 particular, a syntactically invalid email address, as in this command:
29383 </para>
29384 <literallayout class="monospaced">
29385 RCPT TO:&lt;abc xyz@a.b.c&gt;
29386 </literallayout>
29387 <para>
29388 causes immediate rejection of the command, before any other tests are done.
29389 (The ACL cannot be run if there is no valid address to set up for it.) An
29390 example of a protocol error is receiving RCPT before MAIL. If there are
29391 too many syntax or protocol errors in one SMTP session, the connection is
29392 dropped. The limit is set by this option.
29393 </para>
29394 <para>
29395 <indexterm role="concept">
29396 <primary>PIPELINING</primary>
29397 <secondary>expected errors</secondary>
29398 </indexterm>
29399 When the PIPELINING extension to SMTP is in use, some protocol errors are
29400 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
29401 Exim assumes that PIPELINING will be used if it advertises it (see
29402 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
29403 not count towards the limit.
29404 </para>
29405 <para>
29406 <indexterm role="option">
29407 <primary><option>smtp_max_unknown_commands</option></primary>
29408 </indexterm>
29409 </para>
29410 <informaltable frame="all">
29411 <tgroup cols="4" colsep="0" rowsep="0">
29412 <colspec colwidth="8*" align="left"/>
29413 <colspec colwidth="6*" align="center"/>
29414 <colspec colwidth="6*" align="center"/>
29415 <colspec colwidth="6*" align="right"/>
29416 <tbody>
29417 <row>
29418 <entry><option>smtp_max_unknown_commands</option></entry>
29419 <entry>Use: <emphasis>main</emphasis></entry>
29420 <entry>Type: <emphasis>integer</emphasis></entry>
29421 <entry>Default: <emphasis>3</emphasis></entry>
29422 </row>
29423 </tbody>
29424 </tgroup>
29425 </informaltable>
29426 <para>
29427 <indexterm role="concept">
29428 <primary>SMTP</primary>
29429 <secondary>limiting unknown commands</secondary>
29430 </indexterm>
29431 <indexterm role="concept">
29432 <primary>limit</primary>
29433 <secondary>unknown SMTP commands</secondary>
29434 </indexterm>
29435 If there are too many unrecognized commands in an incoming SMTP session, an
29436 Exim server drops the connection. This is a defence against some kinds of abuse
29437 that subvert web
29438 clients
29439 into making connections to SMTP ports; in these circumstances, a number of
29440 non-SMTP command lines are sent first.
29441 </para>
29442 <para>
29443 <indexterm role="option">
29444 <primary><option>smtp_ratelimit_hosts</option></primary>
29445 </indexterm>
29446 </para>
29447 <informaltable frame="all">
29448 <tgroup cols="4" colsep="0" rowsep="0">
29449 <colspec colwidth="8*" align="left"/>
29450 <colspec colwidth="6*" align="center"/>
29451 <colspec colwidth="6*" align="center"/>
29452 <colspec colwidth="6*" align="right"/>
29453 <tbody>
29454 <row>
29455 <entry><option>smtp_ratelimit_hosts</option></entry>
29456 <entry>Use: <emphasis>main</emphasis></entry>
29457 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29458 <entry>Default: <emphasis>unset</emphasis></entry>
29459 </row>
29460 </tbody>
29461 </tgroup>
29462 </informaltable>
29463 <para>
29464 <indexterm role="concept">
29465 <primary>SMTP</primary>
29466 <secondary>rate limiting</secondary>
29467 </indexterm>
29468 <indexterm role="concept">
29469 <primary>limit</primary>
29470 <secondary>rate of message arrival</secondary>
29471 </indexterm>
29472 <indexterm role="concept">
29473 <primary>RCPT</primary>
29474 <secondary>rate limiting</secondary>
29475 </indexterm>
29476 Some sites find it helpful to be able to limit the rate at which certain hosts
29477 can send them messages, and the rate at which an individual message can specify
29478 recipients.
29479 </para>
29480 <para>
29481 Exim has two rate-limiting facilities. This section describes the older
29482 facility, which can limit rates within a single connection. The newer
29483 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
29484 <xref linkend="SECTratelimiting"/> for details of the newer facility.
29485 </para>
29486 <para>
29487 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
29488 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
29489 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
29490 respectively. Each option, if set, must contain a set of four comma-separated
29491 values:
29492 </para>
29493 <itemizedlist>
29494 <listitem>
29495 <para>
29496 A threshold, before which there is no rate limiting.
29497 </para>
29498 </listitem>
29499 <listitem>
29500 <para>
29501 An initial time delay. Unlike other times in Exim, numbers with decimal
29502 fractional parts are allowed here.
29503 </para>
29504 </listitem>
29505 <listitem>
29506 <para>
29507 A factor by which to increase the delay each time.
29508 </para>
29509 </listitem>
29510 <listitem>
29511 <para>
29512 A maximum value for the delay. This should normally be less than 5 minutes,
29513 because after that time, the client is liable to timeout the SMTP command.
29514 </para>
29515 </listitem>
29516 </itemizedlist>
29517 <para>
29518 For example, these settings have been used successfully at the site which
29519 first suggested this feature, for controlling mail from their customers:
29520 </para>
29521 <literallayout class="monospaced">
29522 smtp_ratelimit_mail = 2,0.5s,1.05,4m
29523 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
29524 </literallayout>
29525 <para>
29526 The first setting specifies delays that are applied to MAIL commands after
29527 two have been received over a single connection. The initial delay is 0.5
29528 seconds, increasing by a factor of 1.05 each time. The second setting applies
29529 delays to RCPT commands when more than four occur in a single message.
29530 </para>
29531 <para>
29532 <indexterm role="option">
29533 <primary><option>smtp_ratelimit_mail</option></primary>
29534 </indexterm>
29535 </para>
29536 <informaltable frame="all">
29537 <tgroup cols="4" colsep="0" rowsep="0">
29538 <colspec colwidth="8*" align="left"/>
29539 <colspec colwidth="6*" align="center"/>
29540 <colspec colwidth="6*" align="center"/>
29541 <colspec colwidth="6*" align="right"/>
29542 <tbody>
29543 <row>
29544 <entry><option>smtp_ratelimit_mail</option></entry>
29545 <entry>Use: <emphasis>main</emphasis></entry>
29546 <entry>Type: <emphasis>string</emphasis></entry>
29547 <entry>Default: <emphasis>unset</emphasis></entry>
29548 </row>
29549 </tbody>
29550 </tgroup>
29551 </informaltable>
29552 <para>
29553 See <option>smtp_ratelimit_hosts</option> above.
29554 </para>
29555 <para>
29556 <indexterm role="option">
29557 <primary><option>smtp_ratelimit_rcpt</option></primary>
29558 </indexterm>
29559 </para>
29560 <informaltable frame="all">
29561 <tgroup cols="4" colsep="0" rowsep="0">
29562 <colspec colwidth="8*" align="left"/>
29563 <colspec colwidth="6*" align="center"/>
29564 <colspec colwidth="6*" align="center"/>
29565 <colspec colwidth="6*" align="right"/>
29566 <tbody>
29567 <row>
29568 <entry><option>smtp_ratelimit_rcpt</option></entry>
29569 <entry>Use: <emphasis>main</emphasis></entry>
29570 <entry>Type: <emphasis>string</emphasis></entry>
29571 <entry>Default: <emphasis>unset</emphasis></entry>
29572 </row>
29573 </tbody>
29574 </tgroup>
29575 </informaltable>
29576 <para>
29577 See <option>smtp_ratelimit_hosts</option> above.
29578 </para>
29579 <para>
29580 <indexterm role="option">
29581 <primary><option>smtp_receive_timeout</option></primary>
29582 </indexterm>
29583 </para>
29584 <informaltable frame="all">
29585 <tgroup cols="4" colsep="0" rowsep="0">
29586 <colspec colwidth="8*" align="left"/>
29587 <colspec colwidth="6*" align="center"/>
29588 <colspec colwidth="6*" align="center"/>
29589 <colspec colwidth="6*" align="right"/>
29590 <tbody>
29591 <row>
29592 <entry><option>smtp_receive_timeout</option></entry>
29593 <entry>Use: <emphasis>main</emphasis></entry>
29594 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
29595 <entry>Default: <emphasis>5m</emphasis></entry>
29596 </row>
29597 </tbody>
29598 </tgroup>
29599 </informaltable>
29600 <para>
29601 <indexterm role="concept">
29602 <primary>timeout</primary>
29603 <secondary>for SMTP input</secondary>
29604 </indexterm>
29605 <indexterm role="concept">
29606 <primary>SMTP</primary>
29607 <secondary>input timeout</secondary>
29608 </indexterm>
29609 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
29610 input, including batch SMTP. If a line of input (either an SMTP command or a
29611 data line) is not received within this time, the SMTP connection is dropped and
29612 the message is abandoned.
29613 A line is written to the log containing one of the following messages:
29614 </para>
29615 <literallayout class="monospaced">
29616 SMTP command timeout on connection from...
29617 SMTP data timeout on connection from...
29618 </literallayout>
29619 <para>
29620 The former means that Exim was expecting to read an SMTP command; the latter
29621 means that it was in the DATA phase, reading the contents of a message.
29622 </para>
29623 <para revisionflag="changed">
29624 If the first character of the option is a <quote>$</quote> the option is
29625 expanded before use and may depend on
29626 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
29627 </para>
29628 <para>
29629 <indexterm role="option">
29630 <primary><option>-os</option></primary>
29631 </indexterm>
29632 The value set by this option can be overridden by the
29633 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
29634 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
29635 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
29636 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
29637 </para>
29638 <para>
29639 <indexterm role="option">
29640 <primary><option>smtp_reserve_hosts</option></primary>
29641 </indexterm>
29642 </para>
29643 <informaltable frame="all">
29644 <tgroup cols="4" colsep="0" rowsep="0">
29645 <colspec colwidth="8*" align="left"/>
29646 <colspec colwidth="6*" align="center"/>
29647 <colspec colwidth="6*" align="center"/>
29648 <colspec colwidth="6*" align="right"/>
29649 <tbody>
29650 <row>
29651 <entry><option>smtp_reserve_hosts</option></entry>
29652 <entry>Use: <emphasis>main</emphasis></entry>
29653 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29654 <entry>Default: <emphasis>unset</emphasis></entry>
29655 </row>
29656 </tbody>
29657 </tgroup>
29658 </informaltable>
29659 <para>
29660 This option defines hosts for which SMTP connections are reserved; see
29661 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
29662 </para>
29663 <para>
29664 <indexterm role="option">
29665 <primary><option>smtp_return_error_details</option></primary>
29666 </indexterm>
29667 </para>
29668 <informaltable frame="all">
29669 <tgroup cols="4" colsep="0" rowsep="0">
29670 <colspec colwidth="8*" align="left"/>
29671 <colspec colwidth="6*" align="center"/>
29672 <colspec colwidth="6*" align="center"/>
29673 <colspec colwidth="6*" align="right"/>
29674 <tbody>
29675 <row>
29676 <entry><option>smtp_return_error_details</option></entry>
29677 <entry>Use: <emphasis>main</emphasis></entry>
29678 <entry>Type: <emphasis>boolean</emphasis></entry>
29679 <entry>Default: <emphasis>false</emphasis></entry>
29680 </row>
29681 </tbody>
29682 </tgroup>
29683 </informaltable>
29684 <para>
29685 <indexterm role="concept">
29686 <primary>SMTP</primary>
29687 <secondary>details policy failures</secondary>
29688 </indexterm>
29689 <indexterm role="concept">
29690 <primary>policy control</primary>
29691 <secondary>rejection, returning details</secondary>
29692 </indexterm>
29693 In the default state, Exim uses bland messages such as
29694 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
29695 reasons. Many sysadmins like this because it gives away little information
29696 to spammers. However, some other sysadmins who are applying strict checking
29697 policies want to give out much fuller information about failures. Setting
29698 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
29699 example, instead of <quote>Administrative prohibition</quote>, it might give:
29700 </para>
29701 <literallayout class="monospaced">
29702 550-Rejected after DATA: '&gt;' missing at end of address:
29703 550 failing address in "From" header is: &lt;user@dom.ain
29704 </literallayout>
29705 <para>
29706 <indexterm role="option">
29707 <primary><option>spamd_address</option></primary>
29708 </indexterm>
29709 </para>
29710 <informaltable frame="all">
29711 <tgroup cols="4" colsep="0" rowsep="0">
29712 <colspec colwidth="8*" align="left"/>
29713 <colspec colwidth="6*" align="center"/>
29714 <colspec colwidth="6*" align="center"/>
29715 <colspec colwidth="6*" align="right"/>
29716 <tbody>
29717 <row>
29718 <entry><option>spamd_address</option></entry>
29719 <entry>Use: <emphasis>main</emphasis></entry>
29720 <entry>Type: <emphasis>string</emphasis></entry>
29721 <entry>Default: <emphasis>see below</emphasis></entry>
29722 </row>
29723 </tbody>
29724 </tgroup>
29725 </informaltable>
29726 <para>
29727 This option is available when Exim is compiled with the content-scanning
29728 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
29729 The default value is
29730 </para>
29731 <literallayout class="monospaced">
29732 127.0.0.1 783
29733 </literallayout>
29734 <para>
29735 See section <xref linkend="SECTscanspamass"/> for more details.
29736 </para>
29737 <para>
29738 <indexterm role="option">
29739 <primary><option>split_spool_directory</option></primary>
29740 </indexterm>
29741 </para>
29742 <informaltable frame="all">
29743 <tgroup cols="4" colsep="0" rowsep="0">
29744 <colspec colwidth="8*" align="left"/>
29745 <colspec colwidth="6*" align="center"/>
29746 <colspec colwidth="6*" align="center"/>
29747 <colspec colwidth="6*" align="right"/>
29748 <tbody>
29749 <row>
29750 <entry><option>split_spool_directory</option></entry>
29751 <entry>Use: <emphasis>main</emphasis></entry>
29752 <entry>Type: <emphasis>boolean</emphasis></entry>
29753 <entry>Default: <emphasis>false</emphasis></entry>
29754 </row>
29755 </tbody>
29756 </tgroup>
29757 </informaltable>
29758 <para>
29759 <indexterm role="concept">
29760 <primary>multiple spool directories</primary>
29761 </indexterm>
29762 <indexterm role="concept">
29763 <primary>spool directory</primary>
29764 <secondary>split</secondary>
29765 </indexterm>
29766 <indexterm role="concept">
29767 <primary>directories, multiple</primary>
29768 </indexterm>
29769 If this option is set, it causes Exim to split its input directory into 62
29770 subdirectories, each with a single alphanumeric character as its name. The
29771 sixth character of the message id is used to allocate messages to
29772 subdirectories; this is the least significant base-62 digit of the time of
29773 arrival of the message.
29774 </para>
29775 <para>
29776 Splitting up the spool in this way may provide better performance on systems
29777 where there are long mail queues, by reducing the number of files in any one
29778 directory. The msglog directory is also split up in a similar way to the input
29779 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
29780 are still placed in the single directory <filename>msglog.OLD</filename>.
29781 </para>
29782 <para>
29783 It is not necessary to take any special action for existing messages when
29784 changing <option>split_spool_directory</option>. Exim notices messages that are in the
29785 <quote>wrong</quote> place, and continues to process them. If the option is turned off
29786 after a period of being on, the subdirectories will eventually empty and be
29787 automatically deleted.
29788 </para>
29789 <para>
29790 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
29791 changes. Instead of creating a list of all messages in the queue, and then
29792 trying to deliver each one in turn, it constructs a list of those in one
29793 sub-directory and tries to deliver them, before moving on to the next
29794 sub-directory. The sub-directories are processed in a random order. This
29795 spreads out the scanning of the input directories, and uses less memory. It is
29796 particularly beneficial when there are lots of messages on the queue. However,
29797 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
29798 entire queue has to be scanned and sorted before any deliveries can start.
29799 </para>
29800 <para>
29801 <indexterm role="option">
29802 <primary><option>spool_directory</option></primary>
29803 </indexterm>
29804 </para>
29805 <informaltable frame="all">
29806 <tgroup cols="4" colsep="0" rowsep="0">
29807 <colspec colwidth="8*" align="left"/>
29808 <colspec colwidth="6*" align="center"/>
29809 <colspec colwidth="6*" align="center"/>
29810 <colspec colwidth="6*" align="right"/>
29811 <tbody>
29812 <row>
29813 <entry><option>spool_directory</option></entry>
29814 <entry>Use: <emphasis>main</emphasis></entry>
29815 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29816 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29817 </row>
29818 </tbody>
29819 </tgroup>
29820 </informaltable>
29821 <para>
29822 <indexterm role="concept">
29823 <primary>spool directory</primary>
29824 <secondary>path to</secondary>
29825 </indexterm>
29826 This defines the directory in which Exim keeps its spool, that is, the messages
29827 it is waiting to deliver. The default value is taken from the compile-time
29828 configuration setting, if there is one. If not, this option must be set. The
29829 string is expanded, so it can contain, for example, a reference to
29830 <varname>$primary_hostname</varname>.
29831 </para>
29832 <para>
29833 If the spool directory name is fixed on your installation, it is recommended
29834 that you set it at build time rather than from this option, particularly if the
29835 log files are being written to the spool directory (see <option>log_file_path</option>).
29836 Otherwise log files cannot be used for errors that are detected early on, such
29837 as failures in the configuration file.
29838 </para>
29839 <para>
29840 By using this option to override the compiled-in path, it is possible to run
29841 tests of Exim without using the standard spool.
29842 </para>
29843 <para>
29844 <indexterm role="option">
29845 <primary><option>sqlite_lock_timeout</option></primary>
29846 </indexterm>
29847 </para>
29848 <informaltable frame="all">
29849 <tgroup cols="4" colsep="0" rowsep="0">
29850 <colspec colwidth="8*" align="left"/>
29851 <colspec colwidth="6*" align="center"/>
29852 <colspec colwidth="6*" align="center"/>
29853 <colspec colwidth="6*" align="right"/>
29854 <tbody>
29855 <row>
29856 <entry><option>sqlite_lock_timeout</option></entry>
29857 <entry>Use: <emphasis>main</emphasis></entry>
29858 <entry>Type: <emphasis>time</emphasis></entry>
29859 <entry>Default: <emphasis>5s</emphasis></entry>
29860 </row>
29861 </tbody>
29862 </tgroup>
29863 </informaltable>
29864 <para>
29865 <indexterm role="concept">
29866 <primary>sqlite lookup type</primary>
29867 <secondary>lock timeout</secondary>
29868 </indexterm>
29869 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
29870 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
29871 </para>
29872 <para>
29873 <indexterm role="option">
29874 <primary><option>strict_acl_vars</option></primary>
29875 </indexterm>
29876 </para>
29877 <informaltable frame="all">
29878 <tgroup cols="4" colsep="0" rowsep="0">
29879 <colspec colwidth="8*" align="left"/>
29880 <colspec colwidth="6*" align="center"/>
29881 <colspec colwidth="6*" align="center"/>
29882 <colspec colwidth="6*" align="right"/>
29883 <tbody>
29884 <row>
29885 <entry><option>strict_acl_vars</option></entry>
29886 <entry>Use: <emphasis>main</emphasis></entry>
29887 <entry>Type: <emphasis>boolean</emphasis></entry>
29888 <entry>Default: <emphasis>false</emphasis></entry>
29889 </row>
29890 </tbody>
29891 </tgroup>
29892 </informaltable>
29893 <para>
29894 <indexterm role="concept">
29895 <primary>access control lists (ACLs)</primary>
29896 <secondary>variables, handling unset</secondary>
29897 </indexterm>
29898 This option controls what happens if a syntactically valid but undefined ACL
29899 variable is referenced. If it is false (the default), an empty string
29900 is substituted; if it is true, an error is generated. See section
29901 <xref linkend="SECTaclvariables"/> for details of ACL variables.
29902 </para>
29903 <para>
29904 <indexterm role="option">
29905 <primary><option>strip_excess_angle_brackets</option></primary>
29906 </indexterm>
29907 </para>
29908 <informaltable frame="all">
29909 <tgroup cols="4" colsep="0" rowsep="0">
29910 <colspec colwidth="8*" align="left"/>
29911 <colspec colwidth="6*" align="center"/>
29912 <colspec colwidth="6*" align="center"/>
29913 <colspec colwidth="6*" align="right"/>
29914 <tbody>
29915 <row>
29916 <entry><option>strip_excess_angle_brackets</option></entry>
29917 <entry>Use: <emphasis>main</emphasis></entry>
29918 <entry>Type: <emphasis>boolean</emphasis></entry>
29919 <entry>Default: <emphasis>false</emphasis></entry>
29920 </row>
29921 </tbody>
29922 </tgroup>
29923 </informaltable>
29924 <para>
29925 <indexterm role="concept">
29926 <primary>angle brackets, excess</primary>
29927 </indexterm>
29928 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
29929 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
29930 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
29931 passed on to another MTA, the excess angle brackets are not passed on. If this
29932 option is not set, multiple pairs of angle brackets cause a syntax error.
29933 </para>
29934 <para>
29935 <indexterm role="option">
29936 <primary><option>strip_trailing_dot</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>strip_trailing_dot</option></entry>
29948 <entry>Use: <emphasis>main</emphasis></entry>
29949 <entry>Type: <emphasis>boolean</emphasis></entry>
29950 <entry>Default: <emphasis>false</emphasis></entry>
29951 </row>
29952 </tbody>
29953 </tgroup>
29954 </informaltable>
29955 <para>
29956 <indexterm role="concept">
29957 <primary>trailing dot on domain</primary>
29958 </indexterm>
29959 <indexterm role="concept">
29960 <primary>dot</primary>
29961 <secondary>trailing on domain</secondary>
29962 </indexterm>
29963 If this option is set, a trailing dot at the end of a domain in an address is
29964 ignored. If this is in the envelope and the message is passed on to another
29965 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
29966 domain causes a syntax error.
29967 However, addresses in header lines are checked only when an ACL requests header
29968 syntax checking.
29969 </para>
29970 <para>
29971 <indexterm role="option">
29972 <primary><option>syslog_duplication</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>syslog_duplication</option></entry>
29984 <entry>Use: <emphasis>main</emphasis></entry>
29985 <entry>Type: <emphasis>boolean</emphasis></entry>
29986 <entry>Default: <emphasis>true</emphasis></entry>
29987 </row>
29988 </tbody>
29989 </tgroup>
29990 </informaltable>
29991 <para>
29992 <indexterm role="concept">
29993 <primary>syslog</primary>
29994 <secondary>duplicate log lines; suppressing</secondary>
29995 </indexterm>
29996 When Exim is logging to syslog, it writes the log lines for its three
29997 separate logs at different syslog priorities so that they can in principle
29998 be separated on the logging hosts. Some installations do not require this
29999 separation, and in those cases, the duplication of certain log lines is a
30000 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
30001 particular log line is written to syslog. For lines that normally go to
30002 both the main log and the reject log, the reject log version (possibly
30003 containing message header lines) is written, at LOG_NOTICE priority.
30004 Lines that normally go to both the main and the panic log are written at
30005 the LOG_ALERT priority.
30006 </para>
30007 <para>
30008 <indexterm role="option">
30009 <primary><option>syslog_facility</option></primary>
30010 </indexterm>
30011 </para>
30012 <informaltable frame="all">
30013 <tgroup cols="4" colsep="0" rowsep="0">
30014 <colspec colwidth="8*" align="left"/>
30015 <colspec colwidth="6*" align="center"/>
30016 <colspec colwidth="6*" align="center"/>
30017 <colspec colwidth="6*" align="right"/>
30018 <tbody>
30019 <row>
30020 <entry><option>syslog_facility</option></entry>
30021 <entry>Use: <emphasis>main</emphasis></entry>
30022 <entry>Type: <emphasis>string</emphasis></entry>
30023 <entry>Default: <emphasis>unset</emphasis></entry>
30024 </row>
30025 </tbody>
30026 </tgroup>
30027 </informaltable>
30028 <para>
30029 <indexterm role="concept">
30030 <primary>syslog</primary>
30031 <secondary>facility; setting</secondary>
30032 </indexterm>
30033 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
30034 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
30035 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
30036 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
30037 details of Exim&#x2019;s logging.
30038 </para>
30039 <para>
30040 <indexterm role="option">
30041 <primary><option>syslog_processname</option></primary>
30042 </indexterm>
30043 </para>
30044 <informaltable frame="all">
30045 <tgroup cols="4" colsep="0" rowsep="0">
30046 <colspec colwidth="8*" align="left"/>
30047 <colspec colwidth="6*" align="center"/>
30048 <colspec colwidth="6*" align="center"/>
30049 <colspec colwidth="6*" align="right"/>
30050 <tbody>
30051 <row>
30052 <entry><option>syslog_processname</option></entry>
30053 <entry>Use: <emphasis>main</emphasis></entry>
30054 <entry>Type: <emphasis>string</emphasis></entry>
30055 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
30056 </row>
30057 </tbody>
30058 </tgroup>
30059 </informaltable>
30060 <para>
30061 <indexterm role="concept">
30062 <primary>syslog</primary>
30063 <secondary>process name; setting</secondary>
30064 </indexterm>
30065 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
30066 syslog. The value must be no longer than 32 characters. See chapter
30067 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
30068 </para>
30069 <para>
30070 <indexterm role="option">
30071 <primary><option>syslog_timestamp</option></primary>
30072 </indexterm>
30073 </para>
30074 <informaltable frame="all">
30075 <tgroup cols="4" colsep="0" rowsep="0">
30076 <colspec colwidth="8*" align="left"/>
30077 <colspec colwidth="6*" align="center"/>
30078 <colspec colwidth="6*" align="center"/>
30079 <colspec colwidth="6*" align="right"/>
30080 <tbody>
30081 <row>
30082 <entry><option>syslog_timestamp</option></entry>
30083 <entry>Use: <emphasis>main</emphasis></entry>
30084 <entry>Type: <emphasis>boolean</emphasis></entry>
30085 <entry>Default: <emphasis>true</emphasis></entry>
30086 </row>
30087 </tbody>
30088 </tgroup>
30089 </informaltable>
30090 <para>
30091 <indexterm role="concept">
30092 <primary>syslog</primary>
30093 <secondary>timestamps</secondary>
30094 </indexterm>
30095 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
30096 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
30097 details of Exim&#x2019;s logging.
30098 </para>
30099 <para>
30100 <indexterm role="option">
30101 <primary><option>system_filter</option></primary>
30102 </indexterm>
30103 </para>
30104 <informaltable frame="all">
30105 <tgroup cols="4" colsep="0" rowsep="0">
30106 <colspec colwidth="8*" align="left"/>
30107 <colspec colwidth="6*" align="center"/>
30108 <colspec colwidth="6*" align="center"/>
30109 <colspec colwidth="6*" align="right"/>
30110 <tbody>
30111 <row>
30112 <entry><option>system_filter</option></entry>
30113 <entry>Use: <emphasis>main</emphasis></entry>
30114 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30115 <entry>Default: <emphasis>unset</emphasis></entry>
30116 </row>
30117 </tbody>
30118 </tgroup>
30119 </informaltable>
30120 <para>
30121 <indexterm role="concept">
30122 <primary>filter</primary>
30123 <secondary>system filter</secondary>
30124 </indexterm>
30125 <indexterm role="concept">
30126 <primary>system filter</primary>
30127 <secondary>specifying</secondary>
30128 </indexterm>
30129 <indexterm role="concept">
30130 <primary>Sieve filter</primary>
30131 <secondary>not available for system filter</secondary>
30132 </indexterm>
30133 This option specifies an Exim filter file that is applied to all messages at
30134 the start of each delivery attempt, before any routing is done. System filters
30135 must be Exim filters; they cannot be Sieve filters. If the system filter
30136 generates any deliveries to files or pipes, or any new mail messages, the
30137 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
30138 which transports are to be used. Details of this facility are given in chapter
30139 <xref linkend="CHAPsystemfilter"/>.
30140 </para>
30141 <para>
30142 <indexterm role="option">
30143 <primary><option>system_filter_directory_transport</option></primary>
30144 </indexterm>
30145 </para>
30146 <informaltable frame="all">
30147 <tgroup cols="4" colsep="0" rowsep="0">
30148 <colspec colwidth="8*" align="left"/>
30149 <colspec colwidth="6*" align="center"/>
30150 <colspec colwidth="6*" align="center"/>
30151 <colspec colwidth="6*" align="right"/>
30152 <tbody>
30153 <row>
30154 <entry><option>system_filter_directory_transport</option></entry>
30155 <entry>Use: <emphasis>main</emphasis></entry>
30156 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30157 <entry>Default: <emphasis>unset</emphasis></entry>
30158 </row>
30159 </tbody>
30160 </tgroup>
30161 </informaltable>
30162 <para>
30163 <indexterm role="variable">
30164 <primary><varname>$address_file</varname></primary>
30165 </indexterm>
30166 This sets the name of the transport driver that is to be used when the
30167 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
30168 implying delivery of each message into a separate file in some directory.
30169 During the delivery, the variable <varname>$address_file</varname> contains the path name.
30170 </para>
30171 <para>
30172 <indexterm role="option">
30173 <primary><option>system_filter_file_transport</option></primary>
30174 </indexterm>
30175 </para>
30176 <informaltable frame="all">
30177 <tgroup cols="4" colsep="0" rowsep="0">
30178 <colspec colwidth="8*" align="left"/>
30179 <colspec colwidth="6*" align="center"/>
30180 <colspec colwidth="6*" align="center"/>
30181 <colspec colwidth="6*" align="right"/>
30182 <tbody>
30183 <row>
30184 <entry><option>system_filter_file_transport</option></entry>
30185 <entry>Use: <emphasis>main</emphasis></entry>
30186 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30187 <entry>Default: <emphasis>unset</emphasis></entry>
30188 </row>
30189 </tbody>
30190 </tgroup>
30191 </informaltable>
30192 <para>
30193 <indexterm role="concept">
30194 <primary>file</primary>
30195 <secondary>transport for system filter</secondary>
30196 </indexterm>
30197 This sets the name of the transport driver that is to be used when the <option>save</option>
30198 command in a system message filter specifies a path not ending in <quote>/</quote>. During
30199 the delivery, the variable <varname>$address_file</varname> contains the path name.
30200 </para>
30201 <para>
30202 <indexterm role="option">
30203 <primary><option>system_filter_group</option></primary>
30204 </indexterm>
30205 </para>
30206 <informaltable frame="all">
30207 <tgroup cols="4" colsep="0" rowsep="0">
30208 <colspec colwidth="8*" align="left"/>
30209 <colspec colwidth="6*" align="center"/>
30210 <colspec colwidth="6*" align="center"/>
30211 <colspec colwidth="6*" align="right"/>
30212 <tbody>
30213 <row>
30214 <entry><option>system_filter_group</option></entry>
30215 <entry>Use: <emphasis>main</emphasis></entry>
30216 <entry>Type: <emphasis>string</emphasis></entry>
30217 <entry>Default: <emphasis>unset</emphasis></entry>
30218 </row>
30219 </tbody>
30220 </tgroup>
30221 </informaltable>
30222 <para>
30223 <indexterm role="concept">
30224 <primary>gid (group id)</primary>
30225 <secondary>system filter</secondary>
30226 </indexterm>
30227 This option is used only when <option>system_filter_user</option> is also set. It sets the
30228 gid under which the system filter is run, overriding any gid that is associated
30229 with the user. The value may be numerical or symbolic.
30230 </para>
30231 <para>
30232 <indexterm role="option">
30233 <primary><option>system_filter_pipe_transport</option></primary>
30234 </indexterm>
30235 </para>
30236 <informaltable frame="all">
30237 <tgroup cols="4" colsep="0" rowsep="0">
30238 <colspec colwidth="8*" align="left"/>
30239 <colspec colwidth="6*" align="center"/>
30240 <colspec colwidth="6*" align="center"/>
30241 <colspec colwidth="6*" align="right"/>
30242 <tbody>
30243 <row>
30244 <entry><option>system_filter_pipe_transport</option></entry>
30245 <entry>Use: <emphasis>main</emphasis></entry>
30246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30247 <entry>Default: <emphasis>unset</emphasis></entry>
30248 </row>
30249 </tbody>
30250 </tgroup>
30251 </informaltable>
30252 <para>
30253 <indexterm role="concept">
30254 <primary><command>pipe</command> transport</primary>
30255 <secondary>for system filter</secondary>
30256 </indexterm>
30257 <indexterm role="variable">
30258 <primary><varname>$address_pipe</varname></primary>
30259 </indexterm>
30260 This specifies the transport driver that is to be used when a <option>pipe</option> command
30261 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
30262 contains the pipe command.
30263 </para>
30264 <para>
30265 <indexterm role="option">
30266 <primary><option>system_filter_reply_transport</option></primary>
30267 </indexterm>
30268 </para>
30269 <informaltable frame="all">
30270 <tgroup cols="4" colsep="0" rowsep="0">
30271 <colspec colwidth="8*" align="left"/>
30272 <colspec colwidth="6*" align="center"/>
30273 <colspec colwidth="6*" align="center"/>
30274 <colspec colwidth="6*" align="right"/>
30275 <tbody>
30276 <row>
30277 <entry><option>system_filter_reply_transport</option></entry>
30278 <entry>Use: <emphasis>main</emphasis></entry>
30279 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30280 <entry>Default: <emphasis>unset</emphasis></entry>
30281 </row>
30282 </tbody>
30283 </tgroup>
30284 </informaltable>
30285 <para>
30286 <indexterm role="concept">
30287 <primary><command>autoreply</command> transport</primary>
30288 <secondary>for system filter</secondary>
30289 </indexterm>
30290 This specifies the transport driver that is to be used when a <option>mail</option> command
30291 is used in a system filter.
30292 </para>
30293 <para>
30294 <indexterm role="option">
30295 <primary><option>system_filter_user</option></primary>
30296 </indexterm>
30297 </para>
30298 <informaltable frame="all">
30299 <tgroup cols="4" colsep="0" rowsep="0">
30300 <colspec colwidth="8*" align="left"/>
30301 <colspec colwidth="6*" align="center"/>
30302 <colspec colwidth="6*" align="center"/>
30303 <colspec colwidth="6*" align="right"/>
30304 <tbody>
30305 <row>
30306 <entry><option>system_filter_user</option></entry>
30307 <entry>Use: <emphasis>main</emphasis></entry>
30308 <entry>Type: <emphasis>string</emphasis></entry>
30309 <entry>Default: <emphasis>unset</emphasis></entry>
30310 </row>
30311 </tbody>
30312 </tgroup>
30313 </informaltable>
30314 <para>
30315 <indexterm role="concept">
30316 <primary>uid (user id)</primary>
30317 <secondary>system filter</secondary>
30318 </indexterm>
30319 If this option is set to root, the system filter is run in the main Exim
30320 delivery process, as root.  Otherwise, the system filter runs in a separate
30321 process, as the given user, defaulting to the Exim run-time user.
30322 Unless the string consists entirely of digits, it
30323 is looked up in the password data. Failure to find the named user causes a
30324 configuration error. The gid is either taken from the password data, or
30325 specified by <option>system_filter_group</option>. When the uid is specified numerically,
30326 <option>system_filter_group</option> is required to be set.
30327 </para>
30328 <para>
30329 If the system filter generates any pipe, file, or reply deliveries, the uid
30330 under which the filter is run is used when transporting them, unless a
30331 transport option overrides.
30332 </para>
30333 <para>
30334 <indexterm role="option">
30335 <primary><option>tcp_nodelay</option></primary>
30336 </indexterm>
30337 </para>
30338 <informaltable frame="all">
30339 <tgroup cols="4" colsep="0" rowsep="0">
30340 <colspec colwidth="8*" align="left"/>
30341 <colspec colwidth="6*" align="center"/>
30342 <colspec colwidth="6*" align="center"/>
30343 <colspec colwidth="6*" align="right"/>
30344 <tbody>
30345 <row>
30346 <entry><option>tcp_nodelay</option></entry>
30347 <entry>Use: <emphasis>main</emphasis></entry>
30348 <entry>Type: <emphasis>boolean</emphasis></entry>
30349 <entry>Default: <emphasis>true</emphasis></entry>
30350 </row>
30351 </tbody>
30352 </tgroup>
30353 </informaltable>
30354 <para>
30355 <indexterm role="concept">
30356 <primary>daemon</primary>
30357 <secondary>TCP_NODELAY on sockets</secondary>
30358 </indexterm>
30359 <indexterm role="concept">
30360 <primary>Nagle algorithm</primary>
30361 </indexterm>
30362 <indexterm role="concept">
30363 <primary>TCP_NODELAY on listening sockets</primary>
30364 </indexterm>
30365 If this option is set false, it stops the Exim daemon setting the
30366 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
30367 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
30368 performance in interactive (character-by-character) situations. Turning it off
30369 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
30370 However, it appears that some broken clients cannot cope, and time out. Hence
30371 this option. It affects only those sockets that are set up for listening by the
30372 daemon. Sockets created by the smtp transport for delivering mail always set
30373 TCP_NODELAY.
30374 </para>
30375 <para>
30376 <indexterm role="option">
30377 <primary><option>timeout_frozen_after</option></primary>
30378 </indexterm>
30379 </para>
30380 <informaltable frame="all">
30381 <tgroup cols="4" colsep="0" rowsep="0">
30382 <colspec colwidth="8*" align="left"/>
30383 <colspec colwidth="6*" align="center"/>
30384 <colspec colwidth="6*" align="center"/>
30385 <colspec colwidth="6*" align="right"/>
30386 <tbody>
30387 <row>
30388 <entry><option>timeout_frozen_after</option></entry>
30389 <entry>Use: <emphasis>main</emphasis></entry>
30390 <entry>Type: <emphasis>time</emphasis></entry>
30391 <entry>Default: <emphasis>0s</emphasis></entry>
30392 </row>
30393 </tbody>
30394 </tgroup>
30395 </informaltable>
30396 <para>
30397 <indexterm role="concept">
30398 <primary>frozen messages</primary>
30399 <secondary>timing out</secondary>
30400 </indexterm>
30401 <indexterm role="concept">
30402 <primary>timeout</primary>
30403 <secondary>frozen messages</secondary>
30404 </indexterm>
30405 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
30406 message of any kind that has been on the queue for longer than the given time
30407 is automatically cancelled at the next queue run. If the frozen message is a
30408 bounce message, it is just discarded; otherwise, a bounce is sent to the
30409 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
30410 If you want to timeout frozen bounce messages earlier than other kinds of
30411 frozen message, see <option>ignore_bounce_errors_after</option>.
30412 </para>
30413 <para>
30414 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
30415 frozen messages remain on the queue forever (except for any frozen bounce
30416 messages that are released by <option>ignore_bounce_errors_after</option>).
30417 </para>
30418 <para>
30419 <indexterm role="option">
30420 <primary><option>timezone</option></primary>
30421 </indexterm>
30422 </para>
30423 <informaltable frame="all">
30424 <tgroup cols="4" colsep="0" rowsep="0">
30425 <colspec colwidth="8*" align="left"/>
30426 <colspec colwidth="6*" align="center"/>
30427 <colspec colwidth="6*" align="center"/>
30428 <colspec colwidth="6*" align="right"/>
30429 <tbody>
30430 <row>
30431 <entry><option>timezone</option></entry>
30432 <entry>Use: <emphasis>main</emphasis></entry>
30433 <entry>Type: <emphasis>string</emphasis></entry>
30434 <entry>Default: <emphasis>unset</emphasis></entry>
30435 </row>
30436 </tbody>
30437 </tgroup>
30438 </informaltable>
30439 <para>
30440 <indexterm role="concept">
30441 <primary>timezone, setting</primary>
30442 </indexterm>
30443 The value of <option>timezone</option> is used to set the environment variable TZ while
30444 running Exim (if it is different on entry). This ensures that all timestamps
30445 created by Exim are in the required timezone. If you want all your timestamps
30446 to be in UTC (aka GMT) you should set
30447 </para>
30448 <literallayout class="monospaced">
30449 timezone = UTC
30450 </literallayout>
30451 <para>
30452 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
30453 or, if that is not set, from the value of the TZ environment variable when Exim
30454 is built. If <option>timezone</option> is set to the empty string, either at build or run
30455 time, any existing TZ variable is removed from the environment when Exim
30456 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
30457 unfortunately not all, operating systems.
30458 </para>
30459 <para>
30460 <indexterm role="option">
30461 <primary><option>tls_advertise_hosts</option></primary>
30462 </indexterm>
30463 </para>
30464 <informaltable frame="all">
30465 <tgroup cols="4" colsep="0" rowsep="0">
30466 <colspec colwidth="8*" align="left"/>
30467 <colspec colwidth="6*" align="center"/>
30468 <colspec colwidth="6*" align="center"/>
30469 <colspec colwidth="6*" align="right"/>
30470 <tbody>
30471 <row>
30472 <entry><option>tls_advertise_hosts</option></entry>
30473 <entry>Use: <emphasis>main</emphasis></entry>
30474 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30475 <entry>Default: <emphasis>unset</emphasis></entry>
30476 </row>
30477 </tbody>
30478 </tgroup>
30479 </informaltable>
30480 <para>
30481 <indexterm role="concept">
30482 <primary>TLS</primary>
30483 <secondary>advertising</secondary>
30484 </indexterm>
30485 <indexterm role="concept">
30486 <primary>encryption</primary>
30487 <secondary>on SMTP connection</secondary>
30488 </indexterm>
30489 <indexterm role="concept">
30490 <primary>SMTP</primary>
30491 <secondary>encrypted connection</secondary>
30492 </indexterm>
30493 When Exim is built with support for TLS encrypted connections, the availability
30494 of the STARTTLS command to set up an encrypted session is advertised in
30495 response to EHLO only to those client hosts that match this option. See
30496 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
30497 </para>
30498 <para>
30499 <indexterm role="option">
30500 <primary><option>tls_certificate</option></primary>
30501 </indexterm>
30502 </para>
30503 <informaltable frame="all">
30504 <tgroup cols="4" colsep="0" rowsep="0">
30505 <colspec colwidth="8*" align="left"/>
30506 <colspec colwidth="6*" align="center"/>
30507 <colspec colwidth="6*" align="center"/>
30508 <colspec colwidth="6*" align="right"/>
30509 <tbody>
30510 <row>
30511 <entry><option>tls_certificate</option></entry>
30512 <entry>Use: <emphasis>main</emphasis></entry>
30513 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30514 <entry>Default: <emphasis>unset</emphasis></entry>
30515 </row>
30516 </tbody>
30517 </tgroup>
30518 </informaltable>
30519 <para>
30520 <indexterm role="concept">
30521 <primary>TLS</primary>
30522 <secondary>server certificate; location of</secondary>
30523 </indexterm>
30524 <indexterm role="concept">
30525 <primary>certificate</primary>
30526 <secondary>server, location of</secondary>
30527 </indexterm>
30528 The value of this option is expanded, and must then be the absolute path to a
30529 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
30530 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
30531 <xref linkend="CHAPTLS"/> for further details.
30532 </para>
30533 <para>
30534 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
30535 receiving incoming messages as a server. If you want to supply certificates for
30536 use when sending messages as a client, you must set the <option>tls_certificate</option>
30537 option in the relevant <command>smtp</command> transport.
30538 </para>
30539 <para>
30540 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
30541 if the OpenSSL build supports TLS extensions and the TLS client sends the
30542 Server Name Indication extension, then this option and others documented in
30543 <xref linkend="SECTtlssni"/> will be re-expanded.
30544 </para>
30545 <para>
30546 <indexterm role="option">
30547 <primary><option>tls_crl</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>tls_crl</option></entry>
30559 <entry>Use: <emphasis>main</emphasis></entry>
30560 <entry>Type: <emphasis>string</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>TLS</primary>
30569 <secondary>server certificate revocation list</secondary>
30570 </indexterm>
30571 <indexterm role="concept">
30572 <primary>certificate</primary>
30573 <secondary>revocation list for server</secondary>
30574 </indexterm>
30575 This option specifies a certificate revocation list. The expanded value must
30576 be the name of a file that contains a CRL in PEM format.
30577 </para>
30578 <para>
30579 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30580 </para>
30581 <para>
30582 <indexterm role="option">
30583 <primary><option>tls_dh_max_bits</option></primary>
30584 </indexterm>
30585 </para>
30586 <informaltable frame="all">
30587 <tgroup cols="4" colsep="0" rowsep="0">
30588 <colspec colwidth="8*" align="left"/>
30589 <colspec colwidth="6*" align="center"/>
30590 <colspec colwidth="6*" align="center"/>
30591 <colspec colwidth="6*" align="right"/>
30592 <tbody>
30593 <row>
30594 <entry><option>tls_dh_max_bits</option></entry>
30595 <entry>Use: <emphasis>main</emphasis></entry>
30596 <entry>Type: <emphasis>integer</emphasis></entry>
30597 <entry>Default: <emphasis>2236</emphasis></entry>
30598 </row>
30599 </tbody>
30600 </tgroup>
30601 </informaltable>
30602 <para>
30603 <indexterm role="concept">
30604 <primary>TLS</primary>
30605 <secondary>D-H bit count</secondary>
30606 </indexterm>
30607 The number of bits used for Diffie-Hellman key-exchange may be suggested by
30608 the chosen TLS library.  That value might prove to be too high for
30609 interoperability.  This option provides a maximum clamp on the value
30610 suggested, trading off security for interoperability.
30611 </para>
30612 <para>
30613 The value must be at least 1024.
30614 </para>
30615 <para>
30616 The value 2236 was chosen because, at time of adding the option, it was the
30617 hard-coded maximum value supported by the NSS cryptographic library, as used
30618 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
30619 </para>
30620 <para>
30621 If you prefer more security and are willing to break some clients, raise this
30622 number.
30623 </para>
30624 <para>
30625 Note that the value passed to GnuTLS for *generating* a new prime may be a
30626 little less than this figure, because GnuTLS is inexact and may produce a
30627 larger prime than requested.
30628 </para>
30629 <para>
30630 <indexterm role="option">
30631 <primary><option>tls_dhparam</option></primary>
30632 </indexterm>
30633 </para>
30634 <informaltable frame="all">
30635 <tgroup cols="4" colsep="0" rowsep="0">
30636 <colspec colwidth="8*" align="left"/>
30637 <colspec colwidth="6*" align="center"/>
30638 <colspec colwidth="6*" align="center"/>
30639 <colspec colwidth="6*" align="right"/>
30640 <tbody>
30641 <row>
30642 <entry><option>tls_dhparam</option></entry>
30643 <entry>Use: <emphasis>main</emphasis></entry>
30644 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30645 <entry>Default: <emphasis>unset</emphasis></entry>
30646 </row>
30647 </tbody>
30648 </tgroup>
30649 </informaltable>
30650 <para>
30651 <indexterm role="concept">
30652 <primary>TLS</primary>
30653 <secondary>D-H parameters for server</secondary>
30654 </indexterm>
30655 The value of this option is expanded and indicates the source of DH parameters
30656 to be used by Exim.
30657 </para>
30658 <para>
30659 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
30660 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
30661 PKCS#3 representation of the DH prime.  If the file does not exist, for
30662 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
30663 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
30664 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
30665 and treated as though the <option>tls_dhparam</option> were set to "none".
30666 </para>
30667 <para>
30668 If this option expands to the string "none", then no DH parameters will be
30669 loaded by Exim.
30670 </para>
30671 <para>
30672 If this option expands to the string "historic" and Exim is using GnuTLS, then
30673 Exim will attempt to load a file from inside the spool directory.  If the file
30674 does not exist, Exim will attempt to create it.
30675 See section <xref linkend="SECTgnutlsparam"/> for further details.
30676 </para>
30677 <para>
30678 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
30679 a default DH prime; the default is the 2048 bit prime described in section
30680 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
30681 in IKE is assigned number 23.
30682 </para>
30683 <para>
30684 Otherwise, the option must expand to the name used by Exim for any of a number
30685 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
30686 "ike" followed by the number used by IKE, of "default" which corresponds to
30687 "ike23".
30688 </para>
30689 <para>
30690 The available primes are:
30691 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
30692 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
30693 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
30694 </para>
30695 <para>
30696 Some of these will be too small to be accepted by clients.
30697 Some may be too large to be accepted by clients.
30698 </para>
30699 <para>
30700 The TLS protocol does not negotiate an acceptable size for this; clients tend
30701 to hard-drop connections if what is offered by the server is unacceptable,
30702 whether too large or too small, and there&#x2019;s no provision for the client to
30703 tell the server what these constraints are.  Thus, as a server operator, you
30704 need to make an educated guess as to what is most likely to work for your
30705 userbase.
30706 </para>
30707 <para>
30708 Some known size constraints suggest that a bit-size in the range 2048 to 2236
30709 is most likely to maximise interoperability.  The upper bound comes from
30710 applications using the Mozilla Network Security Services (NSS) library, which
30711 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
30712 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
30713 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
30714 acceptable bound from 1024 to 2048.
30715 </para>
30716 <para revisionflag="changed">
30717 <indexterm role="option">
30718 <primary><option>tls_eccurve</option></primary>
30719 </indexterm>
30720 </para>
30721 <informaltable frame="all" revisionflag="changed">
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>tls_eccurve</option></entry>
30730 <entry>Use: <emphasis>main</emphasis></entry>
30731 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30732 <entry>Default: <emphasis>prime256v1</emphasis></entry>
30733 </row>
30734 </tbody>
30735 </tgroup>
30736 </informaltable>
30737 <para revisionflag="changed">
30738 <indexterm role="concept">
30739 <primary>TLS</primary>
30740 <secondary>EC cryptography</secondary>
30741 </indexterm>
30742 If built with a recent-enough version of OpenSSL,
30743 this option selects a EC curve for use by Exim.
30744 </para>
30745 <para revisionflag="changed">
30746 Curve names of the form <emphasis>prime256v1</emphasis> are accepted.
30747 For even more-recent library versions, names of the form <emphasis>P-512</emphasis>
30748 are also accepted, plus the special value <emphasis>auto</emphasis>
30749 which tell the library to choose.
30750 </para>
30751 <para revisionflag="changed">
30752 If the option is set to an empty string, no EC curves will be enabled.
30753 </para>
30754 <para>
30755 <indexterm role="option">
30756 <primary><option>tls_ocsp_file</option></primary>
30757 </indexterm>
30758 </para>
30759 <informaltable frame="all">
30760 <tgroup cols="4" colsep="0" rowsep="0">
30761 <colspec colwidth="8*" align="left"/>
30762 <colspec colwidth="6*" align="center"/>
30763 <colspec colwidth="6*" align="center"/>
30764 <colspec colwidth="6*" align="right"/>
30765 <tbody>
30766 <row>
30767 <entry><option>tls_ocsp_file</option></entry>
30768 <entry>Use: <emphasis>main</emphasis></entry>
30769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30770 <entry>Default: <emphasis>unset</emphasis></entry>
30771 </row>
30772 </tbody>
30773 </tgroup>
30774 </informaltable>
30775 <para>
30776 <indexterm role="concept">
30777 <primary>TLS</primary>
30778 <secondary>certificate status</secondary>
30779 </indexterm>
30780 <indexterm role="concept">
30781 <primary>TLS</primary>
30782 <secondary>OCSP proof file</secondary>
30783 </indexterm>
30784 This option
30785 must if set expand to the absolute path to a file which contains a current
30786 status proof for the server&#x2019;s certificate, as obtained from the
30787 Certificate Authority.
30788 </para>
30789 <para>
30790 <indexterm role="option">
30791 <primary><option>tls_on_connect_ports</option></primary>
30792 </indexterm>
30793 </para>
30794 <informaltable frame="all">
30795 <tgroup cols="4" colsep="0" rowsep="0">
30796 <colspec colwidth="8*" align="left"/>
30797 <colspec colwidth="6*" align="center"/>
30798 <colspec colwidth="6*" align="center"/>
30799 <colspec colwidth="6*" align="right"/>
30800 <tbody>
30801 <row>
30802 <entry><option>tls_on_connect_ports</option></entry>
30803 <entry>Use: <emphasis>main</emphasis></entry>
30804 <entry>Type: <emphasis>string list</emphasis></entry>
30805 <entry>Default: <emphasis>unset</emphasis></entry>
30806 </row>
30807 </tbody>
30808 </tgroup>
30809 </informaltable>
30810 <para>
30811 <indexterm role="concept">
30812 <primary>SSMTP</primary>
30813 </indexterm>
30814 <indexterm role="concept">
30815 <primary>SMTPS</primary>
30816 </indexterm>
30817 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
30818 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
30819 set up without waiting for the client to issue a STARTTLS command. For
30820 further details, see section <xref linkend="SECTsupobssmt"/>.
30821 </para>
30822 <para>
30823 <indexterm role="option">
30824 <primary><option>tls_privatekey</option></primary>
30825 </indexterm>
30826 </para>
30827 <informaltable frame="all">
30828 <tgroup cols="4" colsep="0" rowsep="0">
30829 <colspec colwidth="8*" align="left"/>
30830 <colspec colwidth="6*" align="center"/>
30831 <colspec colwidth="6*" align="center"/>
30832 <colspec colwidth="6*" align="right"/>
30833 <tbody>
30834 <row>
30835 <entry><option>tls_privatekey</option></entry>
30836 <entry>Use: <emphasis>main</emphasis></entry>
30837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30838 <entry>Default: <emphasis>unset</emphasis></entry>
30839 </row>
30840 </tbody>
30841 </tgroup>
30842 </informaltable>
30843 <para>
30844 <indexterm role="concept">
30845 <primary>TLS</primary>
30846 <secondary>server private key; location of</secondary>
30847 </indexterm>
30848 The value of this option is expanded, and must then be the absolute path to a
30849 file which contains the server&#x2019;s private key. If this option is unset, or if
30850 the expansion is forced to fail, or the result is an empty string, the private
30851 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
30852 <xref linkend="CHAPTLS"/> for further details.
30853 </para>
30854 <para>
30855 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30856 </para>
30857 <para>
30858 <indexterm role="option">
30859 <primary><option>tls_remember_esmtp</option></primary>
30860 </indexterm>
30861 </para>
30862 <informaltable frame="all">
30863 <tgroup cols="4" colsep="0" rowsep="0">
30864 <colspec colwidth="8*" align="left"/>
30865 <colspec colwidth="6*" align="center"/>
30866 <colspec colwidth="6*" align="center"/>
30867 <colspec colwidth="6*" align="right"/>
30868 <tbody>
30869 <row>
30870 <entry><option>tls_remember_esmtp</option></entry>
30871 <entry>Use: <emphasis>main</emphasis></entry>
30872 <entry>Type: <emphasis>boolean</emphasis></entry>
30873 <entry>Default: <emphasis>false</emphasis></entry>
30874 </row>
30875 </tbody>
30876 </tgroup>
30877 </informaltable>
30878 <para>
30879 <indexterm role="concept">
30880 <primary>TLS</primary>
30881 <secondary>esmtp state; remembering</secondary>
30882 </indexterm>
30883 <indexterm role="concept">
30884 <primary>TLS</primary>
30885 <secondary>broken clients</secondary>
30886 </indexterm>
30887 If this option is set true, Exim violates the RFCs by remembering that it is in
30888 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
30889 support for broken clients that fail to send a new EHLO after starting a
30890 TLS session.
30891 </para>
30892 <para>
30893 <indexterm role="option">
30894 <primary><option>tls_require_ciphers</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>tls_require_ciphers</option></entry>
30906 <entry>Use: <emphasis>main</emphasis></entry>
30907 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30908 <entry>Default: <emphasis>unset</emphasis></entry>
30909 </row>
30910 </tbody>
30911 </tgroup>
30912 </informaltable>
30913 <para>
30914 <indexterm role="concept">
30915 <primary>TLS</primary>
30916 <secondary>requiring specific ciphers</secondary>
30917 </indexterm>
30918 <indexterm role="concept">
30919 <primary>cipher</primary>
30920 <secondary>requiring specific</secondary>
30921 </indexterm>
30922 This option controls which ciphers can be used for incoming TLS connections.
30923 The <command>smtp</command> transport has an option of the same name for controlling outgoing
30924 connections. This option is expanded for each connection, so can be varied for
30925 different clients if required. The value of this option must be a list of
30926 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
30927 in somewhat different ways. If GnuTLS is being used, the client controls the
30928 preference order of the available ciphers. Details are given in sections
30929 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
30930 </para>
30931 <para>
30932 <indexterm role="option">
30933 <primary><option>tls_try_verify_hosts</option></primary>
30934 </indexterm>
30935 </para>
30936 <informaltable frame="all">
30937 <tgroup cols="4" colsep="0" rowsep="0">
30938 <colspec colwidth="8*" align="left"/>
30939 <colspec colwidth="6*" align="center"/>
30940 <colspec colwidth="6*" align="center"/>
30941 <colspec colwidth="6*" align="right"/>
30942 <tbody>
30943 <row>
30944 <entry><option>tls_try_verify_hosts</option></entry>
30945 <entry>Use: <emphasis>main</emphasis></entry>
30946 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30947 <entry>Default: <emphasis>unset</emphasis></entry>
30948 </row>
30949 </tbody>
30950 </tgroup>
30951 </informaltable>
30952 <para>
30953 <indexterm role="concept">
30954 <primary>TLS</primary>
30955 <secondary>client certificate verification</secondary>
30956 </indexterm>
30957 <indexterm role="concept">
30958 <primary>certificate</primary>
30959 <secondary>verification of client</secondary>
30960 </indexterm>
30961 See <option>tls_verify_hosts</option> below.
30962 </para>
30963 <para revisionflag="changed">
30964 <indexterm role="option">
30965 <primary><option>tls_verify_certificates</option></primary>
30966 </indexterm>
30967 </para>
30968 <informaltable frame="all" revisionflag="changed">
30969 <tgroup cols="4" colsep="0" rowsep="0">
30970 <colspec colwidth="8*" align="left"/>
30971 <colspec colwidth="6*" align="center"/>
30972 <colspec colwidth="6*" align="center"/>
30973 <colspec colwidth="6*" align="right"/>
30974 <tbody>
30975 <row>
30976 <entry><option>tls_verify_certificates</option></entry>
30977 <entry>Use: <emphasis>main</emphasis></entry>
30978 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30979 <entry>Default: <emphasis>system</emphasis></entry>
30980 </row>
30981 </tbody>
30982 </tgroup>
30983 </informaltable>
30984 <para revisionflag="changed">
30985 <indexterm role="concept">
30986 <primary>TLS</primary>
30987 <secondary>client certificate verification</secondary>
30988 </indexterm>
30989 <indexterm role="concept">
30990 <primary>certificate</primary>
30991 <secondary>verification of client</secondary>
30992 </indexterm>
30993 The value of this option is expanded, and must then be either the
30994 word "system"
30995 or the absolute path to
30996 a file or directory containing permitted certificates for clients that
30997 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
30998 </para>
30999 <para revisionflag="changed">
31000 The "system" value for the option will use a
31001 system default location compiled into the SSL library.
31002 This is not available for GnuTLS versions preceding 3.0.20,
31003 and will be taken as empty; an explicit location
31004 must be specified.
31005 </para>
31006 <para revisionflag="changed">
31007 The use of a directory for the option value is not available for GnuTLS versions
31008 preceding 3.3.6 and a single file must be used.
31009 </para>
31010 <para revisionflag="changed">
31011 With OpenSSL the certificates specified
31012 explicitly
31013 either by file or directory
31014 are added to those given by the system default location.
31015 </para>
31016 <para>
31017 These certificates should be for the certificate authorities trusted, rather
31018 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
31019 the value is a file then the certificates are sent by Exim as a server to
31020 connecting clients, defining the list of accepted certificate authorities.
31021 Thus the values defined should be considered public data.  To avoid this,
31022 use the explicit directory version.
31023 </para>
31024 <para>
31025 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31026 </para>
31027 <para>
31028 A forced expansion failure or setting to an empty string is equivalent to
31029 being unset.
31030 </para>
31031 <para>
31032 <indexterm role="option">
31033 <primary><option>tls_verify_hosts</option></primary>
31034 </indexterm>
31035 </para>
31036 <informaltable frame="all">
31037 <tgroup cols="4" colsep="0" rowsep="0">
31038 <colspec colwidth="8*" align="left"/>
31039 <colspec colwidth="6*" align="center"/>
31040 <colspec colwidth="6*" align="center"/>
31041 <colspec colwidth="6*" align="right"/>
31042 <tbody>
31043 <row>
31044 <entry><option>tls_verify_hosts</option></entry>
31045 <entry>Use: <emphasis>main</emphasis></entry>
31046 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31047 <entry>Default: <emphasis>unset</emphasis></entry>
31048 </row>
31049 </tbody>
31050 </tgroup>
31051 </informaltable>
31052 <para>
31053 <indexterm role="concept">
31054 <primary>TLS</primary>
31055 <secondary>client certificate verification</secondary>
31056 </indexterm>
31057 <indexterm role="concept">
31058 <primary>certificate</primary>
31059 <secondary>verification of client</secondary>
31060 </indexterm>
31061 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
31062 certificates from clients. The expected certificates are defined by
31063 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
31064 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
31065 <option>tls_verify_certificates</option> is not set.
31066 </para>
31067 <para>
31068 Any client that matches <option>tls_verify_hosts</option> is constrained by
31069 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
31070 present one of the listed certificates. If it does not, the connection is
31071 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
31072 the host to use TLS. It can still send SMTP commands through unencrypted
31073 connections. Forcing a client to use TLS has to be done separately using an
31074 ACL to reject inappropriate commands when the connection is not encrypted.
31075 </para>
31076 <para>
31077 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
31078 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
31079 certificate and checks it against <option>tls_verify_certificates</option>, but does not
31080 abort the connection if there is no certificate or if it does not match. This
31081 state can be detected in an ACL, which makes it possible to implement policies
31082 such as <quote>accept for relay only if a verified certificate has been received,
31083 but accept for local delivery if encrypted, even without a verified
31084 certificate</quote>.
31085 </para>
31086 <para>
31087 Client hosts that match neither of these lists are not asked to present
31088 certificates.
31089 </para>
31090 <para>
31091 <indexterm role="option">
31092 <primary><option>trusted_groups</option></primary>
31093 </indexterm>
31094 </para>
31095 <informaltable frame="all">
31096 <tgroup cols="4" colsep="0" rowsep="0">
31097 <colspec colwidth="8*" align="left"/>
31098 <colspec colwidth="6*" align="center"/>
31099 <colspec colwidth="6*" align="center"/>
31100 <colspec colwidth="6*" align="right"/>
31101 <tbody>
31102 <row>
31103 <entry><option>trusted_groups</option></entry>
31104 <entry>Use: <emphasis>main</emphasis></entry>
31105 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31106 <entry>Default: <emphasis>unset</emphasis></entry>
31107 </row>
31108 </tbody>
31109 </tgroup>
31110 </informaltable>
31111 <para>
31112 <indexterm role="concept">
31113 <primary>trusted groups</primary>
31114 </indexterm>
31115 <indexterm role="concept">
31116 <primary>groups</primary>
31117 <secondary>trusted</secondary>
31118 </indexterm>
31119 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
31120 option is set, any process that is running in one of the listed groups, or
31121 which has one of them as a supplementary group, is trusted. The groups can be
31122 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
31123 details of what trusted callers are permitted to do. If neither
31124 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
31125 are trusted.
31126 </para>
31127 <para>
31128 <indexterm role="option">
31129 <primary><option>trusted_users</option></primary>
31130 </indexterm>
31131 </para>
31132 <informaltable frame="all">
31133 <tgroup cols="4" colsep="0" rowsep="0">
31134 <colspec colwidth="8*" align="left"/>
31135 <colspec colwidth="6*" align="center"/>
31136 <colspec colwidth="6*" align="center"/>
31137 <colspec colwidth="6*" align="right"/>
31138 <tbody>
31139 <row>
31140 <entry><option>trusted_users</option></entry>
31141 <entry>Use: <emphasis>main</emphasis></entry>
31142 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31143 <entry>Default: <emphasis>unset</emphasis></entry>
31144 </row>
31145 </tbody>
31146 </tgroup>
31147 </informaltable>
31148 <para>
31149 <indexterm role="concept">
31150 <primary>trusted users</primary>
31151 </indexterm>
31152 <indexterm role="concept">
31153 <primary>user</primary>
31154 <secondary>trusted</secondary>
31155 </indexterm>
31156 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
31157 option is set, any process that is running as one of the listed users is
31158 trusted. The users can be specified numerically or by name. See section
31159 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
31160 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
31161 Exim user are trusted.
31162 </para>
31163 <para>
31164 <indexterm role="option">
31165 <primary><option>unknown_login</option></primary>
31166 </indexterm>
31167 </para>
31168 <informaltable frame="all">
31169 <tgroup cols="4" colsep="0" rowsep="0">
31170 <colspec colwidth="8*" align="left"/>
31171 <colspec colwidth="6*" align="center"/>
31172 <colspec colwidth="6*" align="center"/>
31173 <colspec colwidth="6*" align="right"/>
31174 <tbody>
31175 <row>
31176 <entry><option>unknown_login</option></entry>
31177 <entry>Use: <emphasis>main</emphasis></entry>
31178 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31179 <entry>Default: <emphasis>unset</emphasis></entry>
31180 </row>
31181 </tbody>
31182 </tgroup>
31183 </informaltable>
31184 <para>
31185 <indexterm role="concept">
31186 <primary>uid (user id)</primary>
31187 <secondary>unknown caller</secondary>
31188 </indexterm>
31189 <indexterm role="variable">
31190 <primary><varname>$caller_uid</varname></primary>
31191 </indexterm>
31192 This is a specialized feature for use in unusual configurations. By default, if
31193 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
31194 gives up. The <option>unknown_login</option> option can be used to set a login name to be
31195 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
31196 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
31197 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
31198 <option>-F</option> option.
31199 </para>
31200 <para>
31201 <indexterm role="option">
31202 <primary><option>unknown_username</option></primary>
31203 </indexterm>
31204 </para>
31205 <informaltable frame="all">
31206 <tgroup cols="4" colsep="0" rowsep="0">
31207 <colspec colwidth="8*" align="left"/>
31208 <colspec colwidth="6*" align="center"/>
31209 <colspec colwidth="6*" align="center"/>
31210 <colspec colwidth="6*" align="right"/>
31211 <tbody>
31212 <row>
31213 <entry><option>unknown_username</option></entry>
31214 <entry>Use: <emphasis>main</emphasis></entry>
31215 <entry>Type: <emphasis>string</emphasis></entry>
31216 <entry>Default: <emphasis>unset</emphasis></entry>
31217 </row>
31218 </tbody>
31219 </tgroup>
31220 </informaltable>
31221 <para>
31222 See <option>unknown_login</option>.
31223 </para>
31224 <para>
31225 <indexterm role="option">
31226 <primary><option>untrusted_set_sender</option></primary>
31227 </indexterm>
31228 </para>
31229 <informaltable frame="all">
31230 <tgroup cols="4" colsep="0" rowsep="0">
31231 <colspec colwidth="8*" align="left"/>
31232 <colspec colwidth="6*" align="center"/>
31233 <colspec colwidth="6*" align="center"/>
31234 <colspec colwidth="6*" align="right"/>
31235 <tbody>
31236 <row>
31237 <entry><option>untrusted_set_sender</option></entry>
31238 <entry>Use: <emphasis>main</emphasis></entry>
31239 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
31240 <entry>Default: <emphasis>unset</emphasis></entry>
31241 </row>
31242 </tbody>
31243 </tgroup>
31244 </informaltable>
31245 <para>
31246 <indexterm role="concept">
31247 <primary>trusted users</primary>
31248 </indexterm>
31249 <indexterm role="concept">
31250 <primary>sender</primary>
31251 <secondary>setting by untrusted user</secondary>
31252 </indexterm>
31253 <indexterm role="concept">
31254 <primary>untrusted user setting sender</primary>
31255 </indexterm>
31256 <indexterm role="concept">
31257 <primary>user</primary>
31258 <secondary>untrusted setting sender</secondary>
31259 </indexterm>
31260 <indexterm role="concept">
31261 <primary>envelope sender</primary>
31262 </indexterm>
31263 When an untrusted user submits a message to Exim using the standard input, Exim
31264 normally creates an envelope sender address from the user&#x2019;s login and the
31265 default qualification domain. Data from the <option>-f</option> option (for setting envelope
31266 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
31267 is used) is ignored.
31268 </para>
31269 <para>
31270 However, untrusted users are permitted to set an empty envelope sender address,
31271 to declare that a message should never generate any bounces. For example:
31272 </para>
31273 <literallayout class="monospaced">
31274 exim -f '&lt;&gt;' user@domain.example
31275 </literallayout>
31276 <para>
31277 <indexterm role="variable">
31278 <primary><varname>$sender_ident</varname></primary>
31279 </indexterm>
31280 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
31281 other envelope sender addresses in a controlled way. When it is set, untrusted
31282 users are allowed to set envelope sender addresses that match any of the
31283 patterns in the list. Like all address lists, the string is expanded. The
31284 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
31285 users to setting senders that start with their login ids
31286 followed by a hyphen
31287 by a setting like this:
31288 </para>
31289 <literallayout class="monospaced">
31290 untrusted_set_sender = ^$sender_ident-
31291 </literallayout>
31292 <para>
31293 If you want to allow untrusted users to set envelope sender addresses without
31294 restriction, you can use
31295 </para>
31296 <literallayout class="monospaced">
31297 untrusted_set_sender = *
31298 </literallayout>
31299 <para>
31300 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
31301 only to the setting of the envelope sender. It does not permit untrusted users
31302 to use the other options which trusted user can use to override message
31303 parameters. Furthermore, it does not stop Exim from removing an existing
31304 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
31305 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
31306 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
31307 described in section <xref linkend="SECTthesenhea"/>.
31308 </para>
31309 <para>
31310 The log line for a message&#x2019;s arrival shows the envelope sender following
31311 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
31312 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
31313 envelope sender address, the user&#x2019;s login is shown in parentheses after the
31314 sender address.
31315 </para>
31316 <para>
31317 <indexterm role="option">
31318 <primary><option>uucp_from_pattern</option></primary>
31319 </indexterm>
31320 </para>
31321 <informaltable frame="all">
31322 <tgroup cols="4" colsep="0" rowsep="0">
31323 <colspec colwidth="8*" align="left"/>
31324 <colspec colwidth="6*" align="center"/>
31325 <colspec colwidth="6*" align="center"/>
31326 <colspec colwidth="6*" align="right"/>
31327 <tbody>
31328 <row>
31329 <entry><option>uucp_from_pattern</option></entry>
31330 <entry>Use: <emphasis>main</emphasis></entry>
31331 <entry>Type: <emphasis>string</emphasis></entry>
31332 <entry>Default: <emphasis>see below</emphasis></entry>
31333 </row>
31334 </tbody>
31335 </tgroup>
31336 </informaltable>
31337 <para>
31338 <indexterm role="concept">
31339 <primary><quote>From</quote> line</primary>
31340 </indexterm>
31341 <indexterm role="concept">
31342 <primary>UUCP</primary>
31343 <secondary><quote>From</quote> line</secondary>
31344 </indexterm>
31345 Some applications that pass messages to an MTA via a command line interface use
31346 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
31347 particular, this is used by UUCP software. Exim recognizes such a line by means
31348 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
31349 matches, the sender address is constructed by expanding the contents of
31350 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
31351 default pattern recognizes lines in the following two forms:
31352 </para>
31353 <literallayout class="monospaced">
31354 From ph10 Fri Jan  5 12:35 GMT 1996
31355 From ph10 Fri, 7 Jan 97 14:00:00 GMT
31356 </literallayout>
31357 <para>
31358 The pattern can be seen by running
31359 </para>
31360 <literallayout class="monospaced">
31361 exim -bP uucp_from_pattern
31362 </literallayout>
31363 <para>
31364 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
31365 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
31366 regular expression by a parenthesized subpattern. The default value for
31367 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
31368 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
31369 <option>ignore_fromline_hosts</option>.
31370 </para>
31371 <para>
31372 <indexterm role="option">
31373 <primary><option>uucp_from_sender</option></primary>
31374 </indexterm>
31375 </para>
31376 <informaltable frame="all">
31377 <tgroup cols="4" colsep="0" rowsep="0">
31378 <colspec colwidth="8*" align="left"/>
31379 <colspec colwidth="6*" align="center"/>
31380 <colspec colwidth="6*" align="center"/>
31381 <colspec colwidth="6*" align="right"/>
31382 <tbody>
31383 <row>
31384 <entry><option>uucp_from_sender</option></entry>
31385 <entry>Use: <emphasis>main</emphasis></entry>
31386 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31387 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
31388 </row>
31389 </tbody>
31390 </tgroup>
31391 </informaltable>
31392 <para>
31393 See <option>uucp_from_pattern</option> above.
31394 </para>
31395 <para>
31396 <indexterm role="option">
31397 <primary><option>warn_message_file</option></primary>
31398 </indexterm>
31399 </para>
31400 <informaltable frame="all">
31401 <tgroup cols="4" colsep="0" rowsep="0">
31402 <colspec colwidth="8*" align="left"/>
31403 <colspec colwidth="6*" align="center"/>
31404 <colspec colwidth="6*" align="center"/>
31405 <colspec colwidth="6*" align="right"/>
31406 <tbody>
31407 <row>
31408 <entry><option>warn_message_file</option></entry>
31409 <entry>Use: <emphasis>main</emphasis></entry>
31410 <entry>Type: <emphasis>string</emphasis></entry>
31411 <entry>Default: <emphasis>unset</emphasis></entry>
31412 </row>
31413 </tbody>
31414 </tgroup>
31415 </informaltable>
31416 <para>
31417 <indexterm role="concept">
31418 <primary>warning of delay</primary>
31419 <secondary>customizing the message</secondary>
31420 </indexterm>
31421 <indexterm role="concept">
31422 <primary>customizing</primary>
31423 <secondary>warning message</secondary>
31424 </indexterm>
31425 This option defines a template file containing paragraphs of text to be used
31426 for constructing the warning message which is sent by Exim when a message has
31427 been on the queue for a specified amount of time, as specified by
31428 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
31429 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
31430 </para>
31431 <para>
31432 <indexterm role="option">
31433 <primary><option>write_rejectlog</option></primary>
31434 </indexterm>
31435 </para>
31436 <informaltable frame="all">
31437 <tgroup cols="4" colsep="0" rowsep="0">
31438 <colspec colwidth="8*" align="left"/>
31439 <colspec colwidth="6*" align="center"/>
31440 <colspec colwidth="6*" align="center"/>
31441 <colspec colwidth="6*" align="right"/>
31442 <tbody>
31443 <row>
31444 <entry><option>write_rejectlog</option></entry>
31445 <entry>Use: <emphasis>main</emphasis></entry>
31446 <entry>Type: <emphasis>boolean</emphasis></entry>
31447 <entry>Default: <emphasis>true</emphasis></entry>
31448 </row>
31449 </tbody>
31450 </tgroup>
31451 </informaltable>
31452 <para>
31453 <indexterm role="concept">
31454 <primary>reject log</primary>
31455 <secondary>disabling</secondary>
31456 </indexterm>
31457 If this option is set false, Exim no longer writes anything to the reject log.
31458 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
31459 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
31460 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
31461 </para>
31462 </section>
31463 </chapter>
31464
31465 <chapter id="CHAProutergeneric">
31466 <title>Generic options for routers</title>
31467 <para>
31468 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
31469 <primary>options</primary>
31470 <secondary>generic; for routers</secondary>
31471 </indexterm>
31472 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
31473 <primary>generic options</primary>
31474 <secondary>router</secondary>
31475 </indexterm>
31476 This chapter describes the generic options that apply to all routers.
31477 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
31478 </para>
31479 <para>
31480 For a general description of how a router operates, see sections
31481 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
31482 which the preconditions are tested. The order of expansion of the options that
31483 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
31484 <option>headers_remove</option>, <option>transport</option>.
31485 </para>
31486 <para>
31487 <indexterm role="option">
31488 <primary><option>address_data</option></primary>
31489 </indexterm>
31490 </para>
31491 <informaltable frame="all">
31492 <tgroup cols="4" colsep="0" rowsep="0">
31493 <colspec colwidth="8*" align="left"/>
31494 <colspec colwidth="6*" align="center"/>
31495 <colspec colwidth="6*" align="center"/>
31496 <colspec colwidth="6*" align="right"/>
31497 <tbody>
31498 <row>
31499 <entry><option>address_data</option></entry>
31500 <entry>Use: <emphasis>routers</emphasis></entry>
31501 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31502 <entry>Default: <emphasis>unset</emphasis></entry>
31503 </row>
31504 </tbody>
31505 </tgroup>
31506 </informaltable>
31507 <para>
31508 <indexterm role="concept">
31509 <primary>router</primary>
31510 <secondary>data attached to address</secondary>
31511 </indexterm>
31512 The string is expanded just before the router is run, that is, after all the
31513 precondition tests have succeeded. If the expansion is forced to fail, the
31514 router declines, the value of <option>address_data</option> remains unchanged, and the
31515 <option>more</option> option controls what happens next. Other expansion failures cause
31516 delivery of the address to be deferred.
31517 </para>
31518 <para>
31519 <indexterm role="variable">
31520 <primary><varname>$address_data</varname></primary>
31521 </indexterm>
31522 When the expansion succeeds, the value is retained with the address, and can be
31523 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
31524 routers, and the eventual transport.
31525 </para>
31526 <para>
31527 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
31528 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
31529 in the filter. This is not normally a problem, because such data is usually
31530 either not confidential or it <quote>belongs</quote> to the current user, but if you do
31531 put confidential data into <varname>$address_data</varname> you need to remember this point.
31532 </para>
31533 <para>
31534 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
31535 with the address, though it can be changed by another <option>address_data</option> setting
31536 on a subsequent router. If a router generates child addresses, the value of
31537 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
31538 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
31539 </para>
31540 <para>
31541 The idea of <option>address_data</option> is that you can use it to look up a lot of data
31542 for the address once, and then pick out parts of the data later. For example,
31543 you could use a single LDAP lookup to return a string of the form
31544 </para>
31545 <literallayout class="monospaced">
31546 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
31547 </literallayout>
31548 <para>
31549 In the transport you could pick out the mailbox by a setting such as
31550 </para>
31551 <literallayout class="monospaced">
31552 file = ${extract{mailbox}{$address_data}}
31553 </literallayout>
31554 <para>
31555 This makes the configuration file less messy, and also reduces the number of
31556 lookups (though Exim does cache lookups).
31557 </para>
31558 <para>
31559 <indexterm role="variable">
31560 <primary><varname>$sender_address_data</varname></primary>
31561 </indexterm>
31562 <indexterm role="variable">
31563 <primary><varname>$address_data</varname></primary>
31564 </indexterm>
31565 The <option>address_data</option> facility is also useful as a means of passing information
31566 from one router to another, and from a router to a transport. In addition, if
31567 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
31568 ACL, it remains available for use in the rest of the ACL statement. After
31569 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
31570 </para>
31571 <para>
31572 <indexterm role="option">
31573 <primary><option>address_test</option></primary>
31574 </indexterm>
31575 </para>
31576 <informaltable frame="all">
31577 <tgroup cols="4" colsep="0" rowsep="0">
31578 <colspec colwidth="8*" align="left"/>
31579 <colspec colwidth="6*" align="center"/>
31580 <colspec colwidth="6*" align="center"/>
31581 <colspec colwidth="6*" align="right"/>
31582 <tbody>
31583 <row>
31584 <entry><option>address_test</option></entry>
31585 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31586 <entry>Type: <emphasis>boolean</emphasis></entry>
31587 <entry>Default: <emphasis>true</emphasis></entry>
31588 </row>
31589 </tbody>
31590 </tgroup>
31591 </informaltable>
31592 <para>
31593 <indexterm role="option">
31594 <primary><option>-bt</option></primary>
31595 </indexterm>
31596 <indexterm role="concept">
31597 <primary>router</primary>
31598 <secondary>skipping when address testing</secondary>
31599 </indexterm>
31600 If this option is set false, the router is skipped when routing is being tested
31601 by means of the <option>-bt</option> command line option. This can be a convenience when
31602 your first router sends messages to an external scanner, because it saves you
31603 having to set the <quote>already scanned</quote> indicator when testing real address
31604 routing.
31605 </para>
31606 <para>
31607 <indexterm role="option">
31608 <primary><option>cannot_route_message</option></primary>
31609 </indexterm>
31610 </para>
31611 <informaltable frame="all">
31612 <tgroup cols="4" colsep="0" rowsep="0">
31613 <colspec colwidth="8*" align="left"/>
31614 <colspec colwidth="6*" align="center"/>
31615 <colspec colwidth="6*" align="center"/>
31616 <colspec colwidth="6*" align="right"/>
31617 <tbody>
31618 <row>
31619 <entry><option>cannot_route_message</option></entry>
31620 <entry>Use: <emphasis>routers</emphasis></entry>
31621 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31622 <entry>Default: <emphasis>unset</emphasis></entry>
31623 </row>
31624 </tbody>
31625 </tgroup>
31626 </informaltable>
31627 <para>
31628 <indexterm role="concept">
31629 <primary>router</primary>
31630 <secondary>customizing <quote>cannot route</quote> message</secondary>
31631 </indexterm>
31632 <indexterm role="concept">
31633 <primary>customizing</primary>
31634 <secondary><quote>cannot route</quote> message</secondary>
31635 </indexterm>
31636 This option specifies a text message that is used when an address cannot be
31637 routed because Exim has run out of routers. The default message is
31638 <quote>Unrouteable address</quote>. This option is useful only on routers that have
31639 <option>more</option> set false, or on the very last router in a configuration, because the
31640 value that is used is taken from the last router that is considered. This
31641 includes a router that is skipped because its preconditions are not met, as
31642 well as a router that declines. For example, using the default configuration,
31643 you could put:
31644 </para>
31645 <literallayout class="monospaced">
31646 cannot_route_message = Remote domain not found in DNS
31647 </literallayout>
31648 <para>
31649 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
31650 and
31651 </para>
31652 <literallayout class="monospaced">
31653 cannot_route_message = Unknown local user
31654 </literallayout>
31655 <para>
31656 on the final router that checks for local users. If string expansion fails for
31657 this option, the default message is used. Unless the expansion failure was
31658 explicitly forced, a message about the failure is written to the main and panic
31659 logs, in addition to the normal message about the routing failure.
31660 </para>
31661 <para>
31662 <indexterm role="option">
31663 <primary><option>caseful_local_part</option></primary>
31664 </indexterm>
31665 </para>
31666 <informaltable frame="all">
31667 <tgroup cols="4" colsep="0" rowsep="0">
31668 <colspec colwidth="8*" align="left"/>
31669 <colspec colwidth="6*" align="center"/>
31670 <colspec colwidth="6*" align="center"/>
31671 <colspec colwidth="6*" align="right"/>
31672 <tbody>
31673 <row>
31674 <entry><option>caseful_local_part</option></entry>
31675 <entry>Use: <emphasis>routers</emphasis></entry>
31676 <entry>Type: <emphasis>boolean</emphasis></entry>
31677 <entry>Default: <emphasis>false</emphasis></entry>
31678 </row>
31679 </tbody>
31680 </tgroup>
31681 </informaltable>
31682 <para>
31683 <indexterm role="concept">
31684 <primary>case of local parts</primary>
31685 </indexterm>
31686 <indexterm role="concept">
31687 <primary>router</primary>
31688 <secondary>case of local parts</secondary>
31689 </indexterm>
31690 By default, routers handle the local parts of addresses in a case-insensitive
31691 manner, though the actual case is preserved for transmission with the message.
31692 If you want the case of letters to be significant in a router, you must set
31693 this option true. For individual router options that contain address or local
31694 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
31695 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
31696 more details.
31697 </para>
31698 <para>
31699 <indexterm role="variable">
31700 <primary><varname>$local_part</varname></primary>
31701 </indexterm>
31702 <indexterm role="variable">
31703 <primary><varname>$original_local_part</varname></primary>
31704 </indexterm>
31705 <indexterm role="variable">
31706 <primary><varname>$parent_local_part</varname></primary>
31707 </indexterm>
31708 The value of the <varname>$local_part</varname> variable is forced to lower case while a
31709 router is running unless <option>caseful_local_part</option> is set. When a router assigns
31710 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
31711 is the same as it was in the router. Similarly, when a router generates child
31712 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
31713 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
31714 </para>
31715 <para>
31716 This option applies to the processing of an address by a router. When a
31717 recipient address is being processed in an ACL, there is a separate <option>control</option>
31718 modifier that can be used to specify case-sensitive processing within the ACL
31719 (see section <xref linkend="SECTcontrols"/>).
31720 </para>
31721 <para>
31722 <indexterm role="option">
31723 <primary><option>check_local_user</option></primary>
31724 </indexterm>
31725 </para>
31726 <informaltable frame="all">
31727 <tgroup cols="4" colsep="0" rowsep="0">
31728 <colspec colwidth="8*" align="left"/>
31729 <colspec colwidth="6*" align="center"/>
31730 <colspec colwidth="6*" align="center"/>
31731 <colspec colwidth="6*" align="right"/>
31732 <tbody>
31733 <row>
31734 <entry><option>check_local_user</option></entry>
31735 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31736 <entry>Type: <emphasis>boolean</emphasis></entry>
31737 <entry>Default: <emphasis>false</emphasis></entry>
31738 </row>
31739 </tbody>
31740 </tgroup>
31741 </informaltable>
31742 <para>
31743 <indexterm role="concept">
31744 <primary>local user, checking in router</primary>
31745 </indexterm>
31746 <indexterm role="concept">
31747 <primary>router</primary>
31748 <secondary>checking for local user</secondary>
31749 </indexterm>
31750 <indexterm role="concept">
31751 <primary><filename>/etc/passwd</filename></primary>
31752 </indexterm>
31753 <indexterm role="variable">
31754 <primary><varname>$home</varname></primary>
31755 </indexterm>
31756 When this option is true, Exim checks that the local part of the recipient
31757 address (with affixes removed if relevant) is the name of an account on the
31758 local system. The check is done by calling the <function>getpwnam()</function> function rather
31759 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
31760 holding password data (such as NIS) are supported. If the local part is a local
31761 user, <varname>$home</varname> is set from the password data, and can be tested in other
31762 preconditions that are evaluated after this one (the order of evaluation is
31763 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
31764 overridden by <option>router_home_directory</option>. If the local part is not a local user,
31765 the router is skipped.
31766 </para>
31767 <para>
31768 If you want to check that the local part is either the name of a local user
31769 or matches something else, you cannot combine <option>check_local_user</option> with a
31770 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
31771 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
31772 setting to achieve this. For example:
31773 </para>
31774 <literallayout class="monospaced">
31775 local_parts = passwd;$local_part : lsearch;/etc/other/users
31776 </literallayout>
31777 <para>
31778 Note, however, that the side effects of <option>check_local_user</option> (such as setting
31779 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
31780 <option>local_parts</option> (or any other) precondition.
31781 </para>
31782 <para>
31783 <indexterm role="option">
31784 <primary><option>condition</option></primary>
31785 </indexterm>
31786 </para>
31787 <informaltable frame="all">
31788 <tgroup cols="4" colsep="0" rowsep="0">
31789 <colspec colwidth="8*" align="left"/>
31790 <colspec colwidth="6*" align="center"/>
31791 <colspec colwidth="6*" align="center"/>
31792 <colspec colwidth="6*" align="right"/>
31793 <tbody>
31794 <row>
31795 <entry><option>condition</option></entry>
31796 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31798 <entry>Default: <emphasis>unset</emphasis></entry>
31799 </row>
31800 </tbody>
31801 </tgroup>
31802 </informaltable>
31803 <para>
31804 <indexterm role="concept">
31805 <primary>router</primary>
31806 <secondary>customized precondition</secondary>
31807 </indexterm>
31808 This option specifies a general precondition test that has to succeed for the
31809 router to be called. The <option>condition</option> option is the last precondition to be
31810 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
31811 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
31812 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
31813 router is skipped, and the address is offered to the next one.
31814 </para>
31815 <para>
31816 If the result is any other value, the router is run (as this is the last
31817 precondition to be evaluated, all the other preconditions must be true).
31818 </para>
31819 <para>
31820 This option is unusual in that multiple <option>condition</option> options may be present.
31821 All <option>condition</option> options must succeed.
31822 </para>
31823 <para>
31824 The <option>condition</option> option provides a means of applying custom conditions to the
31825 running of routers. Note that in the case of a simple conditional expansion,
31826 the default expansion values are exactly what is wanted. For example:
31827 </para>
31828 <literallayout class="monospaced">
31829 condition = ${if &gt;{$message_age}{600}}
31830 </literallayout>
31831 <para>
31832 Because of the default behaviour of the string expansion, this is equivalent to
31833 </para>
31834 <literallayout class="monospaced">
31835 condition = ${if &gt;{$message_age}{600}{true}{}}
31836 </literallayout>
31837 <para>
31838 A multiple condition example, which succeeds:
31839 </para>
31840 <literallayout class="monospaced">
31841 condition = ${if &gt;{$message_age}{600}}
31842 condition = ${if !eq{${lc:$local_part}}{postmaster}}
31843 condition = foobar
31844 </literallayout>
31845 <para>
31846 If the expansion fails (other than forced failure) delivery is deferred. Some
31847 of the other precondition options are common special cases that could in fact
31848 be specified using <option>condition</option>.
31849 </para>
31850 <para>
31851 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
31852 are far older, and use one set of semantics.  ACLs are newer and when
31853 they were created, the ACL <option>condition</option> process was given far stricter
31854 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
31855 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
31856 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
31857 Router rules processing behavior.
31858 </para>
31859 <para>
31860 This is best illustrated in an example:
31861 </para>
31862 <literallayout class="monospaced">
31863 # If used in an ACL condition will fail with a syntax error, but
31864 # in a router condition any extra characters are treated as a string
31865
31866 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
31867 true {yes} {no}}
31868
31869 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
31870  {yes} {no}}
31871 </literallayout>
31872 <para>
31873 In each example above, the <option>if</option> statement actually ends after
31874 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
31875 default <option>if</option> behavior is to return a boolean true or a null answer
31876 (which evaluates to false). The rest of the line is then treated as a
31877 string. So the first example resulted in the boolean answer <quote>true</quote>
31878 with the string <quote> {yes} {no}}</quote> appended to it. The second example
31879 resulted in the null output (indicating false) with the string
31880 <quote> {yes} {no}}</quote> appended to it.
31881 </para>
31882 <para>
31883 In fact you can put excess forward braces in too.  In the router
31884 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
31885 mean something, like after a <quote>$</quote> or when required as part of a
31886 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
31887 string characters.
31888 </para>
31889 <para>
31890 Thus, in a Router, the above expansion strings will both always evaluate
31891 true, as the result of expansion is a non-empty string which doesn&#x2019;t
31892 match an explicit false value.  This can be tricky to debug.  By
31893 contrast, in an ACL either of those strings will always result in an
31894 expansion error because the result doesn&#x2019;t look sufficiently boolean.
31895 </para>
31896 <para>
31897 <indexterm role="option">
31898 <primary><option>debug_print</option></primary>
31899 </indexterm>
31900 </para>
31901 <informaltable frame="all">
31902 <tgroup cols="4" colsep="0" rowsep="0">
31903 <colspec colwidth="8*" align="left"/>
31904 <colspec colwidth="6*" align="center"/>
31905 <colspec colwidth="6*" align="center"/>
31906 <colspec colwidth="6*" align="right"/>
31907 <tbody>
31908 <row>
31909 <entry><option>debug_print</option></entry>
31910 <entry>Use: <emphasis>routers</emphasis></entry>
31911 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31912 <entry>Default: <emphasis>unset</emphasis></entry>
31913 </row>
31914 </tbody>
31915 </tgroup>
31916 </informaltable>
31917 <para>
31918 <indexterm role="concept">
31919 <primary>testing</primary>
31920 <secondary>variables in drivers</secondary>
31921 </indexterm>
31922 If this option is set and debugging is enabled (see the <option>-d</option> command line
31923 option) or in address-testing mode (see the <option>-bt</option> command line option),
31924 the string is expanded and included in the debugging output.
31925 If expansion of the string fails, the error message is written to the debugging
31926 output, and Exim carries on processing.
31927 This option is provided to help with checking out the values of variables and
31928 so on when debugging router configurations. For example, if a <option>condition</option>
31929 option appears not to be working, <option>debug_print</option> can be used to output the
31930 variables it references. The output happens after checks for <option>domains</option>,
31931 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
31932 are tested. A newline is added to the text if it does not end with one.
31933 The variable <varname>$router_name</varname> contains the name of the router.
31934 </para>
31935 <para>
31936 <indexterm role="option">
31937 <primary><option>disable_logging</option></primary>
31938 </indexterm>
31939 </para>
31940 <informaltable frame="all">
31941 <tgroup cols="4" colsep="0" rowsep="0">
31942 <colspec colwidth="8*" align="left"/>
31943 <colspec colwidth="6*" align="center"/>
31944 <colspec colwidth="6*" align="center"/>
31945 <colspec colwidth="6*" align="right"/>
31946 <tbody>
31947 <row>
31948 <entry><option>disable_logging</option></entry>
31949 <entry>Use: <emphasis>routers</emphasis></entry>
31950 <entry>Type: <emphasis>boolean</emphasis></entry>
31951 <entry>Default: <emphasis>false</emphasis></entry>
31952 </row>
31953 </tbody>
31954 </tgroup>
31955 </informaltable>
31956 <para>
31957 If this option is set true, nothing is logged for any routing errors
31958 or for any deliveries caused by this router. You should not set this option
31959 unless you really, really know what you are doing. See also the generic
31960 transport option of the same name.
31961 </para>
31962 <para revisionflag="changed">
31963 <indexterm role="option">
31964 <primary><option>dnssec_request_domains</option></primary>
31965 </indexterm>
31966 </para>
31967 <informaltable frame="all" revisionflag="changed">
31968 <tgroup cols="4" colsep="0" rowsep="0">
31969 <colspec colwidth="8*" align="left"/>
31970 <colspec colwidth="6*" align="center"/>
31971 <colspec colwidth="6*" align="center"/>
31972 <colspec colwidth="6*" align="right"/>
31973 <tbody>
31974 <row>
31975 <entry><option>dnssec_request_domains</option></entry>
31976 <entry>Use: <emphasis>routers</emphasis></entry>
31977 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31978 <entry>Default: <emphasis>unset</emphasis></entry>
31979 </row>
31980 </tbody>
31981 </tgroup>
31982 </informaltable>
31983 <para revisionflag="changed">
31984 <indexterm role="concept">
31985 <primary>MX record</primary>
31986 <secondary>security</secondary>
31987 </indexterm>
31988 <indexterm role="concept">
31989 <primary>DNSSEC</primary>
31990 <secondary>MX lookup</secondary>
31991 </indexterm>
31992 <indexterm role="concept">
31993 <primary>security</primary>
31994 <secondary>MX lookup</secondary>
31995 </indexterm>
31996 <indexterm role="concept">
31997 <primary>DNS</primary>
31998 <secondary>DNSSEC</secondary>
31999 </indexterm>
32000 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
32001 the dnssec request bit set.
32002 This applies to all of the SRV, MX, AAAA, A lookup sequence.
32003 </para>
32004 <para revisionflag="changed">
32005 <indexterm role="option">
32006 <primary><option>dnssec_require_domains</option></primary>
32007 </indexterm>
32008 </para>
32009 <informaltable frame="all" revisionflag="changed">
32010 <tgroup cols="4" colsep="0" rowsep="0">
32011 <colspec colwidth="8*" align="left"/>
32012 <colspec colwidth="6*" align="center"/>
32013 <colspec colwidth="6*" align="center"/>
32014 <colspec colwidth="6*" align="right"/>
32015 <tbody>
32016 <row>
32017 <entry><option>dnssec_require_domains</option></entry>
32018 <entry>Use: <emphasis>routers</emphasis></entry>
32019 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32020 <entry>Default: <emphasis>unset</emphasis></entry>
32021 </row>
32022 </tbody>
32023 </tgroup>
32024 </informaltable>
32025 <para revisionflag="changed">
32026 <indexterm role="concept">
32027 <primary>MX record</primary>
32028 <secondary>security</secondary>
32029 </indexterm>
32030 <indexterm role="concept">
32031 <primary>DNSSEC</primary>
32032 <secondary>MX lookup</secondary>
32033 </indexterm>
32034 <indexterm role="concept">
32035 <primary>security</primary>
32036 <secondary>MX lookup</secondary>
32037 </indexterm>
32038 <indexterm role="concept">
32039 <primary>DNS</primary>
32040 <secondary>DNSSEC</secondary>
32041 </indexterm>
32042 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
32043 the dnssec request bit set.  Any returns not having the Authenticated Data bit
32044 (AD bit) set will be ignored and logged as a host-lookup failure.
32045 This applies to all of the SRV, MX, AAAA, A lookup sequence.
32046 </para>
32047 <para>
32048 <indexterm role="option">
32049 <primary><option>domains</option></primary>
32050 </indexterm>
32051 </para>
32052 <informaltable frame="all">
32053 <tgroup cols="4" colsep="0" rowsep="0">
32054 <colspec colwidth="8*" align="left"/>
32055 <colspec colwidth="6*" align="center"/>
32056 <colspec colwidth="6*" align="center"/>
32057 <colspec colwidth="6*" align="right"/>
32058 <tbody>
32059 <row>
32060 <entry><option>domains</option></entry>
32061 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32062 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32063 <entry>Default: <emphasis>unset</emphasis></entry>
32064 </row>
32065 </tbody>
32066 </tgroup>
32067 </informaltable>
32068 <para>
32069 <indexterm role="concept">
32070 <primary>router</primary>
32071 <secondary>restricting to specific domains</secondary>
32072 </indexterm>
32073 <indexterm role="variable">
32074 <primary><varname>$domain_data</varname></primary>
32075 </indexterm>
32076 If this option is set, the router is skipped unless the current domain matches
32077 the list. If the match is achieved by means of a file lookup, the data that the
32078 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
32079 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
32080 a list of the order in which preconditions are evaluated.
32081 </para>
32082 <para>
32083 <indexterm role="option">
32084 <primary><option>driver</option></primary>
32085 </indexterm>
32086 </para>
32087 <informaltable frame="all">
32088 <tgroup cols="4" colsep="0" rowsep="0">
32089 <colspec colwidth="8*" align="left"/>
32090 <colspec colwidth="6*" align="center"/>
32091 <colspec colwidth="6*" align="center"/>
32092 <colspec colwidth="6*" align="right"/>
32093 <tbody>
32094 <row>
32095 <entry><option>driver</option></entry>
32096 <entry>Use: <emphasis>routers</emphasis></entry>
32097 <entry>Type: <emphasis>string</emphasis></entry>
32098 <entry>Default: <emphasis>unset</emphasis></entry>
32099 </row>
32100 </tbody>
32101 </tgroup>
32102 </informaltable>
32103 <para>
32104 This option must always be set. It specifies which of the available routers is
32105 to be used.
32106 </para>
32107 <para revisionflag="changed">
32108 <indexterm role="option">
32109 <primary><option>dsn_lasthop</option></primary>
32110 </indexterm>
32111 </para>
32112 <informaltable frame="all" revisionflag="changed">
32113 <tgroup cols="4" colsep="0" rowsep="0">
32114 <colspec colwidth="8*" align="left"/>
32115 <colspec colwidth="6*" align="center"/>
32116 <colspec colwidth="6*" align="center"/>
32117 <colspec colwidth="6*" align="right"/>
32118 <tbody>
32119 <row>
32120 <entry><option>dsn_lasthop</option></entry>
32121 <entry>Use: <emphasis>routers</emphasis></entry>
32122 <entry>Type: <emphasis>boolean</emphasis></entry>
32123 <entry>Default: <emphasis>false</emphasis></entry>
32124 </row>
32125 </tbody>
32126 </tgroup>
32127 </informaltable>
32128 <para revisionflag="changed">
32129 <indexterm role="concept">
32130 <primary>DSN</primary>
32131 <secondary>success</secondary>
32132 </indexterm>
32133 <indexterm role="concept">
32134 <primary>Delivery Status Notification</primary>
32135 <secondary>success</secondary>
32136 </indexterm>
32137 If this option is set true, and extended DSN (RFC3461) processing is in effect,
32138 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
32139 instead send a success DSN as if the next hop does not support DSN.
32140 Not effective on redirect routers.
32141 </para>
32142 <para>
32143 <indexterm role="option">
32144 <primary><option>errors_to</option></primary>
32145 </indexterm>
32146 </para>
32147 <informaltable frame="all">
32148 <tgroup cols="4" colsep="0" rowsep="0">
32149 <colspec colwidth="8*" align="left"/>
32150 <colspec colwidth="6*" align="center"/>
32151 <colspec colwidth="6*" align="center"/>
32152 <colspec colwidth="6*" align="right"/>
32153 <tbody>
32154 <row>
32155 <entry><option>errors_to</option></entry>
32156 <entry>Use: <emphasis>routers</emphasis></entry>
32157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32158 <entry>Default: <emphasis>unset</emphasis></entry>
32159 </row>
32160 </tbody>
32161 </tgroup>
32162 </informaltable>
32163 <para>
32164 <indexterm role="concept">
32165 <primary>envelope sender</primary>
32166 </indexterm>
32167 <indexterm role="concept">
32168 <primary>router</primary>
32169 <secondary>changing address for errors</secondary>
32170 </indexterm>
32171 If a router successfully handles an address, it may assign the address to a
32172 transport for delivery or it may generate child addresses. In both cases, if
32173 there is a delivery problem during later processing, the resulting bounce
32174 message is sent to the address that results from expanding this string,
32175 provided that the address verifies successfully. The <option>errors_to</option> option is
32176 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
32177 </para>
32178 <para>
32179 The <option>errors_to</option> setting associated with an address can be overridden if it
32180 subsequently passes through other routers that have their own <option>errors_to</option>
32181 settings, or if the message is delivered by a transport with a <option>return_path</option>
32182 setting.
32183 </para>
32184 <para>
32185 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
32186 the expansion fails to verify, the errors address associated with the incoming
32187 address is used. At top level, this is the envelope sender. A non-forced
32188 expansion failure causes delivery to be deferred.
32189 </para>
32190 <para>
32191 If an address for which <option>errors_to</option> has been set ends up being delivered over
32192 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
32193 any bounces that are generated by other MTAs on the delivery route are also
32194 sent there. You can set <option>errors_to</option> to the empty string by either of these
32195 settings:
32196 </para>
32197 <literallayout class="monospaced">
32198 errors_to =
32199 errors_to = ""
32200 </literallayout>
32201 <para>
32202 An expansion item that yields an empty string has the same effect. If you do
32203 this, a locally detected delivery error for addresses processed by this router
32204 no longer gives rise to a bounce message; the error is discarded. If the
32205 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
32206 overridden by the <option>return_path</option> option on the transport.
32207 </para>
32208 <para>
32209 <indexterm role="variable">
32210 <primary><varname>$address_data</varname></primary>
32211 </indexterm>
32212 If for some reason you want to discard local errors, but use a non-empty
32213 MAIL command for remote delivery, you can preserve the original return
32214 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
32215 setting <option>return_path</option>.
32216 </para>
32217 <para>
32218 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
32219 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
32220 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
32221 </para>
32222 <para>
32223 <indexterm role="option">
32224 <primary><option>expn</option></primary>
32225 </indexterm>
32226 </para>
32227 <informaltable frame="all">
32228 <tgroup cols="4" colsep="0" rowsep="0">
32229 <colspec colwidth="8*" align="left"/>
32230 <colspec colwidth="6*" align="center"/>
32231 <colspec colwidth="6*" align="center"/>
32232 <colspec colwidth="6*" align="right"/>
32233 <tbody>
32234 <row>
32235 <entry><option>expn</option></entry>
32236 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32237 <entry>Type: <emphasis>boolean</emphasis></entry>
32238 <entry>Default: <emphasis>true</emphasis></entry>
32239 </row>
32240 </tbody>
32241 </tgroup>
32242 </informaltable>
32243 <para>
32244 <indexterm role="concept">
32245 <primary>address</primary>
32246 <secondary>testing</secondary>
32247 </indexterm>
32248 <indexterm role="concept">
32249 <primary>testing</primary>
32250 <secondary>addresses</secondary>
32251 </indexterm>
32252 <indexterm role="concept">
32253 <primary>EXPN</primary>
32254 <secondary>router skipping</secondary>
32255 </indexterm>
32256 <indexterm role="concept">
32257 <primary>router</primary>
32258 <secondary>skipping for EXPN</secondary>
32259 </indexterm>
32260 If this option is turned off, the router is skipped when testing an address
32261 as a result of processing an SMTP EXPN command. You might, for example,
32262 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
32263 on for the system alias file.
32264 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32265 are evaluated.
32266 </para>
32267 <para>
32268 The use of the SMTP EXPN command is controlled by an ACL (see chapter
32269 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
32270 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
32271 </para>
32272 <para>
32273 <indexterm role="option">
32274 <primary><option>fail_verify</option></primary>
32275 </indexterm>
32276 </para>
32277 <informaltable frame="all">
32278 <tgroup cols="4" colsep="0" rowsep="0">
32279 <colspec colwidth="8*" align="left"/>
32280 <colspec colwidth="6*" align="center"/>
32281 <colspec colwidth="6*" align="center"/>
32282 <colspec colwidth="6*" align="right"/>
32283 <tbody>
32284 <row>
32285 <entry><option>fail_verify</option></entry>
32286 <entry>Use: <emphasis>routers</emphasis></entry>
32287 <entry>Type: <emphasis>boolean</emphasis></entry>
32288 <entry>Default: <emphasis>false</emphasis></entry>
32289 </row>
32290 </tbody>
32291 </tgroup>
32292 </informaltable>
32293 <para>
32294 <indexterm role="concept">
32295 <primary>router</primary>
32296 <secondary>forcing verification failure</secondary>
32297 </indexterm>
32298 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
32299 <option>fail_verify_recipient</option> to the same value.
32300 </para>
32301 <para>
32302 <indexterm role="option">
32303 <primary><option>fail_verify_recipient</option></primary>
32304 </indexterm>
32305 </para>
32306 <informaltable frame="all">
32307 <tgroup cols="4" colsep="0" rowsep="0">
32308 <colspec colwidth="8*" align="left"/>
32309 <colspec colwidth="6*" align="center"/>
32310 <colspec colwidth="6*" align="center"/>
32311 <colspec colwidth="6*" align="right"/>
32312 <tbody>
32313 <row>
32314 <entry><option>fail_verify_recipient</option></entry>
32315 <entry>Use: <emphasis>routers</emphasis></entry>
32316 <entry>Type: <emphasis>boolean</emphasis></entry>
32317 <entry>Default: <emphasis>false</emphasis></entry>
32318 </row>
32319 </tbody>
32320 </tgroup>
32321 </informaltable>
32322 <para>
32323 If this option is true and an address is accepted by this router when
32324 verifying a recipient, verification fails.
32325 </para>
32326 <para>
32327 <indexterm role="option">
32328 <primary><option>fail_verify_sender</option></primary>
32329 </indexterm>
32330 </para>
32331 <informaltable frame="all">
32332 <tgroup cols="4" colsep="0" rowsep="0">
32333 <colspec colwidth="8*" align="left"/>
32334 <colspec colwidth="6*" align="center"/>
32335 <colspec colwidth="6*" align="center"/>
32336 <colspec colwidth="6*" align="right"/>
32337 <tbody>
32338 <row>
32339 <entry><option>fail_verify_sender</option></entry>
32340 <entry>Use: <emphasis>routers</emphasis></entry>
32341 <entry>Type: <emphasis>boolean</emphasis></entry>
32342 <entry>Default: <emphasis>false</emphasis></entry>
32343 </row>
32344 </tbody>
32345 </tgroup>
32346 </informaltable>
32347 <para>
32348 If this option is true and an address is accepted by this router when
32349 verifying a sender, verification fails.
32350 </para>
32351 <para>
32352 <indexterm role="option">
32353 <primary><option>fallback_hosts</option></primary>
32354 </indexterm>
32355 </para>
32356 <informaltable frame="all">
32357 <tgroup cols="4" colsep="0" rowsep="0">
32358 <colspec colwidth="8*" align="left"/>
32359 <colspec colwidth="6*" align="center"/>
32360 <colspec colwidth="6*" align="center"/>
32361 <colspec colwidth="6*" align="right"/>
32362 <tbody>
32363 <row>
32364 <entry><option>fallback_hosts</option></entry>
32365 <entry>Use: <emphasis>routers</emphasis></entry>
32366 <entry>Type: <emphasis>string list</emphasis></entry>
32367 <entry>Default: <emphasis>unset</emphasis></entry>
32368 </row>
32369 </tbody>
32370 </tgroup>
32371 </informaltable>
32372 <para>
32373 <indexterm role="concept">
32374 <primary>router</primary>
32375 <secondary>fallback hosts</secondary>
32376 </indexterm>
32377 <indexterm role="concept">
32378 <primary>fallback</primary>
32379 <secondary>hosts specified on router</secondary>
32380 </indexterm>
32381 String expansion is not applied to this option. The argument must be a
32382 colon-separated list of host names or IP addresses. The list separator can be
32383 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
32384 each name or address. In fact, the format of each item is exactly the same as
32385 defined for the list of hosts in a <command>manualroute</command> router (see section
32386 <xref linkend="SECTformatonehostitem"/>).
32387 </para>
32388 <para>
32389 If a router queues an address for a remote transport, this host list is
32390 associated with the address, and used instead of the transport&#x2019;s fallback host
32391 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
32392 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
32393 transport for further details.
32394 </para>
32395 <para>
32396 <indexterm role="option">
32397 <primary><option>group</option></primary>
32398 </indexterm>
32399 </para>
32400 <informaltable frame="all">
32401 <tgroup cols="4" colsep="0" rowsep="0">
32402 <colspec colwidth="8*" align="left"/>
32403 <colspec colwidth="6*" align="center"/>
32404 <colspec colwidth="6*" align="center"/>
32405 <colspec colwidth="6*" align="right"/>
32406 <tbody>
32407 <row>
32408 <entry><option>group</option></entry>
32409 <entry>Use: <emphasis>routers</emphasis></entry>
32410 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32411 <entry>Default: <emphasis>see below</emphasis></entry>
32412 </row>
32413 </tbody>
32414 </tgroup>
32415 </informaltable>
32416 <para>
32417 <indexterm role="concept">
32418 <primary>gid (group id)</primary>
32419 <secondary>local delivery</secondary>
32420 </indexterm>
32421 <indexterm role="concept">
32422 <primary>local transports</primary>
32423 <secondary>uid and gid</secondary>
32424 </indexterm>
32425 <indexterm role="concept">
32426 <primary>transport</primary>
32427 <secondary>local</secondary>
32428 </indexterm>
32429 <indexterm role="concept">
32430 <primary>router</primary>
32431 <secondary>setting group</secondary>
32432 </indexterm>
32433 When a router queues an address for a transport, and the transport does not
32434 specify a group, the group given here is used when running the delivery
32435 process.
32436 The group may be specified numerically or by name. If expansion fails, the
32437 error is logged and delivery is deferred.
32438 The default is unset, unless <option>check_local_user</option> is set, when the default
32439 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
32440 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
32441 </para>
32442 <para>
32443 <indexterm role="option">
32444 <primary><option>headers_add</option></primary>
32445 </indexterm>
32446 </para>
32447 <informaltable frame="all">
32448 <tgroup cols="4" colsep="0" rowsep="0">
32449 <colspec colwidth="8*" align="left"/>
32450 <colspec colwidth="6*" align="center"/>
32451 <colspec colwidth="6*" align="center"/>
32452 <colspec colwidth="6*" align="right"/>
32453 <tbody>
32454 <row>
32455 <entry><option>headers_add</option></entry>
32456 <entry>Use: <emphasis>routers</emphasis></entry>
32457 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32458 <entry>Default: <emphasis>unset</emphasis></entry>
32459 </row>
32460 </tbody>
32461 </tgroup>
32462 </informaltable>
32463 <para>
32464 <indexterm role="concept">
32465 <primary>header lines</primary>
32466 <secondary>adding</secondary>
32467 </indexterm>
32468 <indexterm role="concept">
32469 <primary>router</primary>
32470 <secondary>adding header lines</secondary>
32471 </indexterm>
32472 This option specifies a list of text headers,
32473 </para>
32474 <para revisionflag="changed">
32475 newline-separated (by default, changeable in the usual way),
32476 </para>
32477 <para>
32478 that is associated with any addresses that are accepted by the router.
32479 Each item is separately expanded, at routing time.  However, this
32480 option has no effect when an address is just being verified. The way in which
32481 the text is used to add header lines at transport time is described in section
32482 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
32483 message is in the process of being transported. This means that references to
32484 header lines in string expansions in the transport&#x2019;s configuration do not
32485 <quote>see</quote> the added header lines.
32486 </para>
32487 <para>
32488 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
32489 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
32490 an item expansion is forced to fail, the item has no effect. Other expansion
32491 failures are treated as configuration errors.
32492 </para>
32493 <para>
32494 Unlike most options, <option>headers_add</option> can be specified multiple times
32495 for a router; all listed headers are added.
32496 </para>
32497 <para>
32498 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
32499 router that has the <option>one_time</option> option set.
32500 </para>
32501 <para>
32502 <indexterm role="concept">
32503 <primary>duplicate addresses</primary>
32504 </indexterm>
32505 <indexterm role="option">
32506 <primary><option>unseen</option></primary>
32507 </indexterm>
32508 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
32509 additions are deleted when the address is passed on to subsequent routers.
32510 For a <option>redirect</option> router, if a generated address is the same as the incoming
32511 address, this can lead to duplicate addresses with different header
32512 modifications. Exim does not do duplicate deliveries (except, in certain
32513 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
32514 which of the duplicates is discarded, so this ambiguous situation should be
32515 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
32516 </para>
32517 <para>
32518 <indexterm role="option">
32519 <primary><option>headers_remove</option></primary>
32520 </indexterm>
32521 </para>
32522 <informaltable frame="all">
32523 <tgroup cols="4" colsep="0" rowsep="0">
32524 <colspec colwidth="8*" align="left"/>
32525 <colspec colwidth="6*" align="center"/>
32526 <colspec colwidth="6*" align="center"/>
32527 <colspec colwidth="6*" align="right"/>
32528 <tbody>
32529 <row>
32530 <entry><option>headers_remove</option></entry>
32531 <entry>Use: <emphasis>routers</emphasis></entry>
32532 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32533 <entry>Default: <emphasis>unset</emphasis></entry>
32534 </row>
32535 </tbody>
32536 </tgroup>
32537 </informaltable>
32538 <para>
32539 <indexterm role="concept">
32540 <primary>header lines</primary>
32541 <secondary>removing</secondary>
32542 </indexterm>
32543 <indexterm role="concept">
32544 <primary>router</primary>
32545 <secondary>removing header lines</secondary>
32546 </indexterm>
32547 This option specifies a list of text headers,
32548 </para>
32549 <para revisionflag="changed">
32550 colon-separated (by default, changeable in the usual way),
32551 </para>
32552 <para>
32553 that is associated with any addresses that are accepted by the router.
32554 Each item is separately expanded, at routing time.  However, this
32555 option has no effect when an address is just being verified. The way in which
32556 the text is used to remove header lines at transport time is described in
32557 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
32558 the message is in the process of being transported. This means that references
32559 to header lines in string expansions in the transport&#x2019;s configuration still
32560 <quote>see</quote> the original header lines.
32561 </para>
32562 <para>
32563 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
32564 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
32565 the item has no effect. Other expansion failures are treated as configuration
32566 errors.
32567 </para>
32568 <para>
32569 Unlike most options, <option>headers_remove</option> can be specified multiple times
32570 for a router; all listed headers are removed.
32571 </para>
32572 <para>
32573 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
32574 router that has the <option>one_time</option> option set.
32575 </para>
32576 <para>
32577 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
32578 removal requests are deleted when the address is passed on to subsequent
32579 routers, and this can lead to problems with duplicates -- see the similar
32580 warning for <option>headers_add</option> above.
32581 </para>
32582 <para revisionflag="changed">
32583 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
32584 items that contain a list separator must have it doubled.
32585 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
32586 </para>
32587 <para>
32588 <indexterm role="option">
32589 <primary><option>ignore_target_hosts</option></primary>
32590 </indexterm>
32591 </para>
32592 <informaltable frame="all">
32593 <tgroup cols="4" colsep="0" rowsep="0">
32594 <colspec colwidth="8*" align="left"/>
32595 <colspec colwidth="6*" align="center"/>
32596 <colspec colwidth="6*" align="center"/>
32597 <colspec colwidth="6*" align="right"/>
32598 <tbody>
32599 <row>
32600 <entry><option>ignore_target_hosts</option></entry>
32601 <entry>Use: <emphasis>routers</emphasis></entry>
32602 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32603 <entry>Default: <emphasis>unset</emphasis></entry>
32604 </row>
32605 </tbody>
32606 </tgroup>
32607 </informaltable>
32608 <para>
32609 <indexterm role="concept">
32610 <primary>IP address</primary>
32611 <secondary>discarding</secondary>
32612 </indexterm>
32613 <indexterm role="concept">
32614 <primary>router</primary>
32615 <secondary>discarding IP addresses</secondary>
32616 </indexterm>
32617 Although this option is a host list, it should normally contain IP address
32618 entries rather than names. If any host that is looked up by the router has an
32619 IP address that matches an item in this list, Exim behaves as if that IP
32620 address did not exist. This option allows you to cope with rogue DNS entries
32621 like
32622 </para>
32623 <literallayout class="monospaced">
32624 remote.domain.example.  A  127.0.0.1
32625 </literallayout>
32626 <para>
32627 by setting
32628 </para>
32629 <literallayout class="monospaced">
32630 ignore_target_hosts = 127.0.0.1
32631 </literallayout>
32632 <para>
32633 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
32634 discarded in this way, the router declines. In a conventional configuration, an
32635 attempt to mail to such a domain would normally provoke the <quote>unrouteable
32636 domain</quote> error, and an attempt to verify an address in the domain would fail.
32637 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
32638 router declines if presented with one of the listed addresses.
32639 </para>
32640 <para>
32641 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
32642 means of the first or the second of the following settings, respectively:
32643 </para>
32644 <literallayout class="monospaced">
32645 ignore_target_hosts = 0.0.0.0/0
32646 ignore_target_hosts = &lt;; 0::0/0
32647 </literallayout>
32648 <para>
32649 The pattern in the first line matches all IPv4 addresses, whereas the pattern
32650 in the second line matches all IPv6 addresses.
32651 </para>
32652 <para>
32653 This option may also be useful for ignoring link-local and site-local IPv6
32654 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
32655 is expanded before use as a list, it is possible to make it dependent on the
32656 domain that is being routed.
32657 </para>
32658 <para>
32659 <indexterm role="variable">
32660 <primary><varname>$host_address</varname></primary>
32661 </indexterm>
32662 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
32663 checked.
32664 </para>
32665 <para>
32666 <indexterm role="option">
32667 <primary><option>initgroups</option></primary>
32668 </indexterm>
32669 </para>
32670 <informaltable frame="all">
32671 <tgroup cols="4" colsep="0" rowsep="0">
32672 <colspec colwidth="8*" align="left"/>
32673 <colspec colwidth="6*" align="center"/>
32674 <colspec colwidth="6*" align="center"/>
32675 <colspec colwidth="6*" align="right"/>
32676 <tbody>
32677 <row>
32678 <entry><option>initgroups</option></entry>
32679 <entry>Use: <emphasis>routers</emphasis></entry>
32680 <entry>Type: <emphasis>boolean</emphasis></entry>
32681 <entry>Default: <emphasis>false</emphasis></entry>
32682 </row>
32683 </tbody>
32684 </tgroup>
32685 </informaltable>
32686 <para>
32687 <indexterm role="concept">
32688 <primary>additional groups</primary>
32689 </indexterm>
32690 <indexterm role="concept">
32691 <primary>groups</primary>
32692 <secondary>additional</secondary>
32693 </indexterm>
32694 <indexterm role="concept">
32695 <primary>local transports</primary>
32696 <secondary>uid and gid</secondary>
32697 </indexterm>
32698 <indexterm role="concept">
32699 <primary>transport</primary>
32700 <secondary>local</secondary>
32701 </indexterm>
32702 If the router queues an address for a transport, and this option is true, and
32703 the uid supplied by the router is not overridden by the transport, the
32704 <function>initgroups()</function> function is called when running the transport to ensure that
32705 any additional groups associated with the uid are set up. See also <option>group</option>
32706 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
32707 </para>
32708 <para>
32709 <indexterm role="option">
32710 <primary><option>local_part_prefix</option></primary>
32711 </indexterm>
32712 </para>
32713 <informaltable frame="all">
32714 <tgroup cols="4" colsep="0" rowsep="0">
32715 <colspec colwidth="8*" align="left"/>
32716 <colspec colwidth="6*" align="center"/>
32717 <colspec colwidth="6*" align="center"/>
32718 <colspec colwidth="6*" align="right"/>
32719 <tbody>
32720 <row>
32721 <entry><option>local_part_prefix</option></entry>
32722 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32723 <entry>Type: <emphasis>string list</emphasis></entry>
32724 <entry>Default: <emphasis>unset</emphasis></entry>
32725 </row>
32726 </tbody>
32727 </tgroup>
32728 </informaltable>
32729 <para>
32730 <indexterm role="concept">
32731 <primary>router</primary>
32732 <secondary>prefix for local part</secondary>
32733 </indexterm>
32734 <indexterm role="concept">
32735 <primary>prefix</primary>
32736 <secondary>for local part, used in router</secondary>
32737 </indexterm>
32738 If this option is set, the router is skipped unless the local part starts with
32739 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
32740 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
32741 evaluated.
32742 </para>
32743 <para>
32744 The list is scanned from left to right, and the first prefix that matches is
32745 used. A limited form of wildcard is available; if the prefix begins with an
32746 asterisk, it matches the longest possible sequence of arbitrary characters at
32747 the start of the local part. An asterisk should therefore always be followed by
32748 some character that does not occur in normal local parts.
32749 <indexterm role="concept">
32750 <primary>multiple mailboxes</primary>
32751 </indexterm>
32752 <indexterm role="concept">
32753 <primary>mailbox</primary>
32754 <secondary>multiple</secondary>
32755 </indexterm>
32756 Wildcarding can be used to set up multiple user mailboxes, as described in
32757 section <xref linkend="SECTmulbox"/>.
32758 </para>
32759 <para>
32760 <indexterm role="variable">
32761 <primary><varname>$local_part</varname></primary>
32762 </indexterm>
32763 <indexterm role="variable">
32764 <primary><varname>$local_part_prefix</varname></primary>
32765 </indexterm>
32766 During the testing of the <option>local_parts</option> option, and while the router is
32767 running, the prefix is removed from the local part, and is available in the
32768 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
32769 the router accepts the address, this remains true during subsequent delivery by
32770 a transport. In particular, the local part that is transmitted in the RCPT
32771 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
32772 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
32773 the relevant transport.
32774 </para>
32775 <para>
32776 When an address is being verified, <option>local_part_prefix</option> affects only the
32777 behaviour of the router. If the callout feature of verification is in use, this
32778 means that the full address, including the prefix, will be used during the
32779 callout.
32780 </para>
32781 <para>
32782 The prefix facility is commonly used to handle local parts of the form
32783 <option>owner-something</option>. Another common use is to support local parts of the form
32784 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
32785 to tell a user their forwarding is broken &ndash; by placing a router like this one
32786 immediately before the router that handles <filename>.forward</filename> files:
32787 </para>
32788 <literallayout class="monospaced">
32789 real_localuser:
32790   driver = accept
32791   local_part_prefix = real-
32792   check_local_user
32793   transport = local_delivery
32794 </literallayout>
32795 <para>
32796 For security, it would probably be a good idea to restrict the use of this
32797 router to locally-generated messages, using a condition such as this:
32798 </para>
32799 <literallayout class="monospaced">
32800   condition = ${if match {$sender_host_address}\
32801                          {\N^(|127\.0\.0\.1)$\N}}
32802 </literallayout>
32803 <para>
32804 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
32805 both conditions must be met if not optional. Care must be taken if wildcards
32806 are used in both a prefix and a suffix on the same router. Different
32807 separator characters must be used to avoid ambiguity.
32808 </para>
32809 <para>
32810 <indexterm role="option">
32811 <primary><option>local_part_prefix_optional</option></primary>
32812 </indexterm>
32813 </para>
32814 <informaltable frame="all">
32815 <tgroup cols="4" colsep="0" rowsep="0">
32816 <colspec colwidth="8*" align="left"/>
32817 <colspec colwidth="6*" align="center"/>
32818 <colspec colwidth="6*" align="center"/>
32819 <colspec colwidth="6*" align="right"/>
32820 <tbody>
32821 <row>
32822 <entry><option>local_part_prefix_optional</option></entry>
32823 <entry>Use: <emphasis>routers</emphasis></entry>
32824 <entry>Type: <emphasis>boolean</emphasis></entry>
32825 <entry>Default: <emphasis>false</emphasis></entry>
32826 </row>
32827 </tbody>
32828 </tgroup>
32829 </informaltable>
32830 <para>
32831 See <option>local_part_prefix</option> above.
32832 </para>
32833 <para>
32834 <indexterm role="option">
32835 <primary><option>local_part_suffix</option></primary>
32836 </indexterm>
32837 </para>
32838 <informaltable frame="all">
32839 <tgroup cols="4" colsep="0" rowsep="0">
32840 <colspec colwidth="8*" align="left"/>
32841 <colspec colwidth="6*" align="center"/>
32842 <colspec colwidth="6*" align="center"/>
32843 <colspec colwidth="6*" align="right"/>
32844 <tbody>
32845 <row>
32846 <entry><option>local_part_suffix</option></entry>
32847 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32848 <entry>Type: <emphasis>string list</emphasis></entry>
32849 <entry>Default: <emphasis>unset</emphasis></entry>
32850 </row>
32851 </tbody>
32852 </tgroup>
32853 </informaltable>
32854 <para>
32855 <indexterm role="concept">
32856 <primary>router</primary>
32857 <secondary>suffix for local part</secondary>
32858 </indexterm>
32859 <indexterm role="concept">
32860 <primary>suffix for local part</primary>
32861 <secondary>used in router</secondary>
32862 </indexterm>
32863 This option operates in the same way as <option>local_part_prefix</option>, except that the
32864 local part must end (rather than start) with the given string, the
32865 <option>local_part_suffix_optional</option> option determines whether the suffix is
32866 mandatory, and the wildcard * character, if present, must be the last
32867 character of the suffix. This option facility is commonly used to handle local
32868 parts of the form <option>something-request</option> and multiple user mailboxes of the form
32869 <option>username-foo</option>.
32870 </para>
32871 <para>
32872 <indexterm role="option">
32873 <primary><option>local_part_suffix_optional</option></primary>
32874 </indexterm>
32875 </para>
32876 <informaltable frame="all">
32877 <tgroup cols="4" colsep="0" rowsep="0">
32878 <colspec colwidth="8*" align="left"/>
32879 <colspec colwidth="6*" align="center"/>
32880 <colspec colwidth="6*" align="center"/>
32881 <colspec colwidth="6*" align="right"/>
32882 <tbody>
32883 <row>
32884 <entry><option>local_part_suffix_optional</option></entry>
32885 <entry>Use: <emphasis>routers</emphasis></entry>
32886 <entry>Type: <emphasis>boolean</emphasis></entry>
32887 <entry>Default: <emphasis>false</emphasis></entry>
32888 </row>
32889 </tbody>
32890 </tgroup>
32891 </informaltable>
32892 <para>
32893 See <option>local_part_suffix</option> above.
32894 </para>
32895 <para>
32896 <indexterm role="option">
32897 <primary><option>local_parts</option></primary>
32898 </indexterm>
32899 </para>
32900 <informaltable frame="all">
32901 <tgroup cols="4" colsep="0" rowsep="0">
32902 <colspec colwidth="8*" align="left"/>
32903 <colspec colwidth="6*" align="center"/>
32904 <colspec colwidth="6*" align="center"/>
32905 <colspec colwidth="6*" align="right"/>
32906 <tbody>
32907 <row>
32908 <entry><option>local_parts</option></entry>
32909 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32910 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
32911 <entry>Default: <emphasis>unset</emphasis></entry>
32912 </row>
32913 </tbody>
32914 </tgroup>
32915 </informaltable>
32916 <para>
32917 <indexterm role="concept">
32918 <primary>router</primary>
32919 <secondary>restricting to specific local parts</secondary>
32920 </indexterm>
32921 <indexterm role="concept">
32922 <primary>local part</primary>
32923 <secondary>checking in router</secondary>
32924 </indexterm>
32925 The router is run only if the local part of the address matches the list.
32926 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32927 are evaluated, and
32928 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
32929 string is expanded, it is possible to make it depend on the domain, for
32930 example:
32931 </para>
32932 <literallayout class="monospaced">
32933 local_parts = dbm;/usr/local/specials/$domain
32934 </literallayout>
32935 <para>
32936 <indexterm role="variable">
32937 <primary><varname>$local_part_data</varname></primary>
32938 </indexterm>
32939 If the match is achieved by a lookup, the data that the lookup returned
32940 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
32941 expansions of the router&#x2019;s private options. You might use this option, for
32942 example, if you have a large number of local virtual domains, and you want to
32943 send all postmaster mail to the same place without having to set up an alias in
32944 each virtual domain:
32945 </para>
32946 <literallayout class="monospaced">
32947 postmaster:
32948   driver = redirect
32949   local_parts = postmaster
32950   data = postmaster@real.domain.example
32951 </literallayout>
32952 <para>
32953 <indexterm role="option">
32954 <primary><option>log_as_local</option></primary>
32955 </indexterm>
32956 </para>
32957 <informaltable frame="all">
32958 <tgroup cols="4" colsep="0" rowsep="0">
32959 <colspec colwidth="8*" align="left"/>
32960 <colspec colwidth="6*" align="center"/>
32961 <colspec colwidth="6*" align="center"/>
32962 <colspec colwidth="6*" align="right"/>
32963 <tbody>
32964 <row>
32965 <entry><option>log_as_local</option></entry>
32966 <entry>Use: <emphasis>routers</emphasis></entry>
32967 <entry>Type: <emphasis>boolean</emphasis></entry>
32968 <entry>Default: <emphasis>see below</emphasis></entry>
32969 </row>
32970 </tbody>
32971 </tgroup>
32972 </informaltable>
32973 <para>
32974 <indexterm role="concept">
32975 <primary>log</primary>
32976 <secondary>delivery line</secondary>
32977 </indexterm>
32978 <indexterm role="concept">
32979 <primary>delivery</primary>
32980 <secondary>log line format</secondary>
32981 </indexterm>
32982 Exim has two logging styles for delivery, the idea being to make local
32983 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
32984 recipient address is given just as the local part, without a domain. The use of
32985 this style is controlled by this option. It defaults to true for the <command>accept</command>
32986 router, and false for all the others. This option applies only when a
32987 router assigns an address to a transport. It has no effect on routers that
32988 redirect addresses.
32989 </para>
32990 <para>
32991 <indexterm role="option">
32992 <primary><option>more</option></primary>
32993 </indexterm>
32994 </para>
32995 <informaltable frame="all">
32996 <tgroup cols="4" colsep="0" rowsep="0">
32997 <colspec colwidth="8*" align="left"/>
32998 <colspec colwidth="6*" align="center"/>
32999 <colspec colwidth="6*" align="center"/>
33000 <colspec colwidth="6*" align="right"/>
33001 <tbody>
33002 <row>
33003 <entry><option>more</option></entry>
33004 <entry>Use: <emphasis>routers</emphasis></entry>
33005 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33006 <entry>Default: <emphasis>true</emphasis></entry>
33007 </row>
33008 </tbody>
33009 </tgroup>
33010 </informaltable>
33011 <para>
33012 The result of string expansion for this option must be a valid boolean value,
33013 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33014 result causes an error, and delivery is deferred. If the expansion is forced to
33015 fail, the default value for the option (true) is used. Other failures cause
33016 delivery to be deferred.
33017 </para>
33018 <para>
33019 If this option is set false, and the router declines to handle the address, no
33020 further routers are tried, routing fails, and the address is bounced.
33021 <indexterm role="option">
33022 <primary><option>self</option></primary>
33023 </indexterm>
33024 However, if the router explicitly passes an address to the following router by
33025 means of the setting
33026 </para>
33027 <literallayout class="monospaced">
33028 self = pass
33029 </literallayout>
33030 <para>
33031 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
33032 does not affect the behaviour if one of the precondition tests fails. In that
33033 case, the address is always passed to the next router.
33034 </para>
33035 <para>
33036 Note that <option>address_data</option> is not considered to be a precondition. If its
33037 expansion is forced to fail, the router declines, and the value of <option>more</option>
33038 controls what happens next.
33039 </para>
33040 <para>
33041 <indexterm role="option">
33042 <primary><option>pass_on_timeout</option></primary>
33043 </indexterm>
33044 </para>
33045 <informaltable frame="all">
33046 <tgroup cols="4" colsep="0" rowsep="0">
33047 <colspec colwidth="8*" align="left"/>
33048 <colspec colwidth="6*" align="center"/>
33049 <colspec colwidth="6*" align="center"/>
33050 <colspec colwidth="6*" align="right"/>
33051 <tbody>
33052 <row>
33053 <entry><option>pass_on_timeout</option></entry>
33054 <entry>Use: <emphasis>routers</emphasis></entry>
33055 <entry>Type: <emphasis>boolean</emphasis></entry>
33056 <entry>Default: <emphasis>false</emphasis></entry>
33057 </row>
33058 </tbody>
33059 </tgroup>
33060 </informaltable>
33061 <para>
33062 <indexterm role="concept">
33063 <primary>timeout</primary>
33064 <secondary>of router</secondary>
33065 </indexterm>
33066 <indexterm role="concept">
33067 <primary>router</primary>
33068 <secondary>timeout</secondary>
33069 </indexterm>
33070 If a router times out during a host lookup, it normally causes deferral of the
33071 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
33072 router, overriding <option>no_more</option>. This may be helpful for systems that are
33073 intermittently connected to the Internet, or those that want to pass to a smart
33074 host any messages that cannot immediately be delivered.
33075 </para>
33076 <para>
33077 There are occasional other temporary errors that can occur while doing DNS
33078 lookups. They are treated in the same way as a timeout, and this option
33079 applies to all of them.
33080 </para>
33081 <para>
33082 <indexterm role="option">
33083 <primary><option>pass_router</option></primary>
33084 </indexterm>
33085 </para>
33086 <informaltable frame="all">
33087 <tgroup cols="4" colsep="0" rowsep="0">
33088 <colspec colwidth="8*" align="left"/>
33089 <colspec colwidth="6*" align="center"/>
33090 <colspec colwidth="6*" align="center"/>
33091 <colspec colwidth="6*" align="right"/>
33092 <tbody>
33093 <row>
33094 <entry><option>pass_router</option></entry>
33095 <entry>Use: <emphasis>routers</emphasis></entry>
33096 <entry>Type: <emphasis>string</emphasis></entry>
33097 <entry>Default: <emphasis>unset</emphasis></entry>
33098 </row>
33099 </tbody>
33100 </tgroup>
33101 </informaltable>
33102 <para>
33103 <indexterm role="concept">
33104 <primary>router</primary>
33105 <secondary>go to after <quote>pass</quote></secondary>
33106 </indexterm>
33107 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
33108 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
33109 routing to continue, and overriding a false setting of <option>more</option>. When one of
33110 these routers returns <quote>pass</quote>, the address is normally handed on to the next
33111 router in sequence. This can be changed by setting <option>pass_router</option> to the name
33112 of another router. However (unlike <option>redirect_router</option>) the named router must
33113 be below the current router, to avoid loops. Note that this option applies only
33114 to the special case of <quote>pass</quote>. It does not apply when a router returns
33115 <quote>decline</quote> because it cannot handle an address.
33116 </para>
33117 <para>
33118 <indexterm role="option">
33119 <primary><option>redirect_router</option></primary>
33120 </indexterm>
33121 </para>
33122 <informaltable frame="all">
33123 <tgroup cols="4" colsep="0" rowsep="0">
33124 <colspec colwidth="8*" align="left"/>
33125 <colspec colwidth="6*" align="center"/>
33126 <colspec colwidth="6*" align="center"/>
33127 <colspec colwidth="6*" align="right"/>
33128 <tbody>
33129 <row>
33130 <entry><option>redirect_router</option></entry>
33131 <entry>Use: <emphasis>routers</emphasis></entry>
33132 <entry>Type: <emphasis>string</emphasis></entry>
33133 <entry>Default: <emphasis>unset</emphasis></entry>
33134 </row>
33135 </tbody>
33136 </tgroup>
33137 </informaltable>
33138 <para>
33139 <indexterm role="concept">
33140 <primary>router</primary>
33141 <secondary>start at after redirection</secondary>
33142 </indexterm>
33143 Sometimes an administrator knows that it is pointless to reprocess addresses
33144 generated from alias or forward files with the same router again. For
33145 example, if an alias file translates real names into login ids there is no
33146 point searching the alias file a second time, especially if it is a large file.
33147 </para>
33148 <para>
33149 The <option>redirect_router</option> option can be set to the name of any router instance.
33150 It causes the routing of any generated addresses to start at the named router
33151 instead of at the first router. This option has no effect if the router in
33152 which it is set does not generate new addresses.
33153 </para>
33154 <para>
33155 <indexterm role="option">
33156 <primary><option>require_files</option></primary>
33157 </indexterm>
33158 </para>
33159 <informaltable frame="all">
33160 <tgroup cols="4" colsep="0" rowsep="0">
33161 <colspec colwidth="8*" align="left"/>
33162 <colspec colwidth="6*" align="center"/>
33163 <colspec colwidth="6*" align="center"/>
33164 <colspec colwidth="6*" align="right"/>
33165 <tbody>
33166 <row>
33167 <entry><option>require_files</option></entry>
33168 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33169 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
33170 <entry>Default: <emphasis>unset</emphasis></entry>
33171 </row>
33172 </tbody>
33173 </tgroup>
33174 </informaltable>
33175 <para>
33176 <indexterm role="concept">
33177 <primary>file</primary>
33178 <secondary>requiring for router</secondary>
33179 </indexterm>
33180 <indexterm role="concept">
33181 <primary>router</primary>
33182 <secondary>requiring file existence</secondary>
33183 </indexterm>
33184 This option provides a general mechanism for predicating the running of a
33185 router on the existence or non-existence of certain files or directories.
33186 Before running a router, as one of its precondition tests, Exim works its way
33187 through the <option>require_files</option> list, expanding each item separately.
33188 </para>
33189 <para>
33190 Because the list is split before expansion, any colons in expansion items must
33191 be doubled, or the facility for using a different list separator must be used.
33192 If any expansion is forced to fail, the item is ignored. Other expansion
33193 failures cause routing of the address to be deferred.
33194 </para>
33195 <para>
33196 If any expanded string is empty, it is ignored. Otherwise, except as described
33197 below, each string must be a fully qualified file path, optionally preceded by
33198 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
33199 existence of the files or directories. The router is skipped if any paths not
33200 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
33201 </para>
33202 <para>
33203 <indexterm role="concept">
33204 <primary>NFS</primary>
33205 </indexterm>
33206 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
33207 the message is deferred. This can happen when NFS-mounted filesystems are
33208 unavailable.
33209 </para>
33210 <para>
33211 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
33212 options, so you cannot use it to check for the existence of a file in which to
33213 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
33214 full list of the order in which preconditions are evaluated.) However, as
33215 these options are all expanded, you can use the <option>exists</option> expansion condition
33216 to make such tests. The <option>require_files</option> option is intended for checking files
33217 that the router may be going to use internally, or which are needed by a
33218 transport (for example <filename>.procmailrc</filename>).
33219 </para>
33220 <para>
33221 During delivery, the <function>stat()</function> function is run as root, but there is a
33222 facility for some checking of the accessibility of a file by another user.
33223 This is not a proper permissions check, but just a <quote>rough</quote> check that
33224 operates as follows:
33225 </para>
33226 <para>
33227 If an item in a <option>require_files</option> list does not contain any forward slash
33228 characters, it is taken to be the user (and optional group, separated by a
33229 comma) to be checked for subsequent files in the list. If no group is specified
33230 but the user is specified symbolically, the gid associated with the uid is
33231 used. For example:
33232 </para>
33233 <literallayout class="monospaced">
33234 require_files = mail:/some/file
33235 require_files = $local_part:$home/.procmailrc
33236 </literallayout>
33237 <para>
33238 If a user or group name in a <option>require_files</option> list does not exist, the
33239 <option>require_files</option> condition fails.
33240 </para>
33241 <para>
33242 Exim performs the check by scanning along the components of the file path, and
33243 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
33244 directories, and <quote>r</quote> access on the final file. Note that this means that file
33245 access control lists, if the operating system has them, are ignored.
33246 </para>
33247 <para>
33248 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
33249 incoming SMTP message, Exim is not running as root, but under its own uid. This
33250 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
33251 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
33252 user is not permitted to read one of the directories on the file&#x2019;s path.
33253 </para>
33254 <para>
33255 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
33256 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
33257 without root access. In this case, if a check for access by a particular user
33258 is requested, Exim creates a subprocess that runs as that user, and tries the
33259 check again in that process.
33260 </para>
33261 <para>
33262 The default action for handling an unresolved EACCES is to consider it to
33263 be caused by a configuration error, and routing is deferred because the
33264 existence or non-existence of the file cannot be determined. However, in some
33265 circumstances it may be desirable to treat this condition as if the file did
33266 not exist. If the file name (or the exclamation mark that precedes the file
33267 name for non-existence) is preceded by a plus sign, the EACCES error is treated
33268 as if the file did not exist. For example:
33269 </para>
33270 <literallayout class="monospaced">
33271 require_files = +/some/file
33272 </literallayout>
33273 <para>
33274 If the router is not an essential part of verification (for example, it
33275 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
33276 option false so that the router is skipped when verifying.
33277 </para>
33278 <para>
33279 <indexterm role="option">
33280 <primary><option>retry_use_local_part</option></primary>
33281 </indexterm>
33282 </para>
33283 <informaltable frame="all">
33284 <tgroup cols="4" colsep="0" rowsep="0">
33285 <colspec colwidth="8*" align="left"/>
33286 <colspec colwidth="6*" align="center"/>
33287 <colspec colwidth="6*" align="center"/>
33288 <colspec colwidth="6*" align="right"/>
33289 <tbody>
33290 <row>
33291 <entry><option>retry_use_local_part</option></entry>
33292 <entry>Use: <emphasis>routers</emphasis></entry>
33293 <entry>Type: <emphasis>boolean</emphasis></entry>
33294 <entry>Default: <emphasis>see below</emphasis></entry>
33295 </row>
33296 </tbody>
33297 </tgroup>
33298 </informaltable>
33299 <para>
33300 <indexterm role="concept">
33301 <primary>hints database</primary>
33302 <secondary>retry keys</secondary>
33303 </indexterm>
33304 <indexterm role="concept">
33305 <primary>local part</primary>
33306 <secondary>in retry keys</secondary>
33307 </indexterm>
33308 When a delivery suffers a temporary routing failure, a retry record is created
33309 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
33310 domain, the key for the retry record should not involve the local part, but for
33311 other addresses, both the domain and the local part should be included.
33312 Usually, remote routing is of the former kind, and local routing is of the
33313 latter kind.
33314 </para>
33315 <para>
33316 This option controls whether the local part is used to form the key for retry
33317 hints for addresses that suffer temporary errors while being handled by this
33318 router. The default value is true for any router that has <option>check_local_user</option>
33319 set, and false otherwise. Note that this option does not apply to hints keys
33320 for transport delays; they are controlled by a generic transport option of the
33321 same name.
33322 </para>
33323 <para>
33324 The setting of <option>retry_use_local_part</option> applies only to the router on which it
33325 appears. If the router generates child addresses, they are routed
33326 independently; this setting does not become attached to them.
33327 </para>
33328 <para>
33329 <indexterm role="option">
33330 <primary><option>router_home_directory</option></primary>
33331 </indexterm>
33332 </para>
33333 <informaltable frame="all">
33334 <tgroup cols="4" colsep="0" rowsep="0">
33335 <colspec colwidth="8*" align="left"/>
33336 <colspec colwidth="6*" align="center"/>
33337 <colspec colwidth="6*" align="center"/>
33338 <colspec colwidth="6*" align="right"/>
33339 <tbody>
33340 <row>
33341 <entry><option>router_home_directory</option></entry>
33342 <entry>Use: <emphasis>routers</emphasis></entry>
33343 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33344 <entry>Default: <emphasis>unset</emphasis></entry>
33345 </row>
33346 </tbody>
33347 </tgroup>
33348 </informaltable>
33349 <para>
33350 <indexterm role="concept">
33351 <primary>router</primary>
33352 <secondary>home directory for</secondary>
33353 </indexterm>
33354 <indexterm role="concept">
33355 <primary>home directory</primary>
33356 <secondary>for router</secondary>
33357 </indexterm>
33358 <indexterm role="variable">
33359 <primary><varname>$home</varname></primary>
33360 </indexterm>
33361 This option sets a home directory for use while the router is running. (Compare
33362 <option>transport_home_directory</option>, which sets a home directory for later
33363 transporting.) In particular, if used on a <command>redirect</command> router, this option
33364 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
33365 forced expansion failure causes the option to be ignored &ndash; other failures
33366 cause the router to defer.
33367 </para>
33368 <para>
33369 Expansion of <option>router_home_directory</option> happens immediately after the
33370 <option>check_local_user</option> test (if configured), before any further expansions take
33371 place.
33372 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33373 are evaluated.)
33374 While the router is running, <option>router_home_directory</option> overrides the value of
33375 <varname>$home</varname> that came from <option>check_local_user</option>.
33376 </para>
33377 <para>
33378 When a router accepts an address and assigns it to a local transport (including
33379 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
33380 delivery), the home directory setting for the transport is taken from the first
33381 of these values that is set:
33382 </para>
33383 <itemizedlist>
33384 <listitem>
33385 <para>
33386 The <option>home_directory</option> option on the transport;
33387 </para>
33388 </listitem>
33389 <listitem>
33390 <para>
33391 The <option>transport_home_directory</option> option on the router;
33392 </para>
33393 </listitem>
33394 <listitem>
33395 <para>
33396 The password data if <option>check_local_user</option> is set on the router;
33397 </para>
33398 </listitem>
33399 <listitem>
33400 <para>
33401 The <option>router_home_directory</option> option on the router.
33402 </para>
33403 </listitem>
33404 </itemizedlist>
33405 <para>
33406 In other words, <option>router_home_directory</option> overrides the password data for the
33407 router, but not for the transport.
33408 </para>
33409 <para>
33410 <indexterm role="option">
33411 <primary><option>self</option></primary>
33412 </indexterm>
33413 </para>
33414 <informaltable frame="all">
33415 <tgroup cols="4" colsep="0" rowsep="0">
33416 <colspec colwidth="8*" align="left"/>
33417 <colspec colwidth="6*" align="center"/>
33418 <colspec colwidth="6*" align="center"/>
33419 <colspec colwidth="6*" align="right"/>
33420 <tbody>
33421 <row>
33422 <entry><option>self</option></entry>
33423 <entry>Use: <emphasis>routers</emphasis></entry>
33424 <entry>Type: <emphasis>string</emphasis></entry>
33425 <entry>Default: <emphasis>freeze</emphasis></entry>
33426 </row>
33427 </tbody>
33428 </tgroup>
33429 </informaltable>
33430 <para>
33431 <indexterm role="concept">
33432 <primary>MX record</primary>
33433 <secondary>pointing to local host</secondary>
33434 </indexterm>
33435 <indexterm role="concept">
33436 <primary>local host</primary>
33437 <secondary>MX pointing to</secondary>
33438 </indexterm>
33439 This option applies to those routers that use a recipient address to find a
33440 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
33441 and <command>manualroute</command> routers.
33442 Certain configurations of the <command>queryprogram</command> router can also specify a list
33443 of remote hosts.
33444 Usually such routers are configured to send the message to a remote host via an
33445 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
33446 host on the list turns out to be the local host.
33447 The way in which Exim checks for the local host is described in section
33448 <xref linkend="SECTreclocipadd"/>.
33449 </para>
33450 <para>
33451 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
33452 example, the router should be configured not to process this domain), or an
33453 error in the DNS (for example, the MX should not point to this host). For this
33454 reason, the default action is to log the incident, defer the address, and
33455 freeze the message. The following alternatives are provided for use in special
33456 cases:
33457 </para>
33458 <variablelist>
33459 <varlistentry>
33460 <term><option>defer</option></term>
33461 <listitem>
33462 <para>
33463 Delivery of the message is tried again later, but the message is not frozen.
33464 </para>
33465 </listitem></varlistentry>
33466 <varlistentry>
33467 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
33468 <listitem>
33469 <para>
33470 The domain is changed to the given domain, and the address is passed back to
33471 be reprocessed by the routers. No rewriting of headers takes place. This
33472 behaviour is essentially a redirection.
33473 </para>
33474 </listitem></varlistentry>
33475 <varlistentry>
33476 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
33477 <listitem>
33478 <para>
33479 The domain is changed to the given domain, and the address is passed back to be
33480 reprocessed by the routers. Any headers that contain the original domain are
33481 rewritten.
33482 </para>
33483 </listitem></varlistentry>
33484 <varlistentry>
33485 <term><option>pass</option></term>
33486 <listitem>
33487 <para>
33488 <indexterm role="option">
33489 <primary><option>more</option></primary>
33490 </indexterm>
33491 <indexterm role="variable">
33492 <primary><varname>$self_hostname</varname></primary>
33493 </indexterm>
33494 The router passes the address to the next router, or to the router named in the
33495 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
33496 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
33497 name of the local host that the router encountered. This can be used to
33498 distinguish between different cases for hosts with multiple names. The
33499 combination
33500 </para>
33501 <literallayout class="monospaced">
33502 self = pass
33503 no_more
33504 </literallayout>
33505 <para>
33506 ensures that only those addresses that routed to the local host are passed on.
33507 Without <option>no_more</option>, addresses that were declined for other reasons would also
33508 be passed to the next router.
33509 </para>
33510 </listitem></varlistentry>
33511 <varlistentry>
33512 <term><option>fail</option></term>
33513 <listitem>
33514 <para>
33515 Delivery fails and an error report is generated.
33516 </para>
33517 </listitem></varlistentry>
33518 <varlistentry>
33519 <term><option>send</option></term>
33520 <listitem>
33521 <para>
33522 <indexterm role="concept">
33523 <primary>local host</primary>
33524 <secondary>sending to</secondary>
33525 </indexterm>
33526 The anomaly is ignored and the address is queued for the transport. This
33527 setting should be used with extreme caution. For an <command>smtp</command> transport, it
33528 makes sense only in cases where the program that is listening on the SMTP port
33529 is not this version of Exim. That is, it must be some other MTA, or Exim with a
33530 different configuration file that handles the domain in another way.
33531 </para>
33532 </listitem></varlistentry>
33533 </variablelist>
33534 <para>
33535 <indexterm role="option">
33536 <primary><option>senders</option></primary>
33537 </indexterm>
33538 </para>
33539 <informaltable frame="all">
33540 <tgroup cols="4" colsep="0" rowsep="0">
33541 <colspec colwidth="8*" align="left"/>
33542 <colspec colwidth="6*" align="center"/>
33543 <colspec colwidth="6*" align="center"/>
33544 <colspec colwidth="6*" align="right"/>
33545 <tbody>
33546 <row>
33547 <entry><option>senders</option></entry>
33548 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33549 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
33550 <entry>Default: <emphasis>unset</emphasis></entry>
33551 </row>
33552 </tbody>
33553 </tgroup>
33554 </informaltable>
33555 <para>
33556 <indexterm role="concept">
33557 <primary>router</primary>
33558 <secondary>checking senders</secondary>
33559 </indexterm>
33560 If this option is set, the router is skipped unless the message&#x2019;s sender
33561 address matches something on the list.
33562 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33563 are evaluated.
33564 </para>
33565 <para>
33566 There are issues concerning verification when the running of routers is
33567 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
33568 setting, it sets the sender to the null string. When using the <option>-bt</option> option
33569 to check a configuration file, it is necessary also to use the <option>-f</option> option to
33570 set an appropriate sender. For incoming mail, the sender is unset when
33571 verifying the sender, but is available when verifying any recipients. If the
33572 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
33573 matters.
33574 </para>
33575 <para>
33576 <indexterm role="option">
33577 <primary><option>translate_ip_address</option></primary>
33578 </indexterm>
33579 </para>
33580 <informaltable frame="all">
33581 <tgroup cols="4" colsep="0" rowsep="0">
33582 <colspec colwidth="8*" align="left"/>
33583 <colspec colwidth="6*" align="center"/>
33584 <colspec colwidth="6*" align="center"/>
33585 <colspec colwidth="6*" align="right"/>
33586 <tbody>
33587 <row>
33588 <entry><option>translate_ip_address</option></entry>
33589 <entry>Use: <emphasis>routers</emphasis></entry>
33590 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33591 <entry>Default: <emphasis>unset</emphasis></entry>
33592 </row>
33593 </tbody>
33594 </tgroup>
33595 </informaltable>
33596 <para>
33597 <indexterm role="concept">
33598 <primary>IP address</primary>
33599 <secondary>translating</secondary>
33600 </indexterm>
33601 <indexterm role="concept">
33602 <primary>packet radio</primary>
33603 </indexterm>
33604 <indexterm role="concept">
33605 <primary>router</primary>
33606 <secondary>IP address translation</secondary>
33607 </indexterm>
33608 There exist some rare networking situations (for example, packet radio) where
33609 it is helpful to be able to translate IP addresses generated by normal routing
33610 mechanisms into other IP addresses, thus performing a kind of manual IP
33611 routing. This should be done only if the normal IP routing of the TCP/IP stack
33612 is inadequate or broken. Because this is an extremely uncommon requirement, the
33613 code to support this option is not included in the Exim binary unless
33614 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
33615 </para>
33616 <para>
33617 <indexterm role="variable">
33618 <primary><varname>$host_address</varname></primary>
33619 </indexterm>
33620 The <option>translate_ip_address</option> string is expanded for every IP address generated
33621 by the router, with the generated address set in <varname>$host_address</varname>. If the
33622 expansion is forced to fail, no action is taken.
33623 For any other expansion error, delivery of the message is deferred.
33624 If the result of the expansion is an IP address, that replaces the original
33625 address; otherwise the result is assumed to be a host name &ndash; this is looked
33626 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
33627 produce one or more replacement IP addresses. For example, to subvert all IP
33628 addresses in some specific networks, this could be added to a router:
33629 </para>
33630 <literallayout class="monospaced">
33631 translate_ip_address = \
33632   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
33633     {$value}fail}}
33634 </literallayout>
33635 <para>
33636 The file would contain lines like
33637 </para>
33638 <literallayout class="monospaced">
33639 10.2.3.128/26    some.host
33640 10.8.4.34/26     10.44.8.15
33641 </literallayout>
33642 <para>
33643 You should not make use of this facility unless you really understand what you
33644 are doing.
33645 </para>
33646 <para>
33647 <indexterm role="option">
33648 <primary><option>transport</option></primary>
33649 </indexterm>
33650 </para>
33651 <informaltable frame="all">
33652 <tgroup cols="4" colsep="0" rowsep="0">
33653 <colspec colwidth="8*" align="left"/>
33654 <colspec colwidth="6*" align="center"/>
33655 <colspec colwidth="6*" align="center"/>
33656 <colspec colwidth="6*" align="right"/>
33657 <tbody>
33658 <row>
33659 <entry><option>transport</option></entry>
33660 <entry>Use: <emphasis>routers</emphasis></entry>
33661 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33662 <entry>Default: <emphasis>unset</emphasis></entry>
33663 </row>
33664 </tbody>
33665 </tgroup>
33666 </informaltable>
33667 <para>
33668 This option specifies the transport to be used when a router accepts an address
33669 and sets it up for delivery. A transport is never needed if a router is used
33670 only for verification. The value of the option is expanded at routing time,
33671 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
33672 and result must be the name of one of the configured transports. If it is not,
33673 delivery is deferred.
33674 </para>
33675 <para>
33676 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
33677 have some private options that set up transports for pipe and file deliveries
33678 (see chapter <xref linkend="CHAPredirect"/>).
33679 </para>
33680 <para>
33681 <indexterm role="option">
33682 <primary><option>transport_current_directory</option></primary>
33683 </indexterm>
33684 </para>
33685 <informaltable frame="all">
33686 <tgroup cols="4" colsep="0" rowsep="0">
33687 <colspec colwidth="8*" align="left"/>
33688 <colspec colwidth="6*" align="center"/>
33689 <colspec colwidth="6*" align="center"/>
33690 <colspec colwidth="6*" align="right"/>
33691 <tbody>
33692 <row>
33693 <entry><option>transport_current_directory</option></entry>
33694 <entry>Use: <emphasis>routers</emphasis></entry>
33695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33696 <entry>Default: <emphasis>unset</emphasis></entry>
33697 </row>
33698 </tbody>
33699 </tgroup>
33700 </informaltable>
33701 <para>
33702 <indexterm role="concept">
33703 <primary>current directory for local transport</primary>
33704 </indexterm>
33705 This option associates a current directory with any address that is routed
33706 to a local transport. This can happen either because a transport is
33707 explicitly configured for the router, or because it generates a delivery to a
33708 file or a pipe. During the delivery process (that is, at transport time), this
33709 option string is expanded and is set as the current directory, unless
33710 overridden by a setting on the transport.
33711 If the expansion fails for any reason, including forced failure, an error is
33712 logged, and delivery is deferred.
33713 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
33714 environment.
33715 </para>
33716 <para>
33717 <indexterm role="option">
33718 <primary><option>transport_home_directory</option></primary>
33719 </indexterm>
33720 </para>
33721 <informaltable frame="all">
33722 <tgroup cols="4" colsep="0" rowsep="0">
33723 <colspec colwidth="8*" align="left"/>
33724 <colspec colwidth="6*" align="center"/>
33725 <colspec colwidth="6*" align="center"/>
33726 <colspec colwidth="6*" align="right"/>
33727 <tbody>
33728 <row>
33729 <entry><option>transport_home_directory</option></entry>
33730 <entry>Use: <emphasis>routers</emphasis></entry>
33731 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33732 <entry>Default: <emphasis>see below</emphasis></entry>
33733 </row>
33734 </tbody>
33735 </tgroup>
33736 </informaltable>
33737 <para>
33738 <indexterm role="concept">
33739 <primary>home directory</primary>
33740 <secondary>for local transport</secondary>
33741 </indexterm>
33742 This option associates a home directory with any address that is routed to a
33743 local transport. This can happen either because a transport is explicitly
33744 configured for the router, or because it generates a delivery to a file or a
33745 pipe. During the delivery process (that is, at transport time), the option
33746 string is expanded and is set as the home directory, unless overridden by a
33747 setting of <option>home_directory</option> on the transport.
33748 If the expansion fails for any reason, including forced failure, an error is
33749 logged, and delivery is deferred.
33750 </para>
33751 <para>
33752 If the transport does not specify a home directory, and
33753 <option>transport_home_directory</option> is not set for the router, the home directory for
33754 the transport is taken from the password data if <option>check_local_user</option> is set for
33755 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
33756 is set; if not, no home directory is set for the transport.
33757 </para>
33758 <para>
33759 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
33760 environment.
33761 </para>
33762 <para>
33763 <indexterm role="option">
33764 <primary><option>unseen</option></primary>
33765 </indexterm>
33766 </para>
33767 <informaltable frame="all">
33768 <tgroup cols="4" colsep="0" rowsep="0">
33769 <colspec colwidth="8*" align="left"/>
33770 <colspec colwidth="6*" align="center"/>
33771 <colspec colwidth="6*" align="center"/>
33772 <colspec colwidth="6*" align="right"/>
33773 <tbody>
33774 <row>
33775 <entry><option>unseen</option></entry>
33776 <entry>Use: <emphasis>routers</emphasis></entry>
33777 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33778 <entry>Default: <emphasis>false</emphasis></entry>
33779 </row>
33780 </tbody>
33781 </tgroup>
33782 </informaltable>
33783 <para>
33784 <indexterm role="concept">
33785 <primary>router</primary>
33786 <secondary>carrying on after success</secondary>
33787 </indexterm>
33788 The result of string expansion for this option must be a valid boolean value,
33789 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33790 result causes an error, and delivery is deferred. If the expansion is forced to
33791 fail, the default value for the option (false) is used. Other failures cause
33792 delivery to be deferred.
33793 </para>
33794 <para>
33795 When this option is set true, routing does not cease if the router accepts the
33796 address. Instead, a copy of the incoming address is passed to the next router,
33797 overriding a false setting of <option>more</option>. There is little point in setting
33798 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
33799 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
33800 sometimes true and sometimes false).
33801 </para>
33802 <para>
33803 <indexterm role="concept">
33804 <primary>copy of message (<option>unseen</option> option)</primary>
33805 </indexterm>
33806 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
33807 qualifier in filter files. It can be used to cause copies of messages to be
33808 delivered to some other destination, while also carrying out a normal delivery.
33809 In effect, the current address is made into a <quote>parent</quote> that has two children
33810 &ndash; one that is delivered as specified by this router, and a clone that goes on
33811 to be routed further. For this reason, <option>unseen</option> may not be combined with the
33812 <option>one_time</option> option in a <command>redirect</command> router.
33813 </para>
33814 <para>
33815 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
33816 this router or by previous routers affect the <quote>unseen</quote> copy of the message
33817 only. The clone that continues to be processed by further routers starts with
33818 no added headers and none specified for removal. For a <option>redirect</option> router, if
33819 a generated address is the same as the incoming address, this can lead to
33820 duplicate addresses with different header modifications. Exim does not do
33821 duplicate deliveries (except, in certain circumstances, to pipes -- see section
33822 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
33823 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
33824 <option>redirect</option> router may be of help.
33825 </para>
33826 <para>
33827 Unlike the handling of header modifications, any data that was set by the
33828 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
33829 subsequent routers.
33830 </para>
33831 <para>
33832 <indexterm role="option">
33833 <primary><option>user</option></primary>
33834 </indexterm>
33835 </para>
33836 <informaltable frame="all">
33837 <tgroup cols="4" colsep="0" rowsep="0">
33838 <colspec colwidth="8*" align="left"/>
33839 <colspec colwidth="6*" align="center"/>
33840 <colspec colwidth="6*" align="center"/>
33841 <colspec colwidth="6*" align="right"/>
33842 <tbody>
33843 <row>
33844 <entry><option>user</option></entry>
33845 <entry>Use: <emphasis>routers</emphasis></entry>
33846 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33847 <entry>Default: <emphasis>see below</emphasis></entry>
33848 </row>
33849 </tbody>
33850 </tgroup>
33851 </informaltable>
33852 <para>
33853 <indexterm role="concept">
33854 <primary>uid (user id)</primary>
33855 <secondary>local delivery</secondary>
33856 </indexterm>
33857 <indexterm role="concept">
33858 <primary>local transports</primary>
33859 <secondary>uid and gid</secondary>
33860 </indexterm>
33861 <indexterm role="concept">
33862 <primary>transport</primary>
33863 <secondary>local</secondary>
33864 </indexterm>
33865 <indexterm role="concept">
33866 <primary>router</primary>
33867 <secondary>user for filter processing</secondary>
33868 </indexterm>
33869 <indexterm role="concept">
33870 <primary>filter</primary>
33871 <secondary>user for processing</secondary>
33872 </indexterm>
33873 When a router queues an address for a transport, and the transport does not
33874 specify a user, the user given here is used when running the delivery process.
33875 The user may be specified numerically or by name. If expansion fails, the
33876 error is logged and delivery is deferred.
33877 This user is also used by the <command>redirect</command> router when running a filter file.
33878 The default is unset, except when <option>check_local_user</option> is set. In this case,
33879 the default is taken from the password information. If the user is specified as
33880 a name, and <option>group</option> is not set, the group associated with the user is used.
33881 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
33882 <xref linkend="CHAPenvironment"/>.
33883 </para>
33884 <para>
33885 <indexterm role="option">
33886 <primary><option>verify</option></primary>
33887 </indexterm>
33888 </para>
33889 <informaltable frame="all">
33890 <tgroup cols="4" colsep="0" rowsep="0">
33891 <colspec colwidth="8*" align="left"/>
33892 <colspec colwidth="6*" align="center"/>
33893 <colspec colwidth="6*" align="center"/>
33894 <colspec colwidth="6*" align="right"/>
33895 <tbody>
33896 <row>
33897 <entry><option>verify</option></entry>
33898 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33899 <entry>Type: <emphasis>boolean</emphasis></entry>
33900 <entry>Default: <emphasis>true</emphasis></entry>
33901 </row>
33902 </tbody>
33903 </tgroup>
33904 </informaltable>
33905 <para>
33906 Setting this option has the effect of setting <option>verify_sender</option> and
33907 <option>verify_recipient</option> to the same value.
33908 </para>
33909 <para>
33910 <indexterm role="option">
33911 <primary><option>verify_only</option></primary>
33912 </indexterm>
33913 </para>
33914 <informaltable frame="all">
33915 <tgroup cols="4" colsep="0" rowsep="0">
33916 <colspec colwidth="8*" align="left"/>
33917 <colspec colwidth="6*" align="center"/>
33918 <colspec colwidth="6*" align="center"/>
33919 <colspec colwidth="6*" align="right"/>
33920 <tbody>
33921 <row>
33922 <entry><option>verify_only</option></entry>
33923 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33924 <entry>Type: <emphasis>boolean</emphasis></entry>
33925 <entry>Default: <emphasis>false</emphasis></entry>
33926 </row>
33927 </tbody>
33928 </tgroup>
33929 </informaltable>
33930 <para>
33931 <indexterm role="concept">
33932 <primary>EXPN</primary>
33933 <secondary>with <option>verify_only</option></secondary>
33934 </indexterm>
33935 <indexterm role="option">
33936 <primary><option>-bv</option></primary>
33937 </indexterm>
33938 <indexterm role="concept">
33939 <primary>router</primary>
33940 <secondary>used only when verifying</secondary>
33941 </indexterm>
33942 If this option is set, the router is used only when verifying an address,
33943 delivering in cutthrough mode or
33944 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
33945 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
33946 restricted to verifying only senders or recipients by means of
33947 <option>verify_sender</option> and <option>verify_recipient</option>.
33948 </para>
33949 <para>
33950 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
33951 SMTP message, Exim is not running as root, but under its own uid. If the router
33952 accesses any files, you need to make sure that they are accessible to the Exim
33953 user or group.
33954 </para>
33955 <para>
33956 <indexterm role="option">
33957 <primary><option>verify_recipient</option></primary>
33958 </indexterm>
33959 </para>
33960 <informaltable frame="all">
33961 <tgroup cols="4" colsep="0" rowsep="0">
33962 <colspec colwidth="8*" align="left"/>
33963 <colspec colwidth="6*" align="center"/>
33964 <colspec colwidth="6*" align="center"/>
33965 <colspec colwidth="6*" align="right"/>
33966 <tbody>
33967 <row>
33968 <entry><option>verify_recipient</option></entry>
33969 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33970 <entry>Type: <emphasis>boolean</emphasis></entry>
33971 <entry>Default: <emphasis>true</emphasis></entry>
33972 </row>
33973 </tbody>
33974 </tgroup>
33975 </informaltable>
33976 <para>
33977 If this option is false, the router is skipped when verifying recipient
33978 addresses,
33979 delivering in cutthrough mode
33980 or testing recipient verification using <option>-bv</option>.
33981 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33982 are evaluated.
33983 See also the <varname>$verify_mode</varname> variable.
33984 </para>
33985 <para>
33986 <indexterm role="option">
33987 <primary><option>verify_sender</option></primary>
33988 </indexterm>
33989 </para>
33990 <informaltable frame="all">
33991 <tgroup cols="4" colsep="0" rowsep="0">
33992 <colspec colwidth="8*" align="left"/>
33993 <colspec colwidth="6*" align="center"/>
33994 <colspec colwidth="6*" align="center"/>
33995 <colspec colwidth="6*" align="right"/>
33996 <tbody>
33997 <row>
33998 <entry><option>verify_sender</option></entry>
33999 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34000 <entry>Type: <emphasis>boolean</emphasis></entry>
34001 <entry>Default: <emphasis>true</emphasis></entry>
34002 </row>
34003 </tbody>
34004 </tgroup>
34005 </informaltable>
34006 <para>
34007 If this option is false, the router is skipped when verifying sender addresses
34008 or testing sender verification using <option>-bvs</option>.
34009 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34010 are evaluated.
34011 See also the <varname>$verify_mode</varname> variable.
34012 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
34013 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
34014 </para>
34015 </chapter>
34016
34017 <chapter id="CHID4">
34018 <title>The accept router</title>
34019 <para>
34020 <indexterm role="concept">
34021 <primary><command>accept</command> router</primary>
34022 </indexterm>
34023 <indexterm role="concept">
34024 <primary>routers</primary>
34025 <secondary><command>accept</command></secondary>
34026 </indexterm>
34027 The <command>accept</command> router has no private options of its own. Unless it is being
34028 used purely for verification (see <option>verify_only</option>) a transport is required to
34029 be defined by the generic <option>transport</option> option. If the preconditions that are
34030 specified by generic options are met, the router accepts the address and queues
34031 it for the given transport. The most common use of this router is for setting
34032 up deliveries to local mailboxes. For example:
34033 </para>
34034 <literallayout class="monospaced">
34035 localusers:
34036   driver = accept
34037   domains = mydomain.example
34038   check_local_user
34039   transport = local_delivery
34040 </literallayout>
34041 <para>
34042 The <option>domains</option> condition in this example checks the domain of the address, and
34043 <option>check_local_user</option> checks that the local part is the login of a local user.
34044 When both preconditions are met, the <command>accept</command> router runs, and queues the
34045 address for the <command>local_delivery</command> transport.
34046 </para>
34047 </chapter>
34048
34049 <chapter id="CHAPdnslookup">
34050 <title>The dnslookup router</title>
34051 <para>
34052 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
34053 <primary><command>dnslookup</command> router</primary>
34054 </indexterm>
34055 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
34056 <primary>routers</primary>
34057 <secondary><command>dnslookup</command></secondary>
34058 </indexterm>
34059 The <command>dnslookup</command> router looks up the hosts that handle mail for the
34060 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
34061 unless <option>verify_only</option> is set.
34062 </para>
34063 <para>
34064 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
34065 SRV records. If none are found, or if SRV support is not configured,
34066 MX records are looked up. If no MX records exist, address records are sought.
34067 However, <option>mx_domains</option> can be set to disable the direct use of address
34068 records.
34069 </para>
34070 <para>
34071 MX records of equal priority are sorted by Exim into a random order. Exim then
34072 looks for address records for the host names obtained from MX or SRV records.
34073 When a host has more than one IP address, they are sorted into a random order,
34074 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
34075 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
34076 generic option, the router declines.
34077 </para>
34078 <para>
34079 Unless they have the highest priority (lowest MX value), MX records that point
34080 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
34081 are discarded, together with any other MX records of equal or lower priority.
34082 </para>
34083 <para>
34084 <indexterm role="concept">
34085 <primary>MX record</primary>
34086 <secondary>pointing to local host</secondary>
34087 </indexterm>
34088 <indexterm role="concept">
34089 <primary>local host</primary>
34090 <secondary>MX pointing to</secondary>
34091 </indexterm>
34092 <indexterm role="option">
34093 <primary><option>self</option></primary>
34094 <secondary>in <command>dnslookup</command> router</secondary>
34095 </indexterm>
34096 If the host pointed to by the highest priority MX record, or looked up as an
34097 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
34098 happens is controlled by the generic <option>self</option> option.
34099 </para>
34100 <section id="SECTprowitdnsloo">
34101 <title>Problems with DNS lookups</title>
34102 <para>
34103 There have been problems with DNS servers when SRV records are looked up.
34104 Some misbehaving servers return a DNS error or timeout when a non-existent
34105 SRV record is sought. Similar problems have in the past been reported for
34106 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
34107 problem, but it is heavy-handed because it is a global option.
34108 </para>
34109 <para>
34110 For this reason, there are two options, <option>srv_fail_domains</option> and
34111 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
34112 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
34113 an attempt to look up an SRV or MX record causes one of these results, and the
34114 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
34115 such record</quote>. In the case of an SRV lookup, this means that the router
34116 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
34117 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
34118 case routing fails.
34119 </para>
34120 </section>
34121 <section id="SECTdnslookupdecline">
34122 <title>Declining addresses by dnslookup</title>
34123 <para>
34124 <indexterm role="concept">
34125 <primary><command>dnslookup</command> router</primary>
34126 <secondary>declines</secondary>
34127 </indexterm>
34128 There are a few cases where a <command>dnslookup</command> router will decline to accept
34129 an address; if such a router is expected to handle "all remaining non-local
34130 domains", then it is important to set <option>no_more</option>.
34131 </para>
34132 <para revisionflag="changed">
34133 The router will defer rather than decline if the domain
34134 is found in the <option>fail_defer_domains</option> router option.
34135 </para>
34136 <para>
34137 Reasons for a <command>dnslookup</command> router to decline currently include:
34138 </para>
34139 <itemizedlist>
34140 <listitem>
34141 <para>
34142 The domain does not exist in DNS
34143 </para>
34144 </listitem>
34145 <listitem>
34146 <para>
34147 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
34148 convention (borrowed from SRV) used to indicate that there is no such service
34149 for this domain and to not fall back to trying A/AAAA records.
34150 </para>
34151 </listitem>
34152 <listitem>
34153 <para>
34154 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
34155 </para>
34156 </listitem>
34157 <listitem>
34158 <para>
34159 MX record points to a non-existent host.
34160 </para>
34161 </listitem>
34162 <listitem>
34163 <para>
34164 MX record points to an IP address and the main section option
34165 <option>allow_mx_to_ip</option> is not set.
34166 </para>
34167 </listitem>
34168 <listitem>
34169 <para>
34170 MX records exist and point to valid hosts, but all hosts resolve only to
34171 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
34172 </para>
34173 </listitem>
34174 <listitem>
34175 <para>
34176 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
34177 <option>dns_check_names_pattern</option> for handling one variant of this)
34178 </para>
34179 </listitem>
34180 <listitem>
34181 <para>
34182 <option>check_secondary_mx</option> is set on this router but the local host can
34183 not be found in the MX records (see below)
34184 </para>
34185 </listitem>
34186 </itemizedlist>
34187 </section>
34188 <section id="SECID118">
34189 <title>Private options for dnslookup</title>
34190 <para>
34191 <indexterm role="concept">
34192 <primary>options</primary>
34193 <secondary><command>dnslookup</command> router</secondary>
34194 </indexterm>
34195 The private options for the <command>dnslookup</command> router are as follows:
34196 </para>
34197 <para>
34198 <indexterm role="option">
34199 <primary><option>check_secondary_mx</option></primary>
34200 </indexterm>
34201 </para>
34202 <informaltable frame="all">
34203 <tgroup cols="4" colsep="0" rowsep="0">
34204 <colspec colwidth="8*" align="left"/>
34205 <colspec colwidth="6*" align="center"/>
34206 <colspec colwidth="6*" align="center"/>
34207 <colspec colwidth="6*" align="right"/>
34208 <tbody>
34209 <row>
34210 <entry><option>check_secondary_mx</option></entry>
34211 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34212 <entry>Type: <emphasis>boolean</emphasis></entry>
34213 <entry>Default: <emphasis>false</emphasis></entry>
34214 </row>
34215 </tbody>
34216 </tgroup>
34217 </informaltable>
34218 <para>
34219 <indexterm role="concept">
34220 <primary>MX record</primary>
34221 <secondary>checking for secondary</secondary>
34222 </indexterm>
34223 If this option is set, the router declines unless the local host is found in
34224 (and removed from) the list of hosts obtained by MX lookup. This can be used to
34225 process domains for which the local host is a secondary mail exchanger
34226 differently to other domains. The way in which Exim decides whether a host is
34227 the local host is described in section <xref linkend="SECTreclocipadd"/>.
34228 </para>
34229 <para>
34230 <indexterm role="option">
34231 <primary><option>check_srv</option></primary>
34232 </indexterm>
34233 </para>
34234 <informaltable frame="all">
34235 <tgroup cols="4" colsep="0" rowsep="0">
34236 <colspec colwidth="8*" align="left"/>
34237 <colspec colwidth="6*" align="center"/>
34238 <colspec colwidth="6*" align="center"/>
34239 <colspec colwidth="6*" align="right"/>
34240 <tbody>
34241 <row>
34242 <entry><option>check_srv</option></entry>
34243 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34245 <entry>Default: <emphasis>unset</emphasis></entry>
34246 </row>
34247 </tbody>
34248 </tgroup>
34249 </informaltable>
34250 <para>
34251 <indexterm role="concept">
34252 <primary>SRV record</primary>
34253 <secondary>enabling use of</secondary>
34254 </indexterm>
34255 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
34256 addition to MX and address records. The support is disabled by default. To
34257 enable SRV support, set the <option>check_srv</option> option to the name of the service
34258 required. For example,
34259 </para>
34260 <literallayout class="monospaced">
34261 check_srv = smtp
34262 </literallayout>
34263 <para>
34264 looks for SRV records that refer to the normal smtp service. The option is
34265 expanded, so the service name can vary from message to message or address
34266 to address. This might be helpful if SRV records are being used for a
34267 submission service. If the expansion is forced to fail, the <option>check_srv</option>
34268 option is ignored, and the router proceeds to look for MX records in the
34269 normal way.
34270 </para>
34271 <para>
34272 When the expansion succeeds, the router searches first for SRV records for
34273 the given service (it assumes TCP protocol). A single SRV record with a
34274 host name that consists of just a single dot indicates <quote>no such service for
34275 this domain</quote>; if this is encountered, the router declines. If other kinds of
34276 SRV record are found, they are used to construct a host list for delivery
34277 according to the rules of RFC 2782. MX records are not sought in this case.
34278 </para>
34279 <para>
34280 When no SRV records are found, MX records (and address records) are sought in
34281 the traditional way. In other words, SRV records take precedence over MX
34282 records, just as MX records take precedence over address records. Note that
34283 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
34284 defined it. It is apparently believed that MX records are sufficient for email
34285 and that SRV records should not be used for this purpose. However, SRV records
34286 have an additional <quote>weight</quote> feature which some people might find useful when
34287 trying to split an SMTP load between hosts of different power.
34288 </para>
34289 <para>
34290 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
34291 when there is a DNS lookup error.
34292 </para>
34293 <para revisionflag="changed">
34294 <indexterm role="option">
34295 <primary><option>fail_defer_domains</option></primary>
34296 </indexterm>
34297 </para>
34298 <informaltable frame="all" revisionflag="changed">
34299 <tgroup cols="4" colsep="0" rowsep="0">
34300 <colspec colwidth="8*" align="left"/>
34301 <colspec colwidth="6*" align="center"/>
34302 <colspec colwidth="6*" align="center"/>
34303 <colspec colwidth="6*" align="right"/>
34304 <tbody>
34305 <row>
34306 <entry><option>fail_defer_domains</option></entry>
34307 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34308 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34309 <entry>Default: <emphasis>unset</emphasis></entry>
34310 </row>
34311 </tbody>
34312 </tgroup>
34313 </informaltable>
34314 <para revisionflag="changed">
34315 <indexterm role="concept">
34316 <primary>MX record</primary>
34317 <secondary>not found</secondary>
34318 </indexterm>
34319 DNS lookups for domains matching <option>fail_defer_domains</option>
34320 which find no matching record will cause the router to defer
34321 rather than the default behaviour of decline.
34322 This maybe be useful for queueing messages for a newly created
34323 domain while the DNS configuration is not ready.
34324 However, it will result in any message with mistyped domains
34325 also being queued.
34326 </para>
34327 <para>
34328 <indexterm role="option">
34329 <primary><option>mx_domains</option></primary>
34330 </indexterm>
34331 </para>
34332 <informaltable frame="all">
34333 <tgroup cols="4" colsep="0" rowsep="0">
34334 <colspec colwidth="8*" align="left"/>
34335 <colspec colwidth="6*" align="center"/>
34336 <colspec colwidth="6*" align="center"/>
34337 <colspec colwidth="6*" align="right"/>
34338 <tbody>
34339 <row>
34340 <entry><option>mx_domains</option></entry>
34341 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34342 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34343 <entry>Default: <emphasis>unset</emphasis></entry>
34344 </row>
34345 </tbody>
34346 </tgroup>
34347 </informaltable>
34348 <para>
34349 <indexterm role="concept">
34350 <primary>MX record</primary>
34351 <secondary>required to exist</secondary>
34352 </indexterm>
34353 <indexterm role="concept">
34354 <primary>SRV record</primary>
34355 <secondary>required to exist</secondary>
34356 </indexterm>
34357 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
34358 record in order to be recognized. (The name of this option could be improved.)
34359 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
34360 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
34361 setting:
34362 </para>
34363 <literallayout class="monospaced">
34364 mx_domains = ! *.discworld.fict.example : *.fict.example
34365 </literallayout>
34366 <para>
34367 This specifies that messages addressed to a domain that matches the list but
34368 has no MX record should be bounced immediately instead of being routed using
34369 the address record.
34370 </para>
34371 <para>
34372 <indexterm role="option">
34373 <primary><option>mx_fail_domains</option></primary>
34374 </indexterm>
34375 </para>
34376 <informaltable frame="all">
34377 <tgroup cols="4" colsep="0" rowsep="0">
34378 <colspec colwidth="8*" align="left"/>
34379 <colspec colwidth="6*" align="center"/>
34380 <colspec colwidth="6*" align="center"/>
34381 <colspec colwidth="6*" align="right"/>
34382 <tbody>
34383 <row>
34384 <entry><option>mx_fail_domains</option></entry>
34385 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34386 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34387 <entry>Default: <emphasis>unset</emphasis></entry>
34388 </row>
34389 </tbody>
34390 </tgroup>
34391 </informaltable>
34392 <para>
34393 If the DNS lookup for MX records for one of the domains in this list causes a
34394 DNS lookup error, Exim behaves as if no MX records were found. See section
34395 <xref linkend="SECTprowitdnsloo"/> for more discussion.
34396 </para>
34397 <para>
34398 <indexterm role="option">
34399 <primary><option>qualify_single</option></primary>
34400 </indexterm>
34401 </para>
34402 <informaltable frame="all">
34403 <tgroup cols="4" colsep="0" rowsep="0">
34404 <colspec colwidth="8*" align="left"/>
34405 <colspec colwidth="6*" align="center"/>
34406 <colspec colwidth="6*" align="center"/>
34407 <colspec colwidth="6*" align="right"/>
34408 <tbody>
34409 <row>
34410 <entry><option>qualify_single</option></entry>
34411 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34412 <entry>Type: <emphasis>boolean</emphasis></entry>
34413 <entry>Default: <emphasis>true</emphasis></entry>
34414 </row>
34415 </tbody>
34416 </tgroup>
34417 </informaltable>
34418 <para>
34419 <indexterm role="concept">
34420 <primary>DNS</primary>
34421 <secondary>resolver options</secondary>
34422 </indexterm>
34423 <indexterm role="concept">
34424 <primary>DNS</primary>
34425 <secondary>qualifying single-component names</secondary>
34426 </indexterm>
34427 When this option is true, the resolver option RES_DEFNAMES is set for DNS
34428 lookups. Typically, but not standardly, this causes the resolver to qualify
34429 single-component names with the default domain. For example, on a machine
34430 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
34431 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
34432 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
34433 <emphasis>resolv.conf</emphasis>.
34434 </para>
34435 <para>
34436 <indexterm role="option">
34437 <primary><option>rewrite_headers</option></primary>
34438 </indexterm>
34439 </para>
34440 <informaltable frame="all">
34441 <tgroup cols="4" colsep="0" rowsep="0">
34442 <colspec colwidth="8*" align="left"/>
34443 <colspec colwidth="6*" align="center"/>
34444 <colspec colwidth="6*" align="center"/>
34445 <colspec colwidth="6*" align="right"/>
34446 <tbody>
34447 <row>
34448 <entry><option>rewrite_headers</option></entry>
34449 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34450 <entry>Type: <emphasis>boolean</emphasis></entry>
34451 <entry>Default: <emphasis>true</emphasis></entry>
34452 </row>
34453 </tbody>
34454 </tgroup>
34455 </informaltable>
34456 <para>
34457 <indexterm role="concept">
34458 <primary>rewriting</primary>
34459 <secondary>header lines</secondary>
34460 </indexterm>
34461 <indexterm role="concept">
34462 <primary>header lines</primary>
34463 <secondary>rewriting</secondary>
34464 </indexterm>
34465 If the domain name in the address that is being processed is not fully
34466 qualified, it may be expanded to its full form by a DNS lookup. For example, if
34467 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
34468 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
34469 occur as a result of setting the <option>widen_domains</option> option. If
34470 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
34471 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
34472 header lines of the message are rewritten with the full domain name.
34473 </para>
34474 <para>
34475 This option should be turned off only when it is known that no message is
34476 ever going to be sent outside an environment where the abbreviation makes
34477 sense.
34478 </para>
34479 <para>
34480 When an MX record is looked up in the DNS and matches a wildcard record, name
34481 servers normally return a record containing the name that has been looked up,
34482 making it impossible to detect whether a wildcard was present or not. However,
34483 some name servers have recently been seen to return the wildcard entry. If the
34484 name returned by a DNS lookup begins with an asterisk, it is not used for
34485 header rewriting.
34486 </para>
34487 <para>
34488 <indexterm role="option">
34489 <primary><option>same_domain_copy_routing</option></primary>
34490 </indexterm>
34491 </para>
34492 <informaltable frame="all">
34493 <tgroup cols="4" colsep="0" rowsep="0">
34494 <colspec colwidth="8*" align="left"/>
34495 <colspec colwidth="6*" align="center"/>
34496 <colspec colwidth="6*" align="center"/>
34497 <colspec colwidth="6*" align="right"/>
34498 <tbody>
34499 <row>
34500 <entry><option>same_domain_copy_routing</option></entry>
34501 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34502 <entry>Type: <emphasis>boolean</emphasis></entry>
34503 <entry>Default: <emphasis>false</emphasis></entry>
34504 </row>
34505 </tbody>
34506 </tgroup>
34507 </informaltable>
34508 <para>
34509 <indexterm role="concept">
34510 <primary>address</primary>
34511 <secondary>copying routing</secondary>
34512 </indexterm>
34513 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
34514 to the same list of hosts. However, this cannot be presumed, because the router
34515 options and preconditions may refer to the local part of the address. By
34516 default, therefore, Exim routes each address in a message independently. DNS
34517 servers run caches, so repeated DNS lookups are not normally expensive, and in
34518 any case, personal messages rarely have more than a few recipients.
34519 </para>
34520 <para>
34521 If you are running mailing lists with large numbers of subscribers at the same
34522 domain, and you are using a <command>dnslookup</command> router which is independent of the
34523 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
34524 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
34525 routes an address to a remote transport, any other unrouted addresses in the
34526 message that have the same domain are automatically given the same routing
34527 without processing them independently,
34528 provided the following conditions are met:
34529 </para>
34530 <itemizedlist>
34531 <listitem>
34532 <para>
34533 No router that processed the address specified <option>headers_add</option> or
34534 <option>headers_remove</option>.
34535 </para>
34536 </listitem>
34537 <listitem>
34538 <para>
34539 The router did not change the address in any way, for example, by <quote>widening</quote>
34540 the domain.
34541 </para>
34542 </listitem>
34543 </itemizedlist>
34544 <para>
34545 <indexterm role="option">
34546 <primary><option>search_parents</option></primary>
34547 </indexterm>
34548 </para>
34549 <informaltable frame="all">
34550 <tgroup cols="4" colsep="0" rowsep="0">
34551 <colspec colwidth="8*" align="left"/>
34552 <colspec colwidth="6*" align="center"/>
34553 <colspec colwidth="6*" align="center"/>
34554 <colspec colwidth="6*" align="right"/>
34555 <tbody>
34556 <row>
34557 <entry><option>search_parents</option></entry>
34558 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34559 <entry>Type: <emphasis>boolean</emphasis></entry>
34560 <entry>Default: <emphasis>false</emphasis></entry>
34561 </row>
34562 </tbody>
34563 </tgroup>
34564 </informaltable>
34565 <para>
34566 <indexterm role="concept">
34567 <primary>DNS</primary>
34568 <secondary>resolver options</secondary>
34569 </indexterm>
34570 When this option is true, the resolver option RES_DNSRCH is set for DNS
34571 lookups. This is different from the <option>qualify_single</option> option in that it
34572 applies to domains containing dots. Typically, but not standardly, it causes
34573 the resolver to search for the name in the current domain and in parent
34574 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
34575 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
34576 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
34577 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
34578 </para>
34579 <para>
34580 Setting this option true can cause problems in domains that have a wildcard MX
34581 record, because any domain that does not have its own MX record matches the
34582 local wildcard.
34583 </para>
34584 <para>
34585 <indexterm role="option">
34586 <primary><option>srv_fail_domains</option></primary>
34587 </indexterm>
34588 </para>
34589 <informaltable frame="all">
34590 <tgroup cols="4" colsep="0" rowsep="0">
34591 <colspec colwidth="8*" align="left"/>
34592 <colspec colwidth="6*" align="center"/>
34593 <colspec colwidth="6*" align="center"/>
34594 <colspec colwidth="6*" align="right"/>
34595 <tbody>
34596 <row>
34597 <entry><option>srv_fail_domains</option></entry>
34598 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34599 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34600 <entry>Default: <emphasis>unset</emphasis></entry>
34601 </row>
34602 </tbody>
34603 </tgroup>
34604 </informaltable>
34605 <para>
34606 If the DNS lookup for SRV records for one of the domains in this list causes a
34607 DNS lookup error, Exim behaves as if no SRV records were found. See section
34608 <xref linkend="SECTprowitdnsloo"/> for more discussion.
34609 </para>
34610 <para>
34611 <indexterm role="option">
34612 <primary><option>widen_domains</option></primary>
34613 </indexterm>
34614 </para>
34615 <informaltable frame="all">
34616 <tgroup cols="4" colsep="0" rowsep="0">
34617 <colspec colwidth="8*" align="left"/>
34618 <colspec colwidth="6*" align="center"/>
34619 <colspec colwidth="6*" align="center"/>
34620 <colspec colwidth="6*" align="right"/>
34621 <tbody>
34622 <row>
34623 <entry><option>widen_domains</option></entry>
34624 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34625 <entry>Type: <emphasis>string list</emphasis></entry>
34626 <entry>Default: <emphasis>unset</emphasis></entry>
34627 </row>
34628 </tbody>
34629 </tgroup>
34630 </informaltable>
34631 <para>
34632 <indexterm role="concept">
34633 <primary>domain</primary>
34634 <secondary>partial; widening</secondary>
34635 </indexterm>
34636 If a DNS lookup fails and this option is set, each of its strings in turn is
34637 added onto the end of the domain, and the lookup is tried again. For example,
34638 if
34639 </para>
34640 <literallayout class="monospaced">
34641 widen_domains = fict.example:ref.example
34642 </literallayout>
34643 <para>
34644 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
34645 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
34646 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
34647 and <option>search_parents</option> options can cause some widening to be undertaken inside
34648 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
34649 when verifying, unless <option>rewrite_headers</option> is false (not the default).
34650 </para>
34651 </section>
34652 <section id="SECID119">
34653 <title>Effect of qualify_single and search_parents</title>
34654 <para>
34655 When a domain from an envelope recipient is changed by the resolver as a result
34656 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
34657 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
34658 is set false. Exim then re-routes the address, using the full domain.
34659 </para>
34660 <para>
34661 These two options affect only the DNS lookup that takes place inside the router
34662 for the domain of the address that is being routed. They do not affect lookups
34663 such as that implied by
34664 </para>
34665 <literallayout class="monospaced">
34666 domains = @mx_any
34667 </literallayout>
34668 <para>
34669 that may happen while processing a router precondition before the router is
34670 entered. No widening ever takes place for these lookups.
34671 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
34672 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
34673 </para>
34674 </section>
34675 </chapter>
34676
34677 <chapter id="CHID5">
34678 <title>The ipliteral router</title>
34679 <para>
34680 <indexterm role="concept">
34681 <primary><command>ipliteral</command> router</primary>
34682 </indexterm>
34683 <indexterm role="concept">
34684 <primary>domain literal</primary>
34685 <secondary>routing</secondary>
34686 </indexterm>
34687 <indexterm role="concept">
34688 <primary>routers</primary>
34689 <secondary><command>ipliteral</command></secondary>
34690 </indexterm>
34691 This router has no private options. Unless it is being used purely for
34692 verification (see <option>verify_only</option>) a transport is required to be defined by the
34693 generic <option>transport</option> option. The router accepts the address if its domain part
34694 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
34695 router handles the address
34696 </para>
34697 <literallayout class="monospaced">
34698 root@[192.168.1.1]
34699 </literallayout>
34700 <para>
34701 by setting up delivery to the host with that IP address. IPv4 domain literals
34702 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
34703 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
34704 </para>
34705 <literallayout class="monospaced">
34706 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
34707 </literallayout>
34708 <para>
34709 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
34710 grounds that sooner or later somebody will try it.
34711 </para>
34712 <para>
34713 <indexterm role="option">
34714 <primary><option>self</option></primary>
34715 <secondary>in <command>ipliteral</command> router</secondary>
34716 </indexterm>
34717 If the IP address matches something in <option>ignore_target_hosts</option>, the router
34718 declines. If an IP literal turns out to refer to the local host, the generic
34719 <option>self</option> option determines what happens.
34720 </para>
34721 <para>
34722 The RFCs require support for domain literals; however, their use is
34723 controversial in today&#x2019;s Internet. If you want to use this router, you must
34724 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
34725 Exim will not recognize the domain literal syntax in addresses.
34726 </para>
34727 </chapter>
34728
34729 <chapter id="CHID6">
34730 <title>The iplookup router</title>
34731 <para>
34732 <indexterm role="concept">
34733 <primary><command>iplookup</command> router</primary>
34734 </indexterm>
34735 <indexterm role="concept">
34736 <primary>routers</primary>
34737 <secondary><command>iplookup</command></secondary>
34738 </indexterm>
34739 The <command>iplookup</command> router was written to fulfil a specific requirement in
34740 Cambridge University (which in fact no longer exists). For this reason, it is
34741 not included in the binary of Exim by default. If you want to include it, you
34742 must set
34743 </para>
34744 <literallayout class="monospaced">
34745 ROUTER_IPLOOKUP=yes
34746 </literallayout>
34747 <para>
34748 in your <filename>Local/Makefile</filename> configuration file.
34749 </para>
34750 <para>
34751 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
34752 connection to one or more specific hosts. The host can then return the same or
34753 a different address &ndash; in effect rewriting the recipient address in the
34754 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
34755 this process fails, the address can be passed on to other routers, or delivery
34756 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
34757 must not be specified for it.
34758 </para>
34759 <para>
34760 <indexterm role="concept">
34761 <primary>options</primary>
34762 <secondary><command>iplookup</command> router</secondary>
34763 </indexterm>
34764 <indexterm role="option">
34765 <primary><option>hosts</option></primary>
34766 </indexterm>
34767 </para>
34768 <informaltable frame="all">
34769 <tgroup cols="4" colsep="0" rowsep="0">
34770 <colspec colwidth="8*" align="left"/>
34771 <colspec colwidth="6*" align="center"/>
34772 <colspec colwidth="6*" align="center"/>
34773 <colspec colwidth="6*" align="right"/>
34774 <tbody>
34775 <row>
34776 <entry><option>hosts</option></entry>
34777 <entry>Use: <emphasis>iplookup</emphasis></entry>
34778 <entry>Type: <emphasis>string</emphasis></entry>
34779 <entry>Default: <emphasis>unset</emphasis></entry>
34780 </row>
34781 </tbody>
34782 </tgroup>
34783 </informaltable>
34784 <para>
34785 This option must be supplied. Its value is a colon-separated list of host
34786 names. The hosts are looked up using <function>gethostbyname()</function>
34787 (or <function>getipnodebyname()</function> when available)
34788 and are tried in order until one responds to the query. If none respond, what
34789 happens is controlled by <option>optional</option>.
34790 </para>
34791 <para>
34792 <indexterm role="option">
34793 <primary><option>optional</option></primary>
34794 </indexterm>
34795 </para>
34796 <informaltable frame="all">
34797 <tgroup cols="4" colsep="0" rowsep="0">
34798 <colspec colwidth="8*" align="left"/>
34799 <colspec colwidth="6*" align="center"/>
34800 <colspec colwidth="6*" align="center"/>
34801 <colspec colwidth="6*" align="right"/>
34802 <tbody>
34803 <row>
34804 <entry><option>optional</option></entry>
34805 <entry>Use: <emphasis>iplookup</emphasis></entry>
34806 <entry>Type: <emphasis>boolean</emphasis></entry>
34807 <entry>Default: <emphasis>false</emphasis></entry>
34808 </row>
34809 </tbody>
34810 </tgroup>
34811 </informaltable>
34812 <para>
34813 If <option>optional</option> is true, if no response is obtained from any host, the address
34814 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
34815 delivery to the address is deferred.
34816 </para>
34817 <para>
34818 <indexterm role="option">
34819 <primary><option>port</option></primary>
34820 </indexterm>
34821 </para>
34822 <informaltable frame="all">
34823 <tgroup cols="4" colsep="0" rowsep="0">
34824 <colspec colwidth="8*" align="left"/>
34825 <colspec colwidth="6*" align="center"/>
34826 <colspec colwidth="6*" align="center"/>
34827 <colspec colwidth="6*" align="right"/>
34828 <tbody>
34829 <row>
34830 <entry><option>port</option></entry>
34831 <entry>Use: <emphasis>iplookup</emphasis></entry>
34832 <entry>Type: <emphasis>integer</emphasis></entry>
34833 <entry>Default: <emphasis>0</emphasis></entry>
34834 </row>
34835 </tbody>
34836 </tgroup>
34837 </informaltable>
34838 <para>
34839 <indexterm role="concept">
34840 <primary>port</primary>
34841 <secondary><command>iplookup</command> router</secondary>
34842 </indexterm>
34843 This option must be supplied. It specifies the port number for the TCP or UDP
34844 call.
34845 </para>
34846 <para>
34847 <indexterm role="option">
34848 <primary><option>protocol</option></primary>
34849 </indexterm>
34850 </para>
34851 <informaltable frame="all">
34852 <tgroup cols="4" colsep="0" rowsep="0">
34853 <colspec colwidth="8*" align="left"/>
34854 <colspec colwidth="6*" align="center"/>
34855 <colspec colwidth="6*" align="center"/>
34856 <colspec colwidth="6*" align="right"/>
34857 <tbody>
34858 <row>
34859 <entry><option>protocol</option></entry>
34860 <entry>Use: <emphasis>iplookup</emphasis></entry>
34861 <entry>Type: <emphasis>string</emphasis></entry>
34862 <entry>Default: <emphasis>udp</emphasis></entry>
34863 </row>
34864 </tbody>
34865 </tgroup>
34866 </informaltable>
34867 <para>
34868 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
34869 protocols is to be used.
34870 </para>
34871 <para>
34872 <indexterm role="option">
34873 <primary><option>query</option></primary>
34874 </indexterm>
34875 </para>
34876 <informaltable frame="all">
34877 <tgroup cols="4" colsep="0" rowsep="0">
34878 <colspec colwidth="8*" align="left"/>
34879 <colspec colwidth="6*" align="center"/>
34880 <colspec colwidth="6*" align="center"/>
34881 <colspec colwidth="6*" align="right"/>
34882 <tbody>
34883 <row>
34884 <entry><option>query</option></entry>
34885 <entry>Use: <emphasis>iplookup</emphasis></entry>
34886 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34887 <entry>Default: <emphasis>see below</emphasis></entry>
34888 </row>
34889 </tbody>
34890 </tgroup>
34891 </informaltable>
34892 <para>
34893 This defines the content of the query that is sent to the remote hosts. The
34894 default value is:
34895 </para>
34896 <literallayout class="monospaced">
34897 $local_part@$domain $local_part@$domain
34898 </literallayout>
34899 <para>
34900 The repetition serves as a way of checking that a response is to the correct
34901 query in the default case (see <option>response_pattern</option> below).
34902 </para>
34903 <para>
34904 <indexterm role="option">
34905 <primary><option>reroute</option></primary>
34906 </indexterm>
34907 </para>
34908 <informaltable frame="all">
34909 <tgroup cols="4" colsep="0" rowsep="0">
34910 <colspec colwidth="8*" align="left"/>
34911 <colspec colwidth="6*" align="center"/>
34912 <colspec colwidth="6*" align="center"/>
34913 <colspec colwidth="6*" align="right"/>
34914 <tbody>
34915 <row>
34916 <entry><option>reroute</option></entry>
34917 <entry>Use: <emphasis>iplookup</emphasis></entry>
34918 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34919 <entry>Default: <emphasis>unset</emphasis></entry>
34920 </row>
34921 </tbody>
34922 </tgroup>
34923 </informaltable>
34924 <para>
34925 If this option is not set, the rerouted address is precisely the byte string
34926 returned by the remote host, up to the first white space, if any. If set, the
34927 string is expanded to form the rerouted address. It can include parts matched
34928 in the response by <option>response_pattern</option> by means of numeric variables such as
34929 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
34930 whether or not a pattern is in use. In all cases, the rerouted address must end
34931 up in the form <emphasis>local_part@domain</emphasis>.
34932 </para>
34933 <para>
34934 <indexterm role="option">
34935 <primary><option>response_pattern</option></primary>
34936 </indexterm>
34937 </para>
34938 <informaltable frame="all">
34939 <tgroup cols="4" colsep="0" rowsep="0">
34940 <colspec colwidth="8*" align="left"/>
34941 <colspec colwidth="6*" align="center"/>
34942 <colspec colwidth="6*" align="center"/>
34943 <colspec colwidth="6*" align="right"/>
34944 <tbody>
34945 <row>
34946 <entry><option>response_pattern</option></entry>
34947 <entry>Use: <emphasis>iplookup</emphasis></entry>
34948 <entry>Type: <emphasis>string</emphasis></entry>
34949 <entry>Default: <emphasis>unset</emphasis></entry>
34950 </row>
34951 </tbody>
34952 </tgroup>
34953 </informaltable>
34954 <para>
34955 This option can be set to a regular expression that is applied to the string
34956 returned from the remote host. If the pattern does not match the response, the
34957 router declines. If <option>response_pattern</option> is not set, no checking of the
34958 response is done, unless the query was defaulted, in which case there is a
34959 check that the text returned after the first white space is the original
34960 address. This checks that the answer that has been received is in response to
34961 the correct question. For example, if the response is just a new domain, the
34962 following could be used:
34963 </para>
34964 <literallayout class="monospaced">
34965 response_pattern = ^([^@]+)$
34966 reroute = $local_part@$1
34967 </literallayout>
34968 <para>
34969 <indexterm role="option">
34970 <primary><option>timeout</option></primary>
34971 </indexterm>
34972 </para>
34973 <informaltable frame="all">
34974 <tgroup cols="4" colsep="0" rowsep="0">
34975 <colspec colwidth="8*" align="left"/>
34976 <colspec colwidth="6*" align="center"/>
34977 <colspec colwidth="6*" align="center"/>
34978 <colspec colwidth="6*" align="right"/>
34979 <tbody>
34980 <row>
34981 <entry><option>timeout</option></entry>
34982 <entry>Use: <emphasis>iplookup</emphasis></entry>
34983 <entry>Type: <emphasis>time</emphasis></entry>
34984 <entry>Default: <emphasis>5s</emphasis></entry>
34985 </row>
34986 </tbody>
34987 </tgroup>
34988 </informaltable>
34989 <para>
34990 This specifies the amount of time to wait for a response from the remote
34991 machine. The same timeout is used for the <function>connect()</function> function for a TCP
34992 call. It does not apply to UDP.
34993 </para>
34994 </chapter>
34995
34996 <chapter id="CHID7">
34997 <title>The manualroute router</title>
34998 <para>
34999 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
35000 <primary><command>manualroute</command> router</primary>
35001 </indexterm>
35002 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
35003 <primary>routers</primary>
35004 <secondary><command>manualroute</command></secondary>
35005 </indexterm>
35006 <indexterm role="concept">
35007 <primary>domain</primary>
35008 <secondary>manually routing</secondary>
35009 </indexterm>
35010 The <command>manualroute</command> router is so-called because it provides a way of manually
35011 routing an address according to its domain. It is mainly used when you want to
35012 route addresses to remote hosts according to your own rules, bypassing the
35013 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
35014 route to local transports, a facility that may be useful if you want to save
35015 messages for dial-in hosts in local files.
35016 </para>
35017 <para>
35018 The <command>manualroute</command> router compares a list of domain patterns with the domain
35019 it is trying to route. If there is no match, the router declines. Each pattern
35020 has associated with it a list of hosts and some other optional data, which may
35021 include a transport. The combination of a pattern and its data is called a
35022 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
35023 generic <option>transport</option> option must specify a transport, unless the router is
35024 being used purely for verification (see <option>verify_only</option>).
35025 </para>
35026 <para>
35027 <indexterm role="variable">
35028 <primary><varname>$host</varname></primary>
35029 </indexterm>
35030 In the case of verification, matching the domain pattern is sufficient for the
35031 router to accept the address. When actually routing an address for delivery,
35032 an address that matches a domain pattern is queued for the associated
35033 transport. If the transport is not a local one, a host list must be associated
35034 with the pattern; IP addresses are looked up for the hosts, and these are
35035 passed to the transport along with the mail address. For local transports, a
35036 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
35037 text string.
35038 </para>
35039 <para>
35040 The list of routing rules can be provided as an inline string in
35041 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
35042 or database by setting <option>route_data</option>. Only one of these settings may appear in
35043 any one instance of <command>manualroute</command>. The format of routing rules is described
35044 below, following the list of private options.
35045 </para>
35046 <section id="SECTprioptman">
35047 <title>Private options for manualroute</title>
35048 <para>
35049 <indexterm role="concept">
35050 <primary>options</primary>
35051 <secondary><command>manualroute</command> router</secondary>
35052 </indexterm>
35053 The private options for the <command>manualroute</command> router are as follows:
35054 </para>
35055 <para>
35056 <indexterm role="option">
35057 <primary><option>host_all_ignored</option></primary>
35058 </indexterm>
35059 </para>
35060 <informaltable frame="all">
35061 <tgroup cols="4" colsep="0" rowsep="0">
35062 <colspec colwidth="8*" align="left"/>
35063 <colspec colwidth="6*" align="center"/>
35064 <colspec colwidth="6*" align="center"/>
35065 <colspec colwidth="6*" align="right"/>
35066 <tbody>
35067 <row>
35068 <entry><option>host_all_ignored</option></entry>
35069 <entry>Use: <emphasis>manualroute</emphasis></entry>
35070 <entry>Type: <emphasis>string</emphasis></entry>
35071 <entry>Default: <emphasis>defer</emphasis></entry>
35072 </row>
35073 </tbody>
35074 </tgroup>
35075 </informaltable>
35076 <para>
35077 See <option>host_find_failed</option>.
35078 </para>
35079 <para>
35080 <indexterm role="option">
35081 <primary><option>host_find_failed</option></primary>
35082 </indexterm>
35083 </para>
35084 <informaltable frame="all">
35085 <tgroup cols="4" colsep="0" rowsep="0">
35086 <colspec colwidth="8*" align="left"/>
35087 <colspec colwidth="6*" align="center"/>
35088 <colspec colwidth="6*" align="center"/>
35089 <colspec colwidth="6*" align="right"/>
35090 <tbody>
35091 <row>
35092 <entry><option>host_find_failed</option></entry>
35093 <entry>Use: <emphasis>manualroute</emphasis></entry>
35094 <entry>Type: <emphasis>string</emphasis></entry>
35095 <entry>Default: <emphasis>freeze</emphasis></entry>
35096 </row>
35097 </tbody>
35098 </tgroup>
35099 </informaltable>
35100 <para>
35101 This option controls what happens when <command>manualroute</command> tries to find an IP
35102 address for a host, and the host does not exist. The option can be set to one
35103 of the following values:
35104 </para>
35105 <literallayout class="monospaced">
35106 decline
35107 defer
35108 fail
35109 freeze
35110 ignore
35111 pass
35112 </literallayout>
35113 <para>
35114 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
35115 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
35116 forces the address to be passed to the next router (or the router defined by
35117 <option>pass_router</option>),
35118 <indexterm role="option">
35119 <primary><option>more</option></primary>
35120 </indexterm>
35121 overriding <option>no_more</option>, whereas the latter passes the address to the next
35122 router only if <option>more</option> is true.
35123 </para>
35124 <para>
35125 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
35126 cannot be found. If all the hosts in the list are ignored, the behaviour is
35127 controlled by the <option>host_all_ignored</option> option. This takes the same values
35128 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
35129 </para>
35130 <para>
35131 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
35132 state; if a host lookup gets a temporary error, delivery is deferred unless the
35133 generic <option>pass_on_timeout</option> option is set.
35134 </para>
35135 <para>
35136 <indexterm role="option">
35137 <primary><option>hosts_randomize</option></primary>
35138 </indexterm>
35139 </para>
35140 <informaltable frame="all">
35141 <tgroup cols="4" colsep="0" rowsep="0">
35142 <colspec colwidth="8*" align="left"/>
35143 <colspec colwidth="6*" align="center"/>
35144 <colspec colwidth="6*" align="center"/>
35145 <colspec colwidth="6*" align="right"/>
35146 <tbody>
35147 <row>
35148 <entry><option>hosts_randomize</option></entry>
35149 <entry>Use: <emphasis>manualroute</emphasis></entry>
35150 <entry>Type: <emphasis>boolean</emphasis></entry>
35151 <entry>Default: <emphasis>false</emphasis></entry>
35152 </row>
35153 </tbody>
35154 </tgroup>
35155 </informaltable>
35156 <para>
35157 <indexterm role="concept">
35158 <primary>randomized host list</primary>
35159 </indexterm>
35160 <indexterm role="concept">
35161 <primary>host</primary>
35162 <secondary>list of; randomized</secondary>
35163 </indexterm>
35164 If this option is set, the order of the items in a host list in a routing rule
35165 is randomized each time the list is used, unless an option in the routing rule
35166 overrides (see below). Randomizing the order of a host list can be used to do
35167 crude load sharing. However, if more than one mail address is routed by the
35168 same router to the same host list, the host lists are considered to be the same
35169 (even though they may be randomized into different orders) for the purpose of
35170 deciding whether to batch the deliveries into a single SMTP transaction.
35171 </para>
35172 <para>
35173 When <option>hosts_randomize</option> is true, a host list may be split
35174 into groups whose order is separately randomized. This makes it possible to
35175 set up MX-like behaviour. The boundaries between groups are indicated by an
35176 item that is just <literal>+</literal> in the host list. For example:
35177 </para>
35178 <literallayout class="monospaced">
35179 route_list = * host1:host2:host3:+:host4:host5
35180 </literallayout>
35181 <para>
35182 The order of the first three hosts and the order of the last two hosts is
35183 randomized for each use, but the first three always end up before the last two.
35184 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
35185 randomized host list is passed to an <command>smtp</command> transport that also has
35186 <option>hosts_randomize set</option>, the list is not re-randomized.
35187 </para>
35188 <para>
35189 <indexterm role="option">
35190 <primary><option>route_data</option></primary>
35191 </indexterm>
35192 </para>
35193 <informaltable frame="all">
35194 <tgroup cols="4" colsep="0" rowsep="0">
35195 <colspec colwidth="8*" align="left"/>
35196 <colspec colwidth="6*" align="center"/>
35197 <colspec colwidth="6*" align="center"/>
35198 <colspec colwidth="6*" align="right"/>
35199 <tbody>
35200 <row>
35201 <entry><option>route_data</option></entry>
35202 <entry>Use: <emphasis>manualroute</emphasis></entry>
35203 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35204 <entry>Default: <emphasis>unset</emphasis></entry>
35205 </row>
35206 </tbody>
35207 </tgroup>
35208 </informaltable>
35209 <para>
35210 If this option is set, it must expand to yield the data part of a routing rule.
35211 Typically, the expansion string includes a lookup based on the domain. For
35212 example:
35213 </para>
35214 <literallayout class="monospaced">
35215 route_data = ${lookup{$domain}dbm{/etc/routes}}
35216 </literallayout>
35217 <para>
35218 If the expansion is forced to fail, or the result is an empty string, the
35219 router declines. Other kinds of expansion failure cause delivery to be
35220 deferred.
35221 </para>
35222 <para>
35223 <indexterm role="option">
35224 <primary><option>route_list</option></primary>
35225 </indexterm>
35226 </para>
35227 <informaltable frame="all">
35228 <tgroup cols="4" colsep="0" rowsep="0">
35229 <colspec colwidth="8*" align="left"/>
35230 <colspec colwidth="6*" align="center"/>
35231 <colspec colwidth="6*" align="center"/>
35232 <colspec colwidth="6*" align="right"/>
35233 <tbody>
35234 <row>
35235 <entry><option>route_list</option></entry>
35236 <entry>Use: <emphasis>manualroute</emphasis></entry>
35237 <entry>Type: <emphasis>string list</emphasis></entry>
35238 <entry>Default: <emphasis>unset</emphasis></entry>
35239 </row>
35240 </tbody>
35241 </tgroup>
35242 </informaltable>
35243 <para>
35244 This string is a list of routing rules, in the form defined below. Note that,
35245 unlike most string lists, the items are separated by semicolons. This is so
35246 that they may contain colon-separated host lists.
35247 </para>
35248 <para>
35249 <indexterm role="option">
35250 <primary><option>same_domain_copy_routing</option></primary>
35251 </indexterm>
35252 </para>
35253 <informaltable frame="all">
35254 <tgroup cols="4" colsep="0" rowsep="0">
35255 <colspec colwidth="8*" align="left"/>
35256 <colspec colwidth="6*" align="center"/>
35257 <colspec colwidth="6*" align="center"/>
35258 <colspec colwidth="6*" align="right"/>
35259 <tbody>
35260 <row>
35261 <entry><option>same_domain_copy_routing</option></entry>
35262 <entry>Use: <emphasis>manualroute</emphasis></entry>
35263 <entry>Type: <emphasis>boolean</emphasis></entry>
35264 <entry>Default: <emphasis>false</emphasis></entry>
35265 </row>
35266 </tbody>
35267 </tgroup>
35268 </informaltable>
35269 <para>
35270 <indexterm role="concept">
35271 <primary>address</primary>
35272 <secondary>copying routing</secondary>
35273 </indexterm>
35274 Addresses with the same domain are normally routed by the <command>manualroute</command>
35275 router to the same list of hosts. However, this cannot be presumed, because the
35276 router options and preconditions may refer to the local part of the address. By
35277 default, therefore, Exim routes each address in a message independently. DNS
35278 servers run caches, so repeated DNS lookups are not normally expensive, and in
35279 any case, personal messages rarely have more than a few recipients.
35280 </para>
35281 <para>
35282 If you are running mailing lists with large numbers of subscribers at the same
35283 domain, and you are using a <command>manualroute</command> router which is independent of the
35284 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35285 lookups for identical domains in one message. In this case, when
35286 <command>manualroute</command> routes an address to a remote transport, any other unrouted
35287 addresses in the message that have the same domain are automatically given the
35288 same routing without processing them independently. However, this is only done
35289 if <option>headers_add</option> and <option>headers_remove</option> are unset.
35290 </para>
35291 </section>
35292 <section id="SECID120">
35293 <title>Routing rules in route_list</title>
35294 <para>
35295 The value of <option>route_list</option> is a string consisting of a sequence of routing
35296 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
35297 entered as two semicolons. Alternatively, the list separator can be changed as
35298 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
35299 Empty rules are ignored. The format of each rule is
35300 </para>
35301 <literallayout>
35302 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
35303 </literallayout>
35304 <para>
35305 The following example contains two rules, each with a simple domain pattern and
35306 no options:
35307 </para>
35308 <literallayout class="monospaced">
35309 route_list = \
35310   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
35311   thes.ref.example  mail-3.ref.example:mail-4.ref.example
35312 </literallayout>
35313 <para>
35314 The three parts of a rule are separated by white space. The pattern and the
35315 list of hosts can be enclosed in quotes if necessary, and if they are, the
35316 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
35317 single domain pattern, which is the only mandatory item in the rule. The
35318 pattern is in the same format as one item in a domain list (see section
35319 <xref linkend="SECTdomainlist"/>),
35320 except that it may not be the name of an interpolated file.
35321 That is, it may be wildcarded, or a regular expression, or a file or database
35322 lookup (with semicolons doubled, because of the use of semicolon as a separator
35323 in a <option>route_list</option>).
35324 </para>
35325 <para>
35326 The rules in <option>route_list</option> are searched in order until one of the patterns
35327 matches the domain that is being routed. The list of hosts and then options are
35328 then used as described below. If there is no match, the router declines. When
35329 <option>route_list</option> is set, <option>route_data</option> must not be set.
35330 </para>
35331 </section>
35332 <section id="SECID121">
35333 <title>Routing rules in route_data</title>
35334 <para>
35335 The use of <option>route_list</option> is convenient when there are only a small number of
35336 routing rules. For larger numbers, it is easier to use a file or database to
35337 hold the routing information, and use the <option>route_data</option> option instead.
35338 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
35339 Most commonly, <option>route_data</option> is set as a string that contains an
35340 expansion lookup. For example, suppose we place two routing rules in a file
35341 like this:
35342 </para>
35343 <literallayout class="monospaced">
35344 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
35345 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
35346 </literallayout>
35347 <para>
35348 This data can be accessed by setting
35349 </para>
35350 <literallayout class="monospaced">
35351 route_data = ${lookup{$domain}lsearch{/the/file/name}}
35352 </literallayout>
35353 <para>
35354 Failure of the lookup results in an empty string, causing the router to
35355 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
35356 requirement is that the result of expanding the string is a list of hosts,
35357 possibly followed by options, separated by white space. The list of hosts must
35358 be enclosed in quotes if it contains white space.
35359 </para>
35360 </section>
35361 <section id="SECID122">
35362 <title>Format of the list of hosts</title>
35363 <para>
35364 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
35365 always separately expanded before use. If the expansion fails, the router
35366 declines. The result of the expansion must be a colon-separated list of names
35367 and/or IP addresses, optionally also including ports. The format of each item
35368 in the list is described in the next section. The list separator can be changed
35369 as described in section <xref linkend="SECTlistconstruct"/>.
35370 </para>
35371 <para>
35372 If the list of hosts was obtained from a <option>route_list</option> item, the following
35373 variables are set during its expansion:
35374 </para>
35375 <itemizedlist>
35376 <listitem>
35377 <para>
35378 <indexterm role="concept">
35379 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
35380 <secondary>in <command>manualroute</command> router</secondary>
35381 </indexterm>
35382 If the domain was matched against a regular expression, the numeric variables
35383 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
35384 </para>
35385 <literallayout class="monospaced">
35386 route_list = ^domain(\d+)   host-$1.text.example
35387 </literallayout>
35388 </listitem>
35389 <listitem>
35390 <para>
35391 <varname>$0</varname> is always set to the entire domain.
35392 </para>
35393 </listitem>
35394 <listitem>
35395 <para>
35396 <varname>$1</varname> is also set when partial matching is done in a file lookup.
35397 </para>
35398 </listitem>
35399 <listitem>
35400 <para>
35401 <indexterm role="variable">
35402 <primary><varname>$value</varname></primary>
35403 </indexterm>
35404 If the pattern that matched the domain was a lookup item, the data that was
35405 looked up is available in the expansion variable <varname>$value</varname>. For example:
35406 </para>
35407 <literallayout class="monospaced">
35408 route_list = lsearch;;/some/file.routes  $value
35409 </literallayout>
35410 </listitem>
35411 </itemizedlist>
35412 <para>
35413 Note the doubling of the semicolon in the pattern that is necessary because
35414 semicolon is the default route list separator.
35415 </para>
35416 </section>
35417 <section id="SECTformatonehostitem">
35418 <title>Format of one host item</title>
35419 <para>
35420 Each item in the list of hosts is either a host name or an IP address,
35421 optionally with an attached port number. When no port is given, an IP address
35422 is not enclosed in brackets. When a port is specified, it overrides the port
35423 specification on the transport. The port is separated from the name or address
35424 by a colon. This leads to some complications:
35425 </para>
35426 <itemizedlist>
35427 <listitem>
35428 <para>
35429 Because colon is the default separator for the list of hosts, either
35430 the colon that specifies a port must be doubled, or the list separator must
35431 be changed. The following two examples have the same effect:
35432 </para>
35433 <literallayout class="monospaced">
35434 route_list = * "host1.tld::1225 : host2.tld::1226"
35435 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
35436 </literallayout>
35437 </listitem>
35438 <listitem>
35439 <para>
35440 When IPv6 addresses are involved, it gets worse, because they contain
35441 colons of their own. To make this case easier, it is permitted to
35442 enclose an IP address (either v4 or v6) in square brackets if a port
35443 number follows. For example:
35444 </para>
35445 <literallayout class="monospaced">
35446 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
35447 </literallayout>
35448 </listitem>
35449 </itemizedlist>
35450 </section>
35451 <section id="SECThostshowused">
35452 <title>How the list of hosts is used</title>
35453 <para>
35454 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
35455 the hosts is tried, in the order specified, when carrying out the SMTP
35456 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
35457 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
35458 transport.
35459 </para>
35460 <para>
35461 Hosts may be listed by name or by IP address. An unadorned name in the list of
35462 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
35463 interpreted as an indirection to a sublist of hosts obtained by looking up MX
35464 records in the DNS. For example:
35465 </para>
35466 <literallayout class="monospaced">
35467 route_list = *  x.y.z:p.q.r/MX:e.f.g
35468 </literallayout>
35469 <para>
35470 If this feature is used with a port specifier, the port must come last. For
35471 example:
35472 </para>
35473 <literallayout class="monospaced">
35474 route_list = *  dom1.tld/mx::1225
35475 </literallayout>
35476 <para>
35477 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
35478 randomized before any lookups are done. Exim then scans the list; for any name
35479 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
35480 be an interface on the local host and the item is not the first in the list,
35481 Exim discards it and any subsequent items. If it is the first item, what
35482 happens is controlled by the
35483 <indexterm role="option">
35484 <primary><option>self</option></primary>
35485 <secondary>in <command>manualroute</command> router</secondary>
35486 </indexterm>
35487 <option>self</option> option of the router.
35488 </para>
35489 <para>
35490 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
35491 hosts obtained by looking up MX records for the name. This is always a DNS
35492 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
35493 below) are not relevant here. The order of these hosts is determined by the
35494 preference values in the MX records, according to the usual rules. Because
35495 randomizing happens before the MX lookup, it does not affect the order that is
35496 defined by MX preferences.
35497 </para>
35498 <para>
35499 If the local host is present in the sublist obtained from MX records, but is
35500 not the most preferred host in that list, it and any equally or less
35501 preferred hosts are removed before the sublist is inserted into the main list.
35502 </para>
35503 <para>
35504 If the local host is the most preferred host in the MX list, what happens
35505 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
35506 is not the first item (that is, there are previous hosts in the main list),
35507 Exim discards this name and any subsequent items in the main list.
35508 </para>
35509 <para>
35510 If the MX item is first in the list of hosts, and the local host is the
35511 most preferred host, what happens is controlled by the <option>self</option> option of the
35512 router.
35513 </para>
35514 <para>
35515 DNS failures when lookup up the MX records are treated in the same way as DNS
35516 failures when looking up IP addresses: <option>pass_on_timeout</option> and
35517 <option>host_find_failed</option> are used when relevant.
35518 </para>
35519 <para>
35520 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
35521 whether obtained from an MX lookup or not.
35522 </para>
35523 </section>
35524 <section id="SECThowoptused">
35525 <title>How the options are used</title>
35526 <para>
35527 The options are a sequence of words; in practice no more than three are ever
35528 present. One of the words can be the name of a transport; this overrides the
35529 <option>transport</option> option on the router for this particular routing rule only. The
35530 other words (if present) control randomization of the list of hosts on a
35531 per-rule basis, and how the IP addresses of the hosts are to be found when
35532 routing to a remote transport. These options are as follows:
35533 </para>
35534 <itemizedlist>
35535 <listitem>
35536 <para>
35537 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
35538 setting of <option>hosts_randomize</option> for this routing rule only.
35539 </para>
35540 </listitem>
35541 <listitem>
35542 <para>
35543 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
35544 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
35545 </para>
35546 </listitem>
35547 <listitem>
35548 <para>
35549 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
35550 find IP addresses. This function may ultimately cause a DNS lookup, but it may
35551 also look in <filename>/etc/hosts</filename> or other sources of information.
35552 </para>
35553 </listitem>
35554 <listitem>
35555 <para>
35556 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
35557 no address records are found. If there is a temporary DNS error (such as a
35558 timeout), delivery is deferred.
35559 </para>
35560 </listitem>
35561 </itemizedlist>
35562 <para>
35563 For example:
35564 </para>
35565 <literallayout class="monospaced">
35566 route_list = domain1  host1:host2:host3  randomize bydns;\
35567              domain2  host4:host5
35568 </literallayout>
35569 <para>
35570 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
35571 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
35572 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
35573 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
35574 call.
35575 </para>
35576 <para>
35577 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
35578 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
35579 instead of TRY_AGAIN. That is why the default action is to try a DNS
35580 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
35581 function called.
35582 </para>
35583 <para>
35584 If no IP address for a host can be found, what happens is controlled by the
35585 <option>host_find_failed</option> option.
35586 </para>
35587 <para>
35588 <indexterm role="variable">
35589 <primary><varname>$host</varname></primary>
35590 </indexterm>
35591 When an address is routed to a local transport, IP addresses are not looked up.
35592 The host list is passed to the transport in the <varname>$host</varname> variable.
35593 </para>
35594 </section>
35595 <section id="SECID123">
35596 <title>Manualroute examples</title>
35597 <para>
35598 In some of the examples that follow, the presence of the <option>remote_smtp</option>
35599 transport, as defined in the default configuration file, is assumed:
35600 </para>
35601 <itemizedlist>
35602 <listitem>
35603 <para>
35604 <indexterm role="concept">
35605 <primary>smart host</primary>
35606 <secondary>example router</secondary>
35607 </indexterm>
35608 The <command>manualroute</command> router can be used to forward all external mail to a
35609 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
35610 named domain list that contains your local domains, for example:
35611 </para>
35612 <literallayout class="monospaced">
35613 domainlist local_domains = my.domain.example
35614 </literallayout>
35615 <para>
35616 You can arrange for all other domains to be routed to a smart host by making
35617 your first router something like this:
35618 </para>
35619 <literallayout class="monospaced">
35620 smart_route:
35621   driver = manualroute
35622   domains = !+local_domains
35623   transport = remote_smtp
35624   route_list = * smarthost.ref.example
35625 </literallayout>
35626 <para>
35627 This causes all non-local addresses to be sent to the single host
35628 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
35629 they are tried in order
35630 (but you can use <option>hosts_randomize</option> to vary the order each time).
35631 Another way of configuring the same thing is this:
35632 </para>
35633 <literallayout class="monospaced">
35634 smart_route:
35635   driver = manualroute
35636   transport = remote_smtp
35637   route_list = !+local_domains  smarthost.ref.example
35638 </literallayout>
35639 <para>
35640 There is no difference in behaviour between these two routers as they stand.
35641 However, they behave differently if <option>no_more</option> is added to them. In the first
35642 example, the router is skipped if the domain does not match the <option>domains</option>
35643 precondition; the following router is always tried. If the router runs, it
35644 always matches the domain and so can never decline. Therefore, <option>no_more</option>
35645 would have no effect. In the second case, the router is never skipped; it
35646 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
35647 <option>no_more</option> would prevent subsequent routers from running.
35648 </para>
35649 </listitem>
35650 <listitem>
35651 <para>
35652 <indexterm role="concept">
35653 <primary>mail hub example</primary>
35654 </indexterm>
35655 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
35656 records in the DNS and delivers it via its own private routing mechanism. Often
35657 the final destinations are behind a firewall, with the mail hub being the one
35658 machine that can connect to machines both inside and outside the firewall. The
35659 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
35660 to the correct hosts. For a small number of domains, the routing can be inline,
35661 using the <option>route_list</option> option, but for a larger number a file or database
35662 lookup is easier to manage.
35663 </para>
35664 <para>
35665 If the domain names are in fact the names of the machines to which the mail is
35666 to be sent by the mail hub, the configuration can be quite simple. For
35667 example:
35668 </para>
35669 <literallayout class="monospaced">
35670 hub_route:
35671   driver = manualroute
35672   transport = remote_smtp
35673   route_list = *.rhodes.tvs.example  $domain
35674 </literallayout>
35675 <para>
35676 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
35677 whose names are the same as the mail domains. A similar approach can be taken
35678 if the host name can be obtained from the domain name by a string manipulation
35679 that the expansion facilities can handle. Otherwise, a lookup based on the
35680 domain can be used to find the host:
35681 </para>
35682 <literallayout class="monospaced">
35683 through_firewall:
35684   driver = manualroute
35685   transport = remote_smtp
35686   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
35687 </literallayout>
35688 <para>
35689 The result of the lookup must be the name or IP address of the host (or
35690 hosts) to which the address is to be routed. If the lookup fails, the route
35691 data is empty, causing the router to decline. The address then passes to the
35692 next router.
35693 </para>
35694 </listitem>
35695 <listitem>
35696 <para>
35697 <indexterm role="concept">
35698 <primary>batched SMTP output example</primary>
35699 </indexterm>
35700 <indexterm role="concept">
35701 <primary>SMTP</primary>
35702 <secondary>batched outgoing; example</secondary>
35703 </indexterm>
35704 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
35705 SMTP format for onward transportation by some other means. This is one way of
35706 storing mail for a dial-up host when it is not connected. The route list entry
35707 can be as simple as a single domain name in a configuration like this:
35708 </para>
35709 <literallayout class="monospaced">
35710 save_in_file:
35711   driver = manualroute
35712   transport = batchsmtp_appendfile
35713   route_list = saved.domain.example
35714 </literallayout>
35715 <para>
35716 though often a pattern is used to pick up more than one domain. If there are
35717 several domains or groups of domains with different transport requirements,
35718 different transports can be listed in the routing information:
35719 </para>
35720 <literallayout class="monospaced">
35721 save_in_file:
35722   driver = manualroute
35723   route_list = \
35724     *.saved.domain1.example  $domain  batch_appendfile; \
35725     *.saved.domain2.example  \
35726       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
35727       batch_pipe
35728 </literallayout>
35729 <para>
35730 <indexterm role="variable">
35731 <primary><varname>$domain</varname></primary>
35732 </indexterm>
35733 <indexterm role="variable">
35734 <primary><varname>$host</varname></primary>
35735 </indexterm>
35736 The first of these just passes the domain in the <varname>$host</varname> variable, which
35737 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
35738 file lookup to find a value to pass, causing the router to decline to handle
35739 the address if the lookup fails.
35740 </para>
35741 </listitem>
35742 <listitem>
35743 <para>
35744 <indexterm role="concept">
35745 <primary>UUCP</primary>
35746 <secondary>example of router for</secondary>
35747 </indexterm>
35748 Routing mail directly to UUCP software is a specific case of the use of
35749 <command>manualroute</command> in a gateway to another mail environment. This is an example of
35750 one way it can be done:
35751 </para>
35752 <literallayout class="monospaced">
35753 # Transport
35754 uucp:
35755   driver = pipe
35756   user = nobody
35757   command = /usr/local/bin/uux -r - \
35758     ${substr_-5:$host}!rmail ${local_part}
35759   return_fail_output = true
35760
35761 # Router
35762 uucphost:
35763   transport = uucp
35764   driver = manualroute
35765   route_data = \
35766     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
35767 </literallayout>
35768 <para>
35769 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
35770 </para>
35771 <literallayout class="monospaced">
35772 darksite.ethereal.example:           darksite.UUCP
35773 </literallayout>
35774 <para>
35775 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
35776 makes clear the distinction between the domain name
35777 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
35778 </para>
35779 </listitem>
35780 </itemizedlist>
35781 <para>
35782 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
35783 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
35784 </para>
35785 </section>
35786 </chapter>
35787
35788 <chapter id="CHAPdriverlast">
35789 <title>The queryprogram router</title>
35790 <para>
35791 <indexterm role="concept" id="IIDquerou1" class="startofrange">
35792 <primary><command>queryprogram</command> router</primary>
35793 </indexterm>
35794 <indexterm role="concept" id="IIDquerou2" class="startofrange">
35795 <primary>routers</primary>
35796 <secondary><command>queryprogram</command></secondary>
35797 </indexterm>
35798 <indexterm role="concept">
35799 <primary>routing</primary>
35800 <secondary>by external program</secondary>
35801 </indexterm>
35802 The <command>queryprogram</command> router routes an address by running an external command
35803 and acting on its output. This is an expensive way to route, and is intended
35804 mainly for use in lightly-loaded systems, or for performing experiments.
35805 However, if it is possible to use the precondition options (<option>domains</option>,
35806 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
35807 be used in special cases, even on a busy host. There are the following private
35808 options:
35809 <indexterm role="concept">
35810 <primary>options</primary>
35811 <secondary><command>queryprogram</command> router</secondary>
35812 </indexterm>
35813 </para>
35814 <para>
35815 <indexterm role="option">
35816 <primary><option>command</option></primary>
35817 </indexterm>
35818 </para>
35819 <informaltable frame="all">
35820 <tgroup cols="4" colsep="0" rowsep="0">
35821 <colspec colwidth="8*" align="left"/>
35822 <colspec colwidth="6*" align="center"/>
35823 <colspec colwidth="6*" align="center"/>
35824 <colspec colwidth="6*" align="right"/>
35825 <tbody>
35826 <row>
35827 <entry><option>command</option></entry>
35828 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35829 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35830 <entry>Default: <emphasis>unset</emphasis></entry>
35831 </row>
35832 </tbody>
35833 </tgroup>
35834 </informaltable>
35835 <para>
35836 This option must be set. It specifies the command that is to be run. The
35837 command is split up into a command name and arguments, and then each is
35838 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
35839 <xref linkend="CHAPpipetransport"/>).
35840 </para>
35841 <para>
35842 <indexterm role="option">
35843 <primary><option>command_group</option></primary>
35844 </indexterm>
35845 </para>
35846 <informaltable frame="all">
35847 <tgroup cols="4" colsep="0" rowsep="0">
35848 <colspec colwidth="8*" align="left"/>
35849 <colspec colwidth="6*" align="center"/>
35850 <colspec colwidth="6*" align="center"/>
35851 <colspec colwidth="6*" align="right"/>
35852 <tbody>
35853 <row>
35854 <entry><option>command_group</option></entry>
35855 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35856 <entry>Type: <emphasis>string</emphasis></entry>
35857 <entry>Default: <emphasis>unset</emphasis></entry>
35858 </row>
35859 </tbody>
35860 </tgroup>
35861 </informaltable>
35862 <para>
35863 <indexterm role="concept">
35864 <primary>gid (group id)</primary>
35865 <secondary>in <command>queryprogram</command> router</secondary>
35866 </indexterm>
35867 This option specifies a gid to be set when running the command while routing an
35868 address for deliver. It must be set if <option>command_user</option> specifies a numerical
35869 uid. If it begins with a digit, it is interpreted as the numerical value of the
35870 gid. Otherwise it is looked up using <function>getgrnam()</function>.
35871 </para>
35872 <para>
35873 <indexterm role="option">
35874 <primary><option>command_user</option></primary>
35875 </indexterm>
35876 </para>
35877 <informaltable frame="all">
35878 <tgroup cols="4" colsep="0" rowsep="0">
35879 <colspec colwidth="8*" align="left"/>
35880 <colspec colwidth="6*" align="center"/>
35881 <colspec colwidth="6*" align="center"/>
35882 <colspec colwidth="6*" align="right"/>
35883 <tbody>
35884 <row>
35885 <entry><option>command_user</option></entry>
35886 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35887 <entry>Type: <emphasis>string</emphasis></entry>
35888 <entry>Default: <emphasis>unset</emphasis></entry>
35889 </row>
35890 </tbody>
35891 </tgroup>
35892 </informaltable>
35893 <para>
35894 <indexterm role="concept">
35895 <primary>uid (user id)</primary>
35896 <secondary>for <command>queryprogram</command></secondary>
35897 </indexterm>
35898 This option must be set. It specifies the uid which is set when running the
35899 command while routing an address for delivery. If the value begins with a digit,
35900 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
35901 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
35902 not set, a value for the gid also.
35903 </para>
35904 <para>
35905 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
35906 root, which it does during a normal delivery in a conventional configuration.
35907 However, when an address is being verified during message reception, Exim is
35908 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
35909 is called from a non-root process, Exim cannot change uid or gid before running
35910 the command. In this circumstance the command runs under the current uid and
35911 gid.
35912 </para>
35913 <para>
35914 <indexterm role="option">
35915 <primary><option>current_directory</option></primary>
35916 </indexterm>
35917 </para>
35918 <informaltable frame="all">
35919 <tgroup cols="4" colsep="0" rowsep="0">
35920 <colspec colwidth="8*" align="left"/>
35921 <colspec colwidth="6*" align="center"/>
35922 <colspec colwidth="6*" align="center"/>
35923 <colspec colwidth="6*" align="right"/>
35924 <tbody>
35925 <row>
35926 <entry><option>current_directory</option></entry>
35927 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35928 <entry>Type: <emphasis>string</emphasis></entry>
35929 <entry>Default: <emphasis>/</emphasis></entry>
35930 </row>
35931 </tbody>
35932 </tgroup>
35933 </informaltable>
35934 <para>
35935 This option specifies an absolute path which is made the current directory
35936 before running the command.
35937 </para>
35938 <para>
35939 <indexterm role="option">
35940 <primary><option>timeout</option></primary>
35941 </indexterm>
35942 </para>
35943 <informaltable frame="all">
35944 <tgroup cols="4" colsep="0" rowsep="0">
35945 <colspec colwidth="8*" align="left"/>
35946 <colspec colwidth="6*" align="center"/>
35947 <colspec colwidth="6*" align="center"/>
35948 <colspec colwidth="6*" align="right"/>
35949 <tbody>
35950 <row>
35951 <entry><option>timeout</option></entry>
35952 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35953 <entry>Type: <emphasis>time</emphasis></entry>
35954 <entry>Default: <emphasis>1h</emphasis></entry>
35955 </row>
35956 </tbody>
35957 </tgroup>
35958 </informaltable>
35959 <para>
35960 If the command does not complete within the timeout period, its process group
35961 is killed and the message is frozen. A value of zero time specifies no
35962 timeout.
35963 </para>
35964 <para>
35965 The standard output of the command is connected to a pipe, which is read when
35966 the command terminates. It should consist of a single line of output,
35967 containing up to five fields, separated by white space. The maximum length of
35968 the line is 1023 characters. Longer lines are silently truncated. The first
35969 field is one of the following words (case-insensitive):
35970 </para>
35971 <itemizedlist>
35972 <listitem>
35973 <para>
35974 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
35975 below).
35976 </para>
35977 </listitem>
35978 <listitem>
35979 <para>
35980 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
35981 <option>no_more</option> is set.
35982 </para>
35983 </listitem>
35984 <listitem>
35985 <para>
35986 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
35987 subsequent text on the line is an error message. If the router is run as part
35988 of address verification during an incoming SMTP message, the message is
35989 included in the SMTP response.
35990 </para>
35991 </listitem>
35992 <listitem>
35993 <para>
35994 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
35995 subsequent text on the line is an error message which is logged. It is not
35996 included in any SMTP response.
35997 </para>
35998 </listitem>
35999 <listitem>
36000 <para>
36001 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
36002 </para>
36003 </listitem>
36004 <listitem>
36005 <para>
36006 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
36007 <option>pass_router</option>), overriding <option>no_more</option>.
36008 </para>
36009 </listitem>
36010 <listitem>
36011 <para>
36012 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
36013 new addresses, which are routed independently, starting with the first router,
36014 or the router specified by <option>redirect_router</option>, if set.
36015 </para>
36016 </listitem>
36017 </itemizedlist>
36018 <para>
36019 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
36020 number of keyed data values, as follows (split into two lines here, to fit on
36021 the page):
36022 </para>
36023 <literallayout class="monospaced">
36024 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
36025 LOOKUP=byname|bydns DATA=&lt;text&gt;
36026 </literallayout>
36027 <para>
36028 The data items can be given in any order, and all are optional. If no transport
36029 is included, the transport specified by the generic <option>transport</option> option is
36030 used. The list of hosts and the lookup type are needed only if the transport is
36031 an <command>smtp</command> transport that does not itself supply a list of hosts.
36032 </para>
36033 <para>
36034 The format of the list of hosts is the same as for the <command>manualroute</command> router.
36035 As well as host names and IP addresses with optional port numbers, as described
36036 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
36037 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
36038 (see section <xref linkend="SECThostshowused"/>).
36039 </para>
36040 <para>
36041 If the lookup type is not specified, Exim behaves as follows when trying to
36042 find an IP address for each host: First, a DNS lookup is done. If this yields
36043 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
36044 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
36045 result of the lookup is the result of that call.
36046 </para>
36047 <para>
36048 <indexterm role="variable">
36049 <primary><varname>$address_data</varname></primary>
36050 </indexterm>
36051 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
36052 variable. For example, this return line
36053 </para>
36054 <literallayout class="monospaced">
36055 accept hosts=x1.y.example:x2.y.example data="rule1"
36056 </literallayout>
36057 <para>
36058 routes the address to the default transport, passing a list of two hosts. When
36059 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
36060 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
36061 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
36062 </para>
36063 </chapter>
36064
36065 <chapter id="CHAPredirect">
36066 <title>The redirect router</title>
36067 <para>
36068 <indexterm role="concept" id="IIDredrou1" class="startofrange">
36069 <primary><command>redirect</command> router</primary>
36070 </indexterm>
36071 <indexterm role="concept" id="IIDredrou2" class="startofrange">
36072 <primary>routers</primary>
36073 <secondary><command>redirect</command></secondary>
36074 </indexterm>
36075 <indexterm role="concept">
36076 <primary>alias file</primary>
36077 <secondary>in a <command>redirect</command> router</secondary>
36078 </indexterm>
36079 <indexterm role="concept">
36080 <primary>address redirection</primary>
36081 <secondary><command>redirect</command> router</secondary>
36082 </indexterm>
36083 The <command>redirect</command> router handles several kinds of address redirection. Its most
36084 common uses are for resolving local part aliases from a central alias file
36085 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
36086 files, but it has many other potential uses. The incoming address can be
36087 redirected in several different ways:
36088 </para>
36089 <itemizedlist>
36090 <listitem>
36091 <para>
36092 It can be replaced by one or more new addresses which are themselves routed
36093 independently.
36094 </para>
36095 </listitem>
36096 <listitem>
36097 <para>
36098 It can be routed to be delivered to a given file or directory.
36099 </para>
36100 </listitem>
36101 <listitem>
36102 <para>
36103 It can be routed to be delivered to a specified pipe command.
36104 </para>
36105 </listitem>
36106 <listitem>
36107 <para>
36108 It can cause an automatic reply to be generated.
36109 </para>
36110 </listitem>
36111 <listitem>
36112 <para>
36113 It can be forced to fail, optionally with a custom error message.
36114 </para>
36115 </listitem>
36116 <listitem>
36117 <para>
36118 It can be temporarily deferred, optionally with a custom message.
36119 </para>
36120 </listitem>
36121 <listitem>
36122 <para>
36123 It can be discarded.
36124 </para>
36125 </listitem>
36126 </itemizedlist>
36127 <para>
36128 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
36129 However, there are some private options which define transports for delivery to
36130 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
36131 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
36132 </para>
36133 <para revisionflag="changed">
36134 If success DSNs have been requested
36135 <indexterm role="concept">
36136 <primary>DSN</primary>
36137 <secondary>success</secondary>
36138 </indexterm>
36139 <indexterm role="concept">
36140 <primary>Delivery Status Notification</primary>
36141 <secondary>success</secondary>
36142 </indexterm>
36143 redirection triggers one and the DSN options are not passed any further.
36144 </para>
36145 <section id="SECID124">
36146 <title>Redirection data</title>
36147 <para>
36148 The router operates by interpreting a text string which it obtains either by
36149 expanding the contents of the <option>data</option> option, or by reading the entire
36150 contents of a file whose name is given in the <option>file</option> option. These two
36151 options are mutually exclusive. The first is commonly used for handling system
36152 aliases, in a configuration like this:
36153 </para>
36154 <literallayout class="monospaced">
36155 system_aliases:
36156   driver = redirect
36157   data = ${lookup{$local_part}lsearch{/etc/aliases}}
36158 </literallayout>
36159 <para>
36160 If the lookup fails, the expanded string in this example is empty. When the
36161 expansion of <option>data</option> results in an empty string, the router declines. A forced
36162 expansion failure also causes the router to decline; other expansion failures
36163 cause delivery to be deferred.
36164 </para>
36165 <para>
36166 A configuration using <option>file</option> is commonly used for handling users&#x2019;
36167 <filename>.forward</filename> files, like this:
36168 </para>
36169 <literallayout class="monospaced">
36170 userforward:
36171   driver = redirect
36172   check_local_user
36173   file = $home/.forward
36174   no_verify
36175 </literallayout>
36176 <para>
36177 If the file does not exist, or causes no action to be taken (for example, it is
36178 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
36179 is not the case when the file contains syntactically valid items that happen to
36180 yield empty addresses, for example, items containing only RFC 2822 address
36181 comments.
36182 </para>
36183 </section>
36184 <section id="SECID125">
36185 <title>Forward files and address verification</title>
36186 <para>
36187 <indexterm role="concept">
36188 <primary>address redirection</primary>
36189 <secondary>while verifying</secondary>
36190 </indexterm>
36191 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
36192 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
36193 </para>
36194 <itemizedlist>
36195 <listitem>
36196 <para>
36197 When Exim is receiving an incoming SMTP message from a remote host, it is
36198 running under the Exim uid, not as root. Exim is unable to change uid to read
36199 the file as the user, and it may not be able to read it as the Exim user. So in
36200 practice the router may not be able to operate.
36201 </para>
36202 </listitem>
36203 <listitem>
36204 <para>
36205 However, even when the router can operate, the existence of a <filename>.forward</filename> file
36206 is unimportant when verifying an address. What should be checked is whether the
36207 local part is a valid user name or not. Cutting out the redirection processing
36208 saves some resources.
36209 </para>
36210 </listitem>
36211 </itemizedlist>
36212 </section>
36213 <section id="SECID126">
36214 <title>Interpreting redirection data</title>
36215 <para>
36216 <indexterm role="concept">
36217 <primary>Sieve filter</primary>
36218 <secondary>specifying in redirection data</secondary>
36219 </indexterm>
36220 <indexterm role="concept">
36221 <primary>filter</primary>
36222 <secondary>specifying in redirection data</secondary>
36223 </indexterm>
36224 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
36225 can be interpreted in two different ways:
36226 </para>
36227 <itemizedlist>
36228 <listitem>
36229 <para>
36230 If the <option>allow_filter</option> option is set true, and the data begins with the text
36231 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
36232 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
36233 respectively. Details of the syntax and semantics of filter files are described
36234 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
36235 document is intended for use by end users.
36236 </para>
36237 </listitem>
36238 <listitem>
36239 <para>
36240 Otherwise, the data must be a comma-separated list of redirection items, as
36241 described in the next section.
36242 </para>
36243 </listitem>
36244 </itemizedlist>
36245 <para>
36246 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
36247 in a non-filter redirection list must always be an absolute path. A filter may
36248 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
36249 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
36250 for the <command>appendfile</command> transport.
36251 </para>
36252 </section>
36253 <section id="SECTitenonfilred">
36254 <title>Items in a non-filter redirection list</title>
36255 <para>
36256 <indexterm role="concept">
36257 <primary>address redirection</primary>
36258 <secondary>non-filter list items</secondary>
36259 </indexterm>
36260 When the redirection data is not an Exim or Sieve filter, for example, if it
36261 comes from a conventional alias or forward file, it consists of a list of
36262 addresses, file names, pipe commands, or certain special items (see section
36263 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
36264 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
36265 depending on their default values. The items in the list are separated by
36266 commas or newlines.
36267 If a comma is required in an item, the entire item must be enclosed in double
36268 quotes.
36269 </para>
36270 <para>
36271 Lines starting with a # character are comments, and are ignored, and # may
36272 also appear following a comma, in which case everything between the # and the
36273 next newline character is ignored.
36274 </para>
36275 <para>
36276 If an item is entirely enclosed in double quotes, these are removed. Otherwise
36277 double quotes are retained because some forms of mail address require their use
36278 (but never to enclose the entire address). In the following description,
36279 <quote>item</quote> refers to what remains after any surrounding double quotes have been
36280 removed.
36281 </para>
36282 <para>
36283 <indexterm role="variable">
36284 <primary><varname>$local_part</varname></primary>
36285 </indexterm>
36286 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
36287 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
36288 of the <option>quote_local_part</option> expansion operator, in case the local part contains
36289 special characters. For example, to redirect all mail for the domain
36290 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
36291 setting:
36292 </para>
36293 <literallayout class="monospaced">
36294 data = ${quote_local_part:$local_part}@newdomain.example
36295 </literallayout>
36296 </section>
36297 <section id="SECTredlocmai">
36298 <title>Redirecting to a local mailbox</title>
36299 <para>
36300 <indexterm role="concept">
36301 <primary>routing</primary>
36302 <secondary>loops in</secondary>
36303 </indexterm>
36304 <indexterm role="concept">
36305 <primary>loop</primary>
36306 <secondary>while routing, avoidance of</secondary>
36307 </indexterm>
36308 <indexterm role="concept">
36309 <primary>address redirection</primary>
36310 <secondary>to local mailbox</secondary>
36311 </indexterm>
36312 A redirection item may safely be the same as the address currently under
36313 consideration. This does not cause a routing loop, because a router is
36314 automatically skipped if any ancestor of the address that is being processed
36315 is the same as the current address and was processed by the current router.
36316 Such an address is therefore passed to the following routers, so it is handled
36317 as if there were no redirection. When making this loop-avoidance test, the
36318 complete local part, including any prefix or suffix, is used.
36319 </para>
36320 <para>
36321 <indexterm role="concept">
36322 <primary>address redirection</primary>
36323 <secondary>local part without domain</secondary>
36324 </indexterm>
36325 Specifying the same local part without a domain is a common usage in personal
36326 filter files when the user wants to have messages delivered to the local
36327 mailbox and also forwarded elsewhere. For example, the user whose login is
36328 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
36329 </para>
36330 <literallayout class="monospaced">
36331 cleo, cleopatra@egypt.example
36332 </literallayout>
36333 <para>
36334 <indexterm role="concept">
36335 <primary>backslash in alias file</primary>
36336 </indexterm>
36337 <indexterm role="concept">
36338 <primary>alias file</primary>
36339 <secondary>backslash in</secondary>
36340 </indexterm>
36341 For compatibility with other MTAs, such unqualified local parts may be
36342 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
36343 it does make a difference if more than one domain is being handled
36344 synonymously.
36345 </para>
36346 <para>
36347 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
36348 2822 address that does not include a domain, the item is qualified using the
36349 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
36350 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
36351 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
36352 </para>
36353 <para>
36354 Care must be taken if there are alias names for local users.
36355 Consider an MTA handling a single local domain where the system alias file
36356 contains:
36357 </para>
36358 <literallayout class="monospaced">
36359 Sam.Reman: spqr
36360 </literallayout>
36361 <para>
36362 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
36363 messages in the local mailbox, and also forward copies elsewhere. He creates
36364 this forward file:
36365 </para>
36366 <literallayout class="monospaced">
36367 Sam.Reman, spqr@reme.elsewhere.example
36368 </literallayout>
36369 <para>
36370 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
36371 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
36372 second time round, because it has previously routed it,
36373 and the following routers presumably cannot handle the alias. The forward file
36374 should really contain
36375 </para>
36376 <literallayout class="monospaced">
36377 spqr, spqr@reme.elsewhere.example
36378 </literallayout>
36379 <para>
36380 but because this is such a common error, the <option>check_ancestor</option> option (see
36381 below) exists to provide a way to get round it. This is normally set on a
36382 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
36383 </para>
36384 </section>
36385 <section id="SECTspecitredli">
36386 <title>Special items in redirection lists</title>
36387 <para>
36388 In addition to addresses, the following types of item may appear in redirection
36389 lists (that is, in non-filter redirection data):
36390 </para>
36391 <itemizedlist>
36392 <listitem>
36393 <para>
36394 <indexterm role="concept">
36395 <primary>pipe</primary>
36396 <secondary>in redirection list</secondary>
36397 </indexterm>
36398 <indexterm role="concept">
36399 <primary>address redirection</primary>
36400 <secondary>to pipe</secondary>
36401 </indexterm>
36402 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
36403 as a valid RFC 2822 address that includes a domain. A transport for running the
36404 command must be specified by the <option>pipe_transport</option> option.
36405 Normally, either the router or the transport specifies a user and a group under
36406 which to run the delivery. The default is to use the Exim user and group.
36407 </para>
36408 <para>
36409 Single or double quotes can be used for enclosing the individual arguments of
36410 the pipe command; no interpretation of escapes is done for single quotes. If
36411 the command contains a comma character, it is necessary to put the whole item
36412 in double quotes, for example:
36413 </para>
36414 <literallayout class="monospaced">
36415 "|/some/command ready,steady,go"
36416 </literallayout>
36417 <para>
36418 since items in redirection lists are terminated by commas. Do not, however,
36419 quote just the command. An item such as
36420 </para>
36421 <literallayout class="monospaced">
36422 |"/some/command ready,steady,go"
36423 </literallayout>
36424 <para>
36425 is interpreted as a pipe with a rather strange command name, and no arguments.
36426 </para>
36427 <para>
36428 Note that the above example assumes that the text comes from a lookup source
36429 of some sort, so that the quotes are part of the data.  If composing a
36430 redirect router with a <option>data</option> option directly specifying this command, the
36431 quotes will be used by the configuration parser to define the extent of one
36432 string, but will not be passed down into the redirect router itself.  There
36433 are two main approaches to get around this: escape quotes to be part of the
36434 data itself, or avoid using this mechanism and instead create a custom
36435 transport with the <option>command</option> option set and reference that transport from
36436 an <option>accept</option> router.
36437 </para>
36438 </listitem>
36439 <listitem>
36440 <para>
36441 <indexterm role="concept">
36442 <primary>file</primary>
36443 <secondary>in redirection list</secondary>
36444 </indexterm>
36445 <indexterm role="concept">
36446 <primary>address redirection</primary>
36447 <secondary>to file</secondary>
36448 </indexterm>
36449 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
36450 parse as a valid RFC 2822 address that includes a domain. For example,
36451 </para>
36452 <literallayout class="monospaced">
36453 /home/world/minbari
36454 </literallayout>
36455 <para>
36456 is treated as a file name, but
36457 </para>
36458 <literallayout class="monospaced">
36459 /s=molari/o=babylon/@x400gate.way
36460 </literallayout>
36461 <para>
36462 is treated as an address. For a file name, a transport must be specified using
36463 the <option>file_transport</option> option. However, if the generated path name ends with a
36464 forward slash character, it is interpreted as a directory name rather than a
36465 file name, and <option>directory_transport</option> is used instead.
36466 </para>
36467 <para>
36468 Normally, either the router or the transport specifies a user and a group under
36469 which to run the delivery. The default is to use the Exim user and group.
36470 </para>
36471 <para>
36472 <indexterm role="concept">
36473 <primary><filename>/dev/null</filename></primary>
36474 </indexterm>
36475 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
36476 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
36477 instead of a transport name. In this case the user and group are not used.
36478 </para>
36479 </listitem>
36480 <listitem>
36481 <para>
36482 <indexterm role="concept">
36483 <primary>included address list</primary>
36484 </indexterm>
36485 <indexterm role="concept">
36486 <primary>address redirection</primary>
36487 <secondary>included external list</secondary>
36488 </indexterm>
36489 If an item is of the form
36490 </para>
36491 <literallayout class="monospaced">
36492 :include:&lt;path name&gt;
36493 </literallayout>
36494 <para>
36495 a list of further items is taken from the given file and included at that
36496 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
36497 out-of-line addition to the list. The items in the included list are separated
36498 by commas or newlines and are not subject to expansion. If this is the first
36499 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
36500 the alias name. This example is incorrect:
36501 </para>
36502 <literallayout class="monospaced">
36503 list1    :include:/opt/lists/list1
36504 </literallayout>
36505 <para>
36506 It must be given as
36507 </para>
36508 <literallayout class="monospaced">
36509 list1:   :include:/opt/lists/list1
36510 </literallayout>
36511 </listitem>
36512 <listitem>
36513 <para>
36514 <indexterm role="concept">
36515 <primary>address redirection</primary>
36516 <secondary>to black hole</secondary>
36517 </indexterm>
36518 Sometimes you want to throw away mail to a particular local part. Making the
36519 <option>data</option> option expand to an empty string does not work, because that causes
36520 the router to decline. Instead, the alias item
36521 <indexterm role="concept">
36522 <primary>black hole</primary>
36523 </indexterm>
36524 <indexterm role="concept">
36525 <primary>abandoning mail</primary>
36526 </indexterm>
36527 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
36528 done, and no error message is generated. This has the same effect as specifying
36529 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
36530 </para>
36531 <para>
36532 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
36533 delivery is done for the original local part, even if other redirection items
36534 are present. If you are generating a multi-item list (for example, by reading a
36535 database) and need the ability to provide a no-op item, you must use
36536 <filename>/dev/null</filename>.
36537 </para>
36538 </listitem>
36539 <listitem>
36540 <para>
36541 <indexterm role="concept">
36542 <primary>delivery</primary>
36543 <secondary>forcing failure</secondary>
36544 </indexterm>
36545 <indexterm role="concept">
36546 <primary>delivery</primary>
36547 <secondary>forcing deferral</secondary>
36548 </indexterm>
36549 <indexterm role="concept">
36550 <primary>failing delivery</primary>
36551 <secondary>forcing</secondary>
36552 </indexterm>
36553 <indexterm role="concept">
36554 <primary>deferred delivery, forcing</primary>
36555 </indexterm>
36556 <indexterm role="concept">
36557 <primary>customizing</primary>
36558 <secondary>failure message</secondary>
36559 </indexterm>
36560 An attempt to deliver a particular address can be deferred or forced to fail by
36561 redirection items of the form
36562 </para>
36563 <literallayout class="monospaced">
36564 :defer:
36565 :fail:
36566 </literallayout>
36567 <para>
36568 respectively. When a redirection list contains such an item, it applies
36569 to the entire redirection; any other items in the list are ignored. Any
36570 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
36571 associated with the failure. For example, an alias file might contain:
36572 </para>
36573 <literallayout class="monospaced">
36574 X.Employee:  :fail: Gone away, no forwarding address
36575 </literallayout>
36576 <para>
36577 In the case of an address that is being verified from an ACL or as the subject
36578 of a
36579 <indexterm role="concept">
36580 <primary>VRFY</primary>
36581 <secondary>error text, display of</secondary>
36582 </indexterm>
36583 VRFY command, the text is included in the SMTP error response by
36584 default.
36585 <indexterm role="concept">
36586 <primary>EXPN</primary>
36587 <secondary>error text, display of</secondary>
36588 </indexterm>
36589 The text is not included in the response to an EXPN command. In non-SMTP cases
36590 the text is included in the error message that Exim generates.
36591 </para>
36592 <para>
36593 <indexterm role="concept">
36594 <primary>SMTP</primary>
36595 <secondary>error codes</secondary>
36596 </indexterm>
36597 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
36598 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
36599 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
36600 followed by a space, and the very first digit is the same as the default error
36601 code, the code from the message is used instead. If the very first digit is
36602 incorrect, a panic error is logged, and the default code is used. You can
36603 suppress the use of the supplied code in a redirect router by setting the
36604 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
36605 ignored.
36606 </para>
36607 <para>
36608 <indexterm role="variable">
36609 <primary><varname>$acl_verify_message</varname></primary>
36610 </indexterm>
36611 In an ACL, an explicitly provided message overrides the default, but the
36612 default message is available in the variable <varname>$acl_verify_message</varname> and can
36613 therefore be included in a custom message if this is desired.
36614 </para>
36615 <para>
36616 Normally the error text is the rest of the redirection list &ndash; a comma does
36617 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
36618 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
36619 as part of the continuation process, but they may exist in other kinds of
36620 lookup and in <emphasis>:include:</emphasis> files.
36621 </para>
36622 <para>
36623 During routing for message delivery (as opposed to verification), a redirection
36624 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
36625 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
36626 subsequent delivery attempt can happen at a later time. If an address is
36627 deferred for too long, it will ultimately fail, because the normal retry
36628 rules still apply.
36629 </para>
36630 </listitem>
36631 <listitem>
36632 <para>
36633 <indexterm role="concept">
36634 <primary>alias file</primary>
36635 <secondary>exception to default</secondary>
36636 </indexterm>
36637 Sometimes it is useful to use a single-key search type with a default (see
36638 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
36639 for exceptions to the default. These can be handled by aliasing them to
36640 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
36641 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
36642 results in an empty redirection list has the same effect.
36643 </para>
36644 </listitem>
36645 </itemizedlist>
36646 </section>
36647 <section id="SECTdupaddr">
36648 <title>Duplicate addresses</title>
36649 <para>
36650 <indexterm role="concept">
36651 <primary>duplicate addresses</primary>
36652 </indexterm>
36653 <indexterm role="concept">
36654 <primary>address duplicate, discarding</primary>
36655 </indexterm>
36656 <indexterm role="concept">
36657 <primary>pipe</primary>
36658 <secondary>duplicated</secondary>
36659 </indexterm>
36660 Exim removes duplicate addresses from the list to which it is delivering, so as
36661 to deliver just one copy to each address. This does not apply to deliveries
36662 routed to pipes by different immediate parent addresses, but an indirect
36663 aliasing scheme of the type
36664 </para>
36665 <literallayout class="monospaced">
36666 pipe:       |/some/command $local_part
36667 localpart1: pipe
36668 localpart2: pipe
36669 </literallayout>
36670 <para>
36671 does not work with a message that is addressed to both local parts, because
36672 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
36673 discarded as being the same as a previously handled address. However, a scheme
36674 such as
36675 </para>
36676 <literallayout class="monospaced">
36677 localpart1: |/some/command $local_part
36678 localpart2: |/some/command $local_part
36679 </literallayout>
36680 <para>
36681 does result in two different pipe deliveries, because the immediate parents of
36682 the pipes are distinct.
36683 </para>
36684 </section>
36685 <section id="SECID128">
36686 <title>Repeated redirection expansion</title>
36687 <para>
36688 <indexterm role="concept">
36689 <primary>repeated redirection expansion</primary>
36690 </indexterm>
36691 <indexterm role="concept">
36692 <primary>address redirection</primary>
36693 <secondary>repeated for each delivery attempt</secondary>
36694 </indexterm>
36695 When a message cannot be delivered to all of its recipients immediately,
36696 leading to two or more delivery attempts, redirection expansion is carried out
36697 afresh each time for those addresses whose children were not all previously
36698 delivered. If redirection is being used as a mailing list, this can lead to new
36699 members of the list receiving copies of old messages. The <option>one_time</option> option
36700 can be used to avoid this.
36701 </para>
36702 </section>
36703 <section id="SECID129">
36704 <title>Errors in redirection lists</title>
36705 <para>
36706 <indexterm role="concept">
36707 <primary>address redirection</primary>
36708 <secondary>errors</secondary>
36709 </indexterm>
36710 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
36711 error is skipped, and an entry is written to the main log. This may be useful
36712 for mailing lists that are automatically managed. Otherwise, if an error is
36713 detected while generating the list of new addresses, the original address is
36714 deferred. See also <option>syntax_errors_to</option>.
36715 </para>
36716 </section>
36717 <section id="SECID130">
36718 <title>Private options for the redirect router</title>
36719 <para>
36720 <indexterm role="concept">
36721 <primary>options</primary>
36722 <secondary><command>redirect</command> router</secondary>
36723 </indexterm>
36724 The private options for the <command>redirect</command> router are as follows:
36725 </para>
36726 <para>
36727 <indexterm role="option">
36728 <primary><option>allow_defer</option></primary>
36729 </indexterm>
36730 </para>
36731 <informaltable frame="all">
36732 <tgroup cols="4" colsep="0" rowsep="0">
36733 <colspec colwidth="8*" align="left"/>
36734 <colspec colwidth="6*" align="center"/>
36735 <colspec colwidth="6*" align="center"/>
36736 <colspec colwidth="6*" align="right"/>
36737 <tbody>
36738 <row>
36739 <entry><option>allow_defer</option></entry>
36740 <entry>Use: <emphasis>redirect</emphasis></entry>
36741 <entry>Type: <emphasis>boolean</emphasis></entry>
36742 <entry>Default: <emphasis>false</emphasis></entry>
36743 </row>
36744 </tbody>
36745 </tgroup>
36746 </informaltable>
36747 <para>
36748 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
36749 data, or the <option>defer</option> command in an Exim filter file.
36750 </para>
36751 <para>
36752 <indexterm role="option">
36753 <primary><option>allow_fail</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>allow_fail</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>failing delivery</primary>
36775 <secondary>from filter</secondary>
36776 </indexterm>
36777 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
36778 and the <option>fail</option> command may be used in an Exim filter file.
36779 </para>
36780 <para>
36781 <indexterm role="option">
36782 <primary><option>allow_filter</option></primary>
36783 </indexterm>
36784 </para>
36785 <informaltable frame="all">
36786 <tgroup cols="4" colsep="0" rowsep="0">
36787 <colspec colwidth="8*" align="left"/>
36788 <colspec colwidth="6*" align="center"/>
36789 <colspec colwidth="6*" align="center"/>
36790 <colspec colwidth="6*" align="right"/>
36791 <tbody>
36792 <row>
36793 <entry><option>allow_filter</option></entry>
36794 <entry>Use: <emphasis>redirect</emphasis></entry>
36795 <entry>Type: <emphasis>boolean</emphasis></entry>
36796 <entry>Default: <emphasis>false</emphasis></entry>
36797 </row>
36798 </tbody>
36799 </tgroup>
36800 </informaltable>
36801 <para>
36802 <indexterm role="concept">
36803 <primary>filter</primary>
36804 <secondary>enabling use of</secondary>
36805 </indexterm>
36806 <indexterm role="concept">
36807 <primary>Sieve filter</primary>
36808 <secondary>enabling use of</secondary>
36809 </indexterm>
36810 Setting this option allows Exim to interpret redirection data that starts with
36811 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
36812 are some features of Exim filter files that some administrators may wish to
36813 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
36814 </para>
36815 <para>
36816 It is also possible to lock out Exim filters or Sieve filters while allowing
36817 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
36818 </para>
36819 <para>
36820 The filter is run using the uid and gid set by the generic <option>user</option> and
36821 <option>group</option> options. These take their defaults from the password data if
36822 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
36823 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
36824 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
36825 </para>
36826 <para>
36827 <indexterm role="option">
36828 <primary><option>allow_freeze</option></primary>
36829 </indexterm>
36830 </para>
36831 <informaltable frame="all">
36832 <tgroup cols="4" colsep="0" rowsep="0">
36833 <colspec colwidth="8*" align="left"/>
36834 <colspec colwidth="6*" align="center"/>
36835 <colspec colwidth="6*" align="center"/>
36836 <colspec colwidth="6*" align="right"/>
36837 <tbody>
36838 <row>
36839 <entry><option>allow_freeze</option></entry>
36840 <entry>Use: <emphasis>redirect</emphasis></entry>
36841 <entry>Type: <emphasis>boolean</emphasis></entry>
36842 <entry>Default: <emphasis>false</emphasis></entry>
36843 </row>
36844 </tbody>
36845 </tgroup>
36846 </informaltable>
36847 <para>
36848 <indexterm role="concept">
36849 <primary>freezing messages</primary>
36850 <secondary>allowing in filter</secondary>
36851 </indexterm>
36852 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
36853 This command is more normally encountered in system filters, and is disabled by
36854 default for redirection filters because it isn&#x2019;t something you usually want to
36855 let ordinary users do.
36856 </para>
36857 <para>
36858 <indexterm role="option">
36859 <primary><option>check_ancestor</option></primary>
36860 </indexterm>
36861 </para>
36862 <informaltable frame="all">
36863 <tgroup cols="4" colsep="0" rowsep="0">
36864 <colspec colwidth="8*" align="left"/>
36865 <colspec colwidth="6*" align="center"/>
36866 <colspec colwidth="6*" align="center"/>
36867 <colspec colwidth="6*" align="right"/>
36868 <tbody>
36869 <row>
36870 <entry><option>check_ancestor</option></entry>
36871 <entry>Use: <emphasis>redirect</emphasis></entry>
36872 <entry>Type: <emphasis>boolean</emphasis></entry>
36873 <entry>Default: <emphasis>false</emphasis></entry>
36874 </row>
36875 </tbody>
36876 </tgroup>
36877 </informaltable>
36878 <para>
36879 This option is concerned with handling generated addresses that are the same
36880 as some address in the list of redirection ancestors of the current address.
36881 Although it is turned off by default in the code, it is set in the default
36882 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
36883 for this use of the <command>redirect</command> router.
36884 </para>
36885 <para>
36886 When <option>check_ancestor</option> is set, if a generated address (including the domain)
36887 is the same as any ancestor of the current address, it is replaced by a copy of
36888 the current address. This helps in the case where local part A is aliased to B,
36889 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
36890 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
36891 <filename>&nbsp;jb/.forward</filename> contains:
36892 </para>
36893 <literallayout class="monospaced">
36894 \Joe.Bloggs, &lt;other item(s)&gt;
36895 </literallayout>
36896 <para>
36897 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
36898 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
36899 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
36900 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
36901 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
36902 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
36903 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
36904 original address. See also the <option>repeat_use</option> option below.
36905 </para>
36906 <para>
36907 <indexterm role="option">
36908 <primary><option>check_group</option></primary>
36909 </indexterm>
36910 </para>
36911 <informaltable frame="all">
36912 <tgroup cols="4" colsep="0" rowsep="0">
36913 <colspec colwidth="8*" align="left"/>
36914 <colspec colwidth="6*" align="center"/>
36915 <colspec colwidth="6*" align="center"/>
36916 <colspec colwidth="6*" align="right"/>
36917 <tbody>
36918 <row>
36919 <entry><option>check_group</option></entry>
36920 <entry>Use: <emphasis>redirect</emphasis></entry>
36921 <entry>Type: <emphasis>boolean</emphasis></entry>
36922 <entry>Default: <emphasis>see below</emphasis></entry>
36923 </row>
36924 </tbody>
36925 </tgroup>
36926 </informaltable>
36927 <para>
36928 When the <option>file</option> option is used, the group owner of the file is checked only
36929 when this option is set. The permitted groups are those listed in the
36930 <option>owngroups</option> option, together with the user&#x2019;s default group if
36931 <option>check_local_user</option> is set. If the file has the wrong group, routing is
36932 deferred. The default setting for this option is true if <option>check_local_user</option>
36933 is set and the <option>modemask</option> option permits the group write bit, or if the
36934 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
36935 </para>
36936 <para>
36937 <indexterm role="option">
36938 <primary><option>check_owner</option></primary>
36939 </indexterm>
36940 </para>
36941 <informaltable frame="all">
36942 <tgroup cols="4" colsep="0" rowsep="0">
36943 <colspec colwidth="8*" align="left"/>
36944 <colspec colwidth="6*" align="center"/>
36945 <colspec colwidth="6*" align="center"/>
36946 <colspec colwidth="6*" align="right"/>
36947 <tbody>
36948 <row>
36949 <entry><option>check_owner</option></entry>
36950 <entry>Use: <emphasis>redirect</emphasis></entry>
36951 <entry>Type: <emphasis>boolean</emphasis></entry>
36952 <entry>Default: <emphasis>see below</emphasis></entry>
36953 </row>
36954 </tbody>
36955 </tgroup>
36956 </informaltable>
36957 <para>
36958 When the <option>file</option> option is used, the owner of the file is checked only when
36959 this option is set. If <option>check_local_user</option> is set, the local user is
36960 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
36961 option. The default value for this option is true if <option>check_local_user</option> or
36962 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
36963 </para>
36964 <para>
36965 <indexterm role="option">
36966 <primary><option>data</option></primary>
36967 </indexterm>
36968 </para>
36969 <informaltable frame="all">
36970 <tgroup cols="4" colsep="0" rowsep="0">
36971 <colspec colwidth="8*" align="left"/>
36972 <colspec colwidth="6*" align="center"/>
36973 <colspec colwidth="6*" align="center"/>
36974 <colspec colwidth="6*" align="right"/>
36975 <tbody>
36976 <row>
36977 <entry><option>data</option></entry>
36978 <entry>Use: <emphasis>redirect</emphasis></entry>
36979 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36980 <entry>Default: <emphasis>unset</emphasis></entry>
36981 </row>
36982 </tbody>
36983 </tgroup>
36984 </informaltable>
36985 <para>
36986 This option is mutually exclusive with <option>file</option>. One or other of them must be
36987 set, but not both. The contents of <option>data</option> are expanded, and then used as the
36988 list of forwarding items, or as a set of filtering instructions. If the
36989 expansion is forced to fail, or the result is an empty string or a string that
36990 has no effect (consists entirely of comments), the router declines.
36991 </para>
36992 <para>
36993 When filtering instructions are used, the string must begin with <quote>#Exim
36994 filter</quote>, and all comments in the string, including this initial one, must be
36995 terminated with newline characters. For example:
36996 </para>
36997 <literallayout class="monospaced">
36998 data = #Exim filter\n\
36999        if $h_to: contains Exim then save $home/mail/exim endif
37000 </literallayout>
37001 <para>
37002 If you are reading the data from a database where newlines cannot be included,
37003 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
37004 choice into a newline.
37005 </para>
37006 <para>
37007 <indexterm role="option">
37008 <primary><option>directory_transport</option></primary>
37009 </indexterm>
37010 </para>
37011 <informaltable frame="all">
37012 <tgroup cols="4" colsep="0" rowsep="0">
37013 <colspec colwidth="8*" align="left"/>
37014 <colspec colwidth="6*" align="center"/>
37015 <colspec colwidth="6*" align="center"/>
37016 <colspec colwidth="6*" align="right"/>
37017 <tbody>
37018 <row>
37019 <entry><option>directory_transport</option></entry>
37020 <entry>Use: <emphasis>redirect</emphasis></entry>
37021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37022 <entry>Default: <emphasis>unset</emphasis></entry>
37023 </row>
37024 </tbody>
37025 </tgroup>
37026 </informaltable>
37027 <para>
37028 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
37029 ending with a slash is specified as a new <quote>address</quote>. The transport used is
37030 specified by this option, which, after expansion, must be the name of a
37031 configured transport. This should normally be an <command>appendfile</command> transport.
37032 </para>
37033 <para>
37034 <indexterm role="option">
37035 <primary><option>file</option></primary>
37036 </indexterm>
37037 </para>
37038 <informaltable frame="all">
37039 <tgroup cols="4" colsep="0" rowsep="0">
37040 <colspec colwidth="8*" align="left"/>
37041 <colspec colwidth="6*" align="center"/>
37042 <colspec colwidth="6*" align="center"/>
37043 <colspec colwidth="6*" align="right"/>
37044 <tbody>
37045 <row>
37046 <entry><option>file</option></entry>
37047 <entry>Use: <emphasis>redirect</emphasis></entry>
37048 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37049 <entry>Default: <emphasis>unset</emphasis></entry>
37050 </row>
37051 </tbody>
37052 </tgroup>
37053 </informaltable>
37054 <para>
37055 This option specifies the name of a file that contains the redirection data. It
37056 is mutually exclusive with the <option>data</option> option. The string is expanded before
37057 use; if the expansion is forced to fail, the router declines. Other expansion
37058 failures cause delivery to be deferred. The result of a successful expansion
37059 must be an absolute path. The entire file is read and used as the redirection
37060 data. If the data is an empty string or a string that has no effect (consists
37061 entirely of comments), the router declines.
37062 </para>
37063 <para>
37064 <indexterm role="concept">
37065 <primary>NFS</primary>
37066 <secondary>checking for file existence</secondary>
37067 </indexterm>
37068 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
37069 runs a check on the containing directory,
37070 unless <option>ignore_enotdir</option> is true (see below).
37071 If the directory does not appear to exist, delivery is deferred. This can
37072 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
37073 is a mount problem. If the containing directory does exist, but the file does
37074 not, the router declines.
37075 </para>
37076 <para>
37077 <indexterm role="option">
37078 <primary><option>file_transport</option></primary>
37079 </indexterm>
37080 </para>
37081 <informaltable frame="all">
37082 <tgroup cols="4" colsep="0" rowsep="0">
37083 <colspec colwidth="8*" align="left"/>
37084 <colspec colwidth="6*" align="center"/>
37085 <colspec colwidth="6*" align="center"/>
37086 <colspec colwidth="6*" align="right"/>
37087 <tbody>
37088 <row>
37089 <entry><option>file_transport</option></entry>
37090 <entry>Use: <emphasis>redirect</emphasis></entry>
37091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37092 <entry>Default: <emphasis>unset</emphasis></entry>
37093 </row>
37094 </tbody>
37095 </tgroup>
37096 </informaltable>
37097 <para>
37098 <indexterm role="variable">
37099 <primary><varname>$address_file</varname></primary>
37100 </indexterm>
37101 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
37102 ending in a slash is specified as a new <quote>address</quote>. The transport used is
37103 specified by this option, which, after expansion, must be the name of a
37104 configured transport. This should normally be an <command>appendfile</command> transport. When
37105 it is running, the file name is in <varname>$address_file</varname>.
37106 </para>
37107 <para>
37108 <indexterm role="option">
37109 <primary><option>filter_prepend_home</option></primary>
37110 </indexterm>
37111 </para>
37112 <informaltable frame="all">
37113 <tgroup cols="4" colsep="0" rowsep="0">
37114 <colspec colwidth="8*" align="left"/>
37115 <colspec colwidth="6*" align="center"/>
37116 <colspec colwidth="6*" align="center"/>
37117 <colspec colwidth="6*" align="right"/>
37118 <tbody>
37119 <row>
37120 <entry><option>filter_prepend_home</option></entry>
37121 <entry>Use: <emphasis>redirect</emphasis></entry>
37122 <entry>Type: <emphasis>boolean</emphasis></entry>
37123 <entry>Default: <emphasis>true</emphasis></entry>
37124 </row>
37125 </tbody>
37126 </tgroup>
37127 </informaltable>
37128 <para>
37129 When this option is true, if a <command>save</command> command in an Exim filter specifies a
37130 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
37131 relative path. If this option is set false, this action does not happen. The
37132 relative path is then passed to the transport unmodified.
37133 </para>
37134 <para>
37135 <indexterm role="option">
37136 <primary><option>forbid_blackhole</option></primary>
37137 </indexterm>
37138 </para>
37139 <informaltable frame="all">
37140 <tgroup cols="4" colsep="0" rowsep="0">
37141 <colspec colwidth="8*" align="left"/>
37142 <colspec colwidth="6*" align="center"/>
37143 <colspec colwidth="6*" align="center"/>
37144 <colspec colwidth="6*" align="right"/>
37145 <tbody>
37146 <row>
37147 <entry><option>forbid_blackhole</option></entry>
37148 <entry>Use: <emphasis>redirect</emphasis></entry>
37149 <entry>Type: <emphasis>boolean</emphasis></entry>
37150 <entry>Default: <emphasis>false</emphasis></entry>
37151 </row>
37152 </tbody>
37153 </tgroup>
37154 </informaltable>
37155 <para>
37156 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
37157 redirection list.
37158 </para>
37159 <para>
37160 <indexterm role="option">
37161 <primary><option>forbid_exim_filter</option></primary>
37162 </indexterm>
37163 </para>
37164 <informaltable frame="all">
37165 <tgroup cols="4" colsep="0" rowsep="0">
37166 <colspec colwidth="8*" align="left"/>
37167 <colspec colwidth="6*" align="center"/>
37168 <colspec colwidth="6*" align="center"/>
37169 <colspec colwidth="6*" align="right"/>
37170 <tbody>
37171 <row>
37172 <entry><option>forbid_exim_filter</option></entry>
37173 <entry>Use: <emphasis>redirect</emphasis></entry>
37174 <entry>Type: <emphasis>boolean</emphasis></entry>
37175 <entry>Default: <emphasis>false</emphasis></entry>
37176 </row>
37177 </tbody>
37178 </tgroup>
37179 </informaltable>
37180 <para>
37181 If this option is set true, only Sieve filters are permitted when
37182 <option>allow_filter</option> is true.
37183 </para>
37184 <para>
37185 <indexterm role="option">
37186 <primary><option>forbid_file</option></primary>
37187 </indexterm>
37188 </para>
37189 <informaltable frame="all">
37190 <tgroup cols="4" colsep="0" rowsep="0">
37191 <colspec colwidth="8*" align="left"/>
37192 <colspec colwidth="6*" align="center"/>
37193 <colspec colwidth="6*" align="center"/>
37194 <colspec colwidth="6*" align="right"/>
37195 <tbody>
37196 <row>
37197 <entry><option>forbid_file</option></entry>
37198 <entry>Use: <emphasis>redirect</emphasis></entry>
37199 <entry>Type: <emphasis>boolean</emphasis></entry>
37200 <entry>Default: <emphasis>false</emphasis></entry>
37201 </row>
37202 </tbody>
37203 </tgroup>
37204 </informaltable>
37205 <para>
37206 <indexterm role="concept">
37207 <primary>delivery</primary>
37208 <secondary>to file; forbidding</secondary>
37209 </indexterm>
37210 <indexterm role="concept">
37211 <primary>Sieve filter</primary>
37212 <secondary>forbidding delivery to a file</secondary>
37213 </indexterm>
37214 <indexterm role="concept">
37215 <primary>Sieve filter</primary>
37216 <secondary><quote>keep</quote> facility; disabling</secondary>
37217 </indexterm>
37218 If this option is true, this router may not generate a new address that
37219 specifies delivery to a local file or directory, either from a filter or from a
37220 conventional forward file. This option is forced to be true if <option>one_time</option> is
37221 set. It applies to Sieve filters as well as to Exim filters, but if true, it
37222 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
37223 </para>
37224 <para>
37225 <indexterm role="option">
37226 <primary><option>forbid_filter_dlfunc</option></primary>
37227 </indexterm>
37228 </para>
37229 <informaltable frame="all">
37230 <tgroup cols="4" colsep="0" rowsep="0">
37231 <colspec colwidth="8*" align="left"/>
37232 <colspec colwidth="6*" align="center"/>
37233 <colspec colwidth="6*" align="center"/>
37234 <colspec colwidth="6*" align="right"/>
37235 <tbody>
37236 <row>
37237 <entry><option>forbid_filter_dlfunc</option></entry>
37238 <entry>Use: <emphasis>redirect</emphasis></entry>
37239 <entry>Type: <emphasis>boolean</emphasis></entry>
37240 <entry>Default: <emphasis>false</emphasis></entry>
37241 </row>
37242 </tbody>
37243 </tgroup>
37244 </informaltable>
37245 <para>
37246 <indexterm role="concept">
37247 <primary>filter</primary>
37248 <secondary>locking out certain features</secondary>
37249 </indexterm>
37250 If this option is true, string expansions in Exim filters are not allowed to
37251 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
37252 functions.
37253 </para>
37254 <para>
37255 <indexterm role="option">
37256 <primary><option>forbid_filter_existstest</option></primary>
37257 </indexterm>
37258 </para>
37259 <informaltable frame="all">
37260 <tgroup cols="4" colsep="0" rowsep="0">
37261 <colspec colwidth="8*" align="left"/>
37262 <colspec colwidth="6*" align="center"/>
37263 <colspec colwidth="6*" align="center"/>
37264 <colspec colwidth="6*" align="right"/>
37265 <tbody>
37266 <row>
37267 <entry><option>forbid_filter_existstest</option></entry>
37268 <entry>Use: <emphasis>redirect</emphasis></entry>
37269 <entry>Type: <emphasis>boolean</emphasis></entry>
37270 <entry>Default: <emphasis>false</emphasis></entry>
37271 </row>
37272 </tbody>
37273 </tgroup>
37274 </informaltable>
37275 <para>
37276 <indexterm role="concept">
37277 <primary>expansion</primary>
37278 <secondary>statting a file</secondary>
37279 </indexterm>
37280 If this option is true, string expansions in Exim filters are not allowed to
37281 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
37282 </para>
37283 <para>
37284 <indexterm role="option">
37285 <primary><option>forbid_filter_logwrite</option></primary>
37286 </indexterm>
37287 </para>
37288 <informaltable frame="all">
37289 <tgroup cols="4" colsep="0" rowsep="0">
37290 <colspec colwidth="8*" align="left"/>
37291 <colspec colwidth="6*" align="center"/>
37292 <colspec colwidth="6*" align="center"/>
37293 <colspec colwidth="6*" align="right"/>
37294 <tbody>
37295 <row>
37296 <entry><option>forbid_filter_logwrite</option></entry>
37297 <entry>Use: <emphasis>redirect</emphasis></entry>
37298 <entry>Type: <emphasis>boolean</emphasis></entry>
37299 <entry>Default: <emphasis>false</emphasis></entry>
37300 </row>
37301 </tbody>
37302 </tgroup>
37303 </informaltable>
37304 <para>
37305 If this option is true, use of the logging facility in Exim filters is not
37306 permitted. Logging is in any case available only if the filter is being run
37307 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
37308 <filename>.forward</filename> files).
37309 </para>
37310 <para>
37311 <indexterm role="option">
37312 <primary><option>forbid_filter_lookup</option></primary>
37313 </indexterm>
37314 </para>
37315 <informaltable frame="all">
37316 <tgroup cols="4" colsep="0" rowsep="0">
37317 <colspec colwidth="8*" align="left"/>
37318 <colspec colwidth="6*" align="center"/>
37319 <colspec colwidth="6*" align="center"/>
37320 <colspec colwidth="6*" align="right"/>
37321 <tbody>
37322 <row>
37323 <entry><option>forbid_filter_lookup</option></entry>
37324 <entry>Use: <emphasis>redirect</emphasis></entry>
37325 <entry>Type: <emphasis>boolean</emphasis></entry>
37326 <entry>Default: <emphasis>false</emphasis></entry>
37327 </row>
37328 </tbody>
37329 </tgroup>
37330 </informaltable>
37331 <para>
37332 If this option is true, string expansions in Exim filter files are not allowed
37333 to make use of <option>lookup</option> items.
37334 </para>
37335 <para>
37336 <indexterm role="option">
37337 <primary><option>forbid_filter_perl</option></primary>
37338 </indexterm>
37339 </para>
37340 <informaltable frame="all">
37341 <tgroup cols="4" colsep="0" rowsep="0">
37342 <colspec colwidth="8*" align="left"/>
37343 <colspec colwidth="6*" align="center"/>
37344 <colspec colwidth="6*" align="center"/>
37345 <colspec colwidth="6*" align="right"/>
37346 <tbody>
37347 <row>
37348 <entry><option>forbid_filter_perl</option></entry>
37349 <entry>Use: <emphasis>redirect</emphasis></entry>
37350 <entry>Type: <emphasis>boolean</emphasis></entry>
37351 <entry>Default: <emphasis>false</emphasis></entry>
37352 </row>
37353 </tbody>
37354 </tgroup>
37355 </informaltable>
37356 <para>
37357 This option has an effect only if Exim is built with embedded Perl support. If
37358 it is true, string expansions in Exim filter files are not allowed to make use
37359 of the embedded Perl support.
37360 </para>
37361 <para>
37362 <indexterm role="option">
37363 <primary><option>forbid_filter_readfile</option></primary>
37364 </indexterm>
37365 </para>
37366 <informaltable frame="all">
37367 <tgroup cols="4" colsep="0" rowsep="0">
37368 <colspec colwidth="8*" align="left"/>
37369 <colspec colwidth="6*" align="center"/>
37370 <colspec colwidth="6*" align="center"/>
37371 <colspec colwidth="6*" align="right"/>
37372 <tbody>
37373 <row>
37374 <entry><option>forbid_filter_readfile</option></entry>
37375 <entry>Use: <emphasis>redirect</emphasis></entry>
37376 <entry>Type: <emphasis>boolean</emphasis></entry>
37377 <entry>Default: <emphasis>false</emphasis></entry>
37378 </row>
37379 </tbody>
37380 </tgroup>
37381 </informaltable>
37382 <para>
37383 If this option is true, string expansions in Exim filter files are not allowed
37384 to make use of <option>readfile</option> items.
37385 </para>
37386 <para>
37387 <indexterm role="option">
37388 <primary><option>forbid_filter_readsocket</option></primary>
37389 </indexterm>
37390 </para>
37391 <informaltable frame="all">
37392 <tgroup cols="4" colsep="0" rowsep="0">
37393 <colspec colwidth="8*" align="left"/>
37394 <colspec colwidth="6*" align="center"/>
37395 <colspec colwidth="6*" align="center"/>
37396 <colspec colwidth="6*" align="right"/>
37397 <tbody>
37398 <row>
37399 <entry><option>forbid_filter_readsocket</option></entry>
37400 <entry>Use: <emphasis>redirect</emphasis></entry>
37401 <entry>Type: <emphasis>boolean</emphasis></entry>
37402 <entry>Default: <emphasis>false</emphasis></entry>
37403 </row>
37404 </tbody>
37405 </tgroup>
37406 </informaltable>
37407 <para>
37408 If this option is true, string expansions in Exim filter files are not allowed
37409 to make use of <option>readsocket</option> items.
37410 </para>
37411 <para>
37412 <indexterm role="option">
37413 <primary><option>forbid_filter_reply</option></primary>
37414 </indexterm>
37415 </para>
37416 <informaltable frame="all">
37417 <tgroup cols="4" colsep="0" rowsep="0">
37418 <colspec colwidth="8*" align="left"/>
37419 <colspec colwidth="6*" align="center"/>
37420 <colspec colwidth="6*" align="center"/>
37421 <colspec colwidth="6*" align="right"/>
37422 <tbody>
37423 <row>
37424 <entry><option>forbid_filter_reply</option></entry>
37425 <entry>Use: <emphasis>redirect</emphasis></entry>
37426 <entry>Type: <emphasis>boolean</emphasis></entry>
37427 <entry>Default: <emphasis>false</emphasis></entry>
37428 </row>
37429 </tbody>
37430 </tgroup>
37431 </informaltable>
37432 <para>
37433 If this option is true, this router may not generate an automatic reply
37434 message. Automatic replies can be generated only from Exim or Sieve filter
37435 files, not from traditional forward files. This option is forced to be true if
37436 <option>one_time</option> is set.
37437 </para>
37438 <para>
37439 <indexterm role="option">
37440 <primary><option>forbid_filter_run</option></primary>
37441 </indexterm>
37442 </para>
37443 <informaltable frame="all">
37444 <tgroup cols="4" colsep="0" rowsep="0">
37445 <colspec colwidth="8*" align="left"/>
37446 <colspec colwidth="6*" align="center"/>
37447 <colspec colwidth="6*" align="center"/>
37448 <colspec colwidth="6*" align="right"/>
37449 <tbody>
37450 <row>
37451 <entry><option>forbid_filter_run</option></entry>
37452 <entry>Use: <emphasis>redirect</emphasis></entry>
37453 <entry>Type: <emphasis>boolean</emphasis></entry>
37454 <entry>Default: <emphasis>false</emphasis></entry>
37455 </row>
37456 </tbody>
37457 </tgroup>
37458 </informaltable>
37459 <para>
37460 If this option is true, string expansions in Exim filter files are not allowed
37461 to make use of <option>run</option> items.
37462 </para>
37463 <para>
37464 <indexterm role="option">
37465 <primary><option>forbid_include</option></primary>
37466 </indexterm>
37467 </para>
37468 <informaltable frame="all">
37469 <tgroup cols="4" colsep="0" rowsep="0">
37470 <colspec colwidth="8*" align="left"/>
37471 <colspec colwidth="6*" align="center"/>
37472 <colspec colwidth="6*" align="center"/>
37473 <colspec colwidth="6*" align="right"/>
37474 <tbody>
37475 <row>
37476 <entry><option>forbid_include</option></entry>
37477 <entry>Use: <emphasis>redirect</emphasis></entry>
37478 <entry>Type: <emphasis>boolean</emphasis></entry>
37479 <entry>Default: <emphasis>false</emphasis></entry>
37480 </row>
37481 </tbody>
37482 </tgroup>
37483 </informaltable>
37484 <para>
37485 If this option is true, items of the form
37486 </para>
37487 <literallayout class="monospaced">
37488 :include:&lt;path name&gt;
37489 </literallayout>
37490 <para>
37491 are not permitted in non-filter redirection lists.
37492 </para>
37493 <para>
37494 <indexterm role="option">
37495 <primary><option>forbid_pipe</option></primary>
37496 </indexterm>
37497 </para>
37498 <informaltable frame="all">
37499 <tgroup cols="4" colsep="0" rowsep="0">
37500 <colspec colwidth="8*" align="left"/>
37501 <colspec colwidth="6*" align="center"/>
37502 <colspec colwidth="6*" align="center"/>
37503 <colspec colwidth="6*" align="right"/>
37504 <tbody>
37505 <row>
37506 <entry><option>forbid_pipe</option></entry>
37507 <entry>Use: <emphasis>redirect</emphasis></entry>
37508 <entry>Type: <emphasis>boolean</emphasis></entry>
37509 <entry>Default: <emphasis>false</emphasis></entry>
37510 </row>
37511 </tbody>
37512 </tgroup>
37513 </informaltable>
37514 <para>
37515 <indexterm role="concept">
37516 <primary>delivery</primary>
37517 <secondary>to pipe; forbidding</secondary>
37518 </indexterm>
37519 If this option is true, this router may not generate a new address which
37520 specifies delivery to a pipe, either from an Exim filter or from a conventional
37521 forward file. This option is forced to be true if <option>one_time</option> is set.
37522 </para>
37523 <para>
37524 <indexterm role="option">
37525 <primary><option>forbid_sieve_filter</option></primary>
37526 </indexterm>
37527 </para>
37528 <informaltable frame="all">
37529 <tgroup cols="4" colsep="0" rowsep="0">
37530 <colspec colwidth="8*" align="left"/>
37531 <colspec colwidth="6*" align="center"/>
37532 <colspec colwidth="6*" align="center"/>
37533 <colspec colwidth="6*" align="right"/>
37534 <tbody>
37535 <row>
37536 <entry><option>forbid_sieve_filter</option></entry>
37537 <entry>Use: <emphasis>redirect</emphasis></entry>
37538 <entry>Type: <emphasis>boolean</emphasis></entry>
37539 <entry>Default: <emphasis>false</emphasis></entry>
37540 </row>
37541 </tbody>
37542 </tgroup>
37543 </informaltable>
37544 <para>
37545 If this option is set true, only Exim filters are permitted when
37546 <option>allow_filter</option> is true.
37547 </para>
37548 <para>
37549 <indexterm role="concept">
37550 <primary>SMTP</primary>
37551 <secondary>error codes</secondary>
37552 </indexterm>
37553 <indexterm role="option">
37554 <primary><option>forbid_smtp_code</option></primary>
37555 </indexterm>
37556 </para>
37557 <informaltable frame="all">
37558 <tgroup cols="4" colsep="0" rowsep="0">
37559 <colspec colwidth="8*" align="left"/>
37560 <colspec colwidth="6*" align="center"/>
37561 <colspec colwidth="6*" align="center"/>
37562 <colspec colwidth="6*" align="right"/>
37563 <tbody>
37564 <row>
37565 <entry><option>forbid_smtp_code</option></entry>
37566 <entry>Use: <emphasis>redirect</emphasis></entry>
37567 <entry>Type: <emphasis>boolean</emphasis></entry>
37568 <entry>Default: <emphasis>false</emphasis></entry>
37569 </row>
37570 </tbody>
37571 </tgroup>
37572 </informaltable>
37573 <para>
37574 If this option is set true, any SMTP error codes that are present at the start
37575 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
37576 the default codes (451 and 550, respectively) are always used.
37577 </para>
37578 <para>
37579 <indexterm role="option">
37580 <primary><option>hide_child_in_errmsg</option></primary>
37581 </indexterm>
37582 </para>
37583 <informaltable frame="all">
37584 <tgroup cols="4" colsep="0" rowsep="0">
37585 <colspec colwidth="8*" align="left"/>
37586 <colspec colwidth="6*" align="center"/>
37587 <colspec colwidth="6*" align="center"/>
37588 <colspec colwidth="6*" align="right"/>
37589 <tbody>
37590 <row>
37591 <entry><option>hide_child_in_errmsg</option></entry>
37592 <entry>Use: <emphasis>redirect</emphasis></entry>
37593 <entry>Type: <emphasis>boolean</emphasis></entry>
37594 <entry>Default: <emphasis>false</emphasis></entry>
37595 </row>
37596 </tbody>
37597 </tgroup>
37598 </informaltable>
37599 <para>
37600 <indexterm role="concept">
37601 <primary>bounce message</primary>
37602 <secondary>redirection details; suppressing</secondary>
37603 </indexterm>
37604 If this option is true, it prevents Exim from quoting a child address if it
37605 generates a bounce or delay message for it. Instead it says <quote>an address
37606 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
37607 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
37608 bounce may well quote the generated address.
37609 </para>
37610 <para>
37611 <indexterm role="option">
37612 <primary><option>ignore_eacces</option></primary>
37613 </indexterm>
37614 </para>
37615 <informaltable frame="all">
37616 <tgroup cols="4" colsep="0" rowsep="0">
37617 <colspec colwidth="8*" align="left"/>
37618 <colspec colwidth="6*" align="center"/>
37619 <colspec colwidth="6*" align="center"/>
37620 <colspec colwidth="6*" align="right"/>
37621 <tbody>
37622 <row>
37623 <entry><option>ignore_eacces</option></entry>
37624 <entry>Use: <emphasis>redirect</emphasis></entry>
37625 <entry>Type: <emphasis>boolean</emphasis></entry>
37626 <entry>Default: <emphasis>false</emphasis></entry>
37627 </row>
37628 </tbody>
37629 </tgroup>
37630 </informaltable>
37631 <para>
37632 <indexterm role="concept">
37633 <primary>EACCES</primary>
37634 </indexterm>
37635 If this option is set and an attempt to open a redirection file yields the
37636 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
37637 file did not exist.
37638 </para>
37639 <para>
37640 <indexterm role="option">
37641 <primary><option>ignore_enotdir</option></primary>
37642 </indexterm>
37643 </para>
37644 <informaltable frame="all">
37645 <tgroup cols="4" colsep="0" rowsep="0">
37646 <colspec colwidth="8*" align="left"/>
37647 <colspec colwidth="6*" align="center"/>
37648 <colspec colwidth="6*" align="center"/>
37649 <colspec colwidth="6*" align="right"/>
37650 <tbody>
37651 <row>
37652 <entry><option>ignore_enotdir</option></entry>
37653 <entry>Use: <emphasis>redirect</emphasis></entry>
37654 <entry>Type: <emphasis>boolean</emphasis></entry>
37655 <entry>Default: <emphasis>false</emphasis></entry>
37656 </row>
37657 </tbody>
37658 </tgroup>
37659 </informaltable>
37660 <para>
37661 <indexterm role="concept">
37662 <primary>ENOTDIR</primary>
37663 </indexterm>
37664 If this option is set and an attempt to open a redirection file yields the
37665 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
37666 router behaves as if the file did not exist.
37667 </para>
37668 <para>
37669 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
37670 router that has the <option>file</option> option set discovers that the file does not exist
37671 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
37672 against unmounted NFS directories. If the parent can not be statted, delivery
37673 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
37674 is set, because that option tells Exim to ignore <quote>something on the path is not
37675 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
37676 that some operating systems give ENOENT where others give ENOTDIR.
37677 </para>
37678 <para>
37679 <indexterm role="option">
37680 <primary><option>include_directory</option></primary>
37681 </indexterm>
37682 </para>
37683 <informaltable frame="all">
37684 <tgroup cols="4" colsep="0" rowsep="0">
37685 <colspec colwidth="8*" align="left"/>
37686 <colspec colwidth="6*" align="center"/>
37687 <colspec colwidth="6*" align="center"/>
37688 <colspec colwidth="6*" align="right"/>
37689 <tbody>
37690 <row>
37691 <entry><option>include_directory</option></entry>
37692 <entry>Use: <emphasis>redirect</emphasis></entry>
37693 <entry>Type: <emphasis>string</emphasis></entry>
37694 <entry>Default: <emphasis>unset</emphasis></entry>
37695 </row>
37696 </tbody>
37697 </tgroup>
37698 </informaltable>
37699 <para>
37700 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
37701 redirection list must start with this directory.
37702 </para>
37703 <para>
37704 <indexterm role="option">
37705 <primary><option>modemask</option></primary>
37706 </indexterm>
37707 </para>
37708 <informaltable frame="all">
37709 <tgroup cols="4" colsep="0" rowsep="0">
37710 <colspec colwidth="8*" align="left"/>
37711 <colspec colwidth="6*" align="center"/>
37712 <colspec colwidth="6*" align="center"/>
37713 <colspec colwidth="6*" align="right"/>
37714 <tbody>
37715 <row>
37716 <entry><option>modemask</option></entry>
37717 <entry>Use: <emphasis>redirect</emphasis></entry>
37718 <entry>Type: <emphasis>octal integer</emphasis></entry>
37719 <entry>Default: <emphasis>022</emphasis></entry>
37720 </row>
37721 </tbody>
37722 </tgroup>
37723 </informaltable>
37724 <para>
37725 This specifies mode bits which must not be set for a file specified by the
37726 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
37727 </para>
37728 <para>
37729 <indexterm role="option">
37730 <primary><option>one_time</option></primary>
37731 </indexterm>
37732 </para>
37733 <informaltable frame="all">
37734 <tgroup cols="4" colsep="0" rowsep="0">
37735 <colspec colwidth="8*" align="left"/>
37736 <colspec colwidth="6*" align="center"/>
37737 <colspec colwidth="6*" align="center"/>
37738 <colspec colwidth="6*" align="right"/>
37739 <tbody>
37740 <row>
37741 <entry><option>one_time</option></entry>
37742 <entry>Use: <emphasis>redirect</emphasis></entry>
37743 <entry>Type: <emphasis>boolean</emphasis></entry>
37744 <entry>Default: <emphasis>false</emphasis></entry>
37745 </row>
37746 </tbody>
37747 </tgroup>
37748 </informaltable>
37749 <para>
37750 <indexterm role="concept">
37751 <primary>one-time aliasing/forwarding expansion</primary>
37752 </indexterm>
37753 <indexterm role="concept">
37754 <primary>alias file</primary>
37755 <secondary>one-time expansion</secondary>
37756 </indexterm>
37757 <indexterm role="concept">
37758 <primary>forward file</primary>
37759 <secondary>one-time expansion</secondary>
37760 </indexterm>
37761 <indexterm role="concept">
37762 <primary>mailing lists</primary>
37763 <secondary>one-time expansion</secondary>
37764 </indexterm>
37765 <indexterm role="concept">
37766 <primary>address redirection</primary>
37767 <secondary>one-time expansion</secondary>
37768 </indexterm>
37769 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
37770 files each time it tries to deliver a message causes a problem when one or more
37771 of the generated addresses fails be delivered at the first attempt. The problem
37772 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
37773 but of what happens when the redirection list changes during the time that the
37774 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
37775 lists, where new subscribers might receive copies of messages that were posted
37776 before they subscribed.
37777 </para>
37778 <para>
37779 If <option>one_time</option> is set and any addresses generated by the router fail to
37780 deliver at the first attempt, the failing addresses are added to the message as
37781 <quote>top level</quote> addresses, and the parent address that generated them is marked
37782 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
37783 attempt.
37784 </para>
37785 <para>
37786 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
37787 router would be lost if delivery did not succeed at the first attempt. For this
37788 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
37789 permitted when <option>one_time</option> is set.
37790 </para>
37791 <para>
37792 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
37793 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
37794 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
37795 </para>
37796 <para>
37797 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
37798 <option>one_time</option>.
37799 </para>
37800 <para>
37801 The original top-level address is remembered with each of the generated
37802 addresses, and is output in any log messages. However, any intermediate parent
37803 addresses are not recorded. This makes a difference to the log only if
37804 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
37805 typically be used for mailing lists, where there is normally just one level of
37806 expansion.
37807 </para>
37808 <para>
37809 <indexterm role="option">
37810 <primary><option>owners</option></primary>
37811 </indexterm>
37812 </para>
37813 <informaltable frame="all">
37814 <tgroup cols="4" colsep="0" rowsep="0">
37815 <colspec colwidth="8*" align="left"/>
37816 <colspec colwidth="6*" align="center"/>
37817 <colspec colwidth="6*" align="center"/>
37818 <colspec colwidth="6*" align="right"/>
37819 <tbody>
37820 <row>
37821 <entry><option>owners</option></entry>
37822 <entry>Use: <emphasis>redirect</emphasis></entry>
37823 <entry>Type: <emphasis>string list</emphasis></entry>
37824 <entry>Default: <emphasis>unset</emphasis></entry>
37825 </row>
37826 </tbody>
37827 </tgroup>
37828 </informaltable>
37829 <para>
37830 <indexterm role="concept">
37831 <primary>ownership</primary>
37832 <secondary>alias file</secondary>
37833 </indexterm>
37834 <indexterm role="concept">
37835 <primary>ownership</primary>
37836 <secondary>forward file</secondary>
37837 </indexterm>
37838 <indexterm role="concept">
37839 <primary>alias file</primary>
37840 <secondary>ownership</secondary>
37841 </indexterm>
37842 <indexterm role="concept">
37843 <primary>forward file</primary>
37844 <secondary>ownership</secondary>
37845 </indexterm>
37846 This specifies a list of permitted owners for the file specified by <option>file</option>.
37847 This list is in addition to the local user when <option>check_local_user</option> is set.
37848 See <option>check_owner</option> above.
37849 </para>
37850 <para>
37851 <indexterm role="option">
37852 <primary><option>owngroups</option></primary>
37853 </indexterm>
37854 </para>
37855 <informaltable frame="all">
37856 <tgroup cols="4" colsep="0" rowsep="0">
37857 <colspec colwidth="8*" align="left"/>
37858 <colspec colwidth="6*" align="center"/>
37859 <colspec colwidth="6*" align="center"/>
37860 <colspec colwidth="6*" align="right"/>
37861 <tbody>
37862 <row>
37863 <entry><option>owngroups</option></entry>
37864 <entry>Use: <emphasis>redirect</emphasis></entry>
37865 <entry>Type: <emphasis>string list</emphasis></entry>
37866 <entry>Default: <emphasis>unset</emphasis></entry>
37867 </row>
37868 </tbody>
37869 </tgroup>
37870 </informaltable>
37871 <para>
37872 This specifies a list of permitted groups for the file specified by <option>file</option>.
37873 The list is in addition to the local user&#x2019;s primary group when
37874 <option>check_local_user</option> is set. See <option>check_group</option> above.
37875 </para>
37876 <para>
37877 <indexterm role="option">
37878 <primary><option>pipe_transport</option></primary>
37879 </indexterm>
37880 </para>
37881 <informaltable frame="all">
37882 <tgroup cols="4" colsep="0" rowsep="0">
37883 <colspec colwidth="8*" align="left"/>
37884 <colspec colwidth="6*" align="center"/>
37885 <colspec colwidth="6*" align="center"/>
37886 <colspec colwidth="6*" align="right"/>
37887 <tbody>
37888 <row>
37889 <entry><option>pipe_transport</option></entry>
37890 <entry>Use: <emphasis>redirect</emphasis></entry>
37891 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37892 <entry>Default: <emphasis>unset</emphasis></entry>
37893 </row>
37894 </tbody>
37895 </tgroup>
37896 </informaltable>
37897 <para>
37898 <indexterm role="variable">
37899 <primary><varname>$address_pipe</varname></primary>
37900 </indexterm>
37901 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
37902 starting with a vertical bar character is specified as a new <quote>address</quote>. The
37903 transport used is specified by this option, which, after expansion, must be the
37904 name of a configured transport. This should normally be a <command>pipe</command> transport.
37905 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
37906 </para>
37907 <para>
37908 <indexterm role="option">
37909 <primary><option>qualify_domain</option></primary>
37910 </indexterm>
37911 </para>
37912 <informaltable frame="all">
37913 <tgroup cols="4" colsep="0" rowsep="0">
37914 <colspec colwidth="8*" align="left"/>
37915 <colspec colwidth="6*" align="center"/>
37916 <colspec colwidth="6*" align="center"/>
37917 <colspec colwidth="6*" align="right"/>
37918 <tbody>
37919 <row>
37920 <entry><option>qualify_domain</option></entry>
37921 <entry>Use: <emphasis>redirect</emphasis></entry>
37922 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37923 <entry>Default: <emphasis>unset</emphasis></entry>
37924 </row>
37925 </tbody>
37926 </tgroup>
37927 </informaltable>
37928 <para>
37929 <indexterm role="variable">
37930 <primary><varname>$qualify_recipient</varname></primary>
37931 </indexterm>
37932 If this option is set, and an unqualified address (one without a domain) is
37933 generated, and that address would normally be qualified by the global setting
37934 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
37935 expanding this string. If the expansion fails, the router declines. If you want
37936 to revert to the default, you can have the expansion generate
37937 <varname>$qualify_recipient</varname>.
37938 </para>
37939 <para>
37940 This option applies to all unqualified addresses generated by Exim filters,
37941 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
37942 not preceded by a backslash. Sieve filters cannot generate unqualified
37943 addresses.
37944 </para>
37945 <para>
37946 <indexterm role="option">
37947 <primary><option>qualify_preserve_domain</option></primary>
37948 </indexterm>
37949 </para>
37950 <informaltable frame="all">
37951 <tgroup cols="4" colsep="0" rowsep="0">
37952 <colspec colwidth="8*" align="left"/>
37953 <colspec colwidth="6*" align="center"/>
37954 <colspec colwidth="6*" align="center"/>
37955 <colspec colwidth="6*" align="right"/>
37956 <tbody>
37957 <row>
37958 <entry><option>qualify_preserve_domain</option></entry>
37959 <entry>Use: <emphasis>redirect</emphasis></entry>
37960 <entry>Type: <emphasis>boolean</emphasis></entry>
37961 <entry>Default: <emphasis>false</emphasis></entry>
37962 </row>
37963 </tbody>
37964 </tgroup>
37965 </informaltable>
37966 <para>
37967 <indexterm role="concept">
37968 <primary>domain</primary>
37969 <secondary>in redirection; preserving</secondary>
37970 </indexterm>
37971 <indexterm role="concept">
37972 <primary>preserving domain in redirection</primary>
37973 </indexterm>
37974 <indexterm role="concept">
37975 <primary>address redirection</primary>
37976 <secondary>domain; preserving</secondary>
37977 </indexterm>
37978 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
37979 set (a configuration error occurs if it is). If an unqualified address (one
37980 without a domain) is generated, it is qualified with the domain of the parent
37981 address (the immediately preceding ancestor) instead of the global
37982 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
37983 this applies whether or not the address is preceded by a backslash.
37984 </para>
37985 <para>
37986 <indexterm role="option">
37987 <primary><option>repeat_use</option></primary>
37988 </indexterm>
37989 </para>
37990 <informaltable frame="all">
37991 <tgroup cols="4" colsep="0" rowsep="0">
37992 <colspec colwidth="8*" align="left"/>
37993 <colspec colwidth="6*" align="center"/>
37994 <colspec colwidth="6*" align="center"/>
37995 <colspec colwidth="6*" align="right"/>
37996 <tbody>
37997 <row>
37998 <entry><option>repeat_use</option></entry>
37999 <entry>Use: <emphasis>redirect</emphasis></entry>
38000 <entry>Type: <emphasis>boolean</emphasis></entry>
38001 <entry>Default: <emphasis>true</emphasis></entry>
38002 </row>
38003 </tbody>
38004 </tgroup>
38005 </informaltable>
38006 <para>
38007 If this option is set false, the router is skipped for a child address that has
38008 any ancestor that was routed by this router. This test happens before any of
38009 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
38010 only when the ancestor is the same as the current address. See also
38011 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
38012 </para>
38013 <para>
38014 <indexterm role="option">
38015 <primary><option>reply_transport</option></primary>
38016 </indexterm>
38017 </para>
38018 <informaltable frame="all">
38019 <tgroup cols="4" colsep="0" rowsep="0">
38020 <colspec colwidth="8*" align="left"/>
38021 <colspec colwidth="6*" align="center"/>
38022 <colspec colwidth="6*" align="center"/>
38023 <colspec colwidth="6*" align="right"/>
38024 <tbody>
38025 <row>
38026 <entry><option>reply_transport</option></entry>
38027 <entry>Use: <emphasis>redirect</emphasis></entry>
38028 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38029 <entry>Default: <emphasis>unset</emphasis></entry>
38030 </row>
38031 </tbody>
38032 </tgroup>
38033 </informaltable>
38034 <para>
38035 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
38036 <option>vacation</option> command is used in a filter file. The transport used is specified
38037 by this option, which, after expansion, must be the name of a configured
38038 transport. This should normally be an <command>autoreply</command> transport. Other transports
38039 are unlikely to do anything sensible or useful.
38040 </para>
38041 <para>
38042 <indexterm role="option">
38043 <primary><option>rewrite</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>rewrite</option></entry>
38055 <entry>Use: <emphasis>redirect</emphasis></entry>
38056 <entry>Type: <emphasis>boolean</emphasis></entry>
38057 <entry>Default: <emphasis>true</emphasis></entry>
38058 </row>
38059 </tbody>
38060 </tgroup>
38061 </informaltable>
38062 <para>
38063 <indexterm role="concept">
38064 <primary>address redirection</primary>
38065 <secondary>disabling rewriting</secondary>
38066 </indexterm>
38067 If this option is set false, addresses generated by the router are not
38068 subject to address rewriting. Otherwise, they are treated like new addresses
38069 and are rewritten according to the global rewriting rules.
38070 </para>
38071 <para>
38072 <indexterm role="option">
38073 <primary><option>sieve_subaddress</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>sieve_subaddress</option></entry>
38085 <entry>Use: <emphasis>redirect</emphasis></entry>
38086 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38087 <entry>Default: <emphasis>unset</emphasis></entry>
38088 </row>
38089 </tbody>
38090 </tgroup>
38091 </informaltable>
38092 <para>
38093 The value of this option is passed to a Sieve filter to specify the
38094 :subaddress part of an address.
38095 </para>
38096 <para>
38097 <indexterm role="option">
38098 <primary><option>sieve_useraddress</option></primary>
38099 </indexterm>
38100 </para>
38101 <informaltable frame="all">
38102 <tgroup cols="4" colsep="0" rowsep="0">
38103 <colspec colwidth="8*" align="left"/>
38104 <colspec colwidth="6*" align="center"/>
38105 <colspec colwidth="6*" align="center"/>
38106 <colspec colwidth="6*" align="right"/>
38107 <tbody>
38108 <row>
38109 <entry><option>sieve_useraddress</option></entry>
38110 <entry>Use: <emphasis>redirect</emphasis></entry>
38111 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38112 <entry>Default: <emphasis>unset</emphasis></entry>
38113 </row>
38114 </tbody>
38115 </tgroup>
38116 </informaltable>
38117 <para>
38118 The value of this option is passed to a Sieve filter to specify the :user part
38119 of an address. However, if it is unset, the entire original local part
38120 (including any prefix or suffix) is used for :user.
38121 </para>
38122 <para>
38123 <indexterm role="option">
38124 <primary><option>sieve_vacation_directory</option></primary>
38125 </indexterm>
38126 </para>
38127 <informaltable frame="all">
38128 <tgroup cols="4" colsep="0" rowsep="0">
38129 <colspec colwidth="8*" align="left"/>
38130 <colspec colwidth="6*" align="center"/>
38131 <colspec colwidth="6*" align="center"/>
38132 <colspec colwidth="6*" align="right"/>
38133 <tbody>
38134 <row>
38135 <entry><option>sieve_vacation_directory</option></entry>
38136 <entry>Use: <emphasis>redirect</emphasis></entry>
38137 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38138 <entry>Default: <emphasis>unset</emphasis></entry>
38139 </row>
38140 </tbody>
38141 </tgroup>
38142 </informaltable>
38143 <para>
38144 <indexterm role="concept">
38145 <primary>Sieve filter</primary>
38146 <secondary>vacation directory</secondary>
38147 </indexterm>
38148 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
38149 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
38150 (do not put anything else in that directory), and ensure that the
38151 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
38152 needs their own directory; Exim will create it if necessary.
38153 </para>
38154 <para>
38155 <indexterm role="option">
38156 <primary><option>skip_syntax_errors</option></primary>
38157 </indexterm>
38158 </para>
38159 <informaltable frame="all">
38160 <tgroup cols="4" colsep="0" rowsep="0">
38161 <colspec colwidth="8*" align="left"/>
38162 <colspec colwidth="6*" align="center"/>
38163 <colspec colwidth="6*" align="center"/>
38164 <colspec colwidth="6*" align="right"/>
38165 <tbody>
38166 <row>
38167 <entry><option>skip_syntax_errors</option></entry>
38168 <entry>Use: <emphasis>redirect</emphasis></entry>
38169 <entry>Type: <emphasis>boolean</emphasis></entry>
38170 <entry>Default: <emphasis>false</emphasis></entry>
38171 </row>
38172 </tbody>
38173 </tgroup>
38174 </informaltable>
38175 <para>
38176 <indexterm role="concept">
38177 <primary>forward file</primary>
38178 <secondary>broken</secondary>
38179 </indexterm>
38180 <indexterm role="concept">
38181 <primary>address redirection</primary>
38182 <secondary>broken files</secondary>
38183 </indexterm>
38184 <indexterm role="concept">
38185 <primary>alias file</primary>
38186 <secondary>broken</secondary>
38187 </indexterm>
38188 <indexterm role="concept">
38189 <primary>broken alias or forward files</primary>
38190 </indexterm>
38191 <indexterm role="concept">
38192 <primary>ignoring faulty addresses</primary>
38193 </indexterm>
38194 <indexterm role="concept">
38195 <primary>skipping faulty addresses</primary>
38196 </indexterm>
38197 <indexterm role="concept">
38198 <primary>error</primary>
38199 <secondary>skipping bad syntax</secondary>
38200 </indexterm>
38201 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
38202 non-filter redirection data are skipped, and each failing address is logged. If
38203 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
38204 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
38205 are expanded and placed at the head of the error message generated by
38206 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
38207 be the same address as the generic <option>errors_to</option> option. The
38208 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
38209 </para>
38210 <para>
38211 If all the addresses in a redirection list are skipped because of syntax
38212 errors, the router declines to handle the original address, and it is passed to
38213 the following routers.
38214 </para>
38215 <para>
38216 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
38217 error in the filter causes filtering to be abandoned without any action being
38218 taken. The incident is logged, and the router declines to handle the address,
38219 so it is passed to the following routers.
38220 </para>
38221 <para>
38222 <indexterm role="concept">
38223 <primary>Sieve filter</primary>
38224 <secondary>syntax errors in</secondary>
38225 </indexterm>
38226 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
38227 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
38228 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
38229 </para>
38230 <para>
38231 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
38232 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
38233 option, used with an address that does not get redirected, can be used to
38234 notify users of these errors, by means of a router like this:
38235 </para>
38236 <literallayout class="monospaced">
38237 userforward:
38238   driver = redirect
38239   allow_filter
38240   check_local_user
38241   file = $home/.forward
38242   file_transport = address_file
38243   pipe_transport = address_pipe
38244   reply_transport = address_reply
38245   no_verify
38246   skip_syntax_errors
38247   syntax_errors_to = real-$local_part@$domain
38248   syntax_errors_text = \
38249    This is an automatically generated message. An error has\n\
38250    been found in your .forward file. Details of the error are\n\
38251    reported below. While this error persists, you will receive\n\
38252    a copy of this message for every message that is addressed\n\
38253    to you. If your .forward file is a filter file, or if it is\n\
38254    a non-filter file containing no valid forwarding addresses,\n\
38255    a copy of each incoming message will be put in your normal\n\
38256    mailbox. If a non-filter file contains at least one valid\n\
38257    forwarding address, forwarding to the valid addresses will\n\
38258    happen, and those will be the only deliveries that occur.
38259 </literallayout>
38260 <para>
38261 You also need a router to ensure that local addresses that are prefixed by
38262 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
38263 put this immediately before the <command>userforward</command> router:
38264 </para>
38265 <literallayout class="monospaced">
38266 real_localuser:
38267   driver = accept
38268   check_local_user
38269   local_part_prefix = real-
38270   transport = local_delivery
38271 </literallayout>
38272 <para>
38273 For security, it would probably be a good idea to restrict the use of this
38274 router to locally-generated messages, using a condition such as this:
38275 </para>
38276 <literallayout class="monospaced">
38277   condition = ${if match {$sender_host_address}\
38278                          {\N^(|127\.0\.0\.1)$\N}}
38279 </literallayout>
38280 <para>
38281 <indexterm role="option">
38282 <primary><option>syntax_errors_text</option></primary>
38283 </indexterm>
38284 </para>
38285 <informaltable frame="all">
38286 <tgroup cols="4" colsep="0" rowsep="0">
38287 <colspec colwidth="8*" align="left"/>
38288 <colspec colwidth="6*" align="center"/>
38289 <colspec colwidth="6*" align="center"/>
38290 <colspec colwidth="6*" align="right"/>
38291 <tbody>
38292 <row>
38293 <entry><option>syntax_errors_text</option></entry>
38294 <entry>Use: <emphasis>redirect</emphasis></entry>
38295 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38296 <entry>Default: <emphasis>unset</emphasis></entry>
38297 </row>
38298 </tbody>
38299 </tgroup>
38300 </informaltable>
38301 <para>
38302 See <option>skip_syntax_errors</option> above.
38303 </para>
38304 <para>
38305 <indexterm role="option">
38306 <primary><option>syntax_errors_to</option></primary>
38307 </indexterm>
38308 </para>
38309 <informaltable frame="all">
38310 <tgroup cols="4" colsep="0" rowsep="0">
38311 <colspec colwidth="8*" align="left"/>
38312 <colspec colwidth="6*" align="center"/>
38313 <colspec colwidth="6*" align="center"/>
38314 <colspec colwidth="6*" align="right"/>
38315 <tbody>
38316 <row>
38317 <entry><option>syntax_errors_to</option></entry>
38318 <entry>Use: <emphasis>redirect</emphasis></entry>
38319 <entry>Type: <emphasis>string</emphasis></entry>
38320 <entry>Default: <emphasis>unset</emphasis></entry>
38321 </row>
38322 </tbody>
38323 </tgroup>
38324 </informaltable>
38325 <para>
38326 See <option>skip_syntax_errors</option> above.
38327 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
38328 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
38329 </para>
38330 </section>
38331 </chapter>
38332
38333 <chapter id="CHAPenvironment">
38334 <title>Environment for running local transports</title>
38335 <titleabbrev>Environment for local transports</titleabbrev>
38336 <para>
38337 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
38338 <primary>local transports</primary>
38339 <secondary>environment for</secondary>
38340 </indexterm>
38341 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
38342 <primary>environment for local transports</primary>
38343 </indexterm>
38344 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
38345 <primary>transport</primary>
38346 <secondary>local; environment for</secondary>
38347 </indexterm>
38348 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
38349 transport can be thought of as similar to a pipe.) Exim always runs transports
38350 in subprocesses, under specified uids and gids. Typical deliveries to local
38351 mailboxes run under the uid and gid of the local user.
38352 </para>
38353 <para>
38354 Exim also sets a specific current directory while running the transport; for
38355 some transports a home directory setting is also relevant. The <command>pipe</command>
38356 transport is the only one that sets up environment variables; see section
38357 <xref linkend="SECTpipeenv"/> for details.
38358 </para>
38359 <para>
38360 The values used for the uid, gid, and the directories may come from several
38361 different places. In many cases, the router that handles the address associates
38362 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
38363 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
38364 configuration, and these override anything that comes from the router.
38365 </para>
38366 <section id="SECID131">
38367 <title>Concurrent deliveries</title>
38368 <para>
38369 <indexterm role="concept">
38370 <primary>concurrent deliveries</primary>
38371 </indexterm>
38372 <indexterm role="concept">
38373 <primary>simultaneous deliveries</primary>
38374 </indexterm>
38375 If two different messages for the same local recipient arrive more or less
38376 simultaneously, the two delivery processes are likely to run concurrently. When
38377 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
38378 rules to stop concurrent processes from writing to the same file at the same
38379 time.
38380 </para>
38381 <para>
38382 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
38383 locking that is needed. Here is a silly example:
38384 </para>
38385 <literallayout class="monospaced">
38386 my_transport:
38387   driver = pipe
38388   command = /bin/sh -c 'cat &gt;&gt;/some/file'
38389 </literallayout>
38390 <para>
38391 This is supposed to write the message at the end of the file. However, if two
38392 messages arrive at the same time, the file will be scrambled. You can use the
38393 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
38394 file using the same algorithm that Exim itself uses.
38395 </para>
38396 </section>
38397 <section id="SECTenvuidgid">
38398 <title>Uids and gids</title>
38399 <para>
38400 <indexterm role="concept">
38401 <primary>local transports</primary>
38402 <secondary>uid and gid</secondary>
38403 </indexterm>
38404 <indexterm role="concept">
38405 <primary>transport</primary>
38406 <secondary>local; uid and gid</secondary>
38407 </indexterm>
38408 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
38409 overrides any group that the router set in the address, even if <option>user</option> is not
38410 set for the transport. This makes it possible, for example, to run local mail
38411 delivery under the uid of the recipient (set by the router), but in a special
38412 group (set by the transport). For example:
38413 </para>
38414 <literallayout class="monospaced">
38415 # Routers ...
38416 # User/group are set by check_local_user in this router
38417 local_users:
38418   driver = accept
38419   check_local_user
38420   transport = group_delivery
38421
38422 # Transports ...
38423 # This transport overrides the group
38424 group_delivery:
38425   driver = appendfile
38426   file = /var/spool/mail/$local_part
38427   group = mail
38428 </literallayout>
38429 <para>
38430 If <option>user</option> is set for a transport, its value overrides what is set in the
38431 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
38432 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
38433 set.
38434 </para>
38435 <para>
38436 <indexterm role="option">
38437 <primary><option>initgroups</option></primary>
38438 </indexterm>
38439 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
38440 function is called for the groups associated with that uid if the
38441 <option>initgroups</option> option is set for the transport. When the uid is not specified
38442 by the transport, but is associated with the address by a router, the option
38443 for calling <function>initgroups()</function> is taken from the router configuration.
38444 </para>
38445 <para>
38446 <indexterm role="concept">
38447 <primary><command>pipe</command> transport</primary>
38448 <secondary>uid for</secondary>
38449 </indexterm>
38450 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
38451 is set and <option>user</option> is not set, the uid of the process that called Exim to
38452 receive the message is used, and if <option>group</option> is not set, the corresponding
38453 original gid is also used.
38454 </para>
38455 <para>
38456 This is the detailed preference order for obtaining a gid; the first of the
38457 following that is set is used:
38458 </para>
38459 <itemizedlist>
38460 <listitem>
38461 <para>
38462 A <option>group</option> setting of the transport;
38463 </para>
38464 </listitem>
38465 <listitem>
38466 <para>
38467 A <option>group</option> setting of the router;
38468 </para>
38469 </listitem>
38470 <listitem>
38471 <para>
38472 A gid associated with a user setting of the router, either as a result of
38473 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
38474 </para>
38475 </listitem>
38476 <listitem>
38477 <para>
38478 The group associated with a non-numeric <option>user</option> setting of the transport;
38479 </para>
38480 </listitem>
38481 <listitem>
38482 <para>
38483 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
38484 the uid is the creator&#x2019;s uid;
38485 </para>
38486 </listitem>
38487 <listitem>
38488 <para>
38489 The Exim gid if the Exim uid is being used as a default.
38490 </para>
38491 </listitem>
38492 </itemizedlist>
38493 <para>
38494 If, for example, the user is specified numerically on the router and there are
38495 no group settings, no gid is available. In this situation, an error occurs.
38496 This is different for the uid, for which there always is an ultimate default.
38497 The first of the following that is set is used:
38498 </para>
38499 <itemizedlist>
38500 <listitem>
38501 <para>
38502 A <option>user</option> setting of the transport;
38503 </para>
38504 </listitem>
38505 <listitem>
38506 <para>
38507 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
38508 </para>
38509 </listitem>
38510 <listitem>
38511 <para>
38512 A <option>user</option> setting of the router;
38513 </para>
38514 </listitem>
38515 <listitem>
38516 <para>
38517 A <option>check_local_user</option> setting of the router;
38518 </para>
38519 </listitem>
38520 <listitem>
38521 <para>
38522 The Exim uid.
38523 </para>
38524 </listitem>
38525 </itemizedlist>
38526 <para>
38527 Of course, an error will still occur if the uid that is chosen is on the
38528 <option>never_users</option> list.
38529 </para>
38530 </section>
38531 <section id="SECID132">
38532 <title>Current and home directories</title>
38533 <para>
38534 <indexterm role="concept">
38535 <primary>current directory for local transport</primary>
38536 </indexterm>
38537 <indexterm role="concept">
38538 <primary>home directory</primary>
38539 <secondary>for local transport</secondary>
38540 </indexterm>
38541 <indexterm role="concept">
38542 <primary>transport</primary>
38543 <secondary>local; home directory for</secondary>
38544 </indexterm>
38545 <indexterm role="concept">
38546 <primary>transport</primary>
38547 <secondary>local; current directory for</secondary>
38548 </indexterm>
38549 Routers may set current and home directories for local transports by means of
38550 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
38551 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
38552 are set, they override the router&#x2019;s values. In detail, the home directory
38553 for a local transport is taken from the first of these values that is set:
38554 </para>
38555 <itemizedlist>
38556 <listitem>
38557 <para>
38558 The <option>home_directory</option> option on the transport;
38559 </para>
38560 </listitem>
38561 <listitem>
38562 <para>
38563 The <option>transport_home_directory</option> option on the router;
38564 </para>
38565 </listitem>
38566 <listitem>
38567 <para>
38568 The password data if <option>check_local_user</option> is set on the router;
38569 </para>
38570 </listitem>
38571 <listitem>
38572 <para>
38573 The <option>router_home_directory</option> option on the router.
38574 </para>
38575 </listitem>
38576 </itemizedlist>
38577 <para>
38578 The current directory is taken from the first of these values that is set:
38579 </para>
38580 <itemizedlist>
38581 <listitem>
38582 <para>
38583 The <option>current_directory</option> option on the transport;
38584 </para>
38585 </listitem>
38586 <listitem>
38587 <para>
38588 The <option>transport_current_directory</option> option on the router.
38589 </para>
38590 </listitem>
38591 </itemizedlist>
38592 <para>
38593 If neither the router nor the transport sets a current directory, Exim uses the
38594 value of the home directory, if it is set. Otherwise it sets the current
38595 directory to <filename>/</filename> before running a local transport.
38596 </para>
38597 </section>
38598 <section id="SECID133">
38599 <title>Expansion variables derived from the address</title>
38600 <para>
38601 <indexterm role="variable">
38602 <primary><varname>$domain</varname></primary>
38603 </indexterm>
38604 <indexterm role="variable">
38605 <primary><varname>$local_part</varname></primary>
38606 </indexterm>
38607 <indexterm role="variable">
38608 <primary><varname>$original_domain</varname></primary>
38609 </indexterm>
38610 Normally a local delivery is handling a single address, and in that case the
38611 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
38612 deliveries. However, in some circumstances more than one address may be handled
38613 at once (for example, while writing batch SMTP for onward transmission by some
38614 other means). In this case, the variables associated with the local part are
38615 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
38616 and <varname>$original_domain</varname> is never set.
38617 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
38618 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
38619 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
38620 </para>
38621 </section>
38622 </chapter>
38623
38624 <chapter id="CHAPtransportgeneric">
38625 <title>Generic options for transports</title>
38626 <para>
38627 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
38628 <primary>generic options</primary>
38629 <secondary>transport</secondary>
38630 </indexterm>
38631 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
38632 <primary>options</primary>
38633 <secondary>generic; for transports</secondary>
38634 </indexterm>
38635 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
38636 <primary>transport</primary>
38637 <secondary>generic options for</secondary>
38638 </indexterm>
38639 The following generic options apply to all transports:
38640 </para>
38641 <para>
38642 <indexterm role="option">
38643 <primary><option>body_only</option></primary>
38644 </indexterm>
38645 </para>
38646 <informaltable frame="all">
38647 <tgroup cols="4" colsep="0" rowsep="0">
38648 <colspec colwidth="8*" align="left"/>
38649 <colspec colwidth="6*" align="center"/>
38650 <colspec colwidth="6*" align="center"/>
38651 <colspec colwidth="6*" align="right"/>
38652 <tbody>
38653 <row>
38654 <entry><option>body_only</option></entry>
38655 <entry>Use: <emphasis>transports</emphasis></entry>
38656 <entry>Type: <emphasis>boolean</emphasis></entry>
38657 <entry>Default: <emphasis>false</emphasis></entry>
38658 </row>
38659 </tbody>
38660 </tgroup>
38661 </informaltable>
38662 <para>
38663 <indexterm role="concept">
38664 <primary>transport</primary>
38665 <secondary>body only</secondary>
38666 </indexterm>
38667 <indexterm role="concept">
38668 <primary>message</primary>
38669 <secondary>transporting body only</secondary>
38670 </indexterm>
38671 <indexterm role="concept">
38672 <primary>body of message</primary>
38673 <secondary>transporting</secondary>
38674 </indexterm>
38675 If this option is set, the message&#x2019;s headers are not transported. It is
38676 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
38677 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
38678 <option>message_suffix</option> should be checked, because this option does not
38679 automatically suppress them.
38680 </para>
38681 <para>
38682 <indexterm role="option">
38683 <primary><option>current_directory</option></primary>
38684 </indexterm>
38685 </para>
38686 <informaltable frame="all">
38687 <tgroup cols="4" colsep="0" rowsep="0">
38688 <colspec colwidth="8*" align="left"/>
38689 <colspec colwidth="6*" align="center"/>
38690 <colspec colwidth="6*" align="center"/>
38691 <colspec colwidth="6*" align="right"/>
38692 <tbody>
38693 <row>
38694 <entry><option>current_directory</option></entry>
38695 <entry>Use: <emphasis>transports</emphasis></entry>
38696 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38697 <entry>Default: <emphasis>unset</emphasis></entry>
38698 </row>
38699 </tbody>
38700 </tgroup>
38701 </informaltable>
38702 <para>
38703 <indexterm role="concept">
38704 <primary>transport</primary>
38705 <secondary>current directory for</secondary>
38706 </indexterm>
38707 This specifies the current directory that is to be set while running the
38708 transport, overriding any value that may have been set by the router.
38709 If the expansion fails for any reason, including forced failure, an error is
38710 logged, and delivery is deferred.
38711 </para>
38712 <para>
38713 <indexterm role="option">
38714 <primary><option>disable_logging</option></primary>
38715 </indexterm>
38716 </para>
38717 <informaltable frame="all">
38718 <tgroup cols="4" colsep="0" rowsep="0">
38719 <colspec colwidth="8*" align="left"/>
38720 <colspec colwidth="6*" align="center"/>
38721 <colspec colwidth="6*" align="center"/>
38722 <colspec colwidth="6*" align="right"/>
38723 <tbody>
38724 <row>
38725 <entry><option>disable_logging</option></entry>
38726 <entry>Use: <emphasis>transports</emphasis></entry>
38727 <entry>Type: <emphasis>boolean</emphasis></entry>
38728 <entry>Default: <emphasis>false</emphasis></entry>
38729 </row>
38730 </tbody>
38731 </tgroup>
38732 </informaltable>
38733 <para>
38734 If this option is set true, nothing is logged for any
38735 deliveries by the transport or for any
38736 transport errors. You should not set this option unless you really, really know
38737 what you are doing.
38738 </para>
38739 <para>
38740 <indexterm role="option">
38741 <primary><option>debug_print</option></primary>
38742 </indexterm>
38743 </para>
38744 <informaltable frame="all">
38745 <tgroup cols="4" colsep="0" rowsep="0">
38746 <colspec colwidth="8*" align="left"/>
38747 <colspec colwidth="6*" align="center"/>
38748 <colspec colwidth="6*" align="center"/>
38749 <colspec colwidth="6*" align="right"/>
38750 <tbody>
38751 <row>
38752 <entry><option>debug_print</option></entry>
38753 <entry>Use: <emphasis>transports</emphasis></entry>
38754 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38755 <entry>Default: <emphasis>unset</emphasis></entry>
38756 </row>
38757 </tbody>
38758 </tgroup>
38759 </informaltable>
38760 <para>
38761 <indexterm role="concept">
38762 <primary>testing</primary>
38763 <secondary>variables in drivers</secondary>
38764 </indexterm>
38765 If this option is set and debugging is enabled (see the <option>-d</option> command line
38766 option), the string is expanded and included in the debugging output when the
38767 transport is run.
38768 If expansion of the string fails, the error message is written to the debugging
38769 output, and Exim carries on processing.
38770 This facility is provided to help with checking out the values of variables and
38771 so on when debugging driver configurations. For example, if a <option>headers_add</option>
38772 option is not working properly, <option>debug_print</option> could be used to output the
38773 variables it references. A newline is added to the text if it does not end with
38774 one.
38775 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
38776 transport and the router that called it.
38777 </para>
38778 <para>
38779 <indexterm role="option">
38780 <primary><option>delivery_date_add</option></primary>
38781 </indexterm>
38782 </para>
38783 <informaltable frame="all">
38784 <tgroup cols="4" colsep="0" rowsep="0">
38785 <colspec colwidth="8*" align="left"/>
38786 <colspec colwidth="6*" align="center"/>
38787 <colspec colwidth="6*" align="center"/>
38788 <colspec colwidth="6*" align="right"/>
38789 <tbody>
38790 <row>
38791 <entry><option>delivery_date_add</option></entry>
38792 <entry>Use: <emphasis>transports</emphasis></entry>
38793 <entry>Type: <emphasis>boolean</emphasis></entry>
38794 <entry>Default: <emphasis>false</emphasis></entry>
38795 </row>
38796 </tbody>
38797 </tgroup>
38798 </informaltable>
38799 <para>
38800 <indexterm role="concept">
38801 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
38802 </indexterm>
38803 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
38804 This gives the actual time the delivery was made. As this is not a standard
38805 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
38806 requests its removal from incoming messages, so that delivered messages can
38807 safely be resent to other recipients.
38808 </para>
38809 <para>
38810 <indexterm role="option">
38811 <primary><option>driver</option></primary>
38812 </indexterm>
38813 </para>
38814 <informaltable frame="all">
38815 <tgroup cols="4" colsep="0" rowsep="0">
38816 <colspec colwidth="8*" align="left"/>
38817 <colspec colwidth="6*" align="center"/>
38818 <colspec colwidth="6*" align="center"/>
38819 <colspec colwidth="6*" align="right"/>
38820 <tbody>
38821 <row>
38822 <entry><option>driver</option></entry>
38823 <entry>Use: <emphasis>transports</emphasis></entry>
38824 <entry>Type: <emphasis>string</emphasis></entry>
38825 <entry>Default: <emphasis>unset</emphasis></entry>
38826 </row>
38827 </tbody>
38828 </tgroup>
38829 </informaltable>
38830 <para>
38831 This specifies which of the available transport drivers is to be used.
38832 There is no default, and this option must be set for every transport.
38833 </para>
38834 <para>
38835 <indexterm role="option">
38836 <primary><option>envelope_to_add</option></primary>
38837 </indexterm>
38838 </para>
38839 <informaltable frame="all">
38840 <tgroup cols="4" colsep="0" rowsep="0">
38841 <colspec colwidth="8*" align="left"/>
38842 <colspec colwidth="6*" align="center"/>
38843 <colspec colwidth="6*" align="center"/>
38844 <colspec colwidth="6*" align="right"/>
38845 <tbody>
38846 <row>
38847 <entry><option>envelope_to_add</option></entry>
38848 <entry>Use: <emphasis>transports</emphasis></entry>
38849 <entry>Type: <emphasis>boolean</emphasis></entry>
38850 <entry>Default: <emphasis>false</emphasis></entry>
38851 </row>
38852 </tbody>
38853 </tgroup>
38854 </informaltable>
38855 <para>
38856 <indexterm role="concept">
38857 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38858 </indexterm>
38859 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
38860 This gives the original address(es) in the incoming envelope that caused this
38861 delivery to happen. More than one address may be present if the transport is
38862 configured to handle several addresses at once, or if more than one original
38863 address was redirected to the same final address. As this is not a standard
38864 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
38865 its removal from incoming messages, so that delivered messages can safely be
38866 resent to other recipients.
38867 </para>
38868 <para>
38869 <indexterm role="option">
38870 <primary><option>group</option></primary>
38871 </indexterm>
38872 </para>
38873 <informaltable frame="all">
38874 <tgroup cols="4" colsep="0" rowsep="0">
38875 <colspec colwidth="8*" align="left"/>
38876 <colspec colwidth="6*" align="center"/>
38877 <colspec colwidth="6*" align="center"/>
38878 <colspec colwidth="6*" align="right"/>
38879 <tbody>
38880 <row>
38881 <entry><option>group</option></entry>
38882 <entry>Use: <emphasis>transports</emphasis></entry>
38883 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38884 <entry>Default: <emphasis>Exim group</emphasis></entry>
38885 </row>
38886 </tbody>
38887 </tgroup>
38888 </informaltable>
38889 <para>
38890 <indexterm role="concept">
38891 <primary>transport</primary>
38892 <secondary>group; specifying</secondary>
38893 </indexterm>
38894 This option specifies a gid for running the transport process, overriding any
38895 value that the router supplies, and also overriding any value associated with
38896 <option>user</option> (see below).
38897 </para>
38898 <para>
38899 <indexterm role="option">
38900 <primary><option>headers_add</option></primary>
38901 </indexterm>
38902 </para>
38903 <informaltable frame="all">
38904 <tgroup cols="4" colsep="0" rowsep="0">
38905 <colspec colwidth="8*" align="left"/>
38906 <colspec colwidth="6*" align="center"/>
38907 <colspec colwidth="6*" align="center"/>
38908 <colspec colwidth="6*" align="right"/>
38909 <tbody>
38910 <row>
38911 <entry><option>headers_add</option></entry>
38912 <entry>Use: <emphasis>transports</emphasis></entry>
38913 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38914 <entry>Default: <emphasis>unset</emphasis></entry>
38915 </row>
38916 </tbody>
38917 </tgroup>
38918 </informaltable>
38919 <para>
38920 <indexterm role="concept">
38921 <primary>header lines</primary>
38922 <secondary>adding in transport</secondary>
38923 </indexterm>
38924 <indexterm role="concept">
38925 <primary>transport</primary>
38926 <secondary>header lines; adding</secondary>
38927 </indexterm>
38928 This option specifies a list of text headers,
38929 </para>
38930 <para revisionflag="changed">
38931 newline-separated (by default, changeable in the usual way),
38932 </para>
38933 <para>
38934 which are (separately) expanded and added to the header
38935 portion of a message as it is transported, as described in section
38936 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
38937 routers. If the result of the expansion is an empty string, or if the expansion
38938 is forced to fail, no action is taken. Other expansion failures are treated as
38939 errors and cause the delivery to be deferred.
38940 </para>
38941 <para>
38942 Unlike most options, <option>headers_add</option> can be specified multiple times
38943 for a transport; all listed headers are added.
38944 </para>
38945 <para>
38946 <indexterm role="option">
38947 <primary><option>headers_only</option></primary>
38948 </indexterm>
38949 </para>
38950 <informaltable frame="all">
38951 <tgroup cols="4" colsep="0" rowsep="0">
38952 <colspec colwidth="8*" align="left"/>
38953 <colspec colwidth="6*" align="center"/>
38954 <colspec colwidth="6*" align="center"/>
38955 <colspec colwidth="6*" align="right"/>
38956 <tbody>
38957 <row>
38958 <entry><option>headers_only</option></entry>
38959 <entry>Use: <emphasis>transports</emphasis></entry>
38960 <entry>Type: <emphasis>boolean</emphasis></entry>
38961 <entry>Default: <emphasis>false</emphasis></entry>
38962 </row>
38963 </tbody>
38964 </tgroup>
38965 </informaltable>
38966 <para>
38967 <indexterm role="concept">
38968 <primary>transport</primary>
38969 <secondary>header lines only</secondary>
38970 </indexterm>
38971 <indexterm role="concept">
38972 <primary>message</primary>
38973 <secondary>transporting headers only</secondary>
38974 </indexterm>
38975 <indexterm role="concept">
38976 <primary>header lines</primary>
38977 <secondary>transporting</secondary>
38978 </indexterm>
38979 If this option is set, the message&#x2019;s body is not transported. It is mutually
38980 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
38981 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
38982 checked, since this option does not automatically suppress them.
38983 </para>
38984 <para>
38985 <indexterm role="option">
38986 <primary><option>headers_remove</option></primary>
38987 </indexterm>
38988 </para>
38989 <informaltable frame="all">
38990 <tgroup cols="4" colsep="0" rowsep="0">
38991 <colspec colwidth="8*" align="left"/>
38992 <colspec colwidth="6*" align="center"/>
38993 <colspec colwidth="6*" align="center"/>
38994 <colspec colwidth="6*" align="right"/>
38995 <tbody>
38996 <row>
38997 <entry><option>headers_remove</option></entry>
38998 <entry>Use: <emphasis>transports</emphasis></entry>
38999 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39000 <entry>Default: <emphasis>unset</emphasis></entry>
39001 </row>
39002 </tbody>
39003 </tgroup>
39004 </informaltable>
39005 <para>
39006 <indexterm role="concept">
39007 <primary>header lines</primary>
39008 <secondary>removing</secondary>
39009 </indexterm>
39010 <indexterm role="concept">
39011 <primary>transport</primary>
39012 <secondary>header lines; removing</secondary>
39013 </indexterm>
39014 This option specifies a list of header names,
39015 </para>
39016 <para revisionflag="changed">
39017 colon-separated (by default, changeable in the usual way);
39018 </para>
39019 <para>
39020 these headers are omitted from the message as it is transported, as described
39021 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
39022 routers.
39023 Each list item is separately expanded.
39024 If the result of the expansion is an empty string, or if the expansion
39025 is forced to fail, no action is taken. Other expansion failures are treated as
39026 errors and cause the delivery to be deferred.
39027 </para>
39028 <para>
39029 Unlike most options, <option>headers_remove</option> can be specified multiple times
39030 for a router; all listed headers are removed.
39031 </para>
39032 <para>
39033 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
39034 items that contain a list separator must have it doubled.
39035 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
39036 </para>
39037 <para>
39038 <indexterm role="option">
39039 <primary><option>headers_rewrite</option></primary>
39040 </indexterm>
39041 </para>
39042 <informaltable frame="all">
39043 <tgroup cols="4" colsep="0" rowsep="0">
39044 <colspec colwidth="8*" align="left"/>
39045 <colspec colwidth="6*" align="center"/>
39046 <colspec colwidth="6*" align="center"/>
39047 <colspec colwidth="6*" align="right"/>
39048 <tbody>
39049 <row>
39050 <entry><option>headers_rewrite</option></entry>
39051 <entry>Use: <emphasis>transports</emphasis></entry>
39052 <entry>Type: <emphasis>string</emphasis></entry>
39053 <entry>Default: <emphasis>unset</emphasis></entry>
39054 </row>
39055 </tbody>
39056 </tgroup>
39057 </informaltable>
39058 <para>
39059 <indexterm role="concept">
39060 <primary>transport</primary>
39061 <secondary>header lines; rewriting</secondary>
39062 </indexterm>
39063 <indexterm role="concept">
39064 <primary>rewriting</primary>
39065 <secondary>at transport time</secondary>
39066 </indexterm>
39067 This option allows addresses in header lines to be rewritten at transport time,
39068 that is, as the message is being copied to its destination. The contents of the
39069 option are a colon-separated list of rewriting rules. Each rule is in exactly
39070 the same form as one of the general rewriting rules that are applied when a
39071 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
39072 example,
39073 </para>
39074 <literallayout class="monospaced">
39075 headers_rewrite = a@b c@d f : \
39076                   x@y w@z
39077 </literallayout>
39078 <para>
39079 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
39080 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
39081 header lines just before they are written out at transport time, so they affect
39082 only those copies of the message that pass through the transport. However, only
39083 the message&#x2019;s original header lines, and any that were added by a system
39084 filter, are rewritten. If a router or transport adds header lines, they are not
39085 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
39086 envelope. You can change the return path using <option>return_path</option>, but you cannot
39087 change envelope recipients at this time.
39088 </para>
39089 <para>
39090 <indexterm role="option">
39091 <primary><option>home_directory</option></primary>
39092 </indexterm>
39093 </para>
39094 <informaltable frame="all">
39095 <tgroup cols="4" colsep="0" rowsep="0">
39096 <colspec colwidth="8*" align="left"/>
39097 <colspec colwidth="6*" align="center"/>
39098 <colspec colwidth="6*" align="center"/>
39099 <colspec colwidth="6*" align="right"/>
39100 <tbody>
39101 <row>
39102 <entry><option>home_directory</option></entry>
39103 <entry>Use: <emphasis>transports</emphasis></entry>
39104 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39105 <entry>Default: <emphasis>unset</emphasis></entry>
39106 </row>
39107 </tbody>
39108 </tgroup>
39109 </informaltable>
39110 <para>
39111 <indexterm role="concept">
39112 <primary>transport</primary>
39113 <secondary>home directory for</secondary>
39114 </indexterm>
39115 <indexterm role="variable">
39116 <primary><varname>$home</varname></primary>
39117 </indexterm>
39118 This option specifies a home directory setting for a local transport,
39119 overriding any value that may be set by the router. The home directory is
39120 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
39121 used as the current directory if no current directory is set by the
39122 <option>current_directory</option> option on the transport or the
39123 <option>transport_current_directory</option> option on the router. If the expansion fails
39124 for any reason, including forced failure, an error is logged, and delivery is
39125 deferred.
39126 </para>
39127 <para>
39128 <indexterm role="option">
39129 <primary><option>initgroups</option></primary>
39130 </indexterm>
39131 </para>
39132 <informaltable frame="all">
39133 <tgroup cols="4" colsep="0" rowsep="0">
39134 <colspec colwidth="8*" align="left"/>
39135 <colspec colwidth="6*" align="center"/>
39136 <colspec colwidth="6*" align="center"/>
39137 <colspec colwidth="6*" align="right"/>
39138 <tbody>
39139 <row>
39140 <entry><option>initgroups</option></entry>
39141 <entry>Use: <emphasis>transports</emphasis></entry>
39142 <entry>Type: <emphasis>boolean</emphasis></entry>
39143 <entry>Default: <emphasis>false</emphasis></entry>
39144 </row>
39145 </tbody>
39146 </tgroup>
39147 </informaltable>
39148 <para>
39149 <indexterm role="concept">
39150 <primary>additional groups</primary>
39151 </indexterm>
39152 <indexterm role="concept">
39153 <primary>groups</primary>
39154 <secondary>additional</secondary>
39155 </indexterm>
39156 <indexterm role="concept">
39157 <primary>transport</primary>
39158 <secondary>group; additional</secondary>
39159 </indexterm>
39160 If this option is true and the uid for the delivery process is provided by the
39161 transport, the <function>initgroups()</function> function is called when running the transport
39162 to ensure that any additional groups associated with the uid are set up.
39163 </para>
39164 <para>
39165 <indexterm role="option">
39166 <primary><option>message_size_limit</option></primary>
39167 </indexterm>
39168 </para>
39169 <informaltable frame="all">
39170 <tgroup cols="4" colsep="0" rowsep="0">
39171 <colspec colwidth="8*" align="left"/>
39172 <colspec colwidth="6*" align="center"/>
39173 <colspec colwidth="6*" align="center"/>
39174 <colspec colwidth="6*" align="right"/>
39175 <tbody>
39176 <row>
39177 <entry><option>message_size_limit</option></entry>
39178 <entry>Use: <emphasis>transports</emphasis></entry>
39179 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39180 <entry>Default: <emphasis>0</emphasis></entry>
39181 </row>
39182 </tbody>
39183 </tgroup>
39184 </informaltable>
39185 <para>
39186 <indexterm role="concept">
39187 <primary>limit</primary>
39188 <secondary>message size per transport</secondary>
39189 </indexterm>
39190 <indexterm role="concept">
39191 <primary>size</primary>
39192 <secondary>of message, limit</secondary>
39193 </indexterm>
39194 <indexterm role="concept">
39195 <primary>transport</primary>
39196 <secondary>message size; limiting</secondary>
39197 </indexterm>
39198 This option controls the size of messages passed through the transport. It is
39199 expanded before use; the result of the expansion must be a sequence of decimal
39200 digits, optionally followed by K or M. If the expansion fails for any reason,
39201 including forced failure, or if the result is not of the required form,
39202 delivery is deferred. If the value is greater than zero and the size of a
39203 message exceeds this limit, the address is failed. If there is any chance that
39204 the resulting bounce message could be routed to the same transport, you should
39205 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
39206 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
39207 delivered.
39208 </para>
39209 <para>
39210 <indexterm role="option">
39211 <primary><option>rcpt_include_affixes</option></primary>
39212 </indexterm>
39213 </para>
39214 <informaltable frame="all">
39215 <tgroup cols="4" colsep="0" rowsep="0">
39216 <colspec colwidth="8*" align="left"/>
39217 <colspec colwidth="6*" align="center"/>
39218 <colspec colwidth="6*" align="center"/>
39219 <colspec colwidth="6*" align="right"/>
39220 <tbody>
39221 <row>
39222 <entry><option>rcpt_include_affixes</option></entry>
39223 <entry>Use: <emphasis>transports</emphasis></entry>
39224 <entry>Type: <emphasis>boolean</emphasis></entry>
39225 <entry>Default: <emphasis>false</emphasis></entry>
39226 </row>
39227 </tbody>
39228 </tgroup>
39229 </informaltable>
39230 <para>
39231 <indexterm role="concept">
39232 <primary>prefix</primary>
39233 <secondary>for local part, including in envelope</secondary>
39234 </indexterm>
39235 <indexterm role="concept">
39236 <primary>suffix for local part</primary>
39237 <secondary>including in envelope</secondary>
39238 </indexterm>
39239 <indexterm role="concept">
39240 <primary>local part</primary>
39241 <secondary>prefix</secondary>
39242 </indexterm>
39243 <indexterm role="concept">
39244 <primary>local part</primary>
39245 <secondary>suffix</secondary>
39246 </indexterm>
39247 When this option is false (the default), and an address that has had any
39248 affixes (prefixes or suffixes) removed from the local part is delivered by any
39249 form of SMTP or LMTP, the affixes are not included. For example, if a router
39250 that contains
39251 </para>
39252 <literallayout class="monospaced">
39253 local_part_prefix = *-
39254 </literallayout>
39255 <para>
39256 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
39257 is delivered with
39258 </para>
39259 <literallayout class="monospaced">
39260 RCPT TO:&lt;xyz@some.domain&gt;
39261 </literallayout>
39262 <para>
39263 This is also the case when an ACL-time callout is being used to verify a
39264 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
39265 whole local part is included in the RCPT command. This option applies to BSMTP
39266 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
39267 <command>lmtp</command> and <command>smtp</command> transports.
39268 </para>
39269 <para>
39270 <indexterm role="option">
39271 <primary><option>retry_use_local_part</option></primary>
39272 </indexterm>
39273 </para>
39274 <informaltable frame="all">
39275 <tgroup cols="4" colsep="0" rowsep="0">
39276 <colspec colwidth="8*" align="left"/>
39277 <colspec colwidth="6*" align="center"/>
39278 <colspec colwidth="6*" align="center"/>
39279 <colspec colwidth="6*" align="right"/>
39280 <tbody>
39281 <row>
39282 <entry><option>retry_use_local_part</option></entry>
39283 <entry>Use: <emphasis>transports</emphasis></entry>
39284 <entry>Type: <emphasis>boolean</emphasis></entry>
39285 <entry>Default: <emphasis>see below</emphasis></entry>
39286 </row>
39287 </tbody>
39288 </tgroup>
39289 </informaltable>
39290 <para>
39291 <indexterm role="concept">
39292 <primary>hints database</primary>
39293 <secondary>retry keys</secondary>
39294 </indexterm>
39295 When a delivery suffers a temporary failure, a retry record is created
39296 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
39297 is based on the name and/or IP address of the failing remote host. For local
39298 deliveries, the key is normally the entire address, including both the local
39299 part and the domain. This is suitable for most common cases of local delivery
39300 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
39301 deliveries to that mailbox, not to the whole domain.
39302 </para>
39303 <para>
39304 However, in some special cases you may want to treat a temporary local delivery
39305 as a failure associated with the domain, and not with a particular local part.
39306 (For example, if you are storing all mail for some domain in files.) You can do
39307 this by setting <option>retry_use_local_part</option> false.
39308 </para>
39309 <para>
39310 For all the local transports, its default value is true. For remote transports,
39311 the default value is false for tidiness, but changing the value has no effect
39312 on a remote transport in the current implementation.
39313 </para>
39314 <para>
39315 <indexterm role="option">
39316 <primary><option>return_path</option></primary>
39317 </indexterm>
39318 </para>
39319 <informaltable frame="all">
39320 <tgroup cols="4" colsep="0" rowsep="0">
39321 <colspec colwidth="8*" align="left"/>
39322 <colspec colwidth="6*" align="center"/>
39323 <colspec colwidth="6*" align="center"/>
39324 <colspec colwidth="6*" align="right"/>
39325 <tbody>
39326 <row>
39327 <entry><option>return_path</option></entry>
39328 <entry>Use: <emphasis>transports</emphasis></entry>
39329 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39330 <entry>Default: <emphasis>unset</emphasis></entry>
39331 </row>
39332 </tbody>
39333 </tgroup>
39334 </informaltable>
39335 <para>
39336 <indexterm role="concept">
39337 <primary>envelope sender</primary>
39338 </indexterm>
39339 <indexterm role="concept">
39340 <primary>transport</primary>
39341 <secondary>return path; changing</secondary>
39342 </indexterm>
39343 <indexterm role="concept">
39344 <primary>return path</primary>
39345 <secondary>changing in transport</secondary>
39346 </indexterm>
39347 If this option is set, the string is expanded at transport time and replaces
39348 the existing return path (envelope sender) value in the copy of the message
39349 that is being delivered. An empty return path is permitted. This feature is
39350 designed for remote deliveries, where the value of this option is used in the
39351 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
39352 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
39353 header line, if one is added to the message (see the next option).
39354 </para>
39355 <para>
39356 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
39357 <option>return_path_on_delivery</option> to the log selector.
39358 </para>
39359 <para>
39360 <indexterm role="variable">
39361 <primary><varname>$return_path</varname></primary>
39362 </indexterm>
39363 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
39364 either the message&#x2019;s envelope sender, or an address set by the
39365 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
39366 replacement occurs; if it fails for another reason, delivery is deferred. This
39367 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
39368 section <xref linkend="SECTverp"/>.
39369 </para>
39370 <para>
39371 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
39372 remote server rejects a message at SMTP time, the bounce message is not sent to
39373 the value of this option. It is sent to the previously set errors address.
39374 This defaults to the incoming sender address, but can be changed by setting
39375 <option>errors_to</option> in a router.
39376 </para>
39377 <para>
39378 <indexterm role="option">
39379 <primary><option>return_path_add</option></primary>
39380 </indexterm>
39381 </para>
39382 <informaltable frame="all">
39383 <tgroup cols="4" colsep="0" rowsep="0">
39384 <colspec colwidth="8*" align="left"/>
39385 <colspec colwidth="6*" align="center"/>
39386 <colspec colwidth="6*" align="center"/>
39387 <colspec colwidth="6*" align="right"/>
39388 <tbody>
39389 <row>
39390 <entry><option>return_path_add</option></entry>
39391 <entry>Use: <emphasis>transports</emphasis></entry>
39392 <entry>Type: <emphasis>boolean</emphasis></entry>
39393 <entry>Default: <emphasis>false</emphasis></entry>
39394 </row>
39395 </tbody>
39396 </tgroup>
39397 </informaltable>
39398 <para>
39399 <indexterm role="concept">
39400 <primary><emphasis>Return-path:</emphasis> header line</primary>
39401 </indexterm>
39402 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
39403 Although the return path is normally available in the prefix line of BSD
39404 mailboxes, this is commonly not displayed by MUAs, and so the user does not
39405 have easy access to it.
39406 </para>
39407 <para>
39408 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
39409 the delivery SMTP server makes the final delivery</quote>. This implies that this
39410 header should not be present in incoming messages. Exim has a configuration
39411 option, <option>return_path_remove</option>, which requests removal of this header from
39412 incoming messages, so that delivered messages can safely be resent to other
39413 recipients.
39414 </para>
39415 <para>
39416 <indexterm role="option">
39417 <primary><option>shadow_condition</option></primary>
39418 </indexterm>
39419 </para>
39420 <informaltable frame="all">
39421 <tgroup cols="4" colsep="0" rowsep="0">
39422 <colspec colwidth="8*" align="left"/>
39423 <colspec colwidth="6*" align="center"/>
39424 <colspec colwidth="6*" align="center"/>
39425 <colspec colwidth="6*" align="right"/>
39426 <tbody>
39427 <row>
39428 <entry><option>shadow_condition</option></entry>
39429 <entry>Use: <emphasis>transports</emphasis></entry>
39430 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39431 <entry>Default: <emphasis>unset</emphasis></entry>
39432 </row>
39433 </tbody>
39434 </tgroup>
39435 </informaltable>
39436 <para>
39437 See <option>shadow_transport</option> below.
39438 </para>
39439 <para>
39440 <indexterm role="option">
39441 <primary><option>shadow_transport</option></primary>
39442 </indexterm>
39443 </para>
39444 <informaltable frame="all">
39445 <tgroup cols="4" colsep="0" rowsep="0">
39446 <colspec colwidth="8*" align="left"/>
39447 <colspec colwidth="6*" align="center"/>
39448 <colspec colwidth="6*" align="center"/>
39449 <colspec colwidth="6*" align="right"/>
39450 <tbody>
39451 <row>
39452 <entry><option>shadow_transport</option></entry>
39453 <entry>Use: <emphasis>transports</emphasis></entry>
39454 <entry>Type: <emphasis>string</emphasis></entry>
39455 <entry>Default: <emphasis>unset</emphasis></entry>
39456 </row>
39457 </tbody>
39458 </tgroup>
39459 </informaltable>
39460 <para>
39461 <indexterm role="concept">
39462 <primary>shadow transport</primary>
39463 </indexterm>
39464 <indexterm role="concept">
39465 <primary>transport</primary>
39466 <secondary>shadow</secondary>
39467 </indexterm>
39468 A local transport may set the <option>shadow_transport</option> option to the name of
39469 another local transport. Shadow remote transports are not supported.
39470 </para>
39471 <para>
39472 Whenever a delivery to the main transport succeeds, and either
39473 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
39474 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
39475 passed to the shadow transport, with the same delivery address or addresses. If
39476 expansion fails, no action is taken except that non-forced expansion failures
39477 cause a log line to be written.
39478 </para>
39479 <para>
39480 The result of the shadow transport is discarded and does not affect the
39481 subsequent processing of the message. Only a single level of shadowing is
39482 provided; the <option>shadow_transport</option> option is ignored on any transport when it
39483 is running as a shadow. Options concerned with output from pipes are also
39484 ignored. The log line for the successful delivery has an item added on the end,
39485 of the form
39486 </para>
39487 <literallayout class="monospaced">
39488 ST=&lt;shadow transport name&gt;
39489 </literallayout>
39490 <para>
39491 If the shadow transport did not succeed, the error message is put in
39492 parentheses afterwards. Shadow transports can be used for a number of different
39493 purposes, including keeping more detailed log information than Exim normally
39494 provides, and implementing automatic acknowledgment policies based on message
39495 headers that some sites insist on.
39496 </para>
39497 <para>
39498 <indexterm role="option">
39499 <primary><option>transport_filter</option></primary>
39500 </indexterm>
39501 </para>
39502 <informaltable frame="all">
39503 <tgroup cols="4" colsep="0" rowsep="0">
39504 <colspec colwidth="8*" align="left"/>
39505 <colspec colwidth="6*" align="center"/>
39506 <colspec colwidth="6*" align="center"/>
39507 <colspec colwidth="6*" align="right"/>
39508 <tbody>
39509 <row>
39510 <entry><option>transport_filter</option></entry>
39511 <entry>Use: <emphasis>transports</emphasis></entry>
39512 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39513 <entry>Default: <emphasis>unset</emphasis></entry>
39514 </row>
39515 </tbody>
39516 </tgroup>
39517 </informaltable>
39518 <para>
39519 <indexterm role="concept">
39520 <primary>transport</primary>
39521 <secondary>filter</secondary>
39522 </indexterm>
39523 <indexterm role="concept">
39524 <primary>filter</primary>
39525 <secondary>transport filter</secondary>
39526 </indexterm>
39527 This option sets up a filtering (in the Unix shell sense) process for messages
39528 at transport time. It should not be confused with mail filtering as set up by
39529 individual users or via a system filter.
39530 </para>
39531 <para>
39532 When the message is about to be written out, the command specified by
39533 <option>transport_filter</option> is started up in a separate, parallel process, and
39534 the entire message, including the header lines, is passed to it on its standard
39535 input (this in fact is done from a third process, to avoid deadlock). The
39536 command must be specified as an absolute path.
39537 </para>
39538 <para>
39539 The lines of the message that are written to the transport filter are
39540 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
39541 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
39542 lines beginning with a dot, and also before any processing implied by the
39543 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
39544 <command>pipe</command> transports.
39545 </para>
39546 <para>
39547 The standard error for the filter process is set to the same destination as its
39548 standard output; this is read and written to the message&#x2019;s ultimate
39549 destination. The process that writes the message to the filter, the
39550 filter itself, and the original process that reads the result and delivers it
39551 are all run in parallel, like a shell pipeline.
39552 </para>
39553 <para>
39554 The filter can perform any transformations it likes, but of course should take
39555 care not to break RFC 2822 syntax. Exim does not check the result, except to
39556 test for a final newline when SMTP is in use. All messages transmitted over
39557 SMTP must end with a newline, so Exim supplies one if it is missing.
39558 </para>
39559 <para>
39560 <indexterm role="concept">
39561 <primary>content scanning</primary>
39562 <secondary>per user</secondary>
39563 </indexterm>
39564 A transport filter can be used to provide content-scanning on a per-user basis
39565 at delivery time if the only required effect of the scan is to modify the
39566 message. For example, a content scan could insert a new header line containing
39567 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
39568 not possible to discard a message at this stage.
39569 </para>
39570 <para>
39571 <indexterm role="concept">
39572 <primary>SMTP</primary>
39573 <secondary>SIZE</secondary>
39574 </indexterm>
39575 A problem might arise if the filter increases the size of a message that is
39576 being sent down an SMTP connection. If the receiving SMTP server has indicated
39577 support for the SIZE parameter, Exim will have sent the size of the message
39578 at the start of the SMTP session. If what is actually sent is substantially
39579 more, the server might reject the message. This can be worked round by setting
39580 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
39581 additions to the message, or to disable the use of SIZE altogether.
39582 </para>
39583 <para>
39584 <indexterm role="variable">
39585 <primary><varname>$pipe_addresses</varname></primary>
39586 </indexterm>
39587 The value of the <option>transport_filter</option> option is the command string for starting
39588 the filter, which is run directly from Exim, not under a shell. The string is
39589 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
39590 Exim breaks it up into arguments and then expands each argument separately (see
39591 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
39592 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
39593 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
39594 an ideal name for this feature here, but as it was already implemented for the
39595 <command>pipe</command> transport, it seemed sensible not to change it.)
39596 </para>
39597 <para>
39598 <indexterm role="variable">
39599 <primary><varname>$host</varname></primary>
39600 </indexterm>
39601 <indexterm role="variable">
39602 <primary><varname>$host_address</varname></primary>
39603 </indexterm>
39604 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
39605 transport is a remote one. They contain the name and IP address of the host to
39606 which the message is being sent. For example:
39607 </para>
39608 <literallayout class="monospaced">
39609 transport_filter = /some/directory/transport-filter.pl \
39610   $host $host_address $sender_address $pipe_addresses
39611 </literallayout>
39612 <para>
39613 Two problems arise if you want to use more complicated expansion items to
39614 generate transport filter commands, both of which due to the fact that the
39615 command is split up <emphasis>before</emphasis> expansion.
39616 </para>
39617 <itemizedlist>
39618 <listitem>
39619 <para>
39620 If an expansion item contains white space, you must quote it, so that it is all
39621 part of the same command item. If the entire option setting is one such
39622 expansion item, you have to take care what kind of quoting you use. For
39623 example:
39624 </para>
39625 <literallayout class="monospaced">
39626 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
39627 </literallayout>
39628 <para>
39629 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
39630 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
39631 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
39632 the single quotes were missing, the line would be split into two items,
39633 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
39634 Exim tried to expand the first one.
39635 </para>
39636 </listitem>
39637 <listitem>
39638 <para>
39639 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
39640 expansion cannot generate multiple arguments, or a command name followed by
39641 arguments. Consider this example:
39642 </para>
39643 <literallayout class="monospaced">
39644 transport_filter = ${lookup{$host}lsearch{/a/file}\
39645                     {$value}{/bin/cat}}
39646 </literallayout>
39647 <para>
39648 The result of the lookup is interpreted as the name of the command, even
39649 if it contains white space. The simplest way round this is to use a shell:
39650 </para>
39651 <literallayout class="monospaced">
39652 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
39653                                {$value}{/bin/cat}}
39654 </literallayout>
39655 </listitem>
39656 </itemizedlist>
39657 <para>
39658 The filter process is run under the same uid and gid as the normal delivery.
39659 For remote deliveries this is the Exim uid/gid by default. The command should
39660 normally yield a zero return code. Transport filters are not supposed to fail.
39661 A non-zero code is taken to mean that the transport filter encountered some
39662 serious problem. Delivery of the message is deferred; the message remains on
39663 the queue and is tried again later. It is not possible to cause a message to be
39664 bounced from a transport filter.
39665 </para>
39666 <para>
39667 If a transport filter is set on an autoreply transport, the original message is
39668 passed through the filter as it is being copied into the newly generated
39669 message, which happens if the <option>return_message</option> option is set.
39670 </para>
39671 <para>
39672 <indexterm role="option">
39673 <primary><option>transport_filter_timeout</option></primary>
39674 </indexterm>
39675 </para>
39676 <informaltable frame="all">
39677 <tgroup cols="4" colsep="0" rowsep="0">
39678 <colspec colwidth="8*" align="left"/>
39679 <colspec colwidth="6*" align="center"/>
39680 <colspec colwidth="6*" align="center"/>
39681 <colspec colwidth="6*" align="right"/>
39682 <tbody>
39683 <row>
39684 <entry><option>transport_filter_timeout</option></entry>
39685 <entry>Use: <emphasis>transports</emphasis></entry>
39686 <entry>Type: <emphasis>time</emphasis></entry>
39687 <entry>Default: <emphasis>5m</emphasis></entry>
39688 </row>
39689 </tbody>
39690 </tgroup>
39691 </informaltable>
39692 <para>
39693 <indexterm role="concept">
39694 <primary>transport</primary>
39695 <secondary>filter, timeout</secondary>
39696 </indexterm>
39697 When Exim is reading the output of a transport filter, it applies a timeout
39698 that can be set by this option. Exceeding the timeout is normally treated as a
39699 temporary delivery failure. However, if a transport filter is used with a
39700 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
39701 way as a timeout in the pipe command itself. By default, a timeout is a hard
39702 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
39703 becomes a temporary error.
39704 </para>
39705 <para>
39706 <indexterm role="option">
39707 <primary><option>user</option></primary>
39708 </indexterm>
39709 </para>
39710 <informaltable frame="all">
39711 <tgroup cols="4" colsep="0" rowsep="0">
39712 <colspec colwidth="8*" align="left"/>
39713 <colspec colwidth="6*" align="center"/>
39714 <colspec colwidth="6*" align="center"/>
39715 <colspec colwidth="6*" align="right"/>
39716 <tbody>
39717 <row>
39718 <entry><option>user</option></entry>
39719 <entry>Use: <emphasis>transports</emphasis></entry>
39720 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39721 <entry>Default: <emphasis>Exim user</emphasis></entry>
39722 </row>
39723 </tbody>
39724 </tgroup>
39725 </informaltable>
39726 <para>
39727 <indexterm role="concept">
39728 <primary>uid (user id)</primary>
39729 <secondary>local delivery</secondary>
39730 </indexterm>
39731 <indexterm role="concept">
39732 <primary>transport</primary>
39733 <secondary>user, specifying</secondary>
39734 </indexterm>
39735 This option specifies the user under whose uid the delivery process is to be
39736 run, overriding any uid that may have been set by the router. If the user is
39737 given as a name, the uid is looked up from the password data, and the
39738 associated group is taken as the value of the gid to be used if the <option>group</option>
39739 option is not set.
39740 </para>
39741 <para>
39742 For deliveries that use local transports, a user and group are normally
39743 specified explicitly or implicitly (for example, as a result of
39744 <option>check_local_user</option>) by the router or transport.
39745 </para>
39746 <para>
39747 <indexterm role="concept">
39748 <primary>hints database</primary>
39749 <secondary>access by remote transport</secondary>
39750 </indexterm>
39751 For remote transports, you should leave this option unset unless you really are
39752 sure you know what you are doing. When a remote transport is running, it needs
39753 to be able to access Exim&#x2019;s hints databases, because each host may have its own
39754 retry data.
39755 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
39756 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
39757 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
39758 </para>
39759 </chapter>
39760
39761 <chapter id="CHAPbatching">
39762 <title>Address batching in local transports</title>
39763 <titleabbrev>Address batching</titleabbrev>
39764 <para>
39765 <indexterm role="concept">
39766 <primary>transport</primary>
39767 <secondary>local; address batching in</secondary>
39768 </indexterm>
39769 The only remote transport (<command>smtp</command>) is normally configured to handle more than
39770 one address at a time, so that when several addresses are routed to the same
39771 remote host, just one copy of the message is sent. Local transports, however,
39772 normally handle one address at a time. That is, a separate instance of the
39773 transport is run for each address that is routed to the transport. A separate
39774 copy of the message is delivered each time.
39775 </para>
39776 <para>
39777 <indexterm role="concept">
39778 <primary>batched local delivery</primary>
39779 </indexterm>
39780 <indexterm role="option">
39781 <primary><option>batch_max</option></primary>
39782 </indexterm>
39783 <indexterm role="option">
39784 <primary><option>batch_id</option></primary>
39785 </indexterm>
39786 In special cases, it may be desirable to handle several addresses at once in a
39787 local transport, for example:
39788 </para>
39789 <itemizedlist>
39790 <listitem>
39791 <para>
39792 In an <command>appendfile</command> transport, when storing messages in files for later
39793 delivery by some other means, a single copy of the message with multiple
39794 recipients saves space.
39795 </para>
39796 </listitem>
39797 <listitem>
39798 <para>
39799 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
39800 a single copy saves time, and is the normal way LMTP is expected to work.
39801 </para>
39802 </listitem>
39803 <listitem>
39804 <para>
39805 In a <command>pipe</command> transport, when passing the message
39806 to a scanner program or
39807 to some other delivery mechanism such as UUCP, multiple recipients may be
39808 acceptable.
39809 </para>
39810 </listitem>
39811 </itemizedlist>
39812 <para>
39813 These three local transports all have the same options for controlling multiple
39814 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
39815 repeating the information for each transport, these options are described here.
39816 </para>
39817 <para>
39818 The <option>batch_max</option> option specifies the maximum number of addresses that can be
39819 delivered together in a single run of the transport. Its default value is one
39820 (no batching). When more than one address is routed to a transport that has a
39821 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
39822 (that is, in a single run of the transport with multiple recipients), subject
39823 to certain conditions:
39824 </para>
39825 <itemizedlist>
39826 <listitem>
39827 <para>
39828 <indexterm role="variable">
39829 <primary><varname>$local_part</varname></primary>
39830 </indexterm>
39831 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
39832 batching is possible.
39833 </para>
39834 </listitem>
39835 <listitem>
39836 <para>
39837 <indexterm role="variable">
39838 <primary><varname>$domain</varname></primary>
39839 </indexterm>
39840 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
39841 addresses with the same domain are batched.
39842 </para>
39843 </listitem>
39844 <listitem>
39845 <para>
39846 <indexterm role="concept">
39847 <primary>customizing</primary>
39848 <secondary>batching condition</secondary>
39849 </indexterm>
39850 If <option>batch_id</option> is set, it is expanded for each address, and only those
39851 addresses with the same expanded value are batched. This allows you to specify
39852 customized batching conditions. Failure of the expansion for any reason,
39853 including forced failure, disables batching, but it does not stop the delivery
39854 from taking place.
39855 </para>
39856 </listitem>
39857 <listitem>
39858 <para>
39859 Batched addresses must also have the same errors address (where to send
39860 delivery errors), the same header additions and removals, the same user and
39861 group for the transport, and if a host list is present, the first host must
39862 be the same.
39863 </para>
39864 </listitem>
39865 </itemizedlist>
39866 <para>
39867 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
39868 both when the file or pipe command is specified in the transport, and when it
39869 is specified by a <command>redirect</command> router, but all the batched addresses must of
39870 course be routed to the same file or pipe command. These two transports have an
39871 option called <option>use_bsmtp</option>, which causes them to deliver the message in
39872 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
39873 <option>check_string</option> and <option>escape_string</option> options are forced to the values
39874 </para>
39875 <literallayout class="monospaced">
39876 check_string = "."
39877 escape_string = ".."
39878 </literallayout>
39879 <para>
39880 when batched SMTP is in use. A full description of the batch SMTP mechanism is
39881 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
39882 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
39883 </para>
39884 <para>
39885 <indexterm role="concept">
39886 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39887 </indexterm>
39888 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
39889 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
39890 that are being processed together. If you are using a batching <command>appendfile</command>
39891 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
39892 addresses is to set the <option>envelope_to_add</option> option.
39893 </para>
39894 <para>
39895 <indexterm role="concept">
39896 <primary><command>pipe</command> transport</primary>
39897 <secondary>with multiple addresses</secondary>
39898 </indexterm>
39899 <indexterm role="variable">
39900 <primary><varname>$pipe_addresses</varname></primary>
39901 </indexterm>
39902 If you are using a <command>pipe</command> transport without BSMTP, and setting the
39903 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
39904 the command. This is not a true variable; it is a bit of magic that causes each
39905 of the recipient addresses to be inserted into the command as a separate
39906 argument. This provides a way of accessing all the addresses that are being
39907 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
39908 are specified by a <command>redirect</command> router.
39909 </para>
39910 </chapter>
39911
39912 <chapter id="CHAPappendfile">
39913 <title>The appendfile transport</title>
39914 <para>
39915 <indexterm role="concept" id="IIDapptra1" class="startofrange">
39916 <primary><command>appendfile</command> transport</primary>
39917 </indexterm>
39918 <indexterm role="concept" id="IIDapptra2" class="startofrange">
39919 <primary>transports</primary>
39920 <secondary><command>appendfile</command></secondary>
39921 </indexterm>
39922 <indexterm role="concept">
39923 <primary>directory creation</primary>
39924 </indexterm>
39925 <indexterm role="concept">
39926 <primary>creating directories</primary>
39927 </indexterm>
39928 The <command>appendfile</command> transport delivers a message by appending it to an existing
39929 file, or by creating an entirely new file in a specified directory. Single
39930 files to which messages are appended can be in the traditional Unix mailbox
39931 format, or optionally in the MBX format supported by the Pine MUA and
39932 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
39933 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
39934 to give added protection against failures that happen part-way through the
39935 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
39936 supported. For all file formats, Exim attempts to create as many levels of
39937 directory as necessary, provided that <option>create_directory</option> is set.
39938 </para>
39939 <para>
39940 The code for the optional formats is not included in the Exim binary by
39941 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
39942 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
39943 included.
39944 </para>
39945 <para>
39946 <indexterm role="concept">
39947 <primary>quota</primary>
39948 <secondary>system</secondary>
39949 </indexterm>
39950 Exim recognizes system quota errors, and generates an appropriate message. Exim
39951 also supports its own quota control within the transport, for use when the
39952 system facility is unavailable or cannot be used for some reason.
39953 </para>
39954 <para>
39955 If there is an error while appending to a file (for example, quota exceeded or
39956 partition filled), Exim attempts to reset the file&#x2019;s length and last
39957 modification time back to what they were before. If there is an error while
39958 creating an entirely new file, the new file is removed.
39959 </para>
39960 <para>
39961 Before appending to a file, a number of security checks are made, and the
39962 file is locked. A detailed description is given below, after the list of
39963 private options.
39964 </para>
39965 <para>
39966 The <command>appendfile</command> transport is most commonly used for local deliveries to
39967 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
39968 putting messages into files for remote delivery by some means other than Exim.
39969 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
39970 option).
39971 </para>
39972 <section id="SECTfildiropt">
39973 <title>The file and directory options</title>
39974 <para>
39975 The <option>file</option> option specifies a single file, to which the message is appended;
39976 the <option>directory</option> option specifies a directory, in which a new file containing
39977 the message is created. Only one of these two options can be set, and for
39978 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
39979 </para>
39980 <para>
39981 <indexterm role="variable">
39982 <primary><varname>$address_file</varname></primary>
39983 </indexterm>
39984 <indexterm role="variable">
39985 <primary><varname>$local_part</varname></primary>
39986 </indexterm>
39987 However, <command>appendfile</command> is also used for delivering messages to files or
39988 directories whose names (or parts of names) are obtained from alias,
39989 forwarding, or filtering operations (for example, a <option>save</option> command in a
39990 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
39991 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
39992 name (or partial name) of the file or directory generated by the redirection
39993 operation. There are two cases:
39994 </para>
39995 <itemizedlist>
39996 <listitem>
39997 <para>
39998 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
39999 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
40000 common case when users with local accounts use filtering to sort mail into
40001 different folders. See for example, the <command>address_file</command> transport in the
40002 default configuration. If the path ends with a slash, it is assumed to be the
40003 name of a directory. A delivery to a directory can also be forced by setting
40004 <option>maildir_format</option> or <option>mailstore_format</option>.
40005 </para>
40006 </listitem>
40007 <listitem>
40008 <para>
40009 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
40010 used to determine the file or directory name for the delivery. Normally, the
40011 contents of <varname>$address_file</varname> are used in some way in the string expansion.
40012 </para>
40013 </listitem>
40014 </itemizedlist>
40015 <para>
40016 <indexterm role="concept">
40017 <primary>Sieve filter</primary>
40018 <secondary>configuring <command>appendfile</command></secondary>
40019 </indexterm>
40020 <indexterm role="concept">
40021 <primary>Sieve filter</primary>
40022 <secondary>relative mailbox path handling</secondary>
40023 </indexterm>
40024 As an example of the second case, consider an environment where users do not
40025 have home directories. They may be permitted to use Exim filter commands of the
40026 form:
40027 </para>
40028 <literallayout class="monospaced">
40029 save folder23
40030 </literallayout>
40031 <para>
40032 or Sieve filter commands of the form:
40033 </para>
40034 <literallayout class="monospaced">
40035 require "fileinto";
40036 fileinto "folder23";
40037 </literallayout>
40038 <para>
40039 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
40040 must transform the relative path into an appropriate absolute file name. In the
40041 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
40042 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
40043 way of handling this requirement:
40044 </para>
40045 <literallayout class="monospaced">
40046 file = ${if eq{$address_file}{inbox} \
40047             {/var/mail/$local_part} \
40048             {${if eq{${substr_0_1:$address_file}}{/} \
40049                   {$address_file} \
40050                   {$home/mail/$address_file} \
40051             }} \
40052        }
40053 </literallayout>
40054 <para>
40055 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
40056 location, absolute paths are used without change, and other folders are in the
40057 <filename>mail</filename> directory within the home directory.
40058 </para>
40059 <para>
40060 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
40061 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
40062 the router. In particular, this is the case if <option>check_local_user</option> is set. If
40063 you want to prevent this happening at routing time, you can set
40064 <option>router_home_directory</option> empty. This forces the router to pass the relative
40065 path to the transport.
40066 </para>
40067 <para>
40068 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
40069 the <option>file</option> or <option>directory</option> option is still used if it is set.
40070 </para>
40071 </section>
40072 <section id="SECID134">
40073 <title>Private options for appendfile</title>
40074 <para>
40075 <indexterm role="concept">
40076 <primary>options</primary>
40077 <secondary><command>appendfile</command> transport</secondary>
40078 </indexterm>
40079 </para>
40080 <para>
40081 <indexterm role="option">
40082 <primary><option>allow_fifo</option></primary>
40083 </indexterm>
40084 </para>
40085 <informaltable frame="all">
40086 <tgroup cols="4" colsep="0" rowsep="0">
40087 <colspec colwidth="8*" align="left"/>
40088 <colspec colwidth="6*" align="center"/>
40089 <colspec colwidth="6*" align="center"/>
40090 <colspec colwidth="6*" align="right"/>
40091 <tbody>
40092 <row>
40093 <entry><option>allow_fifo</option></entry>
40094 <entry>Use: <emphasis>appendfile</emphasis></entry>
40095 <entry>Type: <emphasis>boolean</emphasis></entry>
40096 <entry>Default: <emphasis>false</emphasis></entry>
40097 </row>
40098 </tbody>
40099 </tgroup>
40100 </informaltable>
40101 <para>
40102 <indexterm role="concept">
40103 <primary>fifo (named pipe)</primary>
40104 </indexterm>
40105 <indexterm role="concept">
40106 <primary>named pipe (fifo)</primary>
40107 </indexterm>
40108 <indexterm role="concept">
40109 <primary>pipe</primary>
40110 <secondary>named (fifo)</secondary>
40111 </indexterm>
40112 Setting this option permits delivery to named pipes (FIFOs) as well as to
40113 regular files. If no process is reading the named pipe at delivery time, the
40114 delivery is deferred.
40115 </para>
40116 <para>
40117 <indexterm role="option">
40118 <primary><option>allow_symlink</option></primary>
40119 </indexterm>
40120 </para>
40121 <informaltable frame="all">
40122 <tgroup cols="4" colsep="0" rowsep="0">
40123 <colspec colwidth="8*" align="left"/>
40124 <colspec colwidth="6*" align="center"/>
40125 <colspec colwidth="6*" align="center"/>
40126 <colspec colwidth="6*" align="right"/>
40127 <tbody>
40128 <row>
40129 <entry><option>allow_symlink</option></entry>
40130 <entry>Use: <emphasis>appendfile</emphasis></entry>
40131 <entry>Type: <emphasis>boolean</emphasis></entry>
40132 <entry>Default: <emphasis>false</emphasis></entry>
40133 </row>
40134 </tbody>
40135 </tgroup>
40136 </informaltable>
40137 <para>
40138 <indexterm role="concept">
40139 <primary>symbolic link</primary>
40140 <secondary>to mailbox</secondary>
40141 </indexterm>
40142 <indexterm role="concept">
40143 <primary>mailbox</primary>
40144 <secondary>symbolic link</secondary>
40145 </indexterm>
40146 By default, <command>appendfile</command> will not deliver if the path name for the file is
40147 that of a symbolic link. Setting this option relaxes that constraint, but there
40148 are security issues involved in the use of symbolic links. Be sure you know
40149 what you are doing if you set this. Details of exactly what this option affects
40150 are included in the discussion which follows this list of options.
40151 </para>
40152 <para>
40153 <indexterm role="option">
40154 <primary><option>batch_id</option></primary>
40155 </indexterm>
40156 </para>
40157 <informaltable frame="all">
40158 <tgroup cols="4" colsep="0" rowsep="0">
40159 <colspec colwidth="8*" align="left"/>
40160 <colspec colwidth="6*" align="center"/>
40161 <colspec colwidth="6*" align="center"/>
40162 <colspec colwidth="6*" align="right"/>
40163 <tbody>
40164 <row>
40165 <entry><option>batch_id</option></entry>
40166 <entry>Use: <emphasis>appendfile</emphasis></entry>
40167 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40168 <entry>Default: <emphasis>unset</emphasis></entry>
40169 </row>
40170 </tbody>
40171 </tgroup>
40172 </informaltable>
40173 <para>
40174 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40175 However, batching is automatically disabled for <command>appendfile</command> deliveries that
40176 happen as a result of forwarding or aliasing or other redirection directly to a
40177 file.
40178 </para>
40179 <para>
40180 <indexterm role="option">
40181 <primary><option>batch_max</option></primary>
40182 </indexterm>
40183 </para>
40184 <informaltable frame="all">
40185 <tgroup cols="4" colsep="0" rowsep="0">
40186 <colspec colwidth="8*" align="left"/>
40187 <colspec colwidth="6*" align="center"/>
40188 <colspec colwidth="6*" align="center"/>
40189 <colspec colwidth="6*" align="right"/>
40190 <tbody>
40191 <row>
40192 <entry><option>batch_max</option></entry>
40193 <entry>Use: <emphasis>appendfile</emphasis></entry>
40194 <entry>Type: <emphasis>integer</emphasis></entry>
40195 <entry>Default: <emphasis>1</emphasis></entry>
40196 </row>
40197 </tbody>
40198 </tgroup>
40199 </informaltable>
40200 <para>
40201 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40202 </para>
40203 <para>
40204 <indexterm role="option">
40205 <primary><option>check_group</option></primary>
40206 </indexterm>
40207 </para>
40208 <informaltable frame="all">
40209 <tgroup cols="4" colsep="0" rowsep="0">
40210 <colspec colwidth="8*" align="left"/>
40211 <colspec colwidth="6*" align="center"/>
40212 <colspec colwidth="6*" align="center"/>
40213 <colspec colwidth="6*" align="right"/>
40214 <tbody>
40215 <row>
40216 <entry><option>check_group</option></entry>
40217 <entry>Use: <emphasis>appendfile</emphasis></entry>
40218 <entry>Type: <emphasis>boolean</emphasis></entry>
40219 <entry>Default: <emphasis>false</emphasis></entry>
40220 </row>
40221 </tbody>
40222 </tgroup>
40223 </informaltable>
40224 <para>
40225 When this option is set, the group owner of the file defined by the <option>file</option>
40226 option is checked to see that it is the same as the group under which the
40227 delivery process is running. The default setting is false because the default
40228 file mode is 0600, which means that the group is irrelevant.
40229 </para>
40230 <para>
40231 <indexterm role="option">
40232 <primary><option>check_owner</option></primary>
40233 </indexterm>
40234 </para>
40235 <informaltable frame="all">
40236 <tgroup cols="4" colsep="0" rowsep="0">
40237 <colspec colwidth="8*" align="left"/>
40238 <colspec colwidth="6*" align="center"/>
40239 <colspec colwidth="6*" align="center"/>
40240 <colspec colwidth="6*" align="right"/>
40241 <tbody>
40242 <row>
40243 <entry><option>check_owner</option></entry>
40244 <entry>Use: <emphasis>appendfile</emphasis></entry>
40245 <entry>Type: <emphasis>boolean</emphasis></entry>
40246 <entry>Default: <emphasis>true</emphasis></entry>
40247 </row>
40248 </tbody>
40249 </tgroup>
40250 </informaltable>
40251 <para>
40252 When this option is set, the owner of the file defined by the <option>file</option> option
40253 is checked to ensure that it is the same as the user under which the delivery
40254 process is running.
40255 </para>
40256 <para>
40257 <indexterm role="option">
40258 <primary><option>check_string</option></primary>
40259 </indexterm>
40260 </para>
40261 <informaltable frame="all">
40262 <tgroup cols="4" colsep="0" rowsep="0">
40263 <colspec colwidth="8*" align="left"/>
40264 <colspec colwidth="6*" align="center"/>
40265 <colspec colwidth="6*" align="center"/>
40266 <colspec colwidth="6*" align="right"/>
40267 <tbody>
40268 <row>
40269 <entry><option>check_string</option></entry>
40270 <entry>Use: <emphasis>appendfile</emphasis></entry>
40271 <entry>Type: <emphasis>string</emphasis></entry>
40272 <entry>Default: <emphasis>see below</emphasis></entry>
40273 </row>
40274 </tbody>
40275 </tgroup>
40276 </informaltable>
40277 <para>
40278 <indexterm role="concept">
40279 <primary><quote>From</quote> line</primary>
40280 </indexterm>
40281 As <command>appendfile</command> writes the message, the start of each line is tested for
40282 matching <option>check_string</option>, and if it does, the initial matching characters are
40283 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
40284 a literal string, not a regular expression, and the case of any letters it
40285 contains is significant.
40286 </para>
40287 <para>
40288 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
40289 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
40290 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
40291 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
40292 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
40293 </para>
40294 <para>
40295 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
40296 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
40297 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
40298 if another format is used. For example, to deliver to mailboxes in MMDF format:
40299 <indexterm role="concept">
40300 <primary>MMDF format mailbox</primary>
40301 </indexterm>
40302 <indexterm role="concept">
40303 <primary>mailbox</primary>
40304 <secondary>MMDF format</secondary>
40305 </indexterm>
40306 </para>
40307 <literallayout class="monospaced">
40308 check_string = "\1\1\1\1\n"
40309 escape_string = "\1\1\1\1 \n"
40310 message_prefix = "\1\1\1\1\n"
40311 message_suffix = "\1\1\1\1\n"
40312 </literallayout>
40313 <para>
40314 <indexterm role="option">
40315 <primary><option>create_directory</option></primary>
40316 </indexterm>
40317 </para>
40318 <informaltable frame="all">
40319 <tgroup cols="4" colsep="0" rowsep="0">
40320 <colspec colwidth="8*" align="left"/>
40321 <colspec colwidth="6*" align="center"/>
40322 <colspec colwidth="6*" align="center"/>
40323 <colspec colwidth="6*" align="right"/>
40324 <tbody>
40325 <row>
40326 <entry><option>create_directory</option></entry>
40327 <entry>Use: <emphasis>appendfile</emphasis></entry>
40328 <entry>Type: <emphasis>boolean</emphasis></entry>
40329 <entry>Default: <emphasis>true</emphasis></entry>
40330 </row>
40331 </tbody>
40332 </tgroup>
40333 </informaltable>
40334 <para>
40335 <indexterm role="concept">
40336 <primary>directory creation</primary>
40337 </indexterm>
40338 When this option is true, Exim attempts to create any missing superior
40339 directories for the file that it is about to write. A created directory&#x2019;s mode
40340 is given by the <option>directory_mode</option> option.
40341 </para>
40342 <para>
40343 The group ownership of a newly created directory is highly dependent on the
40344 operating system (and possibly the file system) that is being used. For
40345 example, in Solaris, if the parent directory has the setgid bit set, its group
40346 is propagated to the child; if not, the currently set group is used. However,
40347 in FreeBSD, the parent&#x2019;s group is always used.
40348 </para>
40349 <para>
40350 <indexterm role="option">
40351 <primary><option>create_file</option></primary>
40352 </indexterm>
40353 </para>
40354 <informaltable frame="all">
40355 <tgroup cols="4" colsep="0" rowsep="0">
40356 <colspec colwidth="8*" align="left"/>
40357 <colspec colwidth="6*" align="center"/>
40358 <colspec colwidth="6*" align="center"/>
40359 <colspec colwidth="6*" align="right"/>
40360 <tbody>
40361 <row>
40362 <entry><option>create_file</option></entry>
40363 <entry>Use: <emphasis>appendfile</emphasis></entry>
40364 <entry>Type: <emphasis>string</emphasis></entry>
40365 <entry>Default: <emphasis>anywhere</emphasis></entry>
40366 </row>
40367 </tbody>
40368 </tgroup>
40369 </informaltable>
40370 <para>
40371 This option constrains the location of files and directories that are created
40372 by this transport. It applies to files defined by the <option>file</option> option and
40373 directories defined by the <option>directory</option> option. In the case of maildir
40374 delivery, it applies to the top level directory, not the maildir directories
40375 beneath.
40376 </para>
40377 <para>
40378 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
40379 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
40380 set for the transport. This option is not useful when an explicit file name is
40381 given for normal mailbox deliveries. It is intended for the case when file
40382 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
40383 by an <command>appendfile</command> transport called <option>address_file</option>. See also
40384 <option>file_must_exist</option>.
40385 </para>
40386 <para>
40387 <indexterm role="option">
40388 <primary><option>directory</option></primary>
40389 </indexterm>
40390 </para>
40391 <informaltable frame="all">
40392 <tgroup cols="4" colsep="0" rowsep="0">
40393 <colspec colwidth="8*" align="left"/>
40394 <colspec colwidth="6*" align="center"/>
40395 <colspec colwidth="6*" align="center"/>
40396 <colspec colwidth="6*" align="right"/>
40397 <tbody>
40398 <row>
40399 <entry><option>directory</option></entry>
40400 <entry>Use: <emphasis>appendfile</emphasis></entry>
40401 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40402 <entry>Default: <emphasis>unset</emphasis></entry>
40403 </row>
40404 </tbody>
40405 </tgroup>
40406 </informaltable>
40407 <para>
40408 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
40409 or <option>directory</option> must be set, unless the delivery is the direct result of a
40410 redirection (see section <xref linkend="SECTfildiropt"/>).
40411 </para>
40412 <para>
40413 When <option>directory</option> is set, the string is expanded, and the message is delivered
40414 into a new file or files in or below the given directory, instead of being
40415 appended to a single mailbox file. A number of different formats are provided
40416 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
40417 <xref linkend="SECTopdir"/> for further details of this form of delivery.
40418 </para>
40419 <para>
40420 <indexterm role="option">
40421 <primary><option>directory_file</option></primary>
40422 </indexterm>
40423 </para>
40424 <informaltable frame="all">
40425 <tgroup cols="4" colsep="0" rowsep="0">
40426 <colspec colwidth="8*" align="left"/>
40427 <colspec colwidth="6*" align="center"/>
40428 <colspec colwidth="6*" align="center"/>
40429 <colspec colwidth="6*" align="right"/>
40430 <tbody>
40431 <row>
40432 <entry><option>directory_file</option></entry>
40433 <entry>Use: <emphasis>appendfile</emphasis></entry>
40434 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40435 <entry>Default: <emphasis>see below</emphasis></entry>
40436 </row>
40437 </tbody>
40438 </tgroup>
40439 </informaltable>
40440 <para>
40441 <indexterm role="concept">
40442 <primary>base62</primary>
40443 </indexterm>
40444 <indexterm role="variable">
40445 <primary><varname>$inode</varname></primary>
40446 </indexterm>
40447 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
40448 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
40449 whose name is obtained by expanding this string. The default value is:
40450 </para>
40451 <literallayout class="monospaced">
40452 q${base62:$tod_epoch}-$inode
40453 </literallayout>
40454 <para>
40455 This generates a unique name from the current time, in base 62 form, and the
40456 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
40457 option.
40458 </para>
40459 <para>
40460 <indexterm role="option">
40461 <primary><option>directory_mode</option></primary>
40462 </indexterm>
40463 </para>
40464 <informaltable frame="all">
40465 <tgroup cols="4" colsep="0" rowsep="0">
40466 <colspec colwidth="8*" align="left"/>
40467 <colspec colwidth="6*" align="center"/>
40468 <colspec colwidth="6*" align="center"/>
40469 <colspec colwidth="6*" align="right"/>
40470 <tbody>
40471 <row>
40472 <entry><option>directory_mode</option></entry>
40473 <entry>Use: <emphasis>appendfile</emphasis></entry>
40474 <entry>Type: <emphasis>octal integer</emphasis></entry>
40475 <entry>Default: <emphasis>0700</emphasis></entry>
40476 </row>
40477 </tbody>
40478 </tgroup>
40479 </informaltable>
40480 <para>
40481 If <command>appendfile</command> creates any directories as a result of the
40482 <option>create_directory</option> option, their mode is specified by this option.
40483 </para>
40484 <para>
40485 <indexterm role="option">
40486 <primary><option>escape_string</option></primary>
40487 </indexterm>
40488 </para>
40489 <informaltable frame="all">
40490 <tgroup cols="4" colsep="0" rowsep="0">
40491 <colspec colwidth="8*" align="left"/>
40492 <colspec colwidth="6*" align="center"/>
40493 <colspec colwidth="6*" align="center"/>
40494 <colspec colwidth="6*" align="right"/>
40495 <tbody>
40496 <row>
40497 <entry><option>escape_string</option></entry>
40498 <entry>Use: <emphasis>appendfile</emphasis></entry>
40499 <entry>Type: <emphasis>string</emphasis></entry>
40500 <entry>Default: <emphasis>see description</emphasis></entry>
40501 </row>
40502 </tbody>
40503 </tgroup>
40504 </informaltable>
40505 <para>
40506 See <option>check_string</option> above.
40507 </para>
40508 <para>
40509 <indexterm role="option">
40510 <primary><option>file</option></primary>
40511 </indexterm>
40512 </para>
40513 <informaltable frame="all">
40514 <tgroup cols="4" colsep="0" rowsep="0">
40515 <colspec colwidth="8*" align="left"/>
40516 <colspec colwidth="6*" align="center"/>
40517 <colspec colwidth="6*" align="center"/>
40518 <colspec colwidth="6*" align="right"/>
40519 <tbody>
40520 <row>
40521 <entry><option>file</option></entry>
40522 <entry>Use: <emphasis>appendfile</emphasis></entry>
40523 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40524 <entry>Default: <emphasis>unset</emphasis></entry>
40525 </row>
40526 </tbody>
40527 </tgroup>
40528 </informaltable>
40529 <para>
40530 This option is mutually exclusive with the <option>directory</option> option, but one of
40531 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
40532 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
40533 specifies a single file, to which the message is appended. One or more of
40534 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
40535 <option>file</option>.
40536 </para>
40537 <para>
40538 <indexterm role="concept">
40539 <primary>NFS</primary>
40540 <secondary>lock file</secondary>
40541 </indexterm>
40542 <indexterm role="concept">
40543 <primary>locking files</primary>
40544 </indexterm>
40545 <indexterm role="concept">
40546 <primary>lock files</primary>
40547 </indexterm>
40548 If you are using more than one host to deliver over NFS into the same
40549 mailboxes, you should always use lock files.
40550 </para>
40551 <para>
40552 The string value is expanded for each delivery, and must yield an absolute
40553 path. The most common settings of this option are variations on one of these
40554 examples:
40555 </para>
40556 <literallayout class="monospaced">
40557 file = /var/spool/mail/$local_part
40558 file = /home/$local_part/inbox
40559 file = $home/inbox
40560 </literallayout>
40561 <para>
40562 <indexterm role="concept">
40563 <primary><quote>sticky</quote> bit</primary>
40564 </indexterm>
40565 In the first example, all deliveries are done into the same directory. If Exim
40566 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
40567 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
40568 deliveries to be possible, or alternatively the <option>group</option> option can be used to
40569 run the delivery under a group id which has write access to the directory.
40570 </para>
40571 <para>
40572 <indexterm role="option">
40573 <primary><option>file_format</option></primary>
40574 </indexterm>
40575 </para>
40576 <informaltable frame="all">
40577 <tgroup cols="4" colsep="0" rowsep="0">
40578 <colspec colwidth="8*" align="left"/>
40579 <colspec colwidth="6*" align="center"/>
40580 <colspec colwidth="6*" align="center"/>
40581 <colspec colwidth="6*" align="right"/>
40582 <tbody>
40583 <row>
40584 <entry><option>file_format</option></entry>
40585 <entry>Use: <emphasis>appendfile</emphasis></entry>
40586 <entry>Type: <emphasis>string</emphasis></entry>
40587 <entry>Default: <emphasis>unset</emphasis></entry>
40588 </row>
40589 </tbody>
40590 </tgroup>
40591 </informaltable>
40592 <para>
40593 <indexterm role="concept">
40594 <primary>file</primary>
40595 <secondary>mailbox; checking existing format</secondary>
40596 </indexterm>
40597 This option requests the transport to check the format of an existing file
40598 before adding to it. The check consists of matching a specific string at the
40599 start of the file. The value of the option consists of an even number of
40600 colon-separated strings. The first of each pair is the test string, and the
40601 second is the name of a transport. If the transport associated with a matched
40602 string is not the current transport, control is passed over to the other
40603 transport. For example, suppose the standard <command>local_delivery</command> transport has
40604 this added to it:
40605 </para>
40606 <literallayout class="monospaced">
40607 file_format = "From       : local_delivery :\
40608                \1\1\1\1\n : local_mmdf_delivery"
40609 </literallayout>
40610 <para>
40611 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
40612 a mailbox begins with four binary ones followed by a newline, control is passed
40613 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
40614 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
40615 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
40616 match any string, or if the transport named for a given string is not defined,
40617 delivery is deferred.
40618 </para>
40619 <para>
40620 <indexterm role="option">
40621 <primary><option>file_must_exist</option></primary>
40622 </indexterm>
40623 </para>
40624 <informaltable frame="all">
40625 <tgroup cols="4" colsep="0" rowsep="0">
40626 <colspec colwidth="8*" align="left"/>
40627 <colspec colwidth="6*" align="center"/>
40628 <colspec colwidth="6*" align="center"/>
40629 <colspec colwidth="6*" align="right"/>
40630 <tbody>
40631 <row>
40632 <entry><option>file_must_exist</option></entry>
40633 <entry>Use: <emphasis>appendfile</emphasis></entry>
40634 <entry>Type: <emphasis>boolean</emphasis></entry>
40635 <entry>Default: <emphasis>false</emphasis></entry>
40636 </row>
40637 </tbody>
40638 </tgroup>
40639 </informaltable>
40640 <para>
40641 If this option is true, the file specified by the <option>file</option> option must exist.
40642 A temporary error occurs if it does not, causing delivery to be deferred.
40643 If this option is false, the file is created if it does not exist.
40644 </para>
40645 <para>
40646 <indexterm role="option">
40647 <primary><option>lock_fcntl_timeout</option></primary>
40648 </indexterm>
40649 </para>
40650 <informaltable frame="all">
40651 <tgroup cols="4" colsep="0" rowsep="0">
40652 <colspec colwidth="8*" align="left"/>
40653 <colspec colwidth="6*" align="center"/>
40654 <colspec colwidth="6*" align="center"/>
40655 <colspec colwidth="6*" align="right"/>
40656 <tbody>
40657 <row>
40658 <entry><option>lock_fcntl_timeout</option></entry>
40659 <entry>Use: <emphasis>appendfile</emphasis></entry>
40660 <entry>Type: <emphasis>time</emphasis></entry>
40661 <entry>Default: <emphasis>0s</emphasis></entry>
40662 </row>
40663 </tbody>
40664 </tgroup>
40665 </informaltable>
40666 <para>
40667 <indexterm role="concept">
40668 <primary>timeout</primary>
40669 <secondary>mailbox locking</secondary>
40670 </indexterm>
40671 <indexterm role="concept">
40672 <primary>mailbox</primary>
40673 <secondary>locking, blocking and non-blocking</secondary>
40674 </indexterm>
40675 <indexterm role="concept">
40676 <primary>locking files</primary>
40677 </indexterm>
40678 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
40679 when locking an open mailbox file. If the call fails, the delivery process
40680 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
40681 Non-blocking calls are used so that the file is not kept open during the wait
40682 for the lock; the reason for this is to make it as safe as possible for
40683 deliveries over NFS in the case when processes might be accessing an NFS
40684 mailbox without using a lock file. This should not be done, but
40685 misunderstandings and hence misconfigurations are not unknown.
40686 </para>
40687 <para>
40688 On a busy system, however, the performance of a non-blocking lock approach is
40689 not as good as using a blocking lock with a timeout. In this case, the waiting
40690 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
40691 and can proceed as soon as the previous lock holder releases it.
40692 </para>
40693 <para>
40694 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
40695 timeout, are used. There may still be some retrying: the maximum number of
40696 retries is
40697 </para>
40698 <literallayout class="monospaced">
40699 (lock_retries * lock_interval) / lock_fcntl_timeout
40700 </literallayout>
40701 <para>
40702 rounded up to the next whole number. In other words, the total time during
40703 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
40704 <option>lock_fcntl_timeout</option> is set very large.
40705 </para>
40706 <para>
40707 You should consider setting this option if you are getting a lot of delayed
40708 local deliveries because of errors of the form
40709 </para>
40710 <literallayout class="monospaced">
40711 failed to lock mailbox /some/file (fcntl)
40712 </literallayout>
40713 <para>
40714 <indexterm role="option">
40715 <primary><option>lock_flock_timeout</option></primary>
40716 </indexterm>
40717 </para>
40718 <informaltable frame="all">
40719 <tgroup cols="4" colsep="0" rowsep="0">
40720 <colspec colwidth="8*" align="left"/>
40721 <colspec colwidth="6*" align="center"/>
40722 <colspec colwidth="6*" align="center"/>
40723 <colspec colwidth="6*" align="right"/>
40724 <tbody>
40725 <row>
40726 <entry><option>lock_flock_timeout</option></entry>
40727 <entry>Use: <emphasis>appendfile</emphasis></entry>
40728 <entry>Type: <emphasis>time</emphasis></entry>
40729 <entry>Default: <emphasis>0s</emphasis></entry>
40730 </row>
40731 </tbody>
40732 </tgroup>
40733 </informaltable>
40734 <para>
40735 This timeout applies to file locking when using <function>flock()</function> (see
40736 <option>use_flock</option>); the timeout operates in a similar manner to
40737 <option>lock_fcntl_timeout</option>.
40738 </para>
40739 <para>
40740 <indexterm role="option">
40741 <primary><option>lock_interval</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>lock_interval</option></entry>
40753 <entry>Use: <emphasis>appendfile</emphasis></entry>
40754 <entry>Type: <emphasis>time</emphasis></entry>
40755 <entry>Default: <emphasis>3s</emphasis></entry>
40756 </row>
40757 </tbody>
40758 </tgroup>
40759 </informaltable>
40760 <para>
40761 This specifies the time to wait between attempts to lock the file. See below
40762 for details of locking.
40763 </para>
40764 <para>
40765 <indexterm role="option">
40766 <primary><option>lock_retries</option></primary>
40767 </indexterm>
40768 </para>
40769 <informaltable frame="all">
40770 <tgroup cols="4" colsep="0" rowsep="0">
40771 <colspec colwidth="8*" align="left"/>
40772 <colspec colwidth="6*" align="center"/>
40773 <colspec colwidth="6*" align="center"/>
40774 <colspec colwidth="6*" align="right"/>
40775 <tbody>
40776 <row>
40777 <entry><option>lock_retries</option></entry>
40778 <entry>Use: <emphasis>appendfile</emphasis></entry>
40779 <entry>Type: <emphasis>integer</emphasis></entry>
40780 <entry>Default: <emphasis>10</emphasis></entry>
40781 </row>
40782 </tbody>
40783 </tgroup>
40784 </informaltable>
40785 <para>
40786 This specifies the maximum number of attempts to lock the file. A value of zero
40787 is treated as 1. See below for details of locking.
40788 </para>
40789 <para>
40790 <indexterm role="option">
40791 <primary><option>lockfile_mode</option></primary>
40792 </indexterm>
40793 </para>
40794 <informaltable frame="all">
40795 <tgroup cols="4" colsep="0" rowsep="0">
40796 <colspec colwidth="8*" align="left"/>
40797 <colspec colwidth="6*" align="center"/>
40798 <colspec colwidth="6*" align="center"/>
40799 <colspec colwidth="6*" align="right"/>
40800 <tbody>
40801 <row>
40802 <entry><option>lockfile_mode</option></entry>
40803 <entry>Use: <emphasis>appendfile</emphasis></entry>
40804 <entry>Type: <emphasis>octal integer</emphasis></entry>
40805 <entry>Default: <emphasis>0600</emphasis></entry>
40806 </row>
40807 </tbody>
40808 </tgroup>
40809 </informaltable>
40810 <para>
40811 This specifies the mode of the created lock file, when a lock file is being
40812 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
40813 </para>
40814 <para>
40815 <indexterm role="option">
40816 <primary><option>lockfile_timeout</option></primary>
40817 </indexterm>
40818 </para>
40819 <informaltable frame="all">
40820 <tgroup cols="4" colsep="0" rowsep="0">
40821 <colspec colwidth="8*" align="left"/>
40822 <colspec colwidth="6*" align="center"/>
40823 <colspec colwidth="6*" align="center"/>
40824 <colspec colwidth="6*" align="right"/>
40825 <tbody>
40826 <row>
40827 <entry><option>lockfile_timeout</option></entry>
40828 <entry>Use: <emphasis>appendfile</emphasis></entry>
40829 <entry>Type: <emphasis>time</emphasis></entry>
40830 <entry>Default: <emphasis>30m</emphasis></entry>
40831 </row>
40832 </tbody>
40833 </tgroup>
40834 </informaltable>
40835 <para>
40836 <indexterm role="concept">
40837 <primary>timeout</primary>
40838 <secondary>mailbox locking</secondary>
40839 </indexterm>
40840 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
40841 exists and is older than this value, it is assumed to have been left behind by
40842 accident, and Exim attempts to remove it.
40843 </para>
40844 <para>
40845 <indexterm role="option">
40846 <primary><option>mailbox_filecount</option></primary>
40847 </indexterm>
40848 </para>
40849 <informaltable frame="all">
40850 <tgroup cols="4" colsep="0" rowsep="0">
40851 <colspec colwidth="8*" align="left"/>
40852 <colspec colwidth="6*" align="center"/>
40853 <colspec colwidth="6*" align="center"/>
40854 <colspec colwidth="6*" align="right"/>
40855 <tbody>
40856 <row>
40857 <entry><option>mailbox_filecount</option></entry>
40858 <entry>Use: <emphasis>appendfile</emphasis></entry>
40859 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40860 <entry>Default: <emphasis>unset</emphasis></entry>
40861 </row>
40862 </tbody>
40863 </tgroup>
40864 </informaltable>
40865 <para>
40866 <indexterm role="concept">
40867 <primary>mailbox</primary>
40868 <secondary>specifying size of</secondary>
40869 </indexterm>
40870 <indexterm role="concept">
40871 <primary>size</primary>
40872 <secondary>of mailbox</secondary>
40873 </indexterm>
40874 If this option is set, it is expanded, and the result is taken as the current
40875 number of files in the mailbox. It must be a decimal number, optionally
40876 followed by K or M. This provides a way of obtaining this information from an
40877 external source that maintains the data.
40878 </para>
40879 <para>
40880 <indexterm role="option">
40881 <primary><option>mailbox_size</option></primary>
40882 </indexterm>
40883 </para>
40884 <informaltable frame="all">
40885 <tgroup cols="4" colsep="0" rowsep="0">
40886 <colspec colwidth="8*" align="left"/>
40887 <colspec colwidth="6*" align="center"/>
40888 <colspec colwidth="6*" align="center"/>
40889 <colspec colwidth="6*" align="right"/>
40890 <tbody>
40891 <row>
40892 <entry><option>mailbox_size</option></entry>
40893 <entry>Use: <emphasis>appendfile</emphasis></entry>
40894 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40895 <entry>Default: <emphasis>unset</emphasis></entry>
40896 </row>
40897 </tbody>
40898 </tgroup>
40899 </informaltable>
40900 <para>
40901 <indexterm role="concept">
40902 <primary>mailbox</primary>
40903 <secondary>specifying size of</secondary>
40904 </indexterm>
40905 <indexterm role="concept">
40906 <primary>size</primary>
40907 <secondary>of mailbox</secondary>
40908 </indexterm>
40909 If this option is set, it is expanded, and the result is taken as the current
40910 size the mailbox. It must be a decimal number, optionally followed by K or M.
40911 This provides a way of obtaining this information from an external source that
40912 maintains the data. This is likely to be helpful for maildir deliveries where
40913 it is computationally expensive to compute the size of a mailbox.
40914 </para>
40915 <para>
40916 <indexterm role="option">
40917 <primary><option>maildir_format</option></primary>
40918 </indexterm>
40919 </para>
40920 <informaltable frame="all">
40921 <tgroup cols="4" colsep="0" rowsep="0">
40922 <colspec colwidth="8*" align="left"/>
40923 <colspec colwidth="6*" align="center"/>
40924 <colspec colwidth="6*" align="center"/>
40925 <colspec colwidth="6*" align="right"/>
40926 <tbody>
40927 <row>
40928 <entry><option>maildir_format</option></entry>
40929 <entry>Use: <emphasis>appendfile</emphasis></entry>
40930 <entry>Type: <emphasis>boolean</emphasis></entry>
40931 <entry>Default: <emphasis>false</emphasis></entry>
40932 </row>
40933 </tbody>
40934 </tgroup>
40935 </informaltable>
40936 <para>
40937 <indexterm role="concept">
40938 <primary>maildir format</primary>
40939 <secondary>specifying</secondary>
40940 </indexterm>
40941 If this option is set with the <option>directory</option> option, the delivery is into a new
40942 file, in the <quote>maildir</quote> format that is used by other mail software. When the
40943 transport is activated directly from a <command>redirect</command> router (for example, the
40944 <command>address_file</command> transport in the default configuration), setting
40945 <option>maildir_format</option> causes the path received from the router to be treated as a
40946 directory, whether or not it ends with <literal>/</literal>. This option is available only if
40947 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
40948 <xref linkend="SECTmaildirdelivery"/> below for further details.
40949 </para>
40950 <para>
40951 <indexterm role="option">
40952 <primary><option>maildir_quota_directory_regex</option></primary>
40953 </indexterm>
40954 </para>
40955 <informaltable frame="all">
40956 <tgroup cols="4" colsep="0" rowsep="0">
40957 <colspec colwidth="8*" align="left"/>
40958 <colspec colwidth="6*" align="center"/>
40959 <colspec colwidth="6*" align="center"/>
40960 <colspec colwidth="6*" align="right"/>
40961 <tbody>
40962 <row>
40963 <entry><option>maildir_quota_directory_regex</option></entry>
40964 <entry>Use: <emphasis>appendfile</emphasis></entry>
40965 <entry>Type: <emphasis>string</emphasis></entry>
40966 <entry>Default: <emphasis>See below</emphasis></entry>
40967 </row>
40968 </tbody>
40969 </tgroup>
40970 </informaltable>
40971 <para>
40972 <indexterm role="concept">
40973 <primary>maildir format</primary>
40974 <secondary>quota; directories included in</secondary>
40975 </indexterm>
40976 <indexterm role="concept">
40977 <primary>quota</primary>
40978 <secondary>maildir; directories included in</secondary>
40979 </indexterm>
40980 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
40981 a regular expression for specifying directories, relative to the quota
40982 directory (see <option>quota_directory</option>), that should be included in the quota
40983 calculation. The default value is:
40984 </para>
40985 <literallayout class="monospaced">
40986 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
40987 </literallayout>
40988 <para>
40989 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
40990 (directories whose names begin with a dot). If you want to exclude the
40991 <filename>Trash</filename>
40992 folder from the count (as some sites do), you need to change this setting to
40993 </para>
40994 <literallayout class="monospaced">
40995 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
40996 </literallayout>
40997 <para>
40998 This uses a negative lookahead in the regular expression to exclude the
40999 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
41000 calculations, quota processing is bypassed for any messages that are delivered
41001 directly into that directory.
41002 </para>
41003 <para>
41004 <indexterm role="option">
41005 <primary><option>maildir_retries</option></primary>
41006 </indexterm>
41007 </para>
41008 <informaltable frame="all">
41009 <tgroup cols="4" colsep="0" rowsep="0">
41010 <colspec colwidth="8*" align="left"/>
41011 <colspec colwidth="6*" align="center"/>
41012 <colspec colwidth="6*" align="center"/>
41013 <colspec colwidth="6*" align="right"/>
41014 <tbody>
41015 <row>
41016 <entry><option>maildir_retries</option></entry>
41017 <entry>Use: <emphasis>appendfile</emphasis></entry>
41018 <entry>Type: <emphasis>integer</emphasis></entry>
41019 <entry>Default: <emphasis>10</emphasis></entry>
41020 </row>
41021 </tbody>
41022 </tgroup>
41023 </informaltable>
41024 <para>
41025 This option specifies the number of times to retry when writing a file in
41026 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
41027 </para>
41028 <para>
41029 <indexterm role="option">
41030 <primary><option>maildir_tag</option></primary>
41031 </indexterm>
41032 </para>
41033 <informaltable frame="all">
41034 <tgroup cols="4" colsep="0" rowsep="0">
41035 <colspec colwidth="8*" align="left"/>
41036 <colspec colwidth="6*" align="center"/>
41037 <colspec colwidth="6*" align="center"/>
41038 <colspec colwidth="6*" align="right"/>
41039 <tbody>
41040 <row>
41041 <entry><option>maildir_tag</option></entry>
41042 <entry>Use: <emphasis>appendfile</emphasis></entry>
41043 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41044 <entry>Default: <emphasis>unset</emphasis></entry>
41045 </row>
41046 </tbody>
41047 </tgroup>
41048 </informaltable>
41049 <para>
41050 This option applies only to deliveries in maildir format, and is described in
41051 section <xref linkend="SECTmaildirdelivery"/> below.
41052 </para>
41053 <para>
41054 <indexterm role="option">
41055 <primary><option>maildir_use_size_file</option></primary>
41056 </indexterm>
41057 </para>
41058 <informaltable frame="all">
41059 <tgroup cols="4" colsep="0" rowsep="0">
41060 <colspec colwidth="8*" align="left"/>
41061 <colspec colwidth="6*" align="center"/>
41062 <colspec colwidth="6*" align="center"/>
41063 <colspec colwidth="6*" align="right"/>
41064 <tbody>
41065 <row>
41066 <entry><option>maildir_use_size_file</option></entry>
41067 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
41068 <entry>Type: <emphasis>boolean</emphasis></entry>
41069 <entry>Default: <emphasis>false</emphasis></entry>
41070 </row>
41071 </tbody>
41072 </tgroup>
41073 </informaltable>
41074 <para>
41075 <indexterm role="concept">
41076 <primary>maildir format</primary>
41077 <secondary><filename>maildirsize</filename> file</secondary>
41078 </indexterm>
41079 The result of string expansion for this option must be a valid boolean value.
41080 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
41081 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
41082 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
41083 value is zero. See <option>maildir_quota_directory_regex</option> above and section
41084 <xref linkend="SECTmaildirdelivery"/> below for further details.
41085 </para>
41086 <para>
41087 <indexterm role="option">
41088 <primary><option>maildirfolder_create_regex</option></primary>
41089 </indexterm>
41090 </para>
41091 <informaltable frame="all">
41092 <tgroup cols="4" colsep="0" rowsep="0">
41093 <colspec colwidth="8*" align="left"/>
41094 <colspec colwidth="6*" align="center"/>
41095 <colspec colwidth="6*" align="center"/>
41096 <colspec colwidth="6*" align="right"/>
41097 <tbody>
41098 <row>
41099 <entry><option>maildirfolder_create_regex</option></entry>
41100 <entry>Use: <emphasis>appendfile</emphasis></entry>
41101 <entry>Type: <emphasis>string</emphasis></entry>
41102 <entry>Default: <emphasis>unset</emphasis></entry>
41103 </row>
41104 </tbody>
41105 </tgroup>
41106 </informaltable>
41107 <para>
41108 <indexterm role="concept">
41109 <primary>maildir format</primary>
41110 <secondary><filename>maildirfolder</filename> file</secondary>
41111 </indexterm>
41112 <indexterm role="concept">
41113 <primary><filename>maildirfolder</filename>, creating</primary>
41114 </indexterm>
41115 The value of this option is a regular expression. If it is unset, it has no
41116 effect. Otherwise, before a maildir delivery takes place, the pattern is
41117 matched against the name of the maildir directory, that is, the directory
41118 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
41119 delivery. If there is a match, Exim checks for the existence of a file called
41120 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
41121 See section <xref linkend="SECTmaildirdelivery"/> for more details.
41122 </para>
41123 <para>
41124 <indexterm role="option">
41125 <primary><option>mailstore_format</option></primary>
41126 </indexterm>
41127 </para>
41128 <informaltable frame="all">
41129 <tgroup cols="4" colsep="0" rowsep="0">
41130 <colspec colwidth="8*" align="left"/>
41131 <colspec colwidth="6*" align="center"/>
41132 <colspec colwidth="6*" align="center"/>
41133 <colspec colwidth="6*" align="right"/>
41134 <tbody>
41135 <row>
41136 <entry><option>mailstore_format</option></entry>
41137 <entry>Use: <emphasis>appendfile</emphasis></entry>
41138 <entry>Type: <emphasis>boolean</emphasis></entry>
41139 <entry>Default: <emphasis>false</emphasis></entry>
41140 </row>
41141 </tbody>
41142 </tgroup>
41143 </informaltable>
41144 <para>
41145 <indexterm role="concept">
41146 <primary>mailstore format</primary>
41147 <secondary>specifying</secondary>
41148 </indexterm>
41149 If this option is set with the <option>directory</option> option, the delivery is into two
41150 new files in  <quote>mailstore</quote> format. The option is available only if
41151 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
41152 below for further details.
41153 </para>
41154 <para>
41155 <indexterm role="option">
41156 <primary><option>mailstore_prefix</option></primary>
41157 </indexterm>
41158 </para>
41159 <informaltable frame="all">
41160 <tgroup cols="4" colsep="0" rowsep="0">
41161 <colspec colwidth="8*" align="left"/>
41162 <colspec colwidth="6*" align="center"/>
41163 <colspec colwidth="6*" align="center"/>
41164 <colspec colwidth="6*" align="right"/>
41165 <tbody>
41166 <row>
41167 <entry><option>mailstore_prefix</option></entry>
41168 <entry>Use: <emphasis>appendfile</emphasis></entry>
41169 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41170 <entry>Default: <emphasis>unset</emphasis></entry>
41171 </row>
41172 </tbody>
41173 </tgroup>
41174 </informaltable>
41175 <para>
41176 This option applies only to deliveries in mailstore format, and is described in
41177 section <xref linkend="SECTopdir"/> below.
41178 </para>
41179 <para>
41180 <indexterm role="option">
41181 <primary><option>mailstore_suffix</option></primary>
41182 </indexterm>
41183 </para>
41184 <informaltable frame="all">
41185 <tgroup cols="4" colsep="0" rowsep="0">
41186 <colspec colwidth="8*" align="left"/>
41187 <colspec colwidth="6*" align="center"/>
41188 <colspec colwidth="6*" align="center"/>
41189 <colspec colwidth="6*" align="right"/>
41190 <tbody>
41191 <row>
41192 <entry><option>mailstore_suffix</option></entry>
41193 <entry>Use: <emphasis>appendfile</emphasis></entry>
41194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41195 <entry>Default: <emphasis>unset</emphasis></entry>
41196 </row>
41197 </tbody>
41198 </tgroup>
41199 </informaltable>
41200 <para>
41201 This option applies only to deliveries in mailstore format, and is described in
41202 section <xref linkend="SECTopdir"/> below.
41203 </para>
41204 <para>
41205 <indexterm role="option">
41206 <primary><option>mbx_format</option></primary>
41207 </indexterm>
41208 </para>
41209 <informaltable frame="all">
41210 <tgroup cols="4" colsep="0" rowsep="0">
41211 <colspec colwidth="8*" align="left"/>
41212 <colspec colwidth="6*" align="center"/>
41213 <colspec colwidth="6*" align="center"/>
41214 <colspec colwidth="6*" align="right"/>
41215 <tbody>
41216 <row>
41217 <entry><option>mbx_format</option></entry>
41218 <entry>Use: <emphasis>appendfile</emphasis></entry>
41219 <entry>Type: <emphasis>boolean</emphasis></entry>
41220 <entry>Default: <emphasis>false</emphasis></entry>
41221 </row>
41222 </tbody>
41223 </tgroup>
41224 </informaltable>
41225 <para>
41226 <indexterm role="concept">
41227 <primary>locking files</primary>
41228 </indexterm>
41229 <indexterm role="concept">
41230 <primary>file</primary>
41231 <secondary>locking</secondary>
41232 </indexterm>
41233 <indexterm role="concept">
41234 <primary>file</primary>
41235 <secondary>MBX format</secondary>
41236 </indexterm>
41237 <indexterm role="concept">
41238 <primary>MBX format, specifying</primary>
41239 </indexterm>
41240 This option is available only if Exim has been compiled with SUPPORT_MBX
41241 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
41242 the message is appended to the mailbox file in MBX format instead of
41243 traditional Unix format. This format is supported by Pine4 and its associated
41244 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
41245 </para>
41246 <para>
41247 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
41248 automatically changed by the use of <option>mbx_format</option>. They should normally be set
41249 empty when using MBX format, so this option almost always appears in this
41250 combination:
41251 </para>
41252 <literallayout class="monospaced">
41253 mbx_format = true
41254 message_prefix =
41255 message_suffix =
41256 </literallayout>
41257 <para>
41258 If none of the locking options are mentioned in the configuration,
41259 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
41260 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
41261 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
41262 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
41263 should not be used if any program that does not use this form of locking is
41264 going to access the mailbox, nor should it be used if the mailbox file is NFS
41265 mounted, because it works only when the mailbox is accessed from a single host.
41266 </para>
41267 <para>
41268 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
41269 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
41270 (this means for the whole of a Pine or IMAP session), Exim will not be able to
41271 append messages to it.
41272 </para>
41273 <para>
41274 <indexterm role="option">
41275 <primary><option>message_prefix</option></primary>
41276 </indexterm>
41277 </para>
41278 <informaltable frame="all">
41279 <tgroup cols="4" colsep="0" rowsep="0">
41280 <colspec colwidth="8*" align="left"/>
41281 <colspec colwidth="6*" align="center"/>
41282 <colspec colwidth="6*" align="center"/>
41283 <colspec colwidth="6*" align="right"/>
41284 <tbody>
41285 <row>
41286 <entry><option>message_prefix</option></entry>
41287 <entry>Use: <emphasis>appendfile</emphasis></entry>
41288 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41289 <entry>Default: <emphasis>see below</emphasis></entry>
41290 </row>
41291 </tbody>
41292 </tgroup>
41293 </informaltable>
41294 <para>
41295 <indexterm role="concept">
41296 <primary><quote>From</quote> line</primary>
41297 </indexterm>
41298 The string specified here is expanded and output at the start of every message.
41299 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
41300 in which case it is:
41301 </para>
41302 <literallayout class="monospaced">
41303 message_prefix = "From ${if def:return_path{$return_path}\
41304   {MAILER-DAEMON}} $tod_bsdinbox\n"
41305 </literallayout>
41306 <para>
41307 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41308 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
41309 </para>
41310 <para>
41311 <indexterm role="option">
41312 <primary><option>message_suffix</option></primary>
41313 </indexterm>
41314 </para>
41315 <informaltable frame="all">
41316 <tgroup cols="4" colsep="0" rowsep="0">
41317 <colspec colwidth="8*" align="left"/>
41318 <colspec colwidth="6*" align="center"/>
41319 <colspec colwidth="6*" align="center"/>
41320 <colspec colwidth="6*" align="right"/>
41321 <tbody>
41322 <row>
41323 <entry><option>message_suffix</option></entry>
41324 <entry>Use: <emphasis>appendfile</emphasis></entry>
41325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41326 <entry>Default: <emphasis>see below</emphasis></entry>
41327 </row>
41328 </tbody>
41329 </tgroup>
41330 </informaltable>
41331 <para>
41332 The string specified here is expanded and output at the end of every message.
41333 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
41334 in which case it is a single newline character. The suffix can be suppressed by
41335 setting
41336 </para>
41337 <literallayout class="monospaced">
41338 message_suffix =
41339 </literallayout>
41340 <para>
41341 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41342 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41343 </para>
41344 <para>
41345 <indexterm role="option">
41346 <primary><option>mode</option></primary>
41347 </indexterm>
41348 </para>
41349 <informaltable frame="all">
41350 <tgroup cols="4" colsep="0" rowsep="0">
41351 <colspec colwidth="8*" align="left"/>
41352 <colspec colwidth="6*" align="center"/>
41353 <colspec colwidth="6*" align="center"/>
41354 <colspec colwidth="6*" align="right"/>
41355 <tbody>
41356 <row>
41357 <entry><option>mode</option></entry>
41358 <entry>Use: <emphasis>appendfile</emphasis></entry>
41359 <entry>Type: <emphasis>octal integer</emphasis></entry>
41360 <entry>Default: <emphasis>0600</emphasis></entry>
41361 </row>
41362 </tbody>
41363 </tgroup>
41364 </informaltable>
41365 <para>
41366 If the output file is created, it is given this mode. If it already exists and
41367 has wider permissions, they are reduced to this mode. If it has narrower
41368 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
41369 if the delivery is the result of a <option>save</option> command in a filter file specifying
41370 a particular mode, the mode of the output file is always forced to take that
41371 value, and this option is ignored.
41372 </para>
41373 <para>
41374 <indexterm role="option">
41375 <primary><option>mode_fail_narrower</option></primary>
41376 </indexterm>
41377 </para>
41378 <informaltable frame="all">
41379 <tgroup cols="4" colsep="0" rowsep="0">
41380 <colspec colwidth="8*" align="left"/>
41381 <colspec colwidth="6*" align="center"/>
41382 <colspec colwidth="6*" align="center"/>
41383 <colspec colwidth="6*" align="right"/>
41384 <tbody>
41385 <row>
41386 <entry><option>mode_fail_narrower</option></entry>
41387 <entry>Use: <emphasis>appendfile</emphasis></entry>
41388 <entry>Type: <emphasis>boolean</emphasis></entry>
41389 <entry>Default: <emphasis>true</emphasis></entry>
41390 </row>
41391 </tbody>
41392 </tgroup>
41393 </informaltable>
41394 <para>
41395 This option applies in the case when an existing mailbox file has a narrower
41396 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
41397 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
41398 continues with the delivery attempt, using the existing mode of the file.
41399 </para>
41400 <para>
41401 <indexterm role="option">
41402 <primary><option>notify_comsat</option></primary>
41403 </indexterm>
41404 </para>
41405 <informaltable frame="all">
41406 <tgroup cols="4" colsep="0" rowsep="0">
41407 <colspec colwidth="8*" align="left"/>
41408 <colspec colwidth="6*" align="center"/>
41409 <colspec colwidth="6*" align="center"/>
41410 <colspec colwidth="6*" align="right"/>
41411 <tbody>
41412 <row>
41413 <entry><option>notify_comsat</option></entry>
41414 <entry>Use: <emphasis>appendfile</emphasis></entry>
41415 <entry>Type: <emphasis>boolean</emphasis></entry>
41416 <entry>Default: <emphasis>false</emphasis></entry>
41417 </row>
41418 </tbody>
41419 </tgroup>
41420 </informaltable>
41421 <para>
41422 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
41423 successful delivery to a user mailbox. This is the daemon that notifies logged
41424 on users about incoming mail.
41425 </para>
41426 <para>
41427 <indexterm role="option">
41428 <primary><option>quota</option></primary>
41429 </indexterm>
41430 </para>
41431 <informaltable frame="all">
41432 <tgroup cols="4" colsep="0" rowsep="0">
41433 <colspec colwidth="8*" align="left"/>
41434 <colspec colwidth="6*" align="center"/>
41435 <colspec colwidth="6*" align="center"/>
41436 <colspec colwidth="6*" align="right"/>
41437 <tbody>
41438 <row>
41439 <entry><option>quota</option></entry>
41440 <entry>Use: <emphasis>appendfile</emphasis></entry>
41441 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41442 <entry>Default: <emphasis>unset</emphasis></entry>
41443 </row>
41444 </tbody>
41445 </tgroup>
41446 </informaltable>
41447 <para>
41448 <indexterm role="concept">
41449 <primary>quota</primary>
41450 <secondary>imposed by Exim</secondary>
41451 </indexterm>
41452 This option imposes a limit on the size of the file to which Exim is appending,
41453 or to the total space used in the directory tree when the <option>directory</option> option
41454 is set. In the latter case, computation of the space used is expensive, because
41455 all the files in the directory (and any sub-directories) have to be
41456 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
41457 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
41458 have no shell access to their mailboxes).
41459 </para>
41460 <para>
41461 As there is no interlock against two simultaneous deliveries into a
41462 multi-file mailbox, it is possible for the quota to be overrun in this case.
41463 For single-file mailboxes, of course, an interlock is a necessity.
41464 </para>
41465 <para>
41466 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
41467 may be a lot less than the actual amount of disk space allocated to the file.
41468 If the sizes of a number of files are being added up, the rounding effect can
41469 become quite noticeable, especially on systems that have large block sizes.
41470 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
41471 the obvious value which users understand most easily.
41472 </para>
41473 <para>
41474 The value of the option is expanded, and must then be a numerical value
41475 (decimal point allowed), optionally followed by one of the letters K, M, or G,
41476 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
41477 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
41478 be handled.
41479 </para>
41480 <para>
41481 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
41482 </para>
41483 <para>
41484 The expansion happens while Exim is running as root, before it changes uid for
41485 the delivery. This means that files that are inaccessible to the end user can
41486 be used to hold quota values that are looked up in the expansion. When delivery
41487 fails because this quota is exceeded, the handling of the error is as for
41488 system quota failures.
41489 </para>
41490 <para>
41491 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
41492 mailbox to the specified maximum size, though the value is not accurate to the
41493 last byte, owing to separator lines and additional headers that may get added
41494 during message delivery. When a mailbox is nearly full, large messages may get
41495 refused even though small ones are accepted, because the size of the current
41496 message is added to the quota when the check is made. This behaviour can be
41497 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
41498 for exceeding the quota does not include the current message. Thus, deliveries
41499 continue until the quota has been exceeded; thereafter, no further messages are
41500 delivered. See also <option>quota_warn_threshold</option>.
41501 </para>
41502 <para>
41503 <indexterm role="option">
41504 <primary><option>quota_directory</option></primary>
41505 </indexterm>
41506 </para>
41507 <informaltable frame="all">
41508 <tgroup cols="4" colsep="0" rowsep="0">
41509 <colspec colwidth="8*" align="left"/>
41510 <colspec colwidth="6*" align="center"/>
41511 <colspec colwidth="6*" align="center"/>
41512 <colspec colwidth="6*" align="right"/>
41513 <tbody>
41514 <row>
41515 <entry><option>quota_directory</option></entry>
41516 <entry>Use: <emphasis>appendfile</emphasis></entry>
41517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41518 <entry>Default: <emphasis>unset</emphasis></entry>
41519 </row>
41520 </tbody>
41521 </tgroup>
41522 </informaltable>
41523 <para>
41524 This option defines the directory to check for quota purposes when delivering
41525 into individual files. The default is the delivery directory, or, if a file
41526 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
41527 delivery directory.
41528 </para>
41529 <para>
41530 <indexterm role="option">
41531 <primary><option>quota_filecount</option></primary>
41532 </indexterm>
41533 </para>
41534 <informaltable frame="all">
41535 <tgroup cols="4" colsep="0" rowsep="0">
41536 <colspec colwidth="8*" align="left"/>
41537 <colspec colwidth="6*" align="center"/>
41538 <colspec colwidth="6*" align="center"/>
41539 <colspec colwidth="6*" align="right"/>
41540 <tbody>
41541 <row>
41542 <entry><option>quota_filecount</option></entry>
41543 <entry>Use: <emphasis>appendfile</emphasis></entry>
41544 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41545 <entry>Default: <emphasis>0</emphasis></entry>
41546 </row>
41547 </tbody>
41548 </tgroup>
41549 </informaltable>
41550 <para>
41551 This option applies when the <option>directory</option> option is set. It limits the total
41552 number of files in the directory (compare the inode limit in system quotas). It
41553 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
41554 failure causes delivery to be deferred. A value of zero is interpreted as
41555 <quote>no quota</quote>.
41556 </para>
41557 <para>
41558 <indexterm role="option">
41559 <primary><option>quota_is_inclusive</option></primary>
41560 </indexterm>
41561 </para>
41562 <informaltable frame="all">
41563 <tgroup cols="4" colsep="0" rowsep="0">
41564 <colspec colwidth="8*" align="left"/>
41565 <colspec colwidth="6*" align="center"/>
41566 <colspec colwidth="6*" align="center"/>
41567 <colspec colwidth="6*" align="right"/>
41568 <tbody>
41569 <row>
41570 <entry><option>quota_is_inclusive</option></entry>
41571 <entry>Use: <emphasis>appendfile</emphasis></entry>
41572 <entry>Type: <emphasis>boolean</emphasis></entry>
41573 <entry>Default: <emphasis>true</emphasis></entry>
41574 </row>
41575 </tbody>
41576 </tgroup>
41577 </informaltable>
41578 <para>
41579 See <option>quota</option> above.
41580 </para>
41581 <para>
41582 <indexterm role="option">
41583 <primary><option>quota_size_regex</option></primary>
41584 </indexterm>
41585 </para>
41586 <informaltable frame="all">
41587 <tgroup cols="4" colsep="0" rowsep="0">
41588 <colspec colwidth="8*" align="left"/>
41589 <colspec colwidth="6*" align="center"/>
41590 <colspec colwidth="6*" align="center"/>
41591 <colspec colwidth="6*" align="right"/>
41592 <tbody>
41593 <row>
41594 <entry><option>quota_size_regex</option></entry>
41595 <entry>Use: <emphasis>appendfile</emphasis></entry>
41596 <entry>Type: <emphasis>string</emphasis></entry>
41597 <entry>Default: <emphasis>unset</emphasis></entry>
41598 </row>
41599 </tbody>
41600 </tgroup>
41601 </informaltable>
41602 <para>
41603 This option applies when one of the delivery modes that writes a separate file
41604 for each message is being used. When Exim wants to find the size of one of
41605 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
41606 If this is set to a regular expression that matches the file name, and it
41607 captures one string, that string is interpreted as a representation of the
41608 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
41609 </para>
41610 <para>
41611 This feature is useful only when users have no shell access to their mailboxes
41612 &ndash; otherwise they could defeat the quota simply by renaming the files. This
41613 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
41614 the file length to the file name. For example:
41615 </para>
41616 <literallayout class="monospaced">
41617 maildir_tag = ,S=$message_size
41618 quota_size_regex = ,S=(\d+)
41619 </literallayout>
41620 <para>
41621 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
41622 number of lines in the message.
41623 </para>
41624 <para>
41625 The regular expression should not assume that the length is at the end of the
41626 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
41627 sometimes add other information onto the ends of message file names.
41628 </para>
41629 <para>
41630 Section <xref linkend="SECID136"/> contains further information.
41631 </para>
41632 <para>
41633 <indexterm role="option">
41634 <primary><option>quota_warn_message</option></primary>
41635 </indexterm>
41636 </para>
41637 <informaltable frame="all">
41638 <tgroup cols="4" colsep="0" rowsep="0">
41639 <colspec colwidth="8*" align="left"/>
41640 <colspec colwidth="6*" align="center"/>
41641 <colspec colwidth="6*" align="center"/>
41642 <colspec colwidth="6*" align="right"/>
41643 <tbody>
41644 <row>
41645 <entry><option>quota_warn_message</option></entry>
41646 <entry>Use: <emphasis>appendfile</emphasis></entry>
41647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41648 <entry>Default: <emphasis>see below</emphasis></entry>
41649 </row>
41650 </tbody>
41651 </tgroup>
41652 </informaltable>
41653 <para>
41654 See below for the use of this option. If it is not set when
41655 <option>quota_warn_threshold</option> is set, it defaults to
41656 </para>
41657 <literallayout class="monospaced">
41658 quota_warn_message = "\
41659   To: $local_part@$domain\n\
41660   Subject: Your mailbox\n\n\
41661   This message is automatically created \
41662   by mail delivery software.\n\n\
41663   The size of your mailbox has exceeded \
41664   a warning threshold that is\n\
41665   set by the system administrator.\n"
41666 </literallayout>
41667 <para>
41668 <indexterm role="option">
41669 <primary><option>quota_warn_threshold</option></primary>
41670 </indexterm>
41671 </para>
41672 <informaltable frame="all">
41673 <tgroup cols="4" colsep="0" rowsep="0">
41674 <colspec colwidth="8*" align="left"/>
41675 <colspec colwidth="6*" align="center"/>
41676 <colspec colwidth="6*" align="center"/>
41677 <colspec colwidth="6*" align="right"/>
41678 <tbody>
41679 <row>
41680 <entry><option>quota_warn_threshold</option></entry>
41681 <entry>Use: <emphasis>appendfile</emphasis></entry>
41682 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41683 <entry>Default: <emphasis>0</emphasis></entry>
41684 </row>
41685 </tbody>
41686 </tgroup>
41687 </informaltable>
41688 <para>
41689 <indexterm role="concept">
41690 <primary>quota</primary>
41691 <secondary>warning threshold</secondary>
41692 </indexterm>
41693 <indexterm role="concept">
41694 <primary>mailbox</primary>
41695 <secondary>size warning</secondary>
41696 </indexterm>
41697 <indexterm role="concept">
41698 <primary>size</primary>
41699 <secondary>of mailbox</secondary>
41700 </indexterm>
41701 This option is expanded in the same way as <option>quota</option> (see above). If the
41702 resulting value is greater than zero, and delivery of the message causes the
41703 size of the file or total space in the directory tree to cross the given
41704 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
41705 may be specified as a percentage of it by following the value with a percent
41706 sign. For example:
41707 </para>
41708 <literallayout class="monospaced">
41709 quota = 10M
41710 quota_warn_threshold = 75%
41711 </literallayout>
41712 <para>
41713 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
41714 percent sign is ignored.
41715 </para>
41716 <para>
41717 The warning message itself is specified by the <option>quota_warn_message</option> option,
41718 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
41719 warning message. These do not necessarily have to include the recipient(s) of
41720 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
41721 can include any other header lines that you want. If you do not include a
41722 <emphasis>From:</emphasis> line, the default is:
41723 </para>
41724 <literallayout class="monospaced">
41725 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
41726 </literallayout>
41727 <para>
41728 <indexterm role="option">
41729 <primary><option>errors_reply_to</option></primary>
41730 </indexterm>
41731 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
41732 option.
41733 </para>
41734 <para>
41735 The <option>quota</option> option does not have to be set in order to use this option; they
41736 are independent of one another except when the threshold is specified as a
41737 percentage.
41738 </para>
41739 <para>
41740 <indexterm role="option">
41741 <primary><option>use_bsmtp</option></primary>
41742 </indexterm>
41743 </para>
41744 <informaltable frame="all">
41745 <tgroup cols="4" colsep="0" rowsep="0">
41746 <colspec colwidth="8*" align="left"/>
41747 <colspec colwidth="6*" align="center"/>
41748 <colspec colwidth="6*" align="center"/>
41749 <colspec colwidth="6*" align="right"/>
41750 <tbody>
41751 <row>
41752 <entry><option>use_bsmtp</option></entry>
41753 <entry>Use: <emphasis>appendfile</emphasis></entry>
41754 <entry>Type: <emphasis>boolean</emphasis></entry>
41755 <entry>Default: <emphasis>false</emphasis></entry>
41756 </row>
41757 </tbody>
41758 </tgroup>
41759 </informaltable>
41760 <para>
41761 <indexterm role="concept">
41762 <primary>envelope sender</primary>
41763 </indexterm>
41764 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
41765 format, with the envelope sender and recipient(s) included as SMTP commands. If
41766 you want to include a leading HELO command with such messages, you can do
41767 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
41768 for details of batch SMTP.
41769 </para>
41770 <para>
41771 <indexterm role="option">
41772 <primary><option>use_crlf</option></primary>
41773 </indexterm>
41774 </para>
41775 <informaltable frame="all">
41776 <tgroup cols="4" colsep="0" rowsep="0">
41777 <colspec colwidth="8*" align="left"/>
41778 <colspec colwidth="6*" align="center"/>
41779 <colspec colwidth="6*" align="center"/>
41780 <colspec colwidth="6*" align="right"/>
41781 <tbody>
41782 <row>
41783 <entry><option>use_crlf</option></entry>
41784 <entry>Use: <emphasis>appendfile</emphasis></entry>
41785 <entry>Type: <emphasis>boolean</emphasis></entry>
41786 <entry>Default: <emphasis>false</emphasis></entry>
41787 </row>
41788 </tbody>
41789 </tgroup>
41790 </informaltable>
41791 <para>
41792 <indexterm role="concept">
41793 <primary>carriage return</primary>
41794 </indexterm>
41795 <indexterm role="concept">
41796 <primary>linefeed</primary>
41797 </indexterm>
41798 This option causes lines to be terminated with the two-character CRLF sequence
41799 (carriage return, linefeed) instead of just a linefeed character. In the case
41800 of batched SMTP, the byte sequence written to the file is then an exact image
41801 of what would be sent down a real SMTP connection.
41802 </para>
41803 <para>
41804 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
41805 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
41806 in Berkeley-style mailboxes) are written verbatim, so must contain their own
41807 carriage return characters if these are needed. In cases where these options
41808 have non-empty defaults, the values end with a single linefeed, so they must be
41809 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41810 </para>
41811 <para>
41812 <indexterm role="option">
41813 <primary><option>use_fcntl_lock</option></primary>
41814 </indexterm>
41815 </para>
41816 <informaltable frame="all">
41817 <tgroup cols="4" colsep="0" rowsep="0">
41818 <colspec colwidth="8*" align="left"/>
41819 <colspec colwidth="6*" align="center"/>
41820 <colspec colwidth="6*" align="center"/>
41821 <colspec colwidth="6*" align="right"/>
41822 <tbody>
41823 <row>
41824 <entry><option>use_fcntl_lock</option></entry>
41825 <entry>Use: <emphasis>appendfile</emphasis></entry>
41826 <entry>Type: <emphasis>boolean</emphasis></entry>
41827 <entry>Default: <emphasis>see below</emphasis></entry>
41828 </row>
41829 </tbody>
41830 </tgroup>
41831 </informaltable>
41832 <para>
41833 This option controls the use of the <function>fcntl()</function> function to lock a file for
41834 exclusive use when a message is being appended. It is set by default unless
41835 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
41836 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
41837 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
41838 </para>
41839 <para>
41840 <indexterm role="option">
41841 <primary><option>use_flock_lock</option></primary>
41842 </indexterm>
41843 </para>
41844 <informaltable frame="all">
41845 <tgroup cols="4" colsep="0" rowsep="0">
41846 <colspec colwidth="8*" align="left"/>
41847 <colspec colwidth="6*" align="center"/>
41848 <colspec colwidth="6*" align="center"/>
41849 <colspec colwidth="6*" align="right"/>
41850 <tbody>
41851 <row>
41852 <entry><option>use_flock_lock</option></entry>
41853 <entry>Use: <emphasis>appendfile</emphasis></entry>
41854 <entry>Type: <emphasis>boolean</emphasis></entry>
41855 <entry>Default: <emphasis>false</emphasis></entry>
41856 </row>
41857 </tbody>
41858 </tgroup>
41859 </informaltable>
41860 <para>
41861 This option is provided to support the use of <function>flock()</function> for file locking, for
41862 the few situations where it is needed. Most modern operating systems support
41863 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
41864 each other. Exim uses <function>fcntl()</function> locking by default.
41865 </para>
41866 <para>
41867 This option is required only if you are using an operating system where
41868 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
41869 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
41870 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
41871 </para>
41872 <para>
41873 <indexterm role="concept">
41874 <primary>Solaris</primary>
41875 <secondary><function>flock()</function> support</secondary>
41876 </indexterm>
41877 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
41878 have it (and some, I think, provide a not quite right version built on top of
41879 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
41880 the ability to use it, and any attempt to do so will cause a configuration
41881 error.
41882 </para>
41883 <para>
41884 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
41885 is just being mapped onto <function>fcntl()</function> by the OS).
41886 </para>
41887 <para>
41888 <indexterm role="option">
41889 <primary><option>use_lockfile</option></primary>
41890 </indexterm>
41891 </para>
41892 <informaltable frame="all">
41893 <tgroup cols="4" colsep="0" rowsep="0">
41894 <colspec colwidth="8*" align="left"/>
41895 <colspec colwidth="6*" align="center"/>
41896 <colspec colwidth="6*" align="center"/>
41897 <colspec colwidth="6*" align="right"/>
41898 <tbody>
41899 <row>
41900 <entry><option>use_lockfile</option></entry>
41901 <entry>Use: <emphasis>appendfile</emphasis></entry>
41902 <entry>Type: <emphasis>boolean</emphasis></entry>
41903 <entry>Default: <emphasis>see below</emphasis></entry>
41904 </row>
41905 </tbody>
41906 </tgroup>
41907 </informaltable>
41908 <para>
41909 If this option is turned off, Exim does not attempt to create a lock file when
41910 appending to a mailbox file. In this situation, the only locking is by
41911 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
41912 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
41913 <function>fcntl()</function> rather than a lock file, and even then only when you are not
41914 delivering over NFS from more than one host.
41915 </para>
41916 <para>
41917 <indexterm role="concept">
41918 <primary>NFS</primary>
41919 <secondary>lock file</secondary>
41920 </indexterm>
41921 In order to append to an NFS file safely from more than one host, it is
41922 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
41923 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
41924 file corruption.
41925 </para>
41926 <para>
41927 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
41928 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
41929 except when <option>mbx_format</option> is set.
41930 </para>
41931 <para>
41932 <indexterm role="option">
41933 <primary><option>use_mbx_lock</option></primary>
41934 </indexterm>
41935 </para>
41936 <informaltable frame="all">
41937 <tgroup cols="4" colsep="0" rowsep="0">
41938 <colspec colwidth="8*" align="left"/>
41939 <colspec colwidth="6*" align="center"/>
41940 <colspec colwidth="6*" align="center"/>
41941 <colspec colwidth="6*" align="right"/>
41942 <tbody>
41943 <row>
41944 <entry><option>use_mbx_lock</option></entry>
41945 <entry>Use: <emphasis>appendfile</emphasis></entry>
41946 <entry>Type: <emphasis>boolean</emphasis></entry>
41947 <entry>Default: <emphasis>see below</emphasis></entry>
41948 </row>
41949 </tbody>
41950 </tgroup>
41951 </informaltable>
41952 <para>
41953 This option is available only if Exim has been compiled with SUPPORT_MBX
41954 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
41955 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
41956 of the locking options are mentioned in the configuration. The locking rules
41957 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
41958 the IMAP4 and POP daemons that come with it (see the discussion below). The
41959 rules allow for shared access to the mailbox. However, this kind of locking
41960 does not work when the mailbox is NFS mounted.
41961 </para>
41962 <para>
41963 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
41964 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
41965 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
41966 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
41967 </para>
41968 </section>
41969 <section id="SECTopappend">
41970 <title>Operational details for appending</title>
41971 <para>
41972 <indexterm role="concept">
41973 <primary>appending to a file</primary>
41974 </indexterm>
41975 <indexterm role="concept">
41976 <primary>file</primary>
41977 <secondary>appending</secondary>
41978 </indexterm>
41979 Before appending to a file, the following preparations are made:
41980 </para>
41981 <itemizedlist>
41982 <listitem>
41983 <para>
41984 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
41985 return is given.
41986 </para>
41987 </listitem>
41988 <listitem>
41989 <para>
41990 <indexterm role="concept">
41991 <primary>directory creation</primary>
41992 </indexterm>
41993 If any directories on the file&#x2019;s path are missing, Exim creates them if the
41994 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
41995 <option>directory_mode</option> option.
41996 </para>
41997 </listitem>
41998 <listitem>
41999 <para>
42000 If <option>file_format</option> is set, the format of an existing file is checked. If this
42001 indicates that a different transport should be used, control is passed to that
42002 transport.
42003 </para>
42004 </listitem>
42005 <listitem>
42006 <para>
42007 <indexterm role="concept">
42008 <primary>file</primary>
42009 <secondary>locking</secondary>
42010 </indexterm>
42011 <indexterm role="concept">
42012 <primary>locking files</primary>
42013 </indexterm>
42014 <indexterm role="concept">
42015 <primary>NFS</primary>
42016 <secondary>lock file</secondary>
42017 </indexterm>
42018 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
42019 reliably over NFS, as follows:
42020 </para>
42021 <orderedlist numeration="arabic">
42022 <listitem>
42023 <para>
42024 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
42025 current time, primary host name, and process id added, by opening for writing
42026 as a new file. If this fails with an access error, delivery is deferred.
42027 </para>
42028 </listitem>
42029 <listitem>
42030 <para>
42031 Close the hitching post file, and hard link it to the lock file name.
42032 </para>
42033 </listitem>
42034 <listitem>
42035 <para>
42036 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
42037 Unlink the hitching post name.
42038 </para>
42039 </listitem>
42040 <listitem>
42041 <para>
42042 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
42043 then unlink hitching post name. If the number of links is exactly two, creation
42044 of the lock file succeeded but something (for example, an NFS server crash and
42045 restart) caused this fact not to be communicated to the <function>link()</function> call.
42046 </para>
42047 </listitem>
42048 <listitem>
42049 <para>
42050 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
42051 up to <option>lock_retries</option> times. However, since any program that writes to a
42052 mailbox should complete its task very quickly, it is reasonable to time out old
42053 lock files that are normally the result of user agent and system crashes. If an
42054 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
42055 it before trying again.
42056 </para>
42057 </listitem>
42058 </orderedlist>
42059 </listitem>
42060 <listitem>
42061 <para>
42062 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
42063 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
42064 than non-existence, delivery is deferred.
42065 </para>
42066 </listitem>
42067 <listitem>
42068 <para>
42069 <indexterm role="concept">
42070 <primary>symbolic link</primary>
42071 <secondary>to mailbox</secondary>
42072 </indexterm>
42073 <indexterm role="concept">
42074 <primary>mailbox</primary>
42075 <secondary>symbolic link</secondary>
42076 </indexterm>
42077 If the file does exist and is a symbolic link, delivery is deferred, unless the
42078 <option>allow_symlink</option> option is set, in which case the ownership of the link is
42079 checked, and then <function>stat()</function> is called to find out about the real file, which
42080 is then subjected to the checks below. The check on the top-level link
42081 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
42082 directory, though allowing symbolic links in this case is definitely not a good
42083 idea. If there is a chain of symbolic links, the intermediate ones are not
42084 checked.
42085 </para>
42086 </listitem>
42087 <listitem>
42088 <para>
42089 If the file already exists but is not a regular file, or if the file&#x2019;s owner
42090 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
42091 different from the user and group under which the delivery is running,
42092 delivery is deferred.
42093 </para>
42094 </listitem>
42095 <listitem>
42096 <para>
42097 If the file&#x2019;s permissions are more generous than specified, they are reduced.
42098 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
42099 is set false, in which case the delivery is tried using the existing
42100 permissions.
42101 </para>
42102 </listitem>
42103 <listitem>
42104 <para>
42105 The file&#x2019;s inode number is saved, and the file is then opened for appending.
42106 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
42107 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
42108 </para>
42109 </listitem>
42110 <listitem>
42111 <para>
42112 If the file is opened successfully, check that the inode number hasn&#x2019;t
42113 changed, that it is still a regular file, and that the owner and permissions
42114 have not changed. If anything is wrong, defer delivery and freeze the message.
42115 </para>
42116 </listitem>
42117 <listitem>
42118 <para>
42119 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
42120 option is set. Otherwise, check that the file is being created in a permitted
42121 directory if the <option>create_file</option> option is set (deferring on failure), and then
42122 open for writing as a new file, with the O_EXCL and O_CREAT options,
42123 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
42124 set). In this case, which can happen if the link points to a non-existent file,
42125 the file is opened for writing using O_CREAT but not O_EXCL, because
42126 that prevents link following.
42127 </para>
42128 </listitem>
42129 <listitem>
42130 <para>
42131 <indexterm role="concept">
42132 <primary>loop</primary>
42133 <secondary>while file testing</secondary>
42134 </indexterm>
42135 If opening fails because the file exists, obey the tests given above for
42136 existing files. However, to avoid looping in a situation where the file is
42137 being continuously created and destroyed, the exists/not-exists loop is broken
42138 after 10 repetitions, and the message is then frozen.
42139 </para>
42140 </listitem>
42141 <listitem>
42142 <para>
42143 If opening fails with any other error, defer delivery.
42144 </para>
42145 </listitem>
42146 <listitem>
42147 <para>
42148 <indexterm role="concept">
42149 <primary>file</primary>
42150 <secondary>locking</secondary>
42151 </indexterm>
42152 <indexterm role="concept">
42153 <primary>locking files</primary>
42154 </indexterm>
42155 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
42156 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
42157 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
42158 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
42159 file, and an exclusive lock on the file whose name is
42160 </para>
42161 <literallayout class="monospaced">
42162 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
42163 </literallayout>
42164 <para>
42165 using the device and inode numbers of the open mailbox file, in accordance with
42166 the MBX locking rules. This file is created with a mode that is specified by
42167 the <option>lockfile_mode</option> option.
42168 </para>
42169 <para>
42170 If Exim fails to lock the file, there are two possible courses of action,
42171 depending on the value of the locking timeout. This is obtained from
42172 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
42173 </para>
42174 <para>
42175 If the timeout value is zero, the file is closed, Exim waits for
42176 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
42177 to lock it again. This happens up to <option>lock_retries</option> times, after which the
42178 delivery is deferred.
42179 </para>
42180 <para>
42181 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
42182 <function>flock()</function> are used (with the given timeout), so there has already been some
42183 waiting involved by the time locking fails. Nevertheless, Exim does not give up
42184 immediately. It retries up to
42185 </para>
42186 <literallayout class="monospaced">
42187 (lock_retries * lock_interval) / &lt;timeout&gt;
42188 </literallayout>
42189 <para>
42190 times (rounded up).
42191 </para>
42192 </listitem>
42193 </itemizedlist>
42194 <para>
42195 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
42196 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
42197 </para>
42198 </section>
42199 <section id="SECTopdir">
42200 <title>Operational details for delivery to a new file</title>
42201 <para>
42202 <indexterm role="concept">
42203 <primary>delivery</primary>
42204 <secondary>to single file</secondary>
42205 </indexterm>
42206 <indexterm role="concept">
42207 <primary><quote>From</quote> line</primary>
42208 </indexterm>
42209 When the <option>directory</option> option is set instead of <option>file</option>, each message is
42210 delivered into a newly-created file or set of files. When <command>appendfile</command> is
42211 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
42212 <option>directory</option> is normally set, because the path for delivery is supplied by the
42213 router. (See for example, the <command>address_file</command> transport in the default
42214 configuration.) In this case, delivery is to a new file if either the path name
42215 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
42216 </para>
42217 <para>
42218 No locking is required while writing the message to a new file, so the various
42219 locking options of the transport are ignored. The <quote>From</quote> line that by default
42220 separates messages in a single file is not normally needed, nor is the escaping
42221 of message lines that start with <quote>From</quote>, and there is no need to ensure a
42222 newline at the end of each message. Consequently, the default values for
42223 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
42224 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
42225 </para>
42226 <para>
42227 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
42228 the files in the delivery directory by default. However, you can specify a
42229 different directory by setting <option>quota_directory</option>. Also, for maildir
42230 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
42231 </para>
42232 <para>
42233 <indexterm role="concept">
42234 <primary>maildir format</primary>
42235 </indexterm>
42236 <indexterm role="concept">
42237 <primary>mailstore format</primary>
42238 </indexterm>
42239 There are three different ways in which delivery to individual files can be
42240 done, controlled by the settings of the <option>maildir_format</option> and
42241 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
42242 formats is not included in the binary unless SUPPORT_MAILDIR or
42243 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
42244 </para>
42245 <para>
42246 <indexterm role="concept">
42247 <primary>directory creation</primary>
42248 </indexterm>
42249 In all three cases an attempt is made to create the directory and any necessary
42250 sub-directories if they do not exist, provided that the <option>create_directory</option>
42251 option is set (the default). The location of a created directory can be
42252 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
42253 the <option>directory_mode</option> option. If creation fails, or if the
42254 <option>create_directory</option> option is not set when creation is required, delivery is
42255 deferred.
42256 </para>
42257 </section>
42258 <section id="SECTmaildirdelivery">
42259 <title>Maildir delivery</title>
42260 <para>
42261 <indexterm role="concept">
42262 <primary>maildir format</primary>
42263 <secondary>description of</secondary>
42264 </indexterm>
42265 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
42266 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
42267 directory that is defined by the <option>directory</option> option (the <quote>delivery
42268 directory</quote>). If the delivery is successful, the file is renamed into the
42269 <filename>new</filename> subdirectory.
42270 </para>
42271 <para>
42272 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
42273 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
42274 Exim checks that the time-of-day clock has moved on by at least one microsecond
42275 before terminating the delivery process. This guarantees uniqueness for the
42276 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
42277 opening it. If any response other than ENOENT (does not exist) is given,
42278 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
42279 </para>
42280 <para>
42281 Before Exim carries out a maildir delivery, it ensures that subdirectories
42282 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
42283 do not exist, Exim tries to create them and any superior directories in their
42284 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
42285 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
42286 contains matches the delivery directory, Exim also ensures that a file called
42287 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
42288 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
42289 </para>
42290 <para>
42291 These features make it possible to use Exim to create all the necessary files
42292 and directories in a maildir mailbox, including subdirectories for maildir++
42293 folders. Consider this example:
42294 </para>
42295 <literallayout class="monospaced">
42296 maildir_format = true
42297 directory = /var/mail/$local_part\
42298            ${if eq{$local_part_suffix}{}{}\
42299            {/.${substr_1:$local_part_suffix}}}
42300 maildirfolder_create_regex = /\.[^/]+$
42301 </literallayout>
42302 <para>
42303 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
42304 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
42305 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
42306 not match this name, so Exim will not look for or create the file
42307 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
42308 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
42309 </para>
42310 <para>
42311 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
42312 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
42313 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
42314 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
42315 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
42316 </para>
42317 <para>
42318 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
42319 not inadvertently match the toplevel maildir directory, because a
42320 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
42321 </para>
42322 <para>
42323 <indexterm role="concept">
42324 <primary>quota</primary>
42325 <secondary>in maildir delivery</secondary>
42326 </indexterm>
42327 <indexterm role="concept">
42328 <primary>maildir++</primary>
42329 </indexterm>
42330 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
42331 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
42332 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
42333 Exim assumes the directory is a maildir++ folder directory, which is one level
42334 down from the user&#x2019;s top level mailbox directory. This causes it to start at
42335 the parent directory instead of the current directory when calculating the
42336 amount of space used.
42337 </para>
42338 <para>
42339 One problem with delivering into a multi-file mailbox is that it is
42340 computationally expensive to compute the size of the mailbox for quota
42341 checking. Various approaches have been taken to reduce the amount of work
42342 needed. The next two sections describe two of them. A third alternative is to
42343 use some external process for maintaining the size data, and use the expansion
42344 of the <option>mailbox_size</option> option as a way of importing it into Exim.
42345 </para>
42346 </section>
42347 <section id="SECID135">
42348 <title>Using tags to record message sizes</title>
42349 <para>
42350 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
42351 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
42352 tag is added to its name. However, if adding the tag takes the length of the
42353 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
42354 the tag is dropped and the maildir file is created with no tag.
42355 </para>
42356 <para>
42357 <indexterm role="variable">
42358 <primary><varname>$message_size</varname></primary>
42359 </indexterm>
42360 Tags can be used to encode the size of files in their names; see
42361 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
42362 happens after the message has been written. The value of the <varname>$message_size</varname>
42363 variable is set to the number of bytes actually written. If the expansion is
42364 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
42365 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
42366 Non-printing characters in the string are ignored; if the resulting string is
42367 empty, it is ignored. If it starts with an alphanumeric character, a leading
42368 colon is inserted; this default has not proven to be the path that popular
42369 maildir implementations have chosen (but changing it in Exim would break
42370 backwards compatibility).
42371 </para>
42372 <para>
42373 For one common implementation, you might set:
42374 </para>
42375 <literallayout class="monospaced">
42376 maildir_tag = ,S=${message_size}
42377 </literallayout>
42378 <para>
42379 but you should check the documentation of the other software to be sure.
42380 </para>
42381 <para>
42382 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
42383 as this allows Exim to extract the size from your tag, instead of having to
42384 <function>stat()</function> each message file.
42385 </para>
42386 </section>
42387 <section id="SECID136">
42388 <title>Using a maildirsize file</title>
42389 <para>
42390 <indexterm role="concept">
42391 <primary>quota</primary>
42392 <secondary>in maildir delivery</secondary>
42393 </indexterm>
42394 <indexterm role="concept">
42395 <primary>maildir format</primary>
42396 <secondary><filename>maildirsize</filename> file</secondary>
42397 </indexterm>
42398 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
42399 storing quota and message size information in a file called <filename>maildirsize</filename>
42400 within the toplevel maildir directory. If this file does not exist, Exim
42401 creates it, setting the quota from the <option>quota</option> option of the transport. If
42402 the maildir directory itself does not exist, it is created before any attempt
42403 to write a <filename>maildirsize</filename> file.
42404 </para>
42405 <para>
42406 The <filename>maildirsize</filename> file is used to hold information about the sizes of
42407 messages in the maildir, thus speeding up quota calculations. The quota value
42408 in the file is just a cache; if the quota is changed in the transport, the new
42409 value overrides the cached value when the next message is delivered. The cache
42410 is maintained for the benefit of other programs that access the maildir and
42411 need to know the quota.
42412 </para>
42413 <para>
42414 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
42415 file is maintained (with a zero quota setting), but no quota is imposed.
42416 </para>
42417 <para>
42418 A regular expression is available for controlling which directories in the
42419 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
42420 See the description of the <option>maildir_quota_directory_regex</option> option above for
42421 details.
42422 </para>
42423 </section>
42424 <section id="SECID137">
42425 <title>Mailstore delivery</title>
42426 <para>
42427 <indexterm role="concept">
42428 <primary>mailstore format</primary>
42429 <secondary>description of</secondary>
42430 </indexterm>
42431 If the <option>mailstore_format</option> option is true, each message is written as two
42432 files in the given directory. A unique base name is constructed from the
42433 message id and the current delivery process, and the files that are written use
42434 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
42435 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
42436 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
42437 </para>
42438 <para>
42439 During delivery, the envelope is first written to a file with the suffix
42440 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
42441 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
42442 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
42443 file before accessing either of them. An alternative approach is to wait for
42444 the absence of a <filename>.tmp</filename> file.
42445 </para>
42446 <para>
42447 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
42448 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
42449 the sender address on one line, then all the recipient addresses, one per line.
42450 There can be more than one recipient only if the <option>batch_max</option> option is set
42451 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
42452 appended to the file, followed by a newline if it does not end with one.
42453 </para>
42454 <para>
42455 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
42456 failure, it is ignored. Other expansion errors are treated as serious
42457 configuration errors, and delivery is deferred. The variable
42458 <varname>$mailstore_basename</varname> is available for use during these expansions.
42459 </para>
42460 </section>
42461 <section id="SECID138">
42462 <title>Non-special new file delivery</title>
42463 <para>
42464 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
42465 file is created directly in the named directory. For example, when delivering
42466 messages into files in batched SMTP format for later delivery to some host (see
42467 section <xref linkend="SECTbatchSMTP"/>), a setting such as
42468 </para>
42469 <literallayout class="monospaced">
42470 directory = /var/bsmtp/$host
42471 </literallayout>
42472 <para>
42473 might be used. A message is written to a file with a temporary name, which is
42474 then renamed when the delivery is complete. The final name is obtained by
42475 expanding the contents of the <option>directory_file</option> option.
42476 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
42477 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
42478 </para>
42479 </section>
42480 </chapter>
42481
42482 <chapter id="CHID8">
42483 <title>The autoreply transport</title>
42484 <para>
42485 <indexterm role="concept" id="IIDauttra1" class="startofrange">
42486 <primary>transports</primary>
42487 <secondary><command>autoreply</command></secondary>
42488 </indexterm>
42489 <indexterm role="concept" id="IIDauttra2" class="startofrange">
42490 <primary><command>autoreply</command> transport</primary>
42491 </indexterm>
42492 The <command>autoreply</command> transport is not a true transport in that it does not cause
42493 the message to be transmitted. Instead, it generates a new mail message as an
42494 automatic reply to the incoming message. <emphasis>References:</emphasis> and
42495 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
42496 to the rules in RFCs 2822 and 3834, respectively.
42497 </para>
42498 <para>
42499 If the router that passes the message to this transport does not have the
42500 <option>unseen</option> option set, the original message (for the current recipient) is not
42501 delivered anywhere. However, when the <option>unseen</option> option is set on the router
42502 that passes the message to this transport, routing of the address continues, so
42503 another router can set up a normal message delivery.
42504 </para>
42505 <para>
42506 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
42507 <quote>vacation</quote> message being the standard example. However, it can also be run
42508 directly from a router like any other transport. To reduce the possibility of
42509 message cascades, messages created by the <command>autoreply</command> transport always have
42510 empty envelope sender addresses, like bounce messages.
42511 </para>
42512 <para>
42513 The parameters of the message to be sent can be specified in the configuration
42514 by options described below. However, these are used only when the address
42515 passed to the transport does not contain its own reply information. When the
42516 transport is run as a consequence of a
42517 <option>mail</option>
42518 or <option>vacation</option> command in a filter file, the parameters of the message are
42519 supplied by the filter, and passed with the address. The transport&#x2019;s options
42520 that define the message are then ignored (so they are not usually set in this
42521 case). The message is specified entirely by the filter or by the transport; it
42522 is never built from a mixture of options. However, the <option>file_optional</option>,
42523 <option>mode</option>, and <option>return_message</option> options apply in all cases.
42524 </para>
42525 <para>
42526 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
42527 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
42528 gid of the user, and with appropriate current and home directories (see chapter
42529 <xref linkend="CHAPenvironment"/>).
42530 </para>
42531 <para>
42532 There is a subtle difference between routing a message to a <command>pipe</command> transport
42533 that generates some text to be returned to the sender, and routing it to an
42534 <command>autoreply</command> transport. This difference is noticeable only if more than one
42535 address from the same message is so handled. In the case of a pipe, the
42536 separate outputs from the different addresses are gathered up and returned to
42537 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
42538 message is generated for each address that is passed to it.
42539 </para>
42540 <para>
42541 Non-printing characters are not permitted in the header lines generated for the
42542 message that <command>autoreply</command> creates, with the exception of newlines that are
42543 immediately followed by white space. If any non-printing characters are found,
42544 the transport defers.
42545 Whether characters with the top bit set count as printing characters or not is
42546 controlled by the <option>print_topbitchars</option> global option.
42547 </para>
42548 <para>
42549 If any of the generic options for manipulating headers (for example,
42550 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
42551 of the original message that is included in the generated message when
42552 <option>return_message</option> is set. They do not apply to the generated message itself.
42553 </para>
42554 <para>
42555 <indexterm role="variable">
42556 <primary><varname>$sender_address</varname></primary>
42557 </indexterm>
42558 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
42559 the message, indicating that there were no recipients, it does not treat this
42560 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
42561 is empty (because the incoming message is a bounce message) do not cause
42562 problems. They are just discarded.
42563 </para>
42564 <section id="SECID139">
42565 <title>Private options for autoreply</title>
42566 <para>
42567 <indexterm role="concept">
42568 <primary>options</primary>
42569 <secondary><command>autoreply</command> transport</secondary>
42570 </indexterm>
42571 </para>
42572 <para>
42573 <indexterm role="option">
42574 <primary><option>bcc</option></primary>
42575 </indexterm>
42576 </para>
42577 <informaltable frame="all">
42578 <tgroup cols="4" colsep="0" rowsep="0">
42579 <colspec colwidth="8*" align="left"/>
42580 <colspec colwidth="6*" align="center"/>
42581 <colspec colwidth="6*" align="center"/>
42582 <colspec colwidth="6*" align="right"/>
42583 <tbody>
42584 <row>
42585 <entry><option>bcc</option></entry>
42586 <entry>Use: <emphasis>autoreply</emphasis></entry>
42587 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42588 <entry>Default: <emphasis>unset</emphasis></entry>
42589 </row>
42590 </tbody>
42591 </tgroup>
42592 </informaltable>
42593 <para>
42594 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
42595 message when the message is specified by the transport.
42596 </para>
42597 <para>
42598 <indexterm role="option">
42599 <primary><option>cc</option></primary>
42600 </indexterm>
42601 </para>
42602 <informaltable frame="all">
42603 <tgroup cols="4" colsep="0" rowsep="0">
42604 <colspec colwidth="8*" align="left"/>
42605 <colspec colwidth="6*" align="center"/>
42606 <colspec colwidth="6*" align="center"/>
42607 <colspec colwidth="6*" align="right"/>
42608 <tbody>
42609 <row>
42610 <entry><option>cc</option></entry>
42611 <entry>Use: <emphasis>autoreply</emphasis></entry>
42612 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42613 <entry>Default: <emphasis>unset</emphasis></entry>
42614 </row>
42615 </tbody>
42616 </tgroup>
42617 </informaltable>
42618 <para>
42619 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
42620 when the message is specified by the transport.
42621 </para>
42622 <para>
42623 <indexterm role="option">
42624 <primary><option>file</option></primary>
42625 </indexterm>
42626 </para>
42627 <informaltable frame="all">
42628 <tgroup cols="4" colsep="0" rowsep="0">
42629 <colspec colwidth="8*" align="left"/>
42630 <colspec colwidth="6*" align="center"/>
42631 <colspec colwidth="6*" align="center"/>
42632 <colspec colwidth="6*" align="right"/>
42633 <tbody>
42634 <row>
42635 <entry><option>file</option></entry>
42636 <entry>Use: <emphasis>autoreply</emphasis></entry>
42637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42638 <entry>Default: <emphasis>unset</emphasis></entry>
42639 </row>
42640 </tbody>
42641 </tgroup>
42642 </informaltable>
42643 <para>
42644 The contents of the file are sent as the body of the message when the message
42645 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
42646 string comes first.
42647 </para>
42648 <para>
42649 <indexterm role="option">
42650 <primary><option>file_expand</option></primary>
42651 </indexterm>
42652 </para>
42653 <informaltable frame="all">
42654 <tgroup cols="4" colsep="0" rowsep="0">
42655 <colspec colwidth="8*" align="left"/>
42656 <colspec colwidth="6*" align="center"/>
42657 <colspec colwidth="6*" align="center"/>
42658 <colspec colwidth="6*" align="right"/>
42659 <tbody>
42660 <row>
42661 <entry><option>file_expand</option></entry>
42662 <entry>Use: <emphasis>autoreply</emphasis></entry>
42663 <entry>Type: <emphasis>boolean</emphasis></entry>
42664 <entry>Default: <emphasis>false</emphasis></entry>
42665 </row>
42666 </tbody>
42667 </tgroup>
42668 </informaltable>
42669 <para>
42670 If this is set, the contents of the file named by the <option>file</option> option are
42671 subjected to string expansion as they are added to the message.
42672 </para>
42673 <para>
42674 <indexterm role="option">
42675 <primary><option>file_optional</option></primary>
42676 </indexterm>
42677 </para>
42678 <informaltable frame="all">
42679 <tgroup cols="4" colsep="0" rowsep="0">
42680 <colspec colwidth="8*" align="left"/>
42681 <colspec colwidth="6*" align="center"/>
42682 <colspec colwidth="6*" align="center"/>
42683 <colspec colwidth="6*" align="right"/>
42684 <tbody>
42685 <row>
42686 <entry><option>file_optional</option></entry>
42687 <entry>Use: <emphasis>autoreply</emphasis></entry>
42688 <entry>Type: <emphasis>boolean</emphasis></entry>
42689 <entry>Default: <emphasis>false</emphasis></entry>
42690 </row>
42691 </tbody>
42692 </tgroup>
42693 </informaltable>
42694 <para>
42695 If this option is true, no error is generated if the file named by the <option>file</option>
42696 option or passed with the address does not exist or cannot be read.
42697 </para>
42698 <para>
42699 <indexterm role="option">
42700 <primary><option>from</option></primary>
42701 </indexterm>
42702 </para>
42703 <informaltable frame="all">
42704 <tgroup cols="4" colsep="0" rowsep="0">
42705 <colspec colwidth="8*" align="left"/>
42706 <colspec colwidth="6*" align="center"/>
42707 <colspec colwidth="6*" align="center"/>
42708 <colspec colwidth="6*" align="right"/>
42709 <tbody>
42710 <row>
42711 <entry><option>from</option></entry>
42712 <entry>Use: <emphasis>autoreply</emphasis></entry>
42713 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42714 <entry>Default: <emphasis>unset</emphasis></entry>
42715 </row>
42716 </tbody>
42717 </tgroup>
42718 </informaltable>
42719 <para>
42720 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
42721 specified by the transport.
42722 </para>
42723 <para>
42724 <indexterm role="option">
42725 <primary><option>headers</option></primary>
42726 </indexterm>
42727 </para>
42728 <informaltable frame="all">
42729 <tgroup cols="4" colsep="0" rowsep="0">
42730 <colspec colwidth="8*" align="left"/>
42731 <colspec colwidth="6*" align="center"/>
42732 <colspec colwidth="6*" align="center"/>
42733 <colspec colwidth="6*" align="right"/>
42734 <tbody>
42735 <row>
42736 <entry><option>headers</option></entry>
42737 <entry>Use: <emphasis>autoreply</emphasis></entry>
42738 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42739 <entry>Default: <emphasis>unset</emphasis></entry>
42740 </row>
42741 </tbody>
42742 </tgroup>
42743 </informaltable>
42744 <para>
42745 This specifies additional RFC 2822 headers that are to be added to the message
42746 when the message is specified by the transport. Several can be given by using
42747 <quote>\n</quote> to separate them. There is no check on the format.
42748 </para>
42749 <para>
42750 <indexterm role="option">
42751 <primary><option>log</option></primary>
42752 </indexterm>
42753 </para>
42754 <informaltable frame="all">
42755 <tgroup cols="4" colsep="0" rowsep="0">
42756 <colspec colwidth="8*" align="left"/>
42757 <colspec colwidth="6*" align="center"/>
42758 <colspec colwidth="6*" align="center"/>
42759 <colspec colwidth="6*" align="right"/>
42760 <tbody>
42761 <row>
42762 <entry><option>log</option></entry>
42763 <entry>Use: <emphasis>autoreply</emphasis></entry>
42764 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42765 <entry>Default: <emphasis>unset</emphasis></entry>
42766 </row>
42767 </tbody>
42768 </tgroup>
42769 </informaltable>
42770 <para>
42771 This option names a file in which a record of every message sent is logged when
42772 the message is specified by the transport.
42773 </para>
42774 <para>
42775 <indexterm role="option">
42776 <primary><option>mode</option></primary>
42777 </indexterm>
42778 </para>
42779 <informaltable frame="all">
42780 <tgroup cols="4" colsep="0" rowsep="0">
42781 <colspec colwidth="8*" align="left"/>
42782 <colspec colwidth="6*" align="center"/>
42783 <colspec colwidth="6*" align="center"/>
42784 <colspec colwidth="6*" align="right"/>
42785 <tbody>
42786 <row>
42787 <entry><option>mode</option></entry>
42788 <entry>Use: <emphasis>autoreply</emphasis></entry>
42789 <entry>Type: <emphasis>octal integer</emphasis></entry>
42790 <entry>Default: <emphasis>0600</emphasis></entry>
42791 </row>
42792 </tbody>
42793 </tgroup>
42794 </informaltable>
42795 <para>
42796 If either the log file or the <quote>once</quote> file has to be created, this mode is
42797 used.
42798 </para>
42799 <para>
42800 <indexterm role="option">
42801 <primary><option>never_mail</option></primary>
42802 </indexterm>
42803 </para>
42804 <informaltable frame="all">
42805 <tgroup cols="4" colsep="0" rowsep="0">
42806 <colspec colwidth="8*" align="left"/>
42807 <colspec colwidth="6*" align="center"/>
42808 <colspec colwidth="6*" align="center"/>
42809 <colspec colwidth="6*" align="right"/>
42810 <tbody>
42811 <row>
42812 <entry><option>never_mail</option></entry>
42813 <entry>Use: <emphasis>autoreply</emphasis></entry>
42814 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
42815 <entry>Default: <emphasis>unset</emphasis></entry>
42816 </row>
42817 </tbody>
42818 </tgroup>
42819 </informaltable>
42820 <para>
42821 If any run of the transport creates a message with a recipient that matches any
42822 item in the list, that recipient is quietly discarded. If all recipients are
42823 discarded, no message is created. This applies both when the recipients are
42824 generated by a filter and when they are specified in the transport.
42825 </para>
42826 <para>
42827 <indexterm role="option">
42828 <primary><option>once</option></primary>
42829 </indexterm>
42830 </para>
42831 <informaltable frame="all">
42832 <tgroup cols="4" colsep="0" rowsep="0">
42833 <colspec colwidth="8*" align="left"/>
42834 <colspec colwidth="6*" align="center"/>
42835 <colspec colwidth="6*" align="center"/>
42836 <colspec colwidth="6*" align="right"/>
42837 <tbody>
42838 <row>
42839 <entry><option>once</option></entry>
42840 <entry>Use: <emphasis>autoreply</emphasis></entry>
42841 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42842 <entry>Default: <emphasis>unset</emphasis></entry>
42843 </row>
42844 </tbody>
42845 </tgroup>
42846 </informaltable>
42847 <para>
42848 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
42849 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
42850 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
42851 </para>
42852 <para>
42853 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
42854 By default, if <option>once</option> is set to a non-empty file name, the message
42855 is not sent if a potential recipient is already listed in the database.
42856 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
42857 message is sent if that much time has elapsed since a message was last sent to
42858 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
42859 prevents a message from being sent a second time &ndash; in this case, zero means
42860 infinity.
42861 </para>
42862 <para>
42863 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
42864 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
42865 greater than zero, it changes the way Exim implements the <option>once</option> option.
42866 Instead of using a DBM file to record every recipient it sends to, it uses a
42867 regular file, whose size will never get larger than the given value.
42868 </para>
42869 <para>
42870 In the file, Exim keeps a linear list of recipient addresses and the times at
42871 which they were sent messages. If the file is full when a new address needs to
42872 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
42873 means that a given recipient may receive multiple messages, but at
42874 unpredictable intervals that depend on the rate of turnover of addresses in the
42875 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
42876 </para>
42877 <para>
42878 <indexterm role="option">
42879 <primary><option>once_file_size</option></primary>
42880 </indexterm>
42881 </para>
42882 <informaltable frame="all">
42883 <tgroup cols="4" colsep="0" rowsep="0">
42884 <colspec colwidth="8*" align="left"/>
42885 <colspec colwidth="6*" align="center"/>
42886 <colspec colwidth="6*" align="center"/>
42887 <colspec colwidth="6*" align="right"/>
42888 <tbody>
42889 <row>
42890 <entry><option>once_file_size</option></entry>
42891 <entry>Use: <emphasis>autoreply</emphasis></entry>
42892 <entry>Type: <emphasis>integer</emphasis></entry>
42893 <entry>Default: <emphasis>0</emphasis></entry>
42894 </row>
42895 </tbody>
42896 </tgroup>
42897 </informaltable>
42898 <para>
42899 See <option>once</option> above.
42900 </para>
42901 <para>
42902 <indexterm role="option">
42903 <primary><option>once_repeat</option></primary>
42904 </indexterm>
42905 </para>
42906 <informaltable frame="all">
42907 <tgroup cols="4" colsep="0" rowsep="0">
42908 <colspec colwidth="8*" align="left"/>
42909 <colspec colwidth="6*" align="center"/>
42910 <colspec colwidth="6*" align="center"/>
42911 <colspec colwidth="6*" align="right"/>
42912 <tbody>
42913 <row>
42914 <entry><option>once_repeat</option></entry>
42915 <entry>Use: <emphasis>autoreply</emphasis></entry>
42916 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
42917 <entry>Default: <emphasis>0s</emphasis></entry>
42918 </row>
42919 </tbody>
42920 </tgroup>
42921 </informaltable>
42922 <para>
42923 See <option>once</option> above.
42924 After expansion, the value of this option must be a valid time value.
42925 </para>
42926 <para>
42927 <indexterm role="option">
42928 <primary><option>reply_to</option></primary>
42929 </indexterm>
42930 </para>
42931 <informaltable frame="all">
42932 <tgroup cols="4" colsep="0" rowsep="0">
42933 <colspec colwidth="8*" align="left"/>
42934 <colspec colwidth="6*" align="center"/>
42935 <colspec colwidth="6*" align="center"/>
42936 <colspec colwidth="6*" align="right"/>
42937 <tbody>
42938 <row>
42939 <entry><option>reply_to</option></entry>
42940 <entry>Use: <emphasis>autoreply</emphasis></entry>
42941 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42942 <entry>Default: <emphasis>unset</emphasis></entry>
42943 </row>
42944 </tbody>
42945 </tgroup>
42946 </informaltable>
42947 <para>
42948 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
42949 specified by the transport.
42950 </para>
42951 <para>
42952 <indexterm role="option">
42953 <primary><option>return_message</option></primary>
42954 </indexterm>
42955 </para>
42956 <informaltable frame="all">
42957 <tgroup cols="4" colsep="0" rowsep="0">
42958 <colspec colwidth="8*" align="left"/>
42959 <colspec colwidth="6*" align="center"/>
42960 <colspec colwidth="6*" align="center"/>
42961 <colspec colwidth="6*" align="right"/>
42962 <tbody>
42963 <row>
42964 <entry><option>return_message</option></entry>
42965 <entry>Use: <emphasis>autoreply</emphasis></entry>
42966 <entry>Type: <emphasis>boolean</emphasis></entry>
42967 <entry>Default: <emphasis>false</emphasis></entry>
42968 </row>
42969 </tbody>
42970 </tgroup>
42971 </informaltable>
42972 <para>
42973 If this is set, a copy of the original message is returned with the new
42974 message, subject to the maximum size set in the <option>return_size_limit</option> global
42975 configuration option.
42976 </para>
42977 <para>
42978 <indexterm role="option">
42979 <primary><option>subject</option></primary>
42980 </indexterm>
42981 </para>
42982 <informaltable frame="all">
42983 <tgroup cols="4" colsep="0" rowsep="0">
42984 <colspec colwidth="8*" align="left"/>
42985 <colspec colwidth="6*" align="center"/>
42986 <colspec colwidth="6*" align="center"/>
42987 <colspec colwidth="6*" align="right"/>
42988 <tbody>
42989 <row>
42990 <entry><option>subject</option></entry>
42991 <entry>Use: <emphasis>autoreply</emphasis></entry>
42992 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42993 <entry>Default: <emphasis>unset</emphasis></entry>
42994 </row>
42995 </tbody>
42996 </tgroup>
42997 </informaltable>
42998 <para>
42999 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
43000 specified by the transport. It is tempting to quote the original subject in
43001 automatic responses. For example:
43002 </para>
43003 <literallayout class="monospaced">
43004 subject = Re: $h_subject:
43005 </literallayout>
43006 <para>
43007 There is a danger in doing this, however. It may allow a third party to
43008 subscribe your users to an opt-in mailing list, provided that the list accepts
43009 bounce messages as subscription confirmations. Well-managed lists require a
43010 non-bounce message to confirm a subscription, so the danger is relatively
43011 small.
43012 </para>
43013 <para>
43014 <indexterm role="option">
43015 <primary><option>text</option></primary>
43016 </indexterm>
43017 </para>
43018 <informaltable frame="all">
43019 <tgroup cols="4" colsep="0" rowsep="0">
43020 <colspec colwidth="8*" align="left"/>
43021 <colspec colwidth="6*" align="center"/>
43022 <colspec colwidth="6*" align="center"/>
43023 <colspec colwidth="6*" align="right"/>
43024 <tbody>
43025 <row>
43026 <entry><option>text</option></entry>
43027 <entry>Use: <emphasis>autoreply</emphasis></entry>
43028 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43029 <entry>Default: <emphasis>unset</emphasis></entry>
43030 </row>
43031 </tbody>
43032 </tgroup>
43033 </informaltable>
43034 <para>
43035 This specifies a single string to be used as the body of the message when the
43036 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
43037 the text comes first.
43038 </para>
43039 <para>
43040 <indexterm role="option">
43041 <primary><option>to</option></primary>
43042 </indexterm>
43043 </para>
43044 <informaltable frame="all">
43045 <tgroup cols="4" colsep="0" rowsep="0">
43046 <colspec colwidth="8*" align="left"/>
43047 <colspec colwidth="6*" align="center"/>
43048 <colspec colwidth="6*" align="center"/>
43049 <colspec colwidth="6*" align="right"/>
43050 <tbody>
43051 <row>
43052 <entry><option>to</option></entry>
43053 <entry>Use: <emphasis>autoreply</emphasis></entry>
43054 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43055 <entry>Default: <emphasis>unset</emphasis></entry>
43056 </row>
43057 </tbody>
43058 </tgroup>
43059 </informaltable>
43060 <para>
43061 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
43062 when the message is specified by the transport.
43063 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
43064 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
43065 </para>
43066 </section>
43067 </chapter>
43068
43069 <chapter id="CHAPLMTP">
43070 <title>The lmtp transport</title>
43071 <para>
43072 <indexterm role="concept">
43073 <primary>transports</primary>
43074 <secondary><command>lmtp</command></secondary>
43075 </indexterm>
43076 <indexterm role="concept">
43077 <primary><command>lmtp</command> transport</primary>
43078 </indexterm>
43079 <indexterm role="concept">
43080 <primary>LMTP</primary>
43081 <secondary>over a pipe</secondary>
43082 </indexterm>
43083 <indexterm role="concept">
43084 <primary>LMTP</primary>
43085 <secondary>over a socket</secondary>
43086 </indexterm>
43087 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
43088 specified command
43089 or by interacting with a Unix domain socket.
43090 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
43091 transports. Exim also has support for using LMTP over TCP/IP; this is
43092 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
43093 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
43094 has it commented out. You need to ensure that
43095 </para>
43096 <literallayout class="monospaced">
43097 TRANSPORT_LMTP=yes
43098 </literallayout>
43099 <para>
43100 <indexterm role="concept">
43101 <primary>options</primary>
43102 <secondary><command>lmtp</command> transport</secondary>
43103 </indexterm>
43104 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
43105 included in the Exim binary. The private options of the <command>lmtp</command> transport are
43106 as follows:
43107 </para>
43108 <para>
43109 <indexterm role="option">
43110 <primary><option>batch_id</option></primary>
43111 </indexterm>
43112 </para>
43113 <informaltable frame="all">
43114 <tgroup cols="4" colsep="0" rowsep="0">
43115 <colspec colwidth="8*" align="left"/>
43116 <colspec colwidth="6*" align="center"/>
43117 <colspec colwidth="6*" align="center"/>
43118 <colspec colwidth="6*" align="right"/>
43119 <tbody>
43120 <row>
43121 <entry><option>batch_id</option></entry>
43122 <entry>Use: <emphasis>lmtp</emphasis></entry>
43123 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43124 <entry>Default: <emphasis>unset</emphasis></entry>
43125 </row>
43126 </tbody>
43127 </tgroup>
43128 </informaltable>
43129 <para>
43130 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43131 </para>
43132 <para>
43133 <indexterm role="option">
43134 <primary><option>batch_max</option></primary>
43135 </indexterm>
43136 </para>
43137 <informaltable frame="all">
43138 <tgroup cols="4" colsep="0" rowsep="0">
43139 <colspec colwidth="8*" align="left"/>
43140 <colspec colwidth="6*" align="center"/>
43141 <colspec colwidth="6*" align="center"/>
43142 <colspec colwidth="6*" align="right"/>
43143 <tbody>
43144 <row>
43145 <entry><option>batch_max</option></entry>
43146 <entry>Use: <emphasis>lmtp</emphasis></entry>
43147 <entry>Type: <emphasis>integer</emphasis></entry>
43148 <entry>Default: <emphasis>1</emphasis></entry>
43149 </row>
43150 </tbody>
43151 </tgroup>
43152 </informaltable>
43153 <para>
43154 This limits the number of addresses that can be handled in a single delivery.
43155 Most LMTP servers can handle several addresses at once, so it is normally a
43156 good idea to increase this value. See the description of local delivery
43157 batching in chapter <xref linkend="CHAPbatching"/>.
43158 </para>
43159 <para>
43160 <indexterm role="option">
43161 <primary><option>command</option></primary>
43162 </indexterm>
43163 </para>
43164 <informaltable frame="all">
43165 <tgroup cols="4" colsep="0" rowsep="0">
43166 <colspec colwidth="8*" align="left"/>
43167 <colspec colwidth="6*" align="center"/>
43168 <colspec colwidth="6*" align="center"/>
43169 <colspec colwidth="6*" align="right"/>
43170 <tbody>
43171 <row>
43172 <entry><option>command</option></entry>
43173 <entry>Use: <emphasis>lmtp</emphasis></entry>
43174 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43175 <entry>Default: <emphasis>unset</emphasis></entry>
43176 </row>
43177 </tbody>
43178 </tgroup>
43179 </informaltable>
43180 <para>
43181 This option must be set if <option>socket</option> is not set. The string is a command which
43182 is run in a separate process. It is split up into a command name and list of
43183 arguments, each of which is separately expanded (so expansion cannot change the
43184 number of arguments). The command is run directly, not via a shell. The message
43185 is passed to the new process using the standard input and output to operate the
43186 LMTP protocol.
43187 </para>
43188 <para>
43189 <indexterm role="option">
43190 <primary><option>ignore_quota</option></primary>
43191 </indexterm>
43192 </para>
43193 <informaltable frame="all">
43194 <tgroup cols="4" colsep="0" rowsep="0">
43195 <colspec colwidth="8*" align="left"/>
43196 <colspec colwidth="6*" align="center"/>
43197 <colspec colwidth="6*" align="center"/>
43198 <colspec colwidth="6*" align="right"/>
43199 <tbody>
43200 <row>
43201 <entry><option>ignore_quota</option></entry>
43202 <entry>Use: <emphasis>lmtp</emphasis></entry>
43203 <entry>Type: <emphasis>boolean</emphasis></entry>
43204 <entry>Default: <emphasis>false</emphasis></entry>
43205 </row>
43206 </tbody>
43207 </tgroup>
43208 </informaltable>
43209 <para>
43210 <indexterm role="concept">
43211 <primary>LMTP</primary>
43212 <secondary>ignoring quota errors</secondary>
43213 </indexterm>
43214 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
43215 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
43216 in its response to the LHLO command.
43217 </para>
43218 <para>
43219 <indexterm role="option">
43220 <primary><option>socket</option></primary>
43221 </indexterm>
43222 </para>
43223 <informaltable frame="all">
43224 <tgroup cols="4" colsep="0" rowsep="0">
43225 <colspec colwidth="8*" align="left"/>
43226 <colspec colwidth="6*" align="center"/>
43227 <colspec colwidth="6*" align="center"/>
43228 <colspec colwidth="6*" align="right"/>
43229 <tbody>
43230 <row>
43231 <entry><option>socket</option></entry>
43232 <entry>Use: <emphasis>lmtp</emphasis></entry>
43233 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43234 <entry>Default: <emphasis>unset</emphasis></entry>
43235 </row>
43236 </tbody>
43237 </tgroup>
43238 </informaltable>
43239 <para>
43240 This option must be set if <option>command</option> is not set. The result of expansion must
43241 be the name of a Unix domain socket. The transport connects to the socket and
43242 delivers the message to it using the LMTP protocol.
43243 </para>
43244 <para>
43245 <indexterm role="option">
43246 <primary><option>timeout</option></primary>
43247 </indexterm>
43248 </para>
43249 <informaltable frame="all">
43250 <tgroup cols="4" colsep="0" rowsep="0">
43251 <colspec colwidth="8*" align="left"/>
43252 <colspec colwidth="6*" align="center"/>
43253 <colspec colwidth="6*" align="center"/>
43254 <colspec colwidth="6*" align="right"/>
43255 <tbody>
43256 <row>
43257 <entry><option>timeout</option></entry>
43258 <entry>Use: <emphasis>lmtp</emphasis></entry>
43259 <entry>Type: <emphasis>time</emphasis></entry>
43260 <entry>Default: <emphasis>5m</emphasis></entry>
43261 </row>
43262 </tbody>
43263 </tgroup>
43264 </informaltable>
43265 <para>
43266 The transport is aborted if the created process or Unix domain socket does not
43267 respond to LMTP commands or message input within this timeout. Delivery
43268 is deferred, and will be tried again later. Here is an example of a typical
43269 LMTP transport:
43270 </para>
43271 <literallayout class="monospaced">
43272 lmtp:
43273   driver = lmtp
43274   command = /some/local/lmtp/delivery/program
43275   batch_max = 20
43276   user = exim
43277 </literallayout>
43278 <para>
43279 This delivers up to 20 addresses at a time, in a mixture of domains if
43280 necessary, running as the user <emphasis>exim</emphasis>.
43281 </para>
43282 </chapter>
43283
43284 <chapter id="CHAPpipetransport">
43285 <title>The pipe transport</title>
43286 <para>
43287 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
43288 <primary>transports</primary>
43289 <secondary><command>pipe</command></secondary>
43290 </indexterm>
43291 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
43292 <primary><command>pipe</command> transport</primary>
43293 </indexterm>
43294 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
43295 running in another process. One example is the use of <command>pipe</command> as a
43296 pseudo-remote transport for passing messages to some other delivery mechanism
43297 (such as UUCP). Another is the use by individual users to automatically process
43298 their incoming messages. The <command>pipe</command> transport can be used in one of the
43299 following ways:
43300 </para>
43301 <itemizedlist>
43302 <listitem>
43303 <para>
43304 <indexterm role="variable">
43305 <primary><varname>$local_part</varname></primary>
43306 </indexterm>
43307 A router routes one address to a transport in the normal way, and the
43308 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
43309 contains the local part of the address (as usual), and the command that is run
43310 is specified by the <option>command</option> option on the transport.
43311 </para>
43312 </listitem>
43313 <listitem>
43314 <para>
43315 <indexterm role="variable">
43316 <primary><varname>$pipe_addresses</varname></primary>
43317 </indexterm>
43318 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
43319 transport can handle more than one address in a single run. In this case, when
43320 more than one address is routed to the transport, <varname>$local_part</varname> is not set
43321 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
43322 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
43323 that are routed to the transport.
43324 </para>
43325 </listitem>
43326 <listitem>
43327 <para>
43328 <indexterm role="variable">
43329 <primary><varname>$address_pipe</varname></primary>
43330 </indexterm>
43331 A router redirects an address directly to a pipe command (for example, from an
43332 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
43333 pipe command, and the <option>command</option> option on the transport is ignored unless
43334 <option>force_command</option> is set. If only one address is being transported
43335 (<option>batch_max</option> is not greater than one, or only one address was redirected to
43336 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
43337 </para>
43338 </listitem>
43339 </itemizedlist>
43340 <para>
43341 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
43342 deliver messages over pipes using the LMTP interactive protocol. This is
43343 implemented by the <command>lmtp</command> transport.
43344 </para>
43345 <para>
43346 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
43347 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
43348 other cases, the uid and gid have to be specified explicitly, either on the
43349 transport or on the router that handles the address. Current and <quote>home</quote>
43350 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
43351 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
43352 for a discussion of local delivery batching.
43353 </para>
43354 <section id="SECID140">
43355 <title>Concurrent delivery</title>
43356 <para>
43357 If two messages arrive at almost the same time, and both are routed to a pipe
43358 delivery, the two pipe transports may be run concurrently. You must ensure that
43359 any pipe commands you set up are robust against this happening. If the commands
43360 write to a file, the <option>exim_lock</option> utility might be of use.
43361 </para>
43362 </section>
43363 <section id="SECID141">
43364 <title>Returned status and data</title>
43365 <para>
43366 <indexterm role="concept">
43367 <primary><command>pipe</command> transport</primary>
43368 <secondary>returned data</secondary>
43369 </indexterm>
43370 If the command exits with a non-zero return code, the delivery is deemed to
43371 have failed, unless either the <option>ignore_status</option> option is set (in which case
43372 the return code is treated as zero), or the return code is one of those listed
43373 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
43374 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
43375 logged, but are not included in the bounce message, which merely contains
43376 <quote>local delivery failed</quote>.
43377 </para>
43378 <para>
43379 If the command exits on a signal and the <option>freeze_signal</option> option is set then
43380 the message will be frozen in the queue. If that option is not set, a bounce
43381 will be sent as normal.
43382 </para>
43383 <para>
43384 If the return code is greater than 128 and the command being run is a shell
43385 script, it normally means that the script was terminated by a signal whose
43386 value is the return code minus 128. The <option>freeze_signal</option> option does not
43387 apply in this case.
43388 </para>
43389 <para>
43390 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
43391 return code is set to 127. This is the value that a shell returns if it is
43392 asked to run a non-existent command. The wording for the log line suggests that
43393 a non-existent command may be the problem.
43394 </para>
43395 <para>
43396 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
43397 set and the command produces any output on its standard output or standard
43398 error streams, the command is considered to have failed, even if it gave a zero
43399 return code or if <option>ignore_status</option> is set. The output from the command is
43400 included as part of the bounce message. The <option>return_fail_output</option> option is
43401 similar, except that output is returned only when the command exits with a
43402 failure return code, that is, a value other than zero or a code that matches
43403 <option>temp_errors</option>.
43404 </para>
43405 </section>
43406 <section id="SECThowcommandrun">
43407 <title>How the command is run</title>
43408 <para>
43409 <indexterm role="concept">
43410 <primary><command>pipe</command> transport</primary>
43411 <secondary>path for command</secondary>
43412 </indexterm>
43413 The command line is (by default) broken down into a command name and arguments
43414 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
43415 <option>restrict_to_path</option> options can be used to restrict the commands that may be
43416 run.
43417 </para>
43418 <para>
43419 <indexterm role="concept">
43420 <primary>quoting</primary>
43421 <secondary>in pipe command</secondary>
43422 </indexterm>
43423 Unquoted arguments are delimited by white space. If an argument appears in
43424 double quotes, backslash is interpreted as an escape character in the usual
43425 way. If an argument appears in single quotes, no escaping is done.
43426 </para>
43427 <para>
43428 String expansion is applied to the command line except when it comes from a
43429 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
43430 expansion is applied to each argument in turn rather than to the whole line.
43431 For this reason, any string expansion item that contains white space must be
43432 quoted so as to be contained within a single argument. A setting such as
43433 </para>
43434 <literallayout class="monospaced">
43435 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
43436 </literallayout>
43437 <para>
43438 will not work, because the expansion item gets split between several
43439 arguments. You have to write
43440 </para>
43441 <literallayout class="monospaced">
43442 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
43443 </literallayout>
43444 <para>
43445 to ensure that it is all in one argument. The expansion is done in this way,
43446 argument by argument, so that the number of arguments cannot be changed as a
43447 result of expansion, and quotes or backslashes in inserted variables do not
43448 interact with external quoting. However, this leads to problems if you want to
43449 generate multiple arguments (or the command name plus arguments) from a single
43450 expansion. In this situation, the simplest solution is to use a shell. For
43451 example:
43452 </para>
43453 <literallayout class="monospaced">
43454 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
43455 </literallayout>
43456 <para>
43457 <indexterm role="concept">
43458 <primary>transport</primary>
43459 <secondary>filter</secondary>
43460 </indexterm>
43461 <indexterm role="concept">
43462 <primary>filter</primary>
43463 <secondary>transport filter</secondary>
43464 </indexterm>
43465 <indexterm role="variable">
43466 <primary><varname>$pipe_addresses</varname></primary>
43467 </indexterm>
43468 Special handling takes place when an argument consists of precisely the text
43469 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
43470 place this string is recognized is when it appears as an argument for a pipe or
43471 transport filter command. It causes each address that is being handled to be
43472 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
43473 avoids any problems with spaces or shell metacharacters, and is of use when a
43474 <command>pipe</command> transport is handling groups of addresses in a batch.
43475 </para>
43476 <para>
43477 If <option>force_command</option> is enabled on the transport, Special handling takes place
43478 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
43479 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
43480 argument is inserted in the argument list at that point
43481 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
43482 the only item in the argument; in fact, if it were then <option>force_command</option>
43483 should behave as a no-op.  Rather, it should be used to adjust the command
43484 run while preserving the argument vector separation.
43485 </para>
43486 <para>
43487 After splitting up into arguments and expansion, the resulting command is run
43488 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
43489 message that is being delivered is supplied on the standard input, and the
43490 standard output and standard error are both connected to a single pipe that is
43491 read by Exim. The <option>max_output</option> option controls how much output the command
43492 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
43493 control what is done with it.
43494 </para>
43495 <para>
43496 Not running the command under a shell (by default) lessens the security risks
43497 in cases when a command from a user&#x2019;s filter file is built out of data that was
43498 taken from an incoming message. If a shell is required, it can of course be
43499 explicitly specified as the command to be run. However, there are circumstances
43500 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
43501 under a shell and cannot easily be modified. To allow for these cases, there is
43502 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
43503 works. Instead of breaking up the command line as just described, it expands it
43504 as a single string and passes the result to <filename>/bin/sh</filename>. The
43505 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
43506 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
43507 </para>
43508 </section>
43509 <section id="SECTpipeenv">
43510 <title>Environment variables</title>
43511 <para>
43512 <indexterm role="concept">
43513 <primary><command>pipe</command> transport</primary>
43514 <secondary>environment for command</secondary>
43515 </indexterm>
43516 <indexterm role="concept">
43517 <primary>environment for pipe transport</primary>
43518 </indexterm>
43519 The environment variables listed below are set up when the command is invoked.
43520 This list is a compromise for maximum compatibility with other MTAs. Note that
43521 the <option>environment</option> option can be used to add additional variables to this
43522 environment.
43523 </para>
43524 <literallayout>
43525 <literal>DOMAIN            </literal>   the domain of the address
43526 <literal>HOME              </literal>   the home directory, if set
43527 <literal>HOST              </literal>   the host name when called from a router (see below)
43528 <literal>LOCAL_PART        </literal>   see below
43529 <literal>LOCAL_PART_PREFIX </literal>   see below
43530 <literal>LOCAL_PART_SUFFIX </literal>   see below
43531 <literal>LOGNAME           </literal>   see below
43532 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
43533 <literal>PATH              </literal>   as specified by the <option>path</option> option below
43534 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
43535 <literal>RECIPIENT         </literal>   the complete recipient address
43536 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
43537 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
43538 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
43539 <literal>USER              </literal>   see below
43540 </literallayout>
43541 <para>
43542 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
43543 router, LOCAL_PART is set to the local part of the address. When it is
43544 called as a result of a forward or alias expansion, LOCAL_PART is set to
43545 the local part of the address that was expanded. In both cases, any affixes are
43546 removed from the local part, and made available in LOCAL_PART_PREFIX and
43547 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
43548 same value as LOCAL_PART for compatibility with other MTAs.
43549 </para>
43550 <para>
43551 <indexterm role="concept">
43552 <primary>HOST</primary>
43553 </indexterm>
43554 HOST is set only when a <command>pipe</command> transport is called from a router that
43555 associates hosts with an address, typically when using <command>pipe</command> as a
43556 pseudo-remote transport. HOST is set to the first host name specified by
43557 the router.
43558 </para>
43559 <para>
43560 <indexterm role="concept">
43561 <primary>HOME</primary>
43562 </indexterm>
43563 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
43564 for the HOME environment variable. Otherwise, a home directory may be set
43565 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
43566 user&#x2019;s home directory if <option>check_local_user</option> is set.
43567 </para>
43568 </section>
43569 <section id="SECID142">
43570 <title>Private options for pipe</title>
43571 <para>
43572 <indexterm role="concept">
43573 <primary>options</primary>
43574 <secondary><command>pipe</command> transport</secondary>
43575 </indexterm>
43576 </para>
43577 <para>
43578 <indexterm role="option">
43579 <primary><option>allow_commands</option></primary>
43580 </indexterm>
43581 </para>
43582 <informaltable frame="all">
43583 <tgroup cols="4" colsep="0" rowsep="0">
43584 <colspec colwidth="8*" align="left"/>
43585 <colspec colwidth="6*" align="center"/>
43586 <colspec colwidth="6*" align="center"/>
43587 <colspec colwidth="6*" align="right"/>
43588 <tbody>
43589 <row>
43590 <entry><option>allow_commands</option></entry>
43591 <entry>Use: <emphasis>pipe</emphasis></entry>
43592 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43593 <entry>Default: <emphasis>unset</emphasis></entry>
43594 </row>
43595 </tbody>
43596 </tgroup>
43597 </informaltable>
43598 <para>
43599 <indexterm role="concept">
43600 <primary><command>pipe</command> transport</primary>
43601 <secondary>permitted commands</secondary>
43602 </indexterm>
43603 The string is expanded, and is then interpreted as a colon-separated list of
43604 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
43605 permitted are those in the <option>allow_commands</option> list. They need not be absolute
43606 paths; the <option>path</option> option is still used for relative paths. If
43607 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
43608 in the <option>allow_commands</option> list, or a name without any slashes that is found on
43609 the path. In other words, if neither <option>allow_commands</option> nor
43610 <option>restrict_to_path</option> is set, there is no restriction on the command, but
43611 otherwise only commands that are permitted by one or the other are allowed. For
43612 example, if
43613 </para>
43614 <literallayout class="monospaced">
43615 allow_commands = /usr/bin/vacation
43616 </literallayout>
43617 <para>
43618 and <option>restrict_to_path</option> is not set, the only permitted command is
43619 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
43620 <option>use_shell</option> is set.
43621 </para>
43622 <para>
43623 <indexterm role="option">
43624 <primary><option>batch_id</option></primary>
43625 </indexterm>
43626 </para>
43627 <informaltable frame="all">
43628 <tgroup cols="4" colsep="0" rowsep="0">
43629 <colspec colwidth="8*" align="left"/>
43630 <colspec colwidth="6*" align="center"/>
43631 <colspec colwidth="6*" align="center"/>
43632 <colspec colwidth="6*" align="right"/>
43633 <tbody>
43634 <row>
43635 <entry><option>batch_id</option></entry>
43636 <entry>Use: <emphasis>pipe</emphasis></entry>
43637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43638 <entry>Default: <emphasis>unset</emphasis></entry>
43639 </row>
43640 </tbody>
43641 </tgroup>
43642 </informaltable>
43643 <para>
43644 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43645 </para>
43646 <para>
43647 <indexterm role="option">
43648 <primary><option>batch_max</option></primary>
43649 </indexterm>
43650 </para>
43651 <informaltable frame="all">
43652 <tgroup cols="4" colsep="0" rowsep="0">
43653 <colspec colwidth="8*" align="left"/>
43654 <colspec colwidth="6*" align="center"/>
43655 <colspec colwidth="6*" align="center"/>
43656 <colspec colwidth="6*" align="right"/>
43657 <tbody>
43658 <row>
43659 <entry><option>batch_max</option></entry>
43660 <entry>Use: <emphasis>pipe</emphasis></entry>
43661 <entry>Type: <emphasis>integer</emphasis></entry>
43662 <entry>Default: <emphasis>1</emphasis></entry>
43663 </row>
43664 </tbody>
43665 </tgroup>
43666 </informaltable>
43667 <para>
43668 This limits the number of addresses that can be handled in a single delivery.
43669 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43670 </para>
43671 <para>
43672 <indexterm role="option">
43673 <primary><option>check_string</option></primary>
43674 </indexterm>
43675 </para>
43676 <informaltable frame="all">
43677 <tgroup cols="4" colsep="0" rowsep="0">
43678 <colspec colwidth="8*" align="left"/>
43679 <colspec colwidth="6*" align="center"/>
43680 <colspec colwidth="6*" align="center"/>
43681 <colspec colwidth="6*" align="right"/>
43682 <tbody>
43683 <row>
43684 <entry><option>check_string</option></entry>
43685 <entry>Use: <emphasis>pipe</emphasis></entry>
43686 <entry>Type: <emphasis>string</emphasis></entry>
43687 <entry>Default: <emphasis>unset</emphasis></entry>
43688 </row>
43689 </tbody>
43690 </tgroup>
43691 </informaltable>
43692 <para>
43693 As <command>pipe</command> writes the message, the start of each line is tested for matching
43694 <option>check_string</option>, and if it does, the initial matching characters are replaced
43695 by the contents of <option>escape_string</option>, provided both are set. The value of
43696 <option>check_string</option> is a literal string, not a regular expression, and the case of
43697 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
43698 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
43699 the SMTP escaping protocol. Any settings made in the configuration file are
43700 ignored.
43701 </para>
43702 <para>
43703 <indexterm role="option">
43704 <primary><option>command</option></primary>
43705 </indexterm>
43706 </para>
43707 <informaltable frame="all">
43708 <tgroup cols="4" colsep="0" rowsep="0">
43709 <colspec colwidth="8*" align="left"/>
43710 <colspec colwidth="6*" align="center"/>
43711 <colspec colwidth="6*" align="center"/>
43712 <colspec colwidth="6*" align="right"/>
43713 <tbody>
43714 <row>
43715 <entry><option>command</option></entry>
43716 <entry>Use: <emphasis>pipe</emphasis></entry>
43717 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43718 <entry>Default: <emphasis>unset</emphasis></entry>
43719 </row>
43720 </tbody>
43721 </tgroup>
43722 </informaltable>
43723 <para>
43724 This option need not be set when <command>pipe</command> is being used to deliver to pipes
43725 obtained directly from address redirections. In other cases, the option must be
43726 set, to provide a command to be run. It need not yield an absolute path (see
43727 the <option>path</option> option below). The command is split up into separate arguments by
43728 Exim, and each argument is separately expanded, as described in section
43729 <xref linkend="SECThowcommandrun"/> above.
43730 </para>
43731 <para>
43732 <indexterm role="option">
43733 <primary><option>environment</option></primary>
43734 </indexterm>
43735 </para>
43736 <informaltable frame="all">
43737 <tgroup cols="4" colsep="0" rowsep="0">
43738 <colspec colwidth="8*" align="left"/>
43739 <colspec colwidth="6*" align="center"/>
43740 <colspec colwidth="6*" align="center"/>
43741 <colspec colwidth="6*" align="right"/>
43742 <tbody>
43743 <row>
43744 <entry><option>environment</option></entry>
43745 <entry>Use: <emphasis>pipe</emphasis></entry>
43746 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43747 <entry>Default: <emphasis>unset</emphasis></entry>
43748 </row>
43749 </tbody>
43750 </tgroup>
43751 </informaltable>
43752 <para>
43753 <indexterm role="concept">
43754 <primary><command>pipe</command> transport</primary>
43755 <secondary>environment for command</secondary>
43756 </indexterm>
43757 <indexterm role="concept">
43758 <primary>environment for <command>pipe</command> transport</primary>
43759 </indexterm>
43760 This option is used to add additional variables to the environment in which the
43761 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
43762 a string which is expanded, and then interpreted as a colon-separated list of
43763 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
43764 </para>
43765 <para>
43766 <indexterm role="option">
43767 <primary><option>escape_string</option></primary>
43768 </indexterm>
43769 </para>
43770 <informaltable frame="all">
43771 <tgroup cols="4" colsep="0" rowsep="0">
43772 <colspec colwidth="8*" align="left"/>
43773 <colspec colwidth="6*" align="center"/>
43774 <colspec colwidth="6*" align="center"/>
43775 <colspec colwidth="6*" align="right"/>
43776 <tbody>
43777 <row>
43778 <entry><option>escape_string</option></entry>
43779 <entry>Use: <emphasis>pipe</emphasis></entry>
43780 <entry>Type: <emphasis>string</emphasis></entry>
43781 <entry>Default: <emphasis>unset</emphasis></entry>
43782 </row>
43783 </tbody>
43784 </tgroup>
43785 </informaltable>
43786 <para>
43787 See <option>check_string</option> above.
43788 </para>
43789 <para>
43790 <indexterm role="option">
43791 <primary><option>freeze_exec_fail</option></primary>
43792 </indexterm>
43793 </para>
43794 <informaltable frame="all">
43795 <tgroup cols="4" colsep="0" rowsep="0">
43796 <colspec colwidth="8*" align="left"/>
43797 <colspec colwidth="6*" align="center"/>
43798 <colspec colwidth="6*" align="center"/>
43799 <colspec colwidth="6*" align="right"/>
43800 <tbody>
43801 <row>
43802 <entry><option>freeze_exec_fail</option></entry>
43803 <entry>Use: <emphasis>pipe</emphasis></entry>
43804 <entry>Type: <emphasis>boolean</emphasis></entry>
43805 <entry>Default: <emphasis>false</emphasis></entry>
43806 </row>
43807 </tbody>
43808 </tgroup>
43809 </informaltable>
43810 <para>
43811 <indexterm role="concept">
43812 <primary>exec failure</primary>
43813 </indexterm>
43814 <indexterm role="concept">
43815 <primary>failure of exec</primary>
43816 </indexterm>
43817 <indexterm role="concept">
43818 <primary><command>pipe</command> transport</primary>
43819 <secondary>failure of exec</secondary>
43820 </indexterm>
43821 Failure to exec the command in a pipe transport is by default treated like
43822 any other failure while running the command. However, if <option>freeze_exec_fail</option>
43823 is set, failure to exec is treated specially, and causes the message to be
43824 frozen, whatever the setting of <option>ignore_status</option>.
43825 </para>
43826 <para>
43827 <indexterm role="option">
43828 <primary><option>freeze_signal</option></primary>
43829 </indexterm>
43830 </para>
43831 <informaltable frame="all">
43832 <tgroup cols="4" colsep="0" rowsep="0">
43833 <colspec colwidth="8*" align="left"/>
43834 <colspec colwidth="6*" align="center"/>
43835 <colspec colwidth="6*" align="center"/>
43836 <colspec colwidth="6*" align="right"/>
43837 <tbody>
43838 <row>
43839 <entry><option>freeze_signal</option></entry>
43840 <entry>Use: <emphasis>pipe</emphasis></entry>
43841 <entry>Type: <emphasis>boolean</emphasis></entry>
43842 <entry>Default: <emphasis>false</emphasis></entry>
43843 </row>
43844 </tbody>
43845 </tgroup>
43846 </informaltable>
43847 <para>
43848 <indexterm role="concept">
43849 <primary>signal exit</primary>
43850 </indexterm>
43851 <indexterm role="concept">
43852 <primary><command>pipe</command> transport</primary>
43853 <secondary>,</secondary>
43854 </indexterm>
43855 Normally if the process run by a command in a pipe transport exits on a signal,
43856 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
43857 frozen in Exim&#x2019;s queue instead.
43858 </para>
43859 <para>
43860 <indexterm role="option">
43861 <primary><option>force_command</option></primary>
43862 </indexterm>
43863 </para>
43864 <informaltable frame="all">
43865 <tgroup cols="4" colsep="0" rowsep="0">
43866 <colspec colwidth="8*" align="left"/>
43867 <colspec colwidth="6*" align="center"/>
43868 <colspec colwidth="6*" align="center"/>
43869 <colspec colwidth="6*" align="right"/>
43870 <tbody>
43871 <row>
43872 <entry><option>force_command</option></entry>
43873 <entry>Use: <emphasis>pipe</emphasis></entry>
43874 <entry>Type: <emphasis>boolean</emphasis></entry>
43875 <entry>Default: <emphasis>false</emphasis></entry>
43876 </row>
43877 </tbody>
43878 </tgroup>
43879 </informaltable>
43880 <para>
43881 <indexterm role="concept">
43882 <primary>force command</primary>
43883 </indexterm>
43884 <indexterm role="concept">
43885 <primary><command>pipe</command> transport</primary>
43886 <secondary>,</secondary>
43887 </indexterm>
43888 Normally when a router redirects an address directly to a pipe command
43889 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
43890 is set, the <option>command</option> option will used. This is especially
43891 useful for forcing a wrapper or additional argument to be added to the
43892 command. For example:
43893 </para>
43894 <literallayout class="monospaced">
43895 command = /usr/bin/remote_exec myhost -- $address_pipe
43896 force_command
43897 </literallayout>
43898 <para>
43899 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
43900 <option>force_command</option> is set, expanding out to the original argument vector as
43901 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
43902 </para>
43903 <para>
43904 <indexterm role="option">
43905 <primary><option>ignore_status</option></primary>
43906 </indexterm>
43907 </para>
43908 <informaltable frame="all">
43909 <tgroup cols="4" colsep="0" rowsep="0">
43910 <colspec colwidth="8*" align="left"/>
43911 <colspec colwidth="6*" align="center"/>
43912 <colspec colwidth="6*" align="center"/>
43913 <colspec colwidth="6*" align="right"/>
43914 <tbody>
43915 <row>
43916 <entry><option>ignore_status</option></entry>
43917 <entry>Use: <emphasis>pipe</emphasis></entry>
43918 <entry>Type: <emphasis>boolean</emphasis></entry>
43919 <entry>Default: <emphasis>false</emphasis></entry>
43920 </row>
43921 </tbody>
43922 </tgroup>
43923 </informaltable>
43924 <para>
43925 If this option is true, the status returned by the subprocess that is set up to
43926 run the command is ignored, and Exim behaves as if zero had been returned.
43927 Otherwise, a non-zero status or termination by signal causes an error return
43928 from the transport unless the status value is one of those listed in
43929 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
43930 </para>
43931 <para>
43932 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
43933 See the <option>timeout_defer</option> option for how timeouts are handled.
43934 </para>
43935 <para>
43936 <indexterm role="option">
43937 <primary><option>log_defer_output</option></primary>
43938 </indexterm>
43939 </para>
43940 <informaltable frame="all">
43941 <tgroup cols="4" colsep="0" rowsep="0">
43942 <colspec colwidth="8*" align="left"/>
43943 <colspec colwidth="6*" align="center"/>
43944 <colspec colwidth="6*" align="center"/>
43945 <colspec colwidth="6*" align="right"/>
43946 <tbody>
43947 <row>
43948 <entry><option>log_defer_output</option></entry>
43949 <entry>Use: <emphasis>pipe</emphasis></entry>
43950 <entry>Type: <emphasis>boolean</emphasis></entry>
43951 <entry>Default: <emphasis>false</emphasis></entry>
43952 </row>
43953 </tbody>
43954 </tgroup>
43955 </informaltable>
43956 <para>
43957 <indexterm role="concept">
43958 <primary><command>pipe</command> transport</primary>
43959 <secondary>logging output</secondary>
43960 </indexterm>
43961 If this option is set, and the status returned by the command is
43962 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
43963 and any output was produced, the first line of it is written to the main log.
43964 </para>
43965 <para>
43966 <indexterm role="option">
43967 <primary><option>log_fail_output</option></primary>
43968 </indexterm>
43969 </para>
43970 <informaltable frame="all">
43971 <tgroup cols="4" colsep="0" rowsep="0">
43972 <colspec colwidth="8*" align="left"/>
43973 <colspec colwidth="6*" align="center"/>
43974 <colspec colwidth="6*" align="center"/>
43975 <colspec colwidth="6*" align="right"/>
43976 <tbody>
43977 <row>
43978 <entry><option>log_fail_output</option></entry>
43979 <entry>Use: <emphasis>pipe</emphasis></entry>
43980 <entry>Type: <emphasis>boolean</emphasis></entry>
43981 <entry>Default: <emphasis>false</emphasis></entry>
43982 </row>
43983 </tbody>
43984 </tgroup>
43985 </informaltable>
43986 <para>
43987 If this option is set, and the command returns any output, and also ends with a
43988 return code that is neither zero nor one of the return codes listed in
43989 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
43990 written to the main log. This option and <option>log_output</option> are mutually exclusive.
43991 Only one of them may be set.
43992 </para>
43993 <para>
43994 <indexterm role="option">
43995 <primary><option>log_output</option></primary>
43996 </indexterm>
43997 </para>
43998 <informaltable frame="all">
43999 <tgroup cols="4" colsep="0" rowsep="0">
44000 <colspec colwidth="8*" align="left"/>
44001 <colspec colwidth="6*" align="center"/>
44002 <colspec colwidth="6*" align="center"/>
44003 <colspec colwidth="6*" align="right"/>
44004 <tbody>
44005 <row>
44006 <entry><option>log_output</option></entry>
44007 <entry>Use: <emphasis>pipe</emphasis></entry>
44008 <entry>Type: <emphasis>boolean</emphasis></entry>
44009 <entry>Default: <emphasis>false</emphasis></entry>
44010 </row>
44011 </tbody>
44012 </tgroup>
44013 </informaltable>
44014 <para>
44015 If this option is set and the command returns any output, the first line of
44016 output is written to the main log, whatever the return code. This option and
44017 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
44018 </para>
44019 <para>
44020 <indexterm role="option">
44021 <primary><option>max_output</option></primary>
44022 </indexterm>
44023 </para>
44024 <informaltable frame="all">
44025 <tgroup cols="4" colsep="0" rowsep="0">
44026 <colspec colwidth="8*" align="left"/>
44027 <colspec colwidth="6*" align="center"/>
44028 <colspec colwidth="6*" align="center"/>
44029 <colspec colwidth="6*" align="right"/>
44030 <tbody>
44031 <row>
44032 <entry><option>max_output</option></entry>
44033 <entry>Use: <emphasis>pipe</emphasis></entry>
44034 <entry>Type: <emphasis>integer</emphasis></entry>
44035 <entry>Default: <emphasis>20K</emphasis></entry>
44036 </row>
44037 </tbody>
44038 </tgroup>
44039 </informaltable>
44040 <para>
44041 This specifies the maximum amount of output that the command may produce on its
44042 standard output and standard error file combined. If the limit is exceeded, the
44043 process running the command is killed. This is intended as a safety measure to
44044 catch runaway processes. The limit is applied independently of the settings of
44045 the options that control what is done with such output (for example,
44046 <option>return_output</option>). Because of buffering effects, the amount of output may
44047 exceed the limit by a small amount before Exim notices.
44048 </para>
44049 <para>
44050 <indexterm role="option">
44051 <primary><option>message_prefix</option></primary>
44052 </indexterm>
44053 </para>
44054 <informaltable frame="all">
44055 <tgroup cols="4" colsep="0" rowsep="0">
44056 <colspec colwidth="8*" align="left"/>
44057 <colspec colwidth="6*" align="center"/>
44058 <colspec colwidth="6*" align="center"/>
44059 <colspec colwidth="6*" align="right"/>
44060 <tbody>
44061 <row>
44062 <entry><option>message_prefix</option></entry>
44063 <entry>Use: <emphasis>pipe</emphasis></entry>
44064 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44065 <entry>Default: <emphasis>see below</emphasis></entry>
44066 </row>
44067 </tbody>
44068 </tgroup>
44069 </informaltable>
44070 <para>
44071 The string specified here is expanded and output at the start of every message.
44072 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
44073 </para>
44074 <literallayout class="monospaced">
44075 message_prefix = \
44076   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
44077   ${tod_bsdinbox}\n
44078 </literallayout>
44079 <para>
44080 <indexterm role="concept">
44081 <primary>Cyrus</primary>
44082 </indexterm>
44083 <indexterm role="concept">
44084 <primary><option>tmail</option></primary>
44085 </indexterm>
44086 <indexterm role="concept">
44087 <primary><quote>From</quote> line</primary>
44088 </indexterm>
44089 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
44090 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
44091 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
44092 setting
44093 </para>
44094 <literallayout class="monospaced">
44095 message_prefix =
44096 </literallayout>
44097 <para>
44098 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44099 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
44100 </para>
44101 <para>
44102 <indexterm role="option">
44103 <primary><option>message_suffix</option></primary>
44104 </indexterm>
44105 </para>
44106 <informaltable frame="all">
44107 <tgroup cols="4" colsep="0" rowsep="0">
44108 <colspec colwidth="8*" align="left"/>
44109 <colspec colwidth="6*" align="center"/>
44110 <colspec colwidth="6*" align="center"/>
44111 <colspec colwidth="6*" align="right"/>
44112 <tbody>
44113 <row>
44114 <entry><option>message_suffix</option></entry>
44115 <entry>Use: <emphasis>pipe</emphasis></entry>
44116 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44117 <entry>Default: <emphasis>see below</emphasis></entry>
44118 </row>
44119 </tbody>
44120 </tgroup>
44121 </informaltable>
44122 <para>
44123 The string specified here is expanded and output at the end of every message.
44124 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
44125 The suffix can be suppressed by setting
44126 </para>
44127 <literallayout class="monospaced">
44128 message_suffix =
44129 </literallayout>
44130 <para>
44131 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44132 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
44133 </para>
44134 <para>
44135 <indexterm role="option">
44136 <primary><option>path</option></primary>
44137 </indexterm>
44138 </para>
44139 <informaltable frame="all">
44140 <tgroup cols="4" colsep="0" rowsep="0">
44141 <colspec colwidth="8*" align="left"/>
44142 <colspec colwidth="6*" align="center"/>
44143 <colspec colwidth="6*" align="center"/>
44144 <colspec colwidth="6*" align="right"/>
44145 <tbody>
44146 <row>
44147 <entry><option>path</option></entry>
44148 <entry>Use: <emphasis>pipe</emphasis></entry>
44149 <entry>Type: <emphasis>string</emphasis></entry>
44150 <entry>Default: <emphasis>see below</emphasis></entry>
44151 </row>
44152 </tbody>
44153 </tgroup>
44154 </informaltable>
44155 <para>
44156 This option specifies the string that is set up in the PATH environment
44157 variable of the subprocess. The default is:
44158 </para>
44159 <literallayout class="monospaced">
44160 /bin:/usr/bin
44161 </literallayout>
44162 <para>
44163 If the <option>command</option> option does not yield an absolute path name, the command is
44164 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
44165 apply to a command specified as a transport filter.
44166 </para>
44167 <para>
44168 <indexterm role="option">
44169 <primary><option>permit_coredump</option></primary>
44170 </indexterm>
44171 </para>
44172 <informaltable frame="all">
44173 <tgroup cols="4" colsep="0" rowsep="0">
44174 <colspec colwidth="8*" align="left"/>
44175 <colspec colwidth="6*" align="center"/>
44176 <colspec colwidth="6*" align="center"/>
44177 <colspec colwidth="6*" align="right"/>
44178 <tbody>
44179 <row>
44180 <entry><option>permit_coredump</option></entry>
44181 <entry>Use: <emphasis>pipe</emphasis></entry>
44182 <entry>Type: <emphasis>boolean</emphasis></entry>
44183 <entry>Default: <emphasis>false</emphasis></entry>
44184 </row>
44185 </tbody>
44186 </tgroup>
44187 </informaltable>
44188 <para>
44189 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
44190 a core-dump of a pipe command, enable this command.  This enables core-dumps
44191 during delivery and affects both the Exim binary and the pipe command run.
44192 It is recommended that this option remain off unless and until you have a need
44193 for it and that this only be enabled when needed, as the risk of excessive
44194 resource consumption can be quite high.  Note also that Exim is typically
44195 installed as a setuid binary and most operating systems will inhibit coredumps
44196 of these by default, so further OS-specific action may be required.
44197 </para>
44198 <para>
44199 <indexterm role="option">
44200 <primary><option>pipe_as_creator</option></primary>
44201 </indexterm>
44202 </para>
44203 <informaltable frame="all">
44204 <tgroup cols="4" colsep="0" rowsep="0">
44205 <colspec colwidth="8*" align="left"/>
44206 <colspec colwidth="6*" align="center"/>
44207 <colspec colwidth="6*" align="center"/>
44208 <colspec colwidth="6*" align="right"/>
44209 <tbody>
44210 <row>
44211 <entry><option>pipe_as_creator</option></entry>
44212 <entry>Use: <emphasis>pipe</emphasis></entry>
44213 <entry>Type: <emphasis>boolean</emphasis></entry>
44214 <entry>Default: <emphasis>false</emphasis></entry>
44215 </row>
44216 </tbody>
44217 </tgroup>
44218 </informaltable>
44219 <para>
44220 <indexterm role="concept">
44221 <primary>uid (user id)</primary>
44222 <secondary>local delivery</secondary>
44223 </indexterm>
44224 If the generic <option>user</option> option is not set and this option is true, the delivery
44225 process is run under the uid that was in force when Exim was originally called
44226 to accept the message. If the group id is not otherwise set (via the generic
44227 <option>group</option> option), the gid that was in force when Exim was originally called to
44228 accept the message is used.
44229 </para>
44230 <para>
44231 <indexterm role="option">
44232 <primary><option>restrict_to_path</option></primary>
44233 </indexterm>
44234 </para>
44235 <informaltable frame="all">
44236 <tgroup cols="4" colsep="0" rowsep="0">
44237 <colspec colwidth="8*" align="left"/>
44238 <colspec colwidth="6*" align="center"/>
44239 <colspec colwidth="6*" align="center"/>
44240 <colspec colwidth="6*" align="right"/>
44241 <tbody>
44242 <row>
44243 <entry><option>restrict_to_path</option></entry>
44244 <entry>Use: <emphasis>pipe</emphasis></entry>
44245 <entry>Type: <emphasis>boolean</emphasis></entry>
44246 <entry>Default: <emphasis>false</emphasis></entry>
44247 </row>
44248 </tbody>
44249 </tgroup>
44250 </informaltable>
44251 <para>
44252 When this option is set, any command name not listed in <option>allow_commands</option> must
44253 contain no slashes. The command is searched for only in the directories listed
44254 in the <option>path</option> option. This option is intended for use in the case when a pipe
44255 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
44256 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
44257 </para>
44258 <para>
44259 <indexterm role="option">
44260 <primary><option>return_fail_output</option></primary>
44261 </indexterm>
44262 </para>
44263 <informaltable frame="all">
44264 <tgroup cols="4" colsep="0" rowsep="0">
44265 <colspec colwidth="8*" align="left"/>
44266 <colspec colwidth="6*" align="center"/>
44267 <colspec colwidth="6*" align="center"/>
44268 <colspec colwidth="6*" align="right"/>
44269 <tbody>
44270 <row>
44271 <entry><option>return_fail_output</option></entry>
44272 <entry>Use: <emphasis>pipe</emphasis></entry>
44273 <entry>Type: <emphasis>boolean</emphasis></entry>
44274 <entry>Default: <emphasis>false</emphasis></entry>
44275 </row>
44276 </tbody>
44277 </tgroup>
44278 </informaltable>
44279 <para>
44280 If this option is true, and the command produced any output and ended with a
44281 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
44282 is, the delivery failed), the output is returned in the bounce message.
44283 However, if the message has a null sender (that is, it is itself a bounce
44284 message), output from the command is discarded. This option and
44285 <option>return_output</option> are mutually exclusive. Only one of them may be set.
44286 </para>
44287 <para>
44288 <indexterm role="option">
44289 <primary><option>return_output</option></primary>
44290 </indexterm>
44291 </para>
44292 <informaltable frame="all">
44293 <tgroup cols="4" colsep="0" rowsep="0">
44294 <colspec colwidth="8*" align="left"/>
44295 <colspec colwidth="6*" align="center"/>
44296 <colspec colwidth="6*" align="center"/>
44297 <colspec colwidth="6*" align="right"/>
44298 <tbody>
44299 <row>
44300 <entry><option>return_output</option></entry>
44301 <entry>Use: <emphasis>pipe</emphasis></entry>
44302 <entry>Type: <emphasis>boolean</emphasis></entry>
44303 <entry>Default: <emphasis>false</emphasis></entry>
44304 </row>
44305 </tbody>
44306 </tgroup>
44307 </informaltable>
44308 <para>
44309 If this option is true, and the command produced any output, the delivery is
44310 deemed to have failed whatever the return code from the command, and the output
44311 is returned in the bounce message. Otherwise, the output is just discarded.
44312 However, if the message has a null sender (that is, it is a bounce message),
44313 output from the command is always discarded, whatever the setting of this
44314 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
44315 of them may be set.
44316 </para>
44317 <para>
44318 <indexterm role="option">
44319 <primary><option>temp_errors</option></primary>
44320 </indexterm>
44321 </para>
44322 <informaltable frame="all">
44323 <tgroup cols="4" colsep="0" rowsep="0">
44324 <colspec colwidth="8*" align="left"/>
44325 <colspec colwidth="6*" align="center"/>
44326 <colspec colwidth="6*" align="center"/>
44327 <colspec colwidth="6*" align="right"/>
44328 <tbody>
44329 <row>
44330 <entry><option>temp_errors</option></entry>
44331 <entry>Use: <emphasis>pipe</emphasis></entry>
44332 <entry>Type: <emphasis>string list</emphasis></entry>
44333 <entry>Default: <emphasis>see below</emphasis></entry>
44334 </row>
44335 </tbody>
44336 </tgroup>
44337 </informaltable>
44338 <para>
44339 <indexterm role="concept">
44340 <primary><command>pipe</command> transport</primary>
44341 <secondary>temporary failure</secondary>
44342 </indexterm>
44343 This option contains either a colon-separated list of numbers, or a single
44344 asterisk. If <option>ignore_status</option> is false
44345 and <option>return_output</option> is not set,
44346 and the command exits with a non-zero return code, the failure is treated as
44347 temporary and the delivery is deferred if the return code matches one of the
44348 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
44349 codes are treated as permanent errors. The default setting contains the codes
44350 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
44351 compiled on a system that does not define these macros, it assumes values of 75
44352 and 73, respectively.
44353 </para>
44354 <para>
44355 <indexterm role="option">
44356 <primary><option>timeout</option></primary>
44357 </indexterm>
44358 </para>
44359 <informaltable frame="all">
44360 <tgroup cols="4" colsep="0" rowsep="0">
44361 <colspec colwidth="8*" align="left"/>
44362 <colspec colwidth="6*" align="center"/>
44363 <colspec colwidth="6*" align="center"/>
44364 <colspec colwidth="6*" align="right"/>
44365 <tbody>
44366 <row>
44367 <entry><option>timeout</option></entry>
44368 <entry>Use: <emphasis>pipe</emphasis></entry>
44369 <entry>Type: <emphasis>time</emphasis></entry>
44370 <entry>Default: <emphasis>1h</emphasis></entry>
44371 </row>
44372 </tbody>
44373 </tgroup>
44374 </informaltable>
44375 <para>
44376 If the command fails to complete within this time, it is killed. This normally
44377 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
44378 specifies no timeout. In order to ensure that any subprocesses created by the
44379 command are also killed, Exim makes the initial process a process group leader,
44380 and kills the whole process group on a timeout. However, this can be defeated
44381 if one of the processes starts a new process group.
44382 </para>
44383 <para>
44384 <indexterm role="option">
44385 <primary><option>timeout_defer</option></primary>
44386 </indexterm>
44387 </para>
44388 <informaltable frame="all">
44389 <tgroup cols="4" colsep="0" rowsep="0">
44390 <colspec colwidth="8*" align="left"/>
44391 <colspec colwidth="6*" align="center"/>
44392 <colspec colwidth="6*" align="center"/>
44393 <colspec colwidth="6*" align="right"/>
44394 <tbody>
44395 <row>
44396 <entry><option>timeout_defer</option></entry>
44397 <entry>Use: <emphasis>pipe</emphasis></entry>
44398 <entry>Type: <emphasis>boolean</emphasis></entry>
44399 <entry>Default: <emphasis>false</emphasis></entry>
44400 </row>
44401 </tbody>
44402 </tgroup>
44403 </informaltable>
44404 <para>
44405 A timeout in a <command>pipe</command> transport, either in the command that the transport
44406 runs, or in a transport filter that is associated with it, is by default
44407 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
44408 is set true, both kinds of timeout become temporary errors, causing the
44409 delivery to be deferred.
44410 </para>
44411 <para>
44412 <indexterm role="option">
44413 <primary><option>umask</option></primary>
44414 </indexterm>
44415 </para>
44416 <informaltable frame="all">
44417 <tgroup cols="4" colsep="0" rowsep="0">
44418 <colspec colwidth="8*" align="left"/>
44419 <colspec colwidth="6*" align="center"/>
44420 <colspec colwidth="6*" align="center"/>
44421 <colspec colwidth="6*" align="right"/>
44422 <tbody>
44423 <row>
44424 <entry><option>umask</option></entry>
44425 <entry>Use: <emphasis>pipe</emphasis></entry>
44426 <entry>Type: <emphasis>octal integer</emphasis></entry>
44427 <entry>Default: <emphasis>022</emphasis></entry>
44428 </row>
44429 </tbody>
44430 </tgroup>
44431 </informaltable>
44432 <para>
44433 This specifies the umask setting for the subprocess that runs the command.
44434 </para>
44435 <para>
44436 <indexterm role="option">
44437 <primary><option>use_bsmtp</option></primary>
44438 </indexterm>
44439 </para>
44440 <informaltable frame="all">
44441 <tgroup cols="4" colsep="0" rowsep="0">
44442 <colspec colwidth="8*" align="left"/>
44443 <colspec colwidth="6*" align="center"/>
44444 <colspec colwidth="6*" align="center"/>
44445 <colspec colwidth="6*" align="right"/>
44446 <tbody>
44447 <row>
44448 <entry><option>use_bsmtp</option></entry>
44449 <entry>Use: <emphasis>pipe</emphasis></entry>
44450 <entry>Type: <emphasis>boolean</emphasis></entry>
44451 <entry>Default: <emphasis>false</emphasis></entry>
44452 </row>
44453 </tbody>
44454 </tgroup>
44455 </informaltable>
44456 <para>
44457 <indexterm role="concept">
44458 <primary>envelope sender</primary>
44459 </indexterm>
44460 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
44461 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
44462 commands. If you want to include a leading HELO command with such messages,
44463 you can do so by setting the <option>message_prefix</option> option. See section
44464 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
44465 </para>
44466 <para>
44467 <indexterm role="option">
44468 <primary><option>use_classresources</option></primary>
44469 </indexterm>
44470 </para>
44471 <informaltable frame="all">
44472 <tgroup cols="4" colsep="0" rowsep="0">
44473 <colspec colwidth="8*" align="left"/>
44474 <colspec colwidth="6*" align="center"/>
44475 <colspec colwidth="6*" align="center"/>
44476 <colspec colwidth="6*" align="right"/>
44477 <tbody>
44478 <row>
44479 <entry><option>use_classresources</option></entry>
44480 <entry>Use: <emphasis>pipe</emphasis></entry>
44481 <entry>Type: <emphasis>boolean</emphasis></entry>
44482 <entry>Default: <emphasis>false</emphasis></entry>
44483 </row>
44484 </tbody>
44485 </tgroup>
44486 </informaltable>
44487 <para>
44488 <indexterm role="concept">
44489 <primary>class resources (BSD)</primary>
44490 </indexterm>
44491 This option is available only when Exim is running on FreeBSD, NetBSD, or
44492 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
44493 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
44494 limits for the uid under which the pipe is to run are obtained from the login
44495 class database.
44496 </para>
44497 <para>
44498 <indexterm role="option">
44499 <primary><option>use_crlf</option></primary>
44500 </indexterm>
44501 </para>
44502 <informaltable frame="all">
44503 <tgroup cols="4" colsep="0" rowsep="0">
44504 <colspec colwidth="8*" align="left"/>
44505 <colspec colwidth="6*" align="center"/>
44506 <colspec colwidth="6*" align="center"/>
44507 <colspec colwidth="6*" align="right"/>
44508 <tbody>
44509 <row>
44510 <entry><option>use_crlf</option></entry>
44511 <entry>Use: <emphasis>pipe</emphasis></entry>
44512 <entry>Type: <emphasis>boolean</emphasis></entry>
44513 <entry>Default: <emphasis>false</emphasis></entry>
44514 </row>
44515 </tbody>
44516 </tgroup>
44517 </informaltable>
44518 <para>
44519 <indexterm role="concept">
44520 <primary>carriage return</primary>
44521 </indexterm>
44522 <indexterm role="concept">
44523 <primary>linefeed</primary>
44524 </indexterm>
44525 This option causes lines to be terminated with the two-character CRLF sequence
44526 (carriage return, linefeed) instead of just a linefeed character. In the case
44527 of batched SMTP, the byte sequence written to the pipe is then an exact image
44528 of what would be sent down a real SMTP connection.
44529 </para>
44530 <para>
44531 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
44532 written verbatim, so must contain their own carriage return characters if these
44533 are needed. When <option>use_bsmtp</option> is not set, the default values for both
44534 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
44535 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
44536 </para>
44537 <para>
44538 <indexterm role="option">
44539 <primary><option>use_shell</option></primary>
44540 </indexterm>
44541 </para>
44542 <informaltable frame="all">
44543 <tgroup cols="4" colsep="0" rowsep="0">
44544 <colspec colwidth="8*" align="left"/>
44545 <colspec colwidth="6*" align="center"/>
44546 <colspec colwidth="6*" align="center"/>
44547 <colspec colwidth="6*" align="right"/>
44548 <tbody>
44549 <row>
44550 <entry><option>use_shell</option></entry>
44551 <entry>Use: <emphasis>pipe</emphasis></entry>
44552 <entry>Type: <emphasis>boolean</emphasis></entry>
44553 <entry>Default: <emphasis>false</emphasis></entry>
44554 </row>
44555 </tbody>
44556 </tgroup>
44557 </informaltable>
44558 <para>
44559 <indexterm role="variable">
44560 <primary><varname>$pipe_addresses</varname></primary>
44561 </indexterm>
44562 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
44563 instead of being run directly from the transport, as described in section
44564 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
44565 where the command is expected to be run under a shell and cannot easily be
44566 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
44567 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
44568 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
44569 its <option>-c</option> option.
44570 </para>
44571 </section>
44572 <section id="SECID143">
44573 <title>Using an external local delivery agent</title>
44574 <para>
44575 <indexterm role="concept">
44576 <primary>local delivery</primary>
44577 <secondary>using an external agent</secondary>
44578 </indexterm>
44579 <indexterm role="concept">
44580 <primary><emphasis>procmail</emphasis></primary>
44581 </indexterm>
44582 <indexterm role="concept">
44583 <primary>external local delivery</primary>
44584 </indexterm>
44585 <indexterm role="concept">
44586 <primary>delivery</primary>
44587 <secondary><emphasis>procmail</emphasis></secondary>
44588 </indexterm>
44589 <indexterm role="concept">
44590 <primary>delivery</primary>
44591 <secondary>by external agent</secondary>
44592 </indexterm>
44593 The <command>pipe</command> transport can be used to pass all messages that require local
44594 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
44595 this, care must be taken to ensure that the pipe is run under an appropriate
44596 uid and gid. In some configurations one wants this to be a uid that is trusted
44597 by the delivery agent to supply the correct sender of the message. It may be
44598 necessary to recompile or reconfigure the delivery agent so that it trusts an
44599 appropriate user. The following is an example transport and router
44600 configuration for <option>procmail</option>:
44601 </para>
44602 <literallayout class="monospaced">
44603 # transport
44604 procmail_pipe:
44605   driver = pipe
44606   command = /usr/local/bin/procmail -d $local_part
44607   return_path_add
44608   delivery_date_add
44609   envelope_to_add
44610   check_string = "From "
44611   escape_string = "&gt;From "
44612   umask = 077
44613   user = $local_part
44614   group = mail
44615
44616 # router
44617 procmail:
44618   driver = accept
44619   check_local_user
44620   transport = procmail_pipe
44621 </literallayout>
44622 <para>
44623 In this example, the pipe is run as the local user, but with the group set to
44624 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
44625 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
44626 user to supply a correct sender address. If you do not specify either a
44627 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
44628 home directory is the user&#x2019;s home directory by default.
44629 </para>
44630 <para>
44631 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
44632 </para>
44633 <literallayout class="monospaced">
44634 IFS=" "
44635 </literallayout>
44636 <para>
44637 as shown in some <option>procmail</option> documentation, because Exim does not by default
44638 use a shell to run pipe commands.
44639 </para>
44640 <para>
44641 <indexterm role="concept">
44642 <primary>Cyrus</primary>
44643 </indexterm>
44644 The next example shows a transport and a router for a system where local
44645 deliveries are handled by the Cyrus IMAP server.
44646 </para>
44647 <literallayout class="monospaced">
44648 # transport
44649 local_delivery_cyrus:
44650   driver = pipe
44651   command = /usr/cyrus/bin/deliver \
44652             -m ${substr_1:$local_part_suffix} -- $local_part
44653   user = cyrus
44654   group = mail
44655   return_output
44656   log_output
44657   message_prefix =
44658   message_suffix =
44659
44660 # router
44661 local_user_cyrus:
44662   driver = accept
44663   check_local_user
44664   local_part_suffix = .*
44665   transport = local_delivery_cyrus
44666 </literallayout>
44667 <para>
44668 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
44669 <option>return_output</option> to cause any text written by Cyrus to be returned to the
44670 sender.
44671 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
44672 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
44673 </para>
44674 </section>
44675 </chapter>
44676
44677 <chapter id="CHAPsmtptrans">
44678 <title>The smtp transport</title>
44679 <para>
44680 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
44681 <primary>transports</primary>
44682 <secondary><command>smtp</command></secondary>
44683 </indexterm>
44684 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
44685 <primary><command>smtp</command> transport</primary>
44686 </indexterm>
44687 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
44688 or LMTP protocol. The list of hosts to try can either be taken from the address
44689 that is being processed (having been set up by the router), or specified
44690 explicitly for the transport. Timeout and retry processing (see chapter
44691 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
44692 </para>
44693 <section id="SECID144">
44694 <title>Multiple messages on a single connection</title>
44695 <para>
44696 The sending of multiple messages over a single TCP/IP connection can arise in
44697 two ways:
44698 </para>
44699 <itemizedlist>
44700 <listitem>
44701 <para>
44702 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
44703 routed to the same host, more than one copy of the message has to be sent to
44704 that host. In this situation, multiple copies may be sent in a single run of
44705 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
44706 does when it has too many addresses to send in one message also depends on the
44707 value of the global <option>remote_max_parallel</option> option. Details are given in
44708 section <xref linkend="SECToutSMTPTCP"/>.)
44709 </para>
44710 </listitem>
44711 <listitem>
44712 <para>
44713 <indexterm role="concept">
44714 <primary>hints database</primary>
44715 <secondary>remembering routing</secondary>
44716 </indexterm>
44717 When a message has been successfully delivered over a TCP/IP connection, Exim
44718 looks in its hints database to see if there are any other messages awaiting a
44719 connection to the same host. If there are, a new delivery process is started
44720 for one of them, and the current TCP/IP connection is passed on to it. The new
44721 process may in turn send multiple copies and possibly create yet another
44722 process.
44723 </para>
44724 </listitem>
44725 </itemizedlist>
44726 <para>
44727 For each copy sent over the same TCP/IP connection, a sequence counter is
44728 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
44729 no further messages are sent over that connection.
44730 </para>
44731 </section>
44732 <section id="SECID145">
44733 <title>Use of the $host and $host_address variables</title>
44734 <para>
44735 <indexterm role="variable">
44736 <primary><varname>$host</varname></primary>
44737 </indexterm>
44738 <indexterm role="variable">
44739 <primary><varname>$host_address</varname></primary>
44740 </indexterm>
44741 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
44742 <varname>$host_address</varname> are the name and IP address of the first host on the host list
44743 passed by the router. However, when the transport is about to connect to a
44744 specific host, and while it is connected to that host, <varname>$host</varname> and
44745 <varname>$host_address</varname> are set to the values for that host. These are the values
44746 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
44747 <option>serialize_hosts</option>, and the various TLS options are expanded.
44748 </para>
44749 </section>
44750 <section id="usecippeer">
44751 <title>Use of $tls_cipher and $tls_peerdn</title>
44752 <para>
44753 <indexterm role="variable">
44754 <primary><varname>$tls_bits</varname></primary>
44755 </indexterm>
44756 <indexterm role="variable">
44757 <primary><varname>$tls_cipher</varname></primary>
44758 </indexterm>
44759 <indexterm role="variable">
44760 <primary><varname>$tls_peerdn</varname></primary>
44761 </indexterm>
44762 <indexterm role="variable">
44763 <primary><varname>$tls_sni</varname></primary>
44764 </indexterm>
44765 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
44766 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
44767 are the values that were set when the message was received.
44768 These are the values that are used for options that are expanded before any
44769 SMTP connections are made. Just before each connection is made, these four
44770 variables are emptied. If TLS is subsequently started, they are set to the
44771 appropriate values for the outgoing connection, and these are the values that
44772 are in force when any authenticators are run and when the
44773 <option>authenticated_sender</option> option is expanded.
44774 </para>
44775 <para>
44776 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
44777 and will be removed in a future release.
44778 </para>
44779 </section>
44780 <section id="SECID146">
44781 <title>Private options for smtp</title>
44782 <para>
44783 <indexterm role="concept">
44784 <primary>options</primary>
44785 <secondary><command>smtp</command> transport</secondary>
44786 </indexterm>
44787 The private options of the <command>smtp</command> transport are as follows:
44788 </para>
44789 <para>
44790 <indexterm role="option">
44791 <primary><option>address_retry_include_sender</option></primary>
44792 </indexterm>
44793 </para>
44794 <informaltable frame="all">
44795 <tgroup cols="4" colsep="0" rowsep="0">
44796 <colspec colwidth="8*" align="left"/>
44797 <colspec colwidth="6*" align="center"/>
44798 <colspec colwidth="6*" align="center"/>
44799 <colspec colwidth="6*" align="right"/>
44800 <tbody>
44801 <row>
44802 <entry><option>address_retry_include_sender</option></entry>
44803 <entry>Use: <emphasis>smtp</emphasis></entry>
44804 <entry>Type: <emphasis>boolean</emphasis></entry>
44805 <entry>Default: <emphasis>true</emphasis></entry>
44806 </row>
44807 </tbody>
44808 </tgroup>
44809 </informaltable>
44810 <para>
44811 <indexterm role="concept">
44812 <primary>4<emphasis>xx</emphasis> responses</primary>
44813 <secondary>retrying after</secondary>
44814 </indexterm>
44815 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
44816 is the combination of sender and recipient that is delayed in subsequent queue
44817 runs until the retry time is reached. You can delay the recipient without
44818 reference to the sender (which is what earlier versions of Exim did), by
44819 setting <option>address_retry_include_sender</option> false. However, this can lead to
44820 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
44821 </para>
44822 <para>
44823 <indexterm role="option">
44824 <primary><option>allow_localhost</option></primary>
44825 </indexterm>
44826 </para>
44827 <informaltable frame="all">
44828 <tgroup cols="4" colsep="0" rowsep="0">
44829 <colspec colwidth="8*" align="left"/>
44830 <colspec colwidth="6*" align="center"/>
44831 <colspec colwidth="6*" align="center"/>
44832 <colspec colwidth="6*" align="right"/>
44833 <tbody>
44834 <row>
44835 <entry><option>allow_localhost</option></entry>
44836 <entry>Use: <emphasis>smtp</emphasis></entry>
44837 <entry>Type: <emphasis>boolean</emphasis></entry>
44838 <entry>Default: <emphasis>false</emphasis></entry>
44839 </row>
44840 </tbody>
44841 </tgroup>
44842 </informaltable>
44843 <para>
44844 <indexterm role="concept">
44845 <primary>local host</primary>
44846 <secondary>sending to</secondary>
44847 </indexterm>
44848 <indexterm role="concept">
44849 <primary>fallback</primary>
44850 <secondary>hosts specified on transport</secondary>
44851 </indexterm>
44852 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
44853 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
44854 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
44855 the delivery anyway. This should be used only in special cases when the
44856 configuration ensures that no looping will result (for example, a differently
44857 configured Exim is listening on the port to which the message is sent).
44858 </para>
44859 <para>
44860 <indexterm role="option">
44861 <primary><option>authenticated_sender</option></primary>
44862 </indexterm>
44863 </para>
44864 <informaltable frame="all">
44865 <tgroup cols="4" colsep="0" rowsep="0">
44866 <colspec colwidth="8*" align="left"/>
44867 <colspec colwidth="6*" align="center"/>
44868 <colspec colwidth="6*" align="center"/>
44869 <colspec colwidth="6*" align="right"/>
44870 <tbody>
44871 <row>
44872 <entry><option>authenticated_sender</option></entry>
44873 <entry>Use: <emphasis>smtp</emphasis></entry>
44874 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44875 <entry>Default: <emphasis>unset</emphasis></entry>
44876 </row>
44877 </tbody>
44878 </tgroup>
44879 </informaltable>
44880 <para>
44881 <indexterm role="concept">
44882 <primary>Cyrus</primary>
44883 </indexterm>
44884 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
44885 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
44886 overriding any existing authenticated sender value. If the string expansion is
44887 forced to fail, the option is ignored. Other expansion failures cause delivery
44888 to be deferred. If the result of expansion is an empty string, that is also
44889 ignored.
44890 </para>
44891 <para>
44892 The expansion happens after the outgoing connection has been made and TLS
44893 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
44894 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
44895 particular connection.
44896 </para>
44897 <para>
44898 If the SMTP session is not authenticated, the expansion of
44899 <option>authenticated_sender</option> still happens (and can cause the delivery to be
44900 deferred if it fails), but no AUTH= item is added to MAIL commands
44901 unless <option>authenticated_sender_force</option> is true.
44902 </para>
44903 <para>
44904 This option allows you to use the <command>smtp</command> transport in LMTP mode to
44905 deliver mail to Cyrus IMAP and provide the proper local part as the
44906 <quote>authenticated sender</quote>, via a setting such as:
44907 </para>
44908 <literallayout class="monospaced">
44909 authenticated_sender = $local_part
44910 </literallayout>
44911 <para>
44912 This removes the need for IMAP subfolders to be assigned special ACLs to
44913 allow direct delivery to those subfolders.
44914 </para>
44915 <para>
44916 Because of expected uses such as that just described for Cyrus (when no
44917 domain is involved), there is no checking on the syntax of the provided
44918 value.
44919 </para>
44920 <para>
44921 <indexterm role="option">
44922 <primary><option>authenticated_sender_force</option></primary>
44923 </indexterm>
44924 </para>
44925 <informaltable frame="all">
44926 <tgroup cols="4" colsep="0" rowsep="0">
44927 <colspec colwidth="8*" align="left"/>
44928 <colspec colwidth="6*" align="center"/>
44929 <colspec colwidth="6*" align="center"/>
44930 <colspec colwidth="6*" align="right"/>
44931 <tbody>
44932 <row>
44933 <entry><option>authenticated_sender_force</option></entry>
44934 <entry>Use: <emphasis>smtp</emphasis></entry>
44935 <entry>Type: <emphasis>boolean</emphasis></entry>
44936 <entry>Default: <emphasis>false</emphasis></entry>
44937 </row>
44938 </tbody>
44939 </tgroup>
44940 </informaltable>
44941 <para>
44942 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
44943 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
44944 authenticated as a client.
44945 </para>
44946 <para>
44947 <indexterm role="option">
44948 <primary><option>command_timeout</option></primary>
44949 </indexterm>
44950 </para>
44951 <informaltable frame="all">
44952 <tgroup cols="4" colsep="0" rowsep="0">
44953 <colspec colwidth="8*" align="left"/>
44954 <colspec colwidth="6*" align="center"/>
44955 <colspec colwidth="6*" align="center"/>
44956 <colspec colwidth="6*" align="right"/>
44957 <tbody>
44958 <row>
44959 <entry><option>command_timeout</option></entry>
44960 <entry>Use: <emphasis>smtp</emphasis></entry>
44961 <entry>Type: <emphasis>time</emphasis></entry>
44962 <entry>Default: <emphasis>5m</emphasis></entry>
44963 </row>
44964 </tbody>
44965 </tgroup>
44966 </informaltable>
44967 <para>
44968 This sets a timeout for receiving a response to an SMTP command that has been
44969 sent out. It is also used when waiting for the initial banner line from the
44970 remote host. Its value must not be zero.
44971 </para>
44972 <para>
44973 <indexterm role="option">
44974 <primary><option>connect_timeout</option></primary>
44975 </indexterm>
44976 </para>
44977 <informaltable frame="all">
44978 <tgroup cols="4" colsep="0" rowsep="0">
44979 <colspec colwidth="8*" align="left"/>
44980 <colspec colwidth="6*" align="center"/>
44981 <colspec colwidth="6*" align="center"/>
44982 <colspec colwidth="6*" align="right"/>
44983 <tbody>
44984 <row>
44985 <entry><option>connect_timeout</option></entry>
44986 <entry>Use: <emphasis>smtp</emphasis></entry>
44987 <entry>Type: <emphasis>time</emphasis></entry>
44988 <entry>Default: <emphasis>5m</emphasis></entry>
44989 </row>
44990 </tbody>
44991 </tgroup>
44992 </informaltable>
44993 <para>
44994 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
44995 to a remote host. A setting of zero allows the system timeout (typically
44996 several minutes) to act. To have any effect, the value of this option must be
44997 less than the system timeout. However, it has been observed that on some
44998 systems there is no system timeout, which is why the default value for this
44999 option is 5 minutes, a value recommended by RFC 1123.
45000 </para>
45001 <para>
45002 <indexterm role="option">
45003 <primary><option>connection_max_messages</option></primary>
45004 </indexterm>
45005 </para>
45006 <informaltable frame="all">
45007 <tgroup cols="4" colsep="0" rowsep="0">
45008 <colspec colwidth="8*" align="left"/>
45009 <colspec colwidth="6*" align="center"/>
45010 <colspec colwidth="6*" align="center"/>
45011 <colspec colwidth="6*" align="right"/>
45012 <tbody>
45013 <row>
45014 <entry><option>connection_max_messages</option></entry>
45015 <entry>Use: <emphasis>smtp</emphasis></entry>
45016 <entry>Type: <emphasis>integer</emphasis></entry>
45017 <entry>Default: <emphasis>500</emphasis></entry>
45018 </row>
45019 </tbody>
45020 </tgroup>
45021 </informaltable>
45022 <para>
45023 <indexterm role="concept">
45024 <primary>SMTP</primary>
45025 <secondary>passed connection</secondary>
45026 </indexterm>
45027 <indexterm role="concept">
45028 <primary>SMTP</primary>
45029 <secondary>multiple deliveries</secondary>
45030 </indexterm>
45031 <indexterm role="concept">
45032 <primary>multiple SMTP deliveries</primary>
45033 </indexterm>
45034 This controls the maximum number of separate message deliveries that are sent
45035 over a single TCP/IP connection. If the value is zero, there is no limit.
45036 For testing purposes, this value can be overridden by the <option>-oB</option> command line
45037 option.
45038 </para>
45039 <para>
45040 <indexterm role="option">
45041 <primary><option>data_timeout</option></primary>
45042 </indexterm>
45043 </para>
45044 <informaltable frame="all">
45045 <tgroup cols="4" colsep="0" rowsep="0">
45046 <colspec colwidth="8*" align="left"/>
45047 <colspec colwidth="6*" align="center"/>
45048 <colspec colwidth="6*" align="center"/>
45049 <colspec colwidth="6*" align="right"/>
45050 <tbody>
45051 <row>
45052 <entry><option>data_timeout</option></entry>
45053 <entry>Use: <emphasis>smtp</emphasis></entry>
45054 <entry>Type: <emphasis>time</emphasis></entry>
45055 <entry>Default: <emphasis>5m</emphasis></entry>
45056 </row>
45057 </tbody>
45058 </tgroup>
45059 </informaltable>
45060 <para>
45061 This sets a timeout for the transmission of each block in the data portion of
45062 the message. As a result, the overall timeout for a message depends on the size
45063 of the message. Its value must not be zero. See also <option>final_timeout</option>.
45064 </para>
45065 <para>
45066 <indexterm role="option">
45067 <primary><option>delay_after_cutoff</option></primary>
45068 </indexterm>
45069 </para>
45070 <informaltable frame="all">
45071 <tgroup cols="4" colsep="0" rowsep="0">
45072 <colspec colwidth="8*" align="left"/>
45073 <colspec colwidth="6*" align="center"/>
45074 <colspec colwidth="6*" align="center"/>
45075 <colspec colwidth="6*" align="right"/>
45076 <tbody>
45077 <row>
45078 <entry><option>delay_after_cutoff</option></entry>
45079 <entry>Use: <emphasis>smtp</emphasis></entry>
45080 <entry>Type: <emphasis>boolean</emphasis></entry>
45081 <entry>Default: <emphasis>true</emphasis></entry>
45082 </row>
45083 </tbody>
45084 </tgroup>
45085 </informaltable>
45086 <para>
45087 This option controls what happens when all remote IP addresses for a given
45088 domain have been inaccessible for so long that they have passed their retry
45089 cutoff times.
45090 </para>
45091 <para>
45092 In the default state, if the next retry time has not been reached for any of
45093 them, the address is bounced without trying any deliveries. In other words,
45094 Exim delays retrying an IP address after the final cutoff time until a new
45095 retry time is reached, and can therefore bounce an address without ever trying
45096 a delivery, when machines have been down for a long time. Some people are
45097 unhappy at this prospect, so...
45098 </para>
45099 <para>
45100 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
45101 addresses are past their final cutoff time, Exim tries to deliver to those
45102 IP addresses that have not been tried since the message arrived. If there are
45103 none, of if they all fail, the address is bounced. In other words, it does not
45104 delay when a new message arrives, but immediately tries those expired IP
45105 addresses that haven&#x2019;t been tried since the message arrived. If there is a
45106 continuous stream of messages for the dead hosts, unsetting
45107 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
45108 to them.
45109 </para>
45110 <para>
45111 <indexterm role="option">
45112 <primary><option>dns_qualify_single</option></primary>
45113 </indexterm>
45114 </para>
45115 <informaltable frame="all">
45116 <tgroup cols="4" colsep="0" rowsep="0">
45117 <colspec colwidth="8*" align="left"/>
45118 <colspec colwidth="6*" align="center"/>
45119 <colspec colwidth="6*" align="center"/>
45120 <colspec colwidth="6*" align="right"/>
45121 <tbody>
45122 <row>
45123 <entry><option>dns_qualify_single</option></entry>
45124 <entry>Use: <emphasis>smtp</emphasis></entry>
45125 <entry>Type: <emphasis>boolean</emphasis></entry>
45126 <entry>Default: <emphasis>true</emphasis></entry>
45127 </row>
45128 </tbody>
45129 </tgroup>
45130 </informaltable>
45131 <para>
45132 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
45133 and the <option>gethostbyname</option> option is false,
45134 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
45135 in chapter <xref linkend="CHAPdnslookup"/> for more details.
45136 </para>
45137 <para>
45138 <indexterm role="option">
45139 <primary><option>dns_search_parents</option></primary>
45140 </indexterm>
45141 </para>
45142 <informaltable frame="all">
45143 <tgroup cols="4" colsep="0" rowsep="0">
45144 <colspec colwidth="8*" align="left"/>
45145 <colspec colwidth="6*" align="center"/>
45146 <colspec colwidth="6*" align="center"/>
45147 <colspec colwidth="6*" align="right"/>
45148 <tbody>
45149 <row>
45150 <entry><option>dns_search_parents</option></entry>
45151 <entry>Use: <emphasis>smtp</emphasis></entry>
45152 <entry>Type: <emphasis>boolean</emphasis></entry>
45153 <entry>Default: <emphasis>false</emphasis></entry>
45154 </row>
45155 </tbody>
45156 </tgroup>
45157 </informaltable>
45158 <para>
45159 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
45160 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
45161 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
45162 details.
45163 </para>
45164 <para>
45165 <indexterm role="option">
45166 <primary><option>dnssec_request_domains</option></primary>
45167 </indexterm>
45168 </para>
45169 <informaltable frame="all">
45170 <tgroup cols="4" colsep="0" rowsep="0">
45171 <colspec colwidth="8*" align="left"/>
45172 <colspec colwidth="6*" align="center"/>
45173 <colspec colwidth="6*" align="center"/>
45174 <colspec colwidth="6*" align="right"/>
45175 <tbody>
45176 <row>
45177 <entry><option>dnssec_request_domains</option></entry>
45178 <entry>Use: <emphasis>smtp</emphasis></entry>
45179 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
45180 <entry>Default: <emphasis>unset</emphasis></entry>
45181 </row>
45182 </tbody>
45183 </tgroup>
45184 </informaltable>
45185 <para>
45186 <indexterm role="concept">
45187 <primary>MX record</primary>
45188 <secondary>security</secondary>
45189 </indexterm>
45190 <indexterm role="concept">
45191 <primary>DNSSEC</primary>
45192 <secondary>MX lookup</secondary>
45193 </indexterm>
45194 <indexterm role="concept">
45195 <primary>security</primary>
45196 <secondary>MX lookup</secondary>
45197 </indexterm>
45198 <indexterm role="concept">
45199 <primary>DNS</primary>
45200 <secondary>DNSSEC</secondary>
45201 </indexterm>
45202 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
45203 the dnssec request bit set.
45204 This applies to all of the SRV, MX, AAAA, A lookup sequence.
45205 </para>
45206 <para>
45207 <indexterm role="option">
45208 <primary><option>dnssec_require_domains</option></primary>
45209 </indexterm>
45210 </para>
45211 <informaltable frame="all">
45212 <tgroup cols="4" colsep="0" rowsep="0">
45213 <colspec colwidth="8*" align="left"/>
45214 <colspec colwidth="6*" align="center"/>
45215 <colspec colwidth="6*" align="center"/>
45216 <colspec colwidth="6*" align="right"/>
45217 <tbody>
45218 <row>
45219 <entry><option>dnssec_require_domains</option></entry>
45220 <entry>Use: <emphasis>smtp</emphasis></entry>
45221 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
45222 <entry>Default: <emphasis>unset</emphasis></entry>
45223 </row>
45224 </tbody>
45225 </tgroup>
45226 </informaltable>
45227 <para>
45228 <indexterm role="concept">
45229 <primary>MX record</primary>
45230 <secondary>security</secondary>
45231 </indexterm>
45232 <indexterm role="concept">
45233 <primary>DNSSEC</primary>
45234 <secondary>MX lookup</secondary>
45235 </indexterm>
45236 <indexterm role="concept">
45237 <primary>security</primary>
45238 <secondary>MX lookup</secondary>
45239 </indexterm>
45240 <indexterm role="concept">
45241 <primary>DNS</primary>
45242 <secondary>DNSSEC</secondary>
45243 </indexterm>
45244 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
45245 the dnssec request bit set.  Any returns not having the Authenticated Data bit
45246 (AD bit) set will be ignored and logged as a host-lookup failure.
45247 This applies to all of the SRV, MX, AAAA, A lookup sequence.
45248 </para>
45249 <para>
45250 <indexterm role="option">
45251 <primary><option>dscp</option></primary>
45252 </indexterm>
45253 </para>
45254 <informaltable frame="all">
45255 <tgroup cols="4" colsep="0" rowsep="0">
45256 <colspec colwidth="8*" align="left"/>
45257 <colspec colwidth="6*" align="center"/>
45258 <colspec colwidth="6*" align="center"/>
45259 <colspec colwidth="6*" align="right"/>
45260 <tbody>
45261 <row>
45262 <entry><option>dscp</option></entry>
45263 <entry>Use: <emphasis>smtp</emphasis></entry>
45264 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45265 <entry>Default: <emphasis>unset</emphasis></entry>
45266 </row>
45267 </tbody>
45268 </tgroup>
45269 </informaltable>
45270 <para>
45271 <indexterm role="concept">
45272 <primary>DCSP</primary>
45273 <secondary>outbound</secondary>
45274 </indexterm>
45275 This option causes the DSCP value associated with a socket to be set to one
45276 of a number of fixed strings or to numeric value.
45277 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
45278 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
45279 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
45280 </para>
45281 <para>
45282 The outbound packets from Exim will be marked with this value in the header
45283 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
45284 that these values will have any effect, not be stripped by networking
45285 equipment, or do much of anything without cooperation with your Network
45286 Engineer and those of all network operators between the source and destination.
45287 </para>
45288 <para>
45289 <indexterm role="option">
45290 <primary><option>fallback_hosts</option></primary>
45291 </indexterm>
45292 </para>
45293 <informaltable frame="all">
45294 <tgroup cols="4" colsep="0" rowsep="0">
45295 <colspec colwidth="8*" align="left"/>
45296 <colspec colwidth="6*" align="center"/>
45297 <colspec colwidth="6*" align="center"/>
45298 <colspec colwidth="6*" align="right"/>
45299 <tbody>
45300 <row>
45301 <entry><option>fallback_hosts</option></entry>
45302 <entry>Use: <emphasis>smtp</emphasis></entry>
45303 <entry>Type: <emphasis>string list</emphasis></entry>
45304 <entry>Default: <emphasis>unset</emphasis></entry>
45305 </row>
45306 </tbody>
45307 </tgroup>
45308 </informaltable>
45309 <para>
45310 <indexterm role="concept">
45311 <primary>fallback</primary>
45312 <secondary>hosts specified on transport</secondary>
45313 </indexterm>
45314 String expansion is not applied to this option. The argument must be a
45315 colon-separated list of host names or IP addresses, optionally also including
45316 port numbers, though the separator can be changed, as described in section
45317 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
45318 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
45319 in section <xref linkend="SECTformatonehostitem"/>.
45320 </para>
45321 <para>
45322 Fallback hosts can also be specified on routers, which associate them with the
45323 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
45324 <option>fallback_hosts</option> specified on the transport is used only if the address does
45325 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
45326 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
45327 However, <option>hosts_randomize</option> does apply to fallback host lists.
45328 </para>
45329 <para>
45330 If Exim is unable to deliver to any of the hosts for a particular address, and
45331 the errors are not permanent rejections, the address is put on a separate
45332 transport queue with its host list replaced by the fallback hosts, unless the
45333 address was routed via MX records and the current host was in the original MX
45334 list. In that situation, the fallback host list is not used.
45335 </para>
45336 <para>
45337 Once normal deliveries are complete, the fallback queue is delivered by
45338 re-running the same transports with the new host lists. If several failing
45339 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
45340 copy of the message is sent.
45341 </para>
45342 <para>
45343 The resolution of the host names on the fallback list is controlled by the
45344 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
45345 both to cases when the host list comes with the address and when it is taken
45346 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
45347 fails</quote> facility.
45348 </para>
45349 <para>
45350 <indexterm role="option">
45351 <primary><option>final_timeout</option></primary>
45352 </indexterm>
45353 </para>
45354 <informaltable frame="all">
45355 <tgroup cols="4" colsep="0" rowsep="0">
45356 <colspec colwidth="8*" align="left"/>
45357 <colspec colwidth="6*" align="center"/>
45358 <colspec colwidth="6*" align="center"/>
45359 <colspec colwidth="6*" align="right"/>
45360 <tbody>
45361 <row>
45362 <entry><option>final_timeout</option></entry>
45363 <entry>Use: <emphasis>smtp</emphasis></entry>
45364 <entry>Type: <emphasis>time</emphasis></entry>
45365 <entry>Default: <emphasis>10m</emphasis></entry>
45366 </row>
45367 </tbody>
45368 </tgroup>
45369 </informaltable>
45370 <para>
45371 This is the timeout that applies while waiting for the response to the final
45372 line containing just <quote>.</quote> that terminates a message. Its value must not be
45373 zero.
45374 </para>
45375 <para>
45376 <indexterm role="option">
45377 <primary><option>gethostbyname</option></primary>
45378 </indexterm>
45379 </para>
45380 <informaltable frame="all">
45381 <tgroup cols="4" colsep="0" rowsep="0">
45382 <colspec colwidth="8*" align="left"/>
45383 <colspec colwidth="6*" align="center"/>
45384 <colspec colwidth="6*" align="center"/>
45385 <colspec colwidth="6*" align="right"/>
45386 <tbody>
45387 <row>
45388 <entry><option>gethostbyname</option></entry>
45389 <entry>Use: <emphasis>smtp</emphasis></entry>
45390 <entry>Type: <emphasis>boolean</emphasis></entry>
45391 <entry>Default: <emphasis>false</emphasis></entry>
45392 </row>
45393 </tbody>
45394 </tgroup>
45395 </informaltable>
45396 <para>
45397 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
45398 being used, names are looked up using <function>gethostbyname()</function>
45399 (or <function>getipnodebyname()</function> when available)
45400 instead of using the DNS. Of course, that function may in fact use the DNS, but
45401 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
45402 </para>
45403 <para>
45404 <indexterm role="option">
45405 <primary><option>gnutls_compat_mode</option></primary>
45406 </indexterm>
45407 </para>
45408 <informaltable frame="all">
45409 <tgroup cols="4" colsep="0" rowsep="0">
45410 <colspec colwidth="8*" align="left"/>
45411 <colspec colwidth="6*" align="center"/>
45412 <colspec colwidth="6*" align="center"/>
45413 <colspec colwidth="6*" align="right"/>
45414 <tbody>
45415 <row>
45416 <entry><option>gnutls_compat_mode</option></entry>
45417 <entry>Use: <emphasis>smtp</emphasis></entry>
45418 <entry>Type: <emphasis>boolean</emphasis></entry>
45419 <entry>Default: <emphasis>unset</emphasis></entry>
45420 </row>
45421 </tbody>
45422 </tgroup>
45423 </informaltable>
45424 <para>
45425 This option controls whether GnuTLS is used in compatibility mode in an Exim
45426 server. This reduces security slightly, but improves interworking with older
45427 implementations of TLS.
45428 </para>
45429 <para>
45430 <indexterm role="option">
45431 <primary><option>helo_data</option></primary>
45432 </indexterm>
45433 </para>
45434 <informaltable frame="all">
45435 <tgroup cols="4" colsep="0" rowsep="0">
45436 <colspec colwidth="8*" align="left"/>
45437 <colspec colwidth="6*" align="center"/>
45438 <colspec colwidth="6*" align="center"/>
45439 <colspec colwidth="6*" align="right"/>
45440 <tbody>
45441 <row>
45442 <entry><option>helo_data</option></entry>
45443 <entry>Use: <emphasis>smtp</emphasis></entry>
45444 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45445 <entry>Default: <emphasis>see below</emphasis></entry>
45446 </row>
45447 </tbody>
45448 </tgroup>
45449 </informaltable>
45450 <para>
45451 <indexterm role="concept">
45452 <primary>HELO</primary>
45453 <secondary>argument, setting</secondary>
45454 </indexterm>
45455 <indexterm role="concept">
45456 <primary>EHLO</primary>
45457 <secondary>argument, setting</secondary>
45458 </indexterm>
45459 <indexterm role="concept">
45460 <primary>LHLO argument setting</primary>
45461 </indexterm>
45462 The value of this option is expanded after a connection to a another host has
45463 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
45464 command that starts the outgoing SMTP or LMTP session. The default value of the
45465 option is:
45466 </para>
45467 <literallayout class="monospaced">
45468 $primary_hostname
45469 </literallayout>
45470 <para>
45471 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
45472 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
45473 <varname>$sending_port</varname> are set to the local IP address and port number that are being
45474 used. These variables can be used to generate different values for different
45475 servers or different local IP addresses. For example, if you want the string
45476 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
45477 interface address, you could use this:
45478 </para>
45479 <literallayout class="monospaced">
45480 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
45481   {$primary_hostname}}
45482 </literallayout>
45483 <para>
45484 The use of <option>helo_data</option> applies both to sending messages and when doing
45485 callouts.
45486 </para>
45487 <para>
45488 <indexterm role="option">
45489 <primary><option>hosts</option></primary>
45490 </indexterm>
45491 </para>
45492 <informaltable frame="all">
45493 <tgroup cols="4" colsep="0" rowsep="0">
45494 <colspec colwidth="8*" align="left"/>
45495 <colspec colwidth="6*" align="center"/>
45496 <colspec colwidth="6*" align="center"/>
45497 <colspec colwidth="6*" align="right"/>
45498 <tbody>
45499 <row>
45500 <entry><option>hosts</option></entry>
45501 <entry>Use: <emphasis>smtp</emphasis></entry>
45502 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45503 <entry>Default: <emphasis>unset</emphasis></entry>
45504 </row>
45505 </tbody>
45506 </tgroup>
45507 </informaltable>
45508 <para>
45509 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
45510 finds the hosts by looking up the address domain in the DNS, or by
45511 <command>manualroute</command>, which has lists of hosts in its configuration. However,
45512 email addresses can be passed to the <command>smtp</command> transport by any router, and not
45513 all of them can provide an associated list of hosts.
45514 </para>
45515 <para>
45516 The <option>hosts</option> option specifies a list of hosts to be used if the address being
45517 processed does not have any hosts associated with it. The hosts specified by
45518 <option>hosts</option> are also used, whether or not the address has its own hosts, if
45519 <option>hosts_override</option> is set.
45520 </para>
45521 <para>
45522 The string is first expanded, before being interpreted as a colon-separated
45523 list of host names or IP addresses, possibly including port numbers. The
45524 separator may be changed to something other than colon, as described in section
45525 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
45526 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
45527 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
45528 of the <command>manualroute</command> router is not available here.
45529 </para>
45530 <para>
45531 If the expansion fails, delivery is deferred. Unless the failure was caused by
45532 the inability to complete a lookup, the error is logged to the panic log as
45533 well as the main log. Host names are looked up either by searching directly for
45534 address records in the DNS or by calling <function>gethostbyname()</function> (or
45535 <function>getipnodebyname()</function> when available), depending on the setting of the
45536 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
45537 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
45538 address are used.
45539 </para>
45540 <para>
45541 During delivery, the hosts are tried in order, subject to their retry status,
45542 unless <option>hosts_randomize</option> is set.
45543 </para>
45544 <para>
45545 <indexterm role="option">
45546 <primary><option>hosts_avoid_esmtp</option></primary>
45547 </indexterm>
45548 </para>
45549 <informaltable frame="all">
45550 <tgroup cols="4" colsep="0" rowsep="0">
45551 <colspec colwidth="8*" align="left"/>
45552 <colspec colwidth="6*" align="center"/>
45553 <colspec colwidth="6*" align="center"/>
45554 <colspec colwidth="6*" align="right"/>
45555 <tbody>
45556 <row>
45557 <entry><option>hosts_avoid_esmtp</option></entry>
45558 <entry>Use: <emphasis>smtp</emphasis></entry>
45559 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45560 <entry>Default: <emphasis>unset</emphasis></entry>
45561 </row>
45562 </tbody>
45563 </tgroup>
45564 </informaltable>
45565 <para>
45566 <indexterm role="concept">
45567 <primary>ESMTP, avoiding use of</primary>
45568 </indexterm>
45569 <indexterm role="concept">
45570 <primary>HELO</primary>
45571 <secondary>forcing use of</secondary>
45572 </indexterm>
45573 <indexterm role="concept">
45574 <primary>EHLO</primary>
45575 <secondary>avoiding use of</secondary>
45576 </indexterm>
45577 <indexterm role="concept">
45578 <primary>PIPELINING</primary>
45579 <secondary>avoiding the use of</secondary>
45580 </indexterm>
45581 This option is for use with broken hosts that announce ESMTP facilities (for
45582 example, PIPELINING) and then fail to implement them properly. When a host
45583 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
45584 start of the SMTP session. This means that it cannot use any of the ESMTP
45585 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
45586 </para>
45587 <para>
45588 <indexterm role="option">
45589 <primary><option>hosts_avoid_pipelining</option></primary>
45590 </indexterm>
45591 </para>
45592 <informaltable frame="all">
45593 <tgroup cols="4" colsep="0" rowsep="0">
45594 <colspec colwidth="8*" align="left"/>
45595 <colspec colwidth="6*" align="center"/>
45596 <colspec colwidth="6*" align="center"/>
45597 <colspec colwidth="6*" align="right"/>
45598 <tbody>
45599 <row>
45600 <entry><option>hosts_avoid_pipelining</option></entry>
45601 <entry>Use: <emphasis>smtp</emphasis></entry>
45602 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45603 <entry>Default: <emphasis>unset</emphasis></entry>
45604 </row>
45605 </tbody>
45606 </tgroup>
45607 </informaltable>
45608 <para>
45609 <indexterm role="concept">
45610 <primary>PIPELINING</primary>
45611 <secondary>avoiding the use of</secondary>
45612 </indexterm>
45613 Exim will not use the SMTP PIPELINING extension when delivering to any host
45614 that matches this list, even if the server host advertises PIPELINING support.
45615 </para>
45616 <para>
45617 <indexterm role="option">
45618 <primary><option>hosts_avoid_tls</option></primary>
45619 </indexterm>
45620 </para>
45621 <informaltable frame="all">
45622 <tgroup cols="4" colsep="0" rowsep="0">
45623 <colspec colwidth="8*" align="left"/>
45624 <colspec colwidth="6*" align="center"/>
45625 <colspec colwidth="6*" align="center"/>
45626 <colspec colwidth="6*" align="right"/>
45627 <tbody>
45628 <row>
45629 <entry><option>hosts_avoid_tls</option></entry>
45630 <entry>Use: <emphasis>smtp</emphasis></entry>
45631 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45632 <entry>Default: <emphasis>unset</emphasis></entry>
45633 </row>
45634 </tbody>
45635 </tgroup>
45636 </informaltable>
45637 <para>
45638 <indexterm role="concept">
45639 <primary>TLS</primary>
45640 <secondary>avoiding for certain hosts</secondary>
45641 </indexterm>
45642 Exim will not try to start a TLS session when delivering to any host that
45643 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45644 </para>
45645 <para revisionflag="changed">
45646 <indexterm role="option">
45647 <primary><option>hosts_verify_avoid_tls</option></primary>
45648 </indexterm>
45649 </para>
45650 <informaltable frame="all" revisionflag="changed">
45651 <tgroup cols="4" colsep="0" rowsep="0">
45652 <colspec colwidth="8*" align="left"/>
45653 <colspec colwidth="6*" align="center"/>
45654 <colspec colwidth="6*" align="center"/>
45655 <colspec colwidth="6*" align="right"/>
45656 <tbody>
45657 <row>
45658 <entry><option>hosts_verify_avoid_tls</option></entry>
45659 <entry>Use: <emphasis>smtp</emphasis></entry>
45660 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45661 <entry>Default: <emphasis>unset</emphasis></entry>
45662 </row>
45663 </tbody>
45664 </tgroup>
45665 </informaltable>
45666 <para revisionflag="changed">
45667 <indexterm role="concept">
45668 <primary>TLS</primary>
45669 <secondary>avoiding for certain hosts</secondary>
45670 </indexterm>
45671 Exim will not try to start a TLS session for a verify callout,
45672 or when delivering in cutthrough mode,
45673 to any host that matches this list.
45674 </para>
45675 <para>
45676 <indexterm role="option">
45677 <primary><option>hosts_max_try</option></primary>
45678 </indexterm>
45679 </para>
45680 <informaltable frame="all">
45681 <tgroup cols="4" colsep="0" rowsep="0">
45682 <colspec colwidth="8*" align="left"/>
45683 <colspec colwidth="6*" align="center"/>
45684 <colspec colwidth="6*" align="center"/>
45685 <colspec colwidth="6*" align="right"/>
45686 <tbody>
45687 <row>
45688 <entry><option>hosts_max_try</option></entry>
45689 <entry>Use: <emphasis>smtp</emphasis></entry>
45690 <entry>Type: <emphasis>integer</emphasis></entry>
45691 <entry>Default: <emphasis>5</emphasis></entry>
45692 </row>
45693 </tbody>
45694 </tgroup>
45695 </informaltable>
45696 <para>
45697 <indexterm role="concept">
45698 <primary>host</primary>
45699 <secondary>maximum number to try</secondary>
45700 </indexterm>
45701 <indexterm role="concept">
45702 <primary>limit</primary>
45703 <secondary>number of hosts tried</secondary>
45704 </indexterm>
45705 <indexterm role="concept">
45706 <primary>limit</primary>
45707 <secondary>number of MX tried</secondary>
45708 </indexterm>
45709 <indexterm role="concept">
45710 <primary>MX record</primary>
45711 <secondary>maximum tried</secondary>
45712 </indexterm>
45713 This option limits the number of IP addresses that are tried for any one
45714 delivery in cases where there are temporary delivery errors. Section
45715 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
45716 </para>
45717 <para>
45718 <indexterm role="option">
45719 <primary><option>hosts_max_try_hardlimit</option></primary>
45720 </indexterm>
45721 </para>
45722 <informaltable frame="all">
45723 <tgroup cols="4" colsep="0" rowsep="0">
45724 <colspec colwidth="8*" align="left"/>
45725 <colspec colwidth="6*" align="center"/>
45726 <colspec colwidth="6*" align="center"/>
45727 <colspec colwidth="6*" align="right"/>
45728 <tbody>
45729 <row>
45730 <entry><option>hosts_max_try_hardlimit</option></entry>
45731 <entry>Use: <emphasis>smtp</emphasis></entry>
45732 <entry>Type: <emphasis>integer</emphasis></entry>
45733 <entry>Default: <emphasis>50</emphasis></entry>
45734 </row>
45735 </tbody>
45736 </tgroup>
45737 </informaltable>
45738 <para>
45739 This is an additional check on the maximum number of IP addresses that Exim
45740 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
45741 why it exists.
45742 </para>
45743 <para>
45744 <indexterm role="option">
45745 <primary><option>hosts_nopass_tls</option></primary>
45746 </indexterm>
45747 </para>
45748 <informaltable frame="all">
45749 <tgroup cols="4" colsep="0" rowsep="0">
45750 <colspec colwidth="8*" align="left"/>
45751 <colspec colwidth="6*" align="center"/>
45752 <colspec colwidth="6*" align="center"/>
45753 <colspec colwidth="6*" align="right"/>
45754 <tbody>
45755 <row>
45756 <entry><option>hosts_nopass_tls</option></entry>
45757 <entry>Use: <emphasis>smtp</emphasis></entry>
45758 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45759 <entry>Default: <emphasis>unset</emphasis></entry>
45760 </row>
45761 </tbody>
45762 </tgroup>
45763 </informaltable>
45764 <para>
45765 <indexterm role="concept">
45766 <primary>TLS</primary>
45767 <secondary>passing connection</secondary>
45768 </indexterm>
45769 <indexterm role="concept">
45770 <primary>multiple SMTP deliveries</primary>
45771 </indexterm>
45772 <indexterm role="concept">
45773 <primary>TLS</primary>
45774 <secondary>multiple message deliveries</secondary>
45775 </indexterm>
45776 For any host that matches this list, a connection on which a TLS session has
45777 been started will not be passed to a new delivery process for sending another
45778 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
45779 explanation of when this might be needed.
45780 </para>
45781 <para>
45782 <indexterm role="option">
45783 <primary><option>hosts_override</option></primary>
45784 </indexterm>
45785 </para>
45786 <informaltable frame="all">
45787 <tgroup cols="4" colsep="0" rowsep="0">
45788 <colspec colwidth="8*" align="left"/>
45789 <colspec colwidth="6*" align="center"/>
45790 <colspec colwidth="6*" align="center"/>
45791 <colspec colwidth="6*" align="right"/>
45792 <tbody>
45793 <row>
45794 <entry><option>hosts_override</option></entry>
45795 <entry>Use: <emphasis>smtp</emphasis></entry>
45796 <entry>Type: <emphasis>boolean</emphasis></entry>
45797 <entry>Default: <emphasis>false</emphasis></entry>
45798 </row>
45799 </tbody>
45800 </tgroup>
45801 </informaltable>
45802 <para>
45803 If this option is set and the <option>hosts</option> option is also set, any hosts that are
45804 attached to the address are ignored, and instead the hosts specified by the
45805 <option>hosts</option> option are always used. This option does not apply to
45806 <option>fallback_hosts</option>.
45807 </para>
45808 <para>
45809 <indexterm role="option">
45810 <primary><option>hosts_randomize</option></primary>
45811 </indexterm>
45812 </para>
45813 <informaltable frame="all">
45814 <tgroup cols="4" colsep="0" rowsep="0">
45815 <colspec colwidth="8*" align="left"/>
45816 <colspec colwidth="6*" align="center"/>
45817 <colspec colwidth="6*" align="center"/>
45818 <colspec colwidth="6*" align="right"/>
45819 <tbody>
45820 <row>
45821 <entry><option>hosts_randomize</option></entry>
45822 <entry>Use: <emphasis>smtp</emphasis></entry>
45823 <entry>Type: <emphasis>boolean</emphasis></entry>
45824 <entry>Default: <emphasis>false</emphasis></entry>
45825 </row>
45826 </tbody>
45827 </tgroup>
45828 </informaltable>
45829 <para>
45830 <indexterm role="concept">
45831 <primary>randomized host list</primary>
45832 </indexterm>
45833 <indexterm role="concept">
45834 <primary>host</primary>
45835 <secondary>list of; randomized</secondary>
45836 </indexterm>
45837 <indexterm role="concept">
45838 <primary>fallback</primary>
45839 <secondary>randomized hosts</secondary>
45840 </indexterm>
45841 If this option is set, and either the list of hosts is taken from the
45842 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
45843 were not obtained from MX records (this includes fallback hosts from the
45844 router), and were not randomized by the router, the order of trying the hosts
45845 is randomized each time the transport runs. Randomizing the order of a host
45846 list can be used to do crude load sharing.
45847 </para>
45848 <para>
45849 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
45850 order is separately randomized. This makes it possible to set up MX-like
45851 behaviour. The boundaries between groups are indicated by an item that is just
45852 <literal>+</literal> in the host list. For example:
45853 </para>
45854 <literallayout class="monospaced">
45855 hosts = host1:host2:host3:+:host4:host5
45856 </literallayout>
45857 <para>
45858 The order of the first three hosts and the order of the last two hosts is
45859 randomized for each use, but the first three always end up before the last two.
45860 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
45861 </para>
45862 <para>
45863 <indexterm role="option">
45864 <primary><option>hosts_require_auth</option></primary>
45865 </indexterm>
45866 </para>
45867 <informaltable frame="all">
45868 <tgroup cols="4" colsep="0" rowsep="0">
45869 <colspec colwidth="8*" align="left"/>
45870 <colspec colwidth="6*" align="center"/>
45871 <colspec colwidth="6*" align="center"/>
45872 <colspec colwidth="6*" align="right"/>
45873 <tbody>
45874 <row>
45875 <entry><option>hosts_require_auth</option></entry>
45876 <entry>Use: <emphasis>smtp</emphasis></entry>
45877 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45878 <entry>Default: <emphasis>unset</emphasis></entry>
45879 </row>
45880 </tbody>
45881 </tgroup>
45882 </informaltable>
45883 <para>
45884 <indexterm role="concept">
45885 <primary>authentication</primary>
45886 <secondary>required by client</secondary>
45887 </indexterm>
45888 This option provides a list of servers for which authentication must succeed
45889 before Exim will try to transfer a message. If authentication fails for
45890 servers which are not in this list, Exim tries to send unauthenticated. If
45891 authentication fails for one of these servers, delivery is deferred. This
45892 temporary error is detectable in the retry rules, so it can be turned into a
45893 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
45894 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45895 </para>
45896 <para>
45897 <indexterm role="option">
45898 <primary><option>hosts_request_ocsp</option></primary>
45899 </indexterm>
45900 </para>
45901 <informaltable frame="all">
45902 <tgroup cols="4" colsep="0" rowsep="0">
45903 <colspec colwidth="8*" align="left"/>
45904 <colspec colwidth="6*" align="center"/>
45905 <colspec colwidth="6*" align="center"/>
45906 <colspec colwidth="6*" align="right"/>
45907 <tbody>
45908 <row>
45909 <entry><option>hosts_request_ocsp</option></entry>
45910 <entry>Use: <emphasis>smtp</emphasis></entry>
45911 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45912 <entry>Default: <emphasis>*</emphasis></entry>
45913 </row>
45914 </tbody>
45915 </tgroup>
45916 </informaltable>
45917 <para>
45918 <indexterm role="concept">
45919 <primary>TLS</primary>
45920 <secondary>requiring for certain servers</secondary>
45921 </indexterm>
45922 Exim will request a Certificate Status on a
45923 TLS session for any host that matches this list.
45924 <option>tls_verify_certificates</option> should also be set for the transport.
45925 </para>
45926 <para>
45927 <indexterm role="option">
45928 <primary><option>hosts_require_ocsp</option></primary>
45929 </indexterm>
45930 </para>
45931 <informaltable frame="all">
45932 <tgroup cols="4" colsep="0" rowsep="0">
45933 <colspec colwidth="8*" align="left"/>
45934 <colspec colwidth="6*" align="center"/>
45935 <colspec colwidth="6*" align="center"/>
45936 <colspec colwidth="6*" align="right"/>
45937 <tbody>
45938 <row>
45939 <entry><option>hosts_require_ocsp</option></entry>
45940 <entry>Use: <emphasis>smtp</emphasis></entry>
45941 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45942 <entry>Default: <emphasis>unset</emphasis></entry>
45943 </row>
45944 </tbody>
45945 </tgroup>
45946 </informaltable>
45947 <para>
45948 <indexterm role="concept">
45949 <primary>TLS</primary>
45950 <secondary>requiring for certain servers</secondary>
45951 </indexterm>
45952 Exim will request, and check for a valid Certificate Status being given, on a
45953 TLS session for any host that matches this list.
45954 <option>tls_verify_certificates</option> should also be set for the transport.
45955 </para>
45956 <para>
45957 <indexterm role="option">
45958 <primary><option>hosts_require_tls</option></primary>
45959 </indexterm>
45960 </para>
45961 <informaltable frame="all">
45962 <tgroup cols="4" colsep="0" rowsep="0">
45963 <colspec colwidth="8*" align="left"/>
45964 <colspec colwidth="6*" align="center"/>
45965 <colspec colwidth="6*" align="center"/>
45966 <colspec colwidth="6*" align="right"/>
45967 <tbody>
45968 <row>
45969 <entry><option>hosts_require_tls</option></entry>
45970 <entry>Use: <emphasis>smtp</emphasis></entry>
45971 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45972 <entry>Default: <emphasis>unset</emphasis></entry>
45973 </row>
45974 </tbody>
45975 </tgroup>
45976 </informaltable>
45977 <para>
45978 <indexterm role="concept">
45979 <primary>TLS</primary>
45980 <secondary>requiring for certain servers</secondary>
45981 </indexterm>
45982 Exim will insist on using a TLS session when delivering to any host that
45983 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45984 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
45985 incoming messages, use an appropriate ACL.
45986 </para>
45987 <para>
45988 <indexterm role="option">
45989 <primary><option>hosts_try_auth</option></primary>
45990 </indexterm>
45991 </para>
45992 <informaltable frame="all">
45993 <tgroup cols="4" colsep="0" rowsep="0">
45994 <colspec colwidth="8*" align="left"/>
45995 <colspec colwidth="6*" align="center"/>
45996 <colspec colwidth="6*" align="center"/>
45997 <colspec colwidth="6*" align="right"/>
45998 <tbody>
45999 <row>
46000 <entry><option>hosts_try_auth</option></entry>
46001 <entry>Use: <emphasis>smtp</emphasis></entry>
46002 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46003 <entry>Default: <emphasis>unset</emphasis></entry>
46004 </row>
46005 </tbody>
46006 </tgroup>
46007 </informaltable>
46008 <para>
46009 <indexterm role="concept">
46010 <primary>authentication</primary>
46011 <secondary>optional in client</secondary>
46012 </indexterm>
46013 This option provides a list of servers to which, provided they announce
46014 authentication support, Exim will attempt to authenticate as a client when it
46015 connects. If authentication fails, Exim will try to transfer the message
46016 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
46017 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
46018 </para>
46019 <para revisionflag="changed">
46020 <indexterm role="option">
46021 <primary><option>hosts_try_prdr</option></primary>
46022 </indexterm>
46023 </para>
46024 <informaltable frame="all" revisionflag="changed">
46025 <tgroup cols="4" colsep="0" rowsep="0">
46026 <colspec colwidth="8*" align="left"/>
46027 <colspec colwidth="6*" align="center"/>
46028 <colspec colwidth="6*" align="center"/>
46029 <colspec colwidth="6*" align="right"/>
46030 <tbody>
46031 <row>
46032 <entry><option>hosts_try_prdr</option></entry>
46033 <entry>Use: <emphasis>smtp</emphasis></entry>
46034 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46035 <entry>Default: <emphasis>*</emphasis></entry>
46036 </row>
46037 </tbody>
46038 </tgroup>
46039 </informaltable>
46040 <para revisionflag="changed">
46041 <indexterm role="concept">
46042 <primary>PRDR</primary>
46043 <secondary>enabling, optional in client</secondary>
46044 </indexterm>
46045 This option provides a list of servers to which, provided they announce
46046 PRDR support, Exim will attempt to negotiate PRDR
46047 for multi-recipient messages.
46048 The option can usually be left as default.
46049 </para>
46050 <para>
46051 <indexterm role="option">
46052 <primary><option>interface</option></primary>
46053 </indexterm>
46054 </para>
46055 <informaltable frame="all">
46056 <tgroup cols="4" colsep="0" rowsep="0">
46057 <colspec colwidth="8*" align="left"/>
46058 <colspec colwidth="6*" align="center"/>
46059 <colspec colwidth="6*" align="center"/>
46060 <colspec colwidth="6*" align="right"/>
46061 <tbody>
46062 <row>
46063 <entry><option>interface</option></entry>
46064 <entry>Use: <emphasis>smtp</emphasis></entry>
46065 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
46066 <entry>Default: <emphasis>unset</emphasis></entry>
46067 </row>
46068 </tbody>
46069 </tgroup>
46070 </informaltable>
46071 <para>
46072 <indexterm role="concept">
46073 <primary>bind IP address</primary>
46074 </indexterm>
46075 <indexterm role="concept">
46076 <primary>IP address</primary>
46077 <secondary>binding</secondary>
46078 </indexterm>
46079 <indexterm role="variable">
46080 <primary><varname>$host</varname></primary>
46081 </indexterm>
46082 <indexterm role="variable">
46083 <primary><varname>$host_address</varname></primary>
46084 </indexterm>
46085 This option specifies which interface to bind to when making an outgoing SMTP
46086 call. The value is an IP address, not an interface name such as
46087 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
46088 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
46089 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
46090 outgoing interface address. There is no variable that contains an outgoing
46091 interface address because, unless it is set by this option, its value is
46092 unknown.
46093 </para>
46094 <para>
46095 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
46096 <varname>$host_address</varname> refer to the host to which a connection is about to be made
46097 during the expansion of the string. Forced expansion failure, or an empty
46098 string result causes the option to be ignored. Otherwise, after expansion, the
46099 string must be a list of IP addresses, colon-separated by default, but the
46100 separator can be changed in the usual way. For example:
46101 </para>
46102 <literallayout class="monospaced">
46103 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
46104 </literallayout>
46105 <para>
46106 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
46107 connection. If none of them are the correct type, the option is ignored. If
46108 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
46109 interface to use if the host has more than one.
46110 </para>
46111 <para>
46112 <indexterm role="option">
46113 <primary><option>keepalive</option></primary>
46114 </indexterm>
46115 </para>
46116 <informaltable frame="all">
46117 <tgroup cols="4" colsep="0" rowsep="0">
46118 <colspec colwidth="8*" align="left"/>
46119 <colspec colwidth="6*" align="center"/>
46120 <colspec colwidth="6*" align="center"/>
46121 <colspec colwidth="6*" align="right"/>
46122 <tbody>
46123 <row>
46124 <entry><option>keepalive</option></entry>
46125 <entry>Use: <emphasis>smtp</emphasis></entry>
46126 <entry>Type: <emphasis>boolean</emphasis></entry>
46127 <entry>Default: <emphasis>true</emphasis></entry>
46128 </row>
46129 </tbody>
46130 </tgroup>
46131 </informaltable>
46132 <para>
46133 <indexterm role="concept">
46134 <primary>keepalive</primary>
46135 <secondary>on outgoing connection</secondary>
46136 </indexterm>
46137 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
46138 connections. When set, it causes the kernel to probe idle connections
46139 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
46140 of the connection should send a acknowledgment if the connection is still okay
46141 or a reset if the connection has been aborted. The reason for doing this is
46142 that it has the beneficial effect of freeing up certain types of connection
46143 that can get stuck when the remote host is disconnected without tidying up the
46144 TCP/IP call properly. The keepalive mechanism takes several hours to detect
46145 unreachable hosts.
46146 </para>
46147 <para>
46148 <indexterm role="option">
46149 <primary><option>lmtp_ignore_quota</option></primary>
46150 </indexterm>
46151 </para>
46152 <informaltable frame="all">
46153 <tgroup cols="4" colsep="0" rowsep="0">
46154 <colspec colwidth="8*" align="left"/>
46155 <colspec colwidth="6*" align="center"/>
46156 <colspec colwidth="6*" align="center"/>
46157 <colspec colwidth="6*" align="right"/>
46158 <tbody>
46159 <row>
46160 <entry><option>lmtp_ignore_quota</option></entry>
46161 <entry>Use: <emphasis>smtp</emphasis></entry>
46162 <entry>Type: <emphasis>boolean</emphasis></entry>
46163 <entry>Default: <emphasis>false</emphasis></entry>
46164 </row>
46165 </tbody>
46166 </tgroup>
46167 </informaltable>
46168 <para>
46169 <indexterm role="concept">
46170 <primary>LMTP</primary>
46171 <secondary>ignoring quota errors</secondary>
46172 </indexterm>
46173 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
46174 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
46175 has advertised support for IGNOREQUOTA in its response to the LHLO command.
46176 </para>
46177 <para>
46178 <indexterm role="option">
46179 <primary><option>max_rcpt</option></primary>
46180 </indexterm>
46181 </para>
46182 <informaltable frame="all">
46183 <tgroup cols="4" colsep="0" rowsep="0">
46184 <colspec colwidth="8*" align="left"/>
46185 <colspec colwidth="6*" align="center"/>
46186 <colspec colwidth="6*" align="center"/>
46187 <colspec colwidth="6*" align="right"/>
46188 <tbody>
46189 <row>
46190 <entry><option>max_rcpt</option></entry>
46191 <entry>Use: <emphasis>smtp</emphasis></entry>
46192 <entry>Type: <emphasis>integer</emphasis></entry>
46193 <entry>Default: <emphasis>100</emphasis></entry>
46194 </row>
46195 </tbody>
46196 </tgroup>
46197 </informaltable>
46198 <para>
46199 <indexterm role="concept">
46200 <primary>RCPT</primary>
46201 <secondary>maximum number of outgoing</secondary>
46202 </indexterm>
46203 This option limits the number of RCPT commands that are sent in a single
46204 SMTP message transaction. Each set of addresses is treated independently, and
46205 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
46206 permits this.
46207 </para>
46208 <para>
46209 <indexterm role="option">
46210 <primary><option>multi_domain</option></primary>
46211 </indexterm>
46212 </para>
46213 <informaltable frame="all">
46214 <tgroup cols="4" colsep="0" rowsep="0">
46215 <colspec colwidth="8*" align="left"/>
46216 <colspec colwidth="6*" align="center"/>
46217 <colspec colwidth="6*" align="center"/>
46218 <colspec colwidth="6*" align="right"/>
46219 <tbody>
46220 <row>
46221 <entry><option>multi_domain</option></entry>
46222 <entry>Use: <emphasis>smtp</emphasis></entry>
46223 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
46224 <entry>Default: <emphasis>true</emphasis></entry>
46225 </row>
46226 </tbody>
46227 </tgroup>
46228 </informaltable>
46229 <para>
46230 <indexterm role="variable">
46231 <primary><varname>$domain</varname></primary>
46232 </indexterm>
46233 When this option is set, the <command>smtp</command> transport can handle a number of
46234 addresses containing a mixture of different domains provided they all resolve
46235 to the same list of hosts. Turning the option off restricts the transport to
46236 handling only one domain at a time. This is useful if you want to use
46237 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
46238 is a single domain involved in a remote delivery.
46239 </para>
46240 <para revisionflag="changed">
46241 It is expanded per-address and can depend on any of
46242 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
46243 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
46244 </para>
46245 <para>
46246 <indexterm role="option">
46247 <primary><option>port</option></primary>
46248 </indexterm>
46249 </para>
46250 <informaltable frame="all">
46251 <tgroup cols="4" colsep="0" rowsep="0">
46252 <colspec colwidth="8*" align="left"/>
46253 <colspec colwidth="6*" align="center"/>
46254 <colspec colwidth="6*" align="center"/>
46255 <colspec colwidth="6*" align="right"/>
46256 <tbody>
46257 <row>
46258 <entry><option>port</option></entry>
46259 <entry>Use: <emphasis>smtp</emphasis></entry>
46260 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46261 <entry>Default: <emphasis>see below</emphasis></entry>
46262 </row>
46263 </tbody>
46264 </tgroup>
46265 </informaltable>
46266 <para>
46267 <indexterm role="concept">
46268 <primary>port</primary>
46269 <secondary>sending TCP/IP</secondary>
46270 </indexterm>
46271 <indexterm role="concept">
46272 <primary>TCP/IP</primary>
46273 <secondary>setting outgoing port</secondary>
46274 </indexterm>
46275 This option specifies the TCP/IP port on the server to which Exim connects.
46276 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
46277 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
46278 The name was changed to minimize confusion with the outgoing port. There is no
46279 variable that contains an outgoing port.
46280 </para>
46281 <para>
46282 If the value of this option begins with a digit it is taken as a port number;
46283 otherwise it is looked up using <function>getservbyname()</function>. The default value is
46284 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
46285 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
46286 is deferred.
46287 </para>
46288 <para>
46289 <indexterm role="option">
46290 <primary><option>protocol</option></primary>
46291 </indexterm>
46292 </para>
46293 <informaltable frame="all">
46294 <tgroup cols="4" colsep="0" rowsep="0">
46295 <colspec colwidth="8*" align="left"/>
46296 <colspec colwidth="6*" align="center"/>
46297 <colspec colwidth="6*" align="center"/>
46298 <colspec colwidth="6*" align="right"/>
46299 <tbody>
46300 <row>
46301 <entry><option>protocol</option></entry>
46302 <entry>Use: <emphasis>smtp</emphasis></entry>
46303 <entry>Type: <emphasis>string</emphasis></entry>
46304 <entry>Default: <emphasis>smtp</emphasis></entry>
46305 </row>
46306 </tbody>
46307 </tgroup>
46308 </informaltable>
46309 <para>
46310 <indexterm role="concept">
46311 <primary>LMTP</primary>
46312 <secondary>over TCP/IP</secondary>
46313 </indexterm>
46314 <indexterm role="concept">
46315 <primary>ssmtp protocol</primary>
46316 <secondary>outbound</secondary>
46317 </indexterm>
46318 <indexterm role="concept">
46319 <primary>TLS</primary>
46320 <secondary>SSL-on-connect outbound</secondary>
46321 </indexterm>
46322 <indexterm role="variable">
46323 <primary><varname>$port</varname></primary>
46324 </indexterm>
46325 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
46326 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
46327 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
46328 deliveries into closed message stores. Exim also has support for running LMTP
46329 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
46330 </para>
46331 <para>
46332 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
46333 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
46334 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
46335 The Internet standards bodies strongly discourage use of this mode.
46336 </para>
46337 <para>
46338 <indexterm role="option">
46339 <primary><option>retry_include_ip_address</option></primary>
46340 </indexterm>
46341 </para>
46342 <informaltable frame="all">
46343 <tgroup cols="4" colsep="0" rowsep="0">
46344 <colspec colwidth="8*" align="left"/>
46345 <colspec colwidth="6*" align="center"/>
46346 <colspec colwidth="6*" align="center"/>
46347 <colspec colwidth="6*" align="right"/>
46348 <tbody>
46349 <row>
46350 <entry><option>retry_include_ip_address</option></entry>
46351 <entry>Use: <emphasis>smtp</emphasis></entry>
46352 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
46353 <entry>Default: <emphasis>true</emphasis></entry>
46354 </row>
46355 </tbody>
46356 </tgroup>
46357 </informaltable>
46358 <para>
46359 Exim normally includes both the host name and the IP address in the key it
46360 constructs for indexing retry data after a temporary delivery failure. This
46361 means that when one of several IP addresses for a host is failing, it gets
46362 tried periodically (controlled by the retry rules), but use of the other IP
46363 addresses is not affected.
46364 </para>
46365 <para>
46366 However, in some dialup environments hosts are assigned a different IP address
46367 each time they connect. In this situation the use of the IP address as part of
46368 the retry key leads to undesirable behaviour. Setting this option false causes
46369 Exim to use only the host name.
46370 </para>
46371 <para revisionflag="changed">
46372 Since it is expanded it can be made to depend on the host or domain.
46373 </para>
46374 <para>
46375 <indexterm role="option">
46376 <primary><option>serialize_hosts</option></primary>
46377 </indexterm>
46378 </para>
46379 <informaltable frame="all">
46380 <tgroup cols="4" colsep="0" rowsep="0">
46381 <colspec colwidth="8*" align="left"/>
46382 <colspec colwidth="6*" align="center"/>
46383 <colspec colwidth="6*" align="center"/>
46384 <colspec colwidth="6*" align="right"/>
46385 <tbody>
46386 <row>
46387 <entry><option>serialize_hosts</option></entry>
46388 <entry>Use: <emphasis>smtp</emphasis></entry>
46389 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46390 <entry>Default: <emphasis>unset</emphasis></entry>
46391 </row>
46392 </tbody>
46393 </tgroup>
46394 </informaltable>
46395 <para>
46396 <indexterm role="concept">
46397 <primary>serializing connections</primary>
46398 </indexterm>
46399 <indexterm role="concept">
46400 <primary>host</primary>
46401 <secondary>serializing connections</secondary>
46402 </indexterm>
46403 Because Exim operates in a distributed manner, if several messages for the same
46404 host arrive at around the same time, more than one simultaneous connection to
46405 the remote host can occur. This is not usually a problem except when there is a
46406 slow link between the hosts. In that situation it may be helpful to restrict
46407 Exim to one connection at a time. This can be done by setting
46408 <option>serialize_hosts</option> to match the relevant hosts.
46409 </para>
46410 <para>
46411 <indexterm role="concept">
46412 <primary>hints database</primary>
46413 <secondary>serializing deliveries to a host</secondary>
46414 </indexterm>
46415 Exim implements serialization by means of a hints database in which a record is
46416 written whenever a process connects to one of the restricted hosts. The record
46417 is deleted when the connection is completed. Obviously there is scope for
46418 records to get left lying around if there is a system or program crash. To
46419 guard against this, Exim ignores any records that are more than six hours old.
46420 </para>
46421 <para>
46422 If you set up this kind of serialization, you should also arrange to delete the
46423 relevant hints database whenever your system reboots. The names of the files
46424 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
46425 may be one or two files, depending on the type of DBM in use. The same files
46426 are used for ETRN serialization.
46427 </para>
46428 <para>
46429 <indexterm role="option">
46430 <primary><option>size_addition</option></primary>
46431 </indexterm>
46432 </para>
46433 <informaltable frame="all">
46434 <tgroup cols="4" colsep="0" rowsep="0">
46435 <colspec colwidth="8*" align="left"/>
46436 <colspec colwidth="6*" align="center"/>
46437 <colspec colwidth="6*" align="center"/>
46438 <colspec colwidth="6*" align="right"/>
46439 <tbody>
46440 <row>
46441 <entry><option>size_addition</option></entry>
46442 <entry>Use: <emphasis>smtp</emphasis></entry>
46443 <entry>Type: <emphasis>integer</emphasis></entry>
46444 <entry>Default: <emphasis>1024</emphasis></entry>
46445 </row>
46446 </tbody>
46447 </tgroup>
46448 </informaltable>
46449 <para>
46450 <indexterm role="concept">
46451 <primary>SMTP</primary>
46452 <secondary>SIZE</secondary>
46453 </indexterm>
46454 <indexterm role="concept">
46455 <primary>message</primary>
46456 <secondary>size issue for transport filter</secondary>
46457 </indexterm>
46458 <indexterm role="concept">
46459 <primary>size</primary>
46460 <secondary>of message</secondary>
46461 </indexterm>
46462 <indexterm role="concept">
46463 <primary>transport</primary>
46464 <secondary>filter</secondary>
46465 </indexterm>
46466 <indexterm role="concept">
46467 <primary>filter</primary>
46468 <secondary>transport filter</secondary>
46469 </indexterm>
46470 If a remote SMTP server indicates that it supports the SIZE option of the
46471 MAIL command, Exim uses this to pass over the message size at the start of
46472 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
46473 sends, to allow for headers and other text that may be added during delivery by
46474 configuration options or in a transport filter. It may be necessary to increase
46475 this if a lot of text is added to messages.
46476 </para>
46477 <para>
46478 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
46479 the use of the SIZE option altogether.
46480 </para>
46481 <para>
46482 <indexterm role="option">
46483 <primary><option>tls_certificate</option></primary>
46484 </indexterm>
46485 </para>
46486 <informaltable frame="all">
46487 <tgroup cols="4" colsep="0" rowsep="0">
46488 <colspec colwidth="8*" align="left"/>
46489 <colspec colwidth="6*" align="center"/>
46490 <colspec colwidth="6*" align="center"/>
46491 <colspec colwidth="6*" align="right"/>
46492 <tbody>
46493 <row>
46494 <entry><option>tls_certificate</option></entry>
46495 <entry>Use: <emphasis>smtp</emphasis></entry>
46496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46497 <entry>Default: <emphasis>unset</emphasis></entry>
46498 </row>
46499 </tbody>
46500 </tgroup>
46501 </informaltable>
46502 <para>
46503 <indexterm role="concept">
46504 <primary>TLS</primary>
46505 <secondary>client certificate, location of</secondary>
46506 </indexterm>
46507 <indexterm role="concept">
46508 <primary>certificate</primary>
46509 <secondary>client, location of</secondary>
46510 </indexterm>
46511 <indexterm role="variable">
46512 <primary><varname>$host</varname></primary>
46513 </indexterm>
46514 <indexterm role="variable">
46515 <primary><varname>$host_address</varname></primary>
46516 </indexterm>
46517 The value of this option must be the absolute path to a file which contains the
46518 client&#x2019;s certificate, for possible use when sending a message over an encrypted
46519 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
46520 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
46521 details of TLS.
46522 </para>
46523 <para>
46524 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
46525 certificate when sending messages as a client. The global option of the same
46526 name specifies the certificate for Exim as a server; it is not automatically
46527 assumed that the same certificate should be used when Exim is operating as a
46528 client.
46529 </para>
46530 <para>
46531 <indexterm role="option">
46532 <primary><option>tls_crl</option></primary>
46533 </indexterm>
46534 </para>
46535 <informaltable frame="all">
46536 <tgroup cols="4" colsep="0" rowsep="0">
46537 <colspec colwidth="8*" align="left"/>
46538 <colspec colwidth="6*" align="center"/>
46539 <colspec colwidth="6*" align="center"/>
46540 <colspec colwidth="6*" align="right"/>
46541 <tbody>
46542 <row>
46543 <entry><option>tls_crl</option></entry>
46544 <entry>Use: <emphasis>smtp</emphasis></entry>
46545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46546 <entry>Default: <emphasis>unset</emphasis></entry>
46547 </row>
46548 </tbody>
46549 </tgroup>
46550 </informaltable>
46551 <para>
46552 <indexterm role="concept">
46553 <primary>TLS</primary>
46554 <secondary>client certificate revocation list</secondary>
46555 </indexterm>
46556 <indexterm role="concept">
46557 <primary>certificate</primary>
46558 <secondary>revocation list for client</secondary>
46559 </indexterm>
46560 This option specifies a certificate revocation list. The expanded value must
46561 be the name of a file that contains a CRL in PEM format.
46562 </para>
46563 <para>
46564 <indexterm role="option">
46565 <primary><option>tls_dh_min_bits</option></primary>
46566 </indexterm>
46567 </para>
46568 <informaltable frame="all">
46569 <tgroup cols="4" colsep="0" rowsep="0">
46570 <colspec colwidth="8*" align="left"/>
46571 <colspec colwidth="6*" align="center"/>
46572 <colspec colwidth="6*" align="center"/>
46573 <colspec colwidth="6*" align="right"/>
46574 <tbody>
46575 <row>
46576 <entry><option>tls_dh_min_bits</option></entry>
46577 <entry>Use: <emphasis>smtp</emphasis></entry>
46578 <entry>Type: <emphasis>integer</emphasis></entry>
46579 <entry>Default: <emphasis>1024</emphasis></entry>
46580 </row>
46581 </tbody>
46582 </tgroup>
46583 </informaltable>
46584 <para>
46585 <indexterm role="concept">
46586 <primary>TLS</primary>
46587 <secondary>Diffie-Hellman minimum acceptable size</secondary>
46588 </indexterm>
46589 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
46590 key agreement is negotiated, the server will provide a large prime number
46591 for use.  This option establishes the minimum acceptable size of that number.
46592 If the parameter offered by the server is too small, then the TLS handshake
46593 will fail.
46594 </para>
46595 <para>
46596 Only supported when using GnuTLS.
46597 </para>
46598 <para>
46599 <indexterm role="option">
46600 <primary><option>tls_privatekey</option></primary>
46601 </indexterm>
46602 </para>
46603 <informaltable frame="all">
46604 <tgroup cols="4" colsep="0" rowsep="0">
46605 <colspec colwidth="8*" align="left"/>
46606 <colspec colwidth="6*" align="center"/>
46607 <colspec colwidth="6*" align="center"/>
46608 <colspec colwidth="6*" align="right"/>
46609 <tbody>
46610 <row>
46611 <entry><option>tls_privatekey</option></entry>
46612 <entry>Use: <emphasis>smtp</emphasis></entry>
46613 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46614 <entry>Default: <emphasis>unset</emphasis></entry>
46615 </row>
46616 </tbody>
46617 </tgroup>
46618 </informaltable>
46619 <para>
46620 <indexterm role="concept">
46621 <primary>TLS</primary>
46622 <secondary>client private key, location of</secondary>
46623 </indexterm>
46624 <indexterm role="variable">
46625 <primary><varname>$host</varname></primary>
46626 </indexterm>
46627 <indexterm role="variable">
46628 <primary><varname>$host_address</varname></primary>
46629 </indexterm>
46630 The value of this option must be the absolute path to a file which contains the
46631 client&#x2019;s private key. This is used when sending a message over an encrypted
46632 connection using a client certificate. The values of <varname>$host</varname> and
46633 <varname>$host_address</varname> are set to the name and address of the server during the
46634 expansion. If this option is unset, or the expansion is forced to fail, or the
46635 result is an empty string, the private key is assumed to be in the same file as
46636 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46637 </para>
46638 <para>
46639 <indexterm role="option">
46640 <primary><option>tls_require_ciphers</option></primary>
46641 </indexterm>
46642 </para>
46643 <informaltable frame="all">
46644 <tgroup cols="4" colsep="0" rowsep="0">
46645 <colspec colwidth="8*" align="left"/>
46646 <colspec colwidth="6*" align="center"/>
46647 <colspec colwidth="6*" align="center"/>
46648 <colspec colwidth="6*" align="right"/>
46649 <tbody>
46650 <row>
46651 <entry><option>tls_require_ciphers</option></entry>
46652 <entry>Use: <emphasis>smtp</emphasis></entry>
46653 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46654 <entry>Default: <emphasis>unset</emphasis></entry>
46655 </row>
46656 </tbody>
46657 </tgroup>
46658 </informaltable>
46659 <para>
46660 <indexterm role="concept">
46661 <primary>TLS</primary>
46662 <secondary>requiring specific ciphers</secondary>
46663 </indexterm>
46664 <indexterm role="concept">
46665 <primary>cipher</primary>
46666 <secondary>requiring specific</secondary>
46667 </indexterm>
46668 <indexterm role="variable">
46669 <primary><varname>$host</varname></primary>
46670 </indexterm>
46671 <indexterm role="variable">
46672 <primary><varname>$host_address</varname></primary>
46673 </indexterm>
46674 The value of this option must be a list of permitted cipher suites, for use
46675 when setting up an outgoing encrypted connection. (There is a global option of
46676 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
46677 <varname>$host_address</varname> are set to the name and address of the server during the
46678 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
46679 is used in different ways by OpenSSL and GnuTLS (see sections
46680 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
46681 ciphers is a preference order.
46682 </para>
46683 <para>
46684 <indexterm role="option">
46685 <primary><option>tls_sni</option></primary>
46686 </indexterm>
46687 </para>
46688 <informaltable frame="all">
46689 <tgroup cols="4" colsep="0" rowsep="0">
46690 <colspec colwidth="8*" align="left"/>
46691 <colspec colwidth="6*" align="center"/>
46692 <colspec colwidth="6*" align="center"/>
46693 <colspec colwidth="6*" align="right"/>
46694 <tbody>
46695 <row>
46696 <entry><option>tls_sni</option></entry>
46697 <entry>Use: <emphasis>smtp</emphasis></entry>
46698 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46699 <entry>Default: <emphasis>unset</emphasis></entry>
46700 </row>
46701 </tbody>
46702 </tgroup>
46703 </informaltable>
46704 <para>
46705 <indexterm role="concept">
46706 <primary>TLS</primary>
46707 <secondary>Server Name Indication</secondary>
46708 </indexterm>
46709 <indexterm role="variable">
46710 <primary><varname>$tls_sni</varname></primary>
46711 </indexterm>
46712 If this option is set then it sets the $tls_out_sni variable and causes any
46713 TLS session to pass this value as the Server Name Indication extension to
46714 the remote side, which can be used by the remote side to select an appropriate
46715 certificate and private key for the session.
46716 </para>
46717 <para>
46718 See <xref linkend="SECTtlssni"/> for more information.
46719 </para>
46720 <para>
46721 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
46722 TLS extensions.
46723 </para>
46724 <para>
46725 <indexterm role="option">
46726 <primary><option>tls_tempfail_tryclear</option></primary>
46727 </indexterm>
46728 </para>
46729 <informaltable frame="all">
46730 <tgroup cols="4" colsep="0" rowsep="0">
46731 <colspec colwidth="8*" align="left"/>
46732 <colspec colwidth="6*" align="center"/>
46733 <colspec colwidth="6*" align="center"/>
46734 <colspec colwidth="6*" align="right"/>
46735 <tbody>
46736 <row>
46737 <entry><option>tls_tempfail_tryclear</option></entry>
46738 <entry>Use: <emphasis>smtp</emphasis></entry>
46739 <entry>Type: <emphasis>boolean</emphasis></entry>
46740 <entry>Default: <emphasis>true</emphasis></entry>
46741 </row>
46742 </tbody>
46743 </tgroup>
46744 </informaltable>
46745 <para>
46746 <indexterm role="concept">
46747 <primary>4<emphasis>xx</emphasis> responses</primary>
46748 <secondary>to STARTTLS</secondary>
46749 </indexterm>
46750 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
46751 setting up a TLS session, this option determines whether or not Exim should try
46752 to deliver the message unencrypted. If it is set false, delivery to the
46753 current host is deferred; if there are other hosts, they are tried. If this
46754 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
46755 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
46756 TLS negotiation fails, Exim closes the current connection (because it is in an
46757 unknown state), opens a new one to the same host, and then tries the delivery
46758 in clear.
46759 </para>
46760 <para revisionflag="changed">
46761 <indexterm role="option">
46762 <primary><option>tls_try_verify_hosts</option></primary>
46763 </indexterm>
46764 </para>
46765 <informaltable frame="all" revisionflag="changed">
46766 <tgroup cols="4" colsep="0" rowsep="0">
46767 <colspec colwidth="8*" align="left"/>
46768 <colspec colwidth="6*" align="center"/>
46769 <colspec colwidth="6*" align="center"/>
46770 <colspec colwidth="6*" align="right"/>
46771 <tbody>
46772 <row>
46773 <entry><option>tls_try_verify_hosts</option></entry>
46774 <entry>Use: <emphasis>smtp</emphasis></entry>
46775 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46776 <entry>Default: <emphasis>*</emphasis></entry>
46777 </row>
46778 </tbody>
46779 </tgroup>
46780 </informaltable>
46781 <para>
46782 <indexterm role="concept">
46783 <primary>TLS</primary>
46784 <secondary>server certificate verification</secondary>
46785 </indexterm>
46786 <indexterm role="concept">
46787 <primary>certificate</primary>
46788 <secondary>verification of server</secondary>
46789 </indexterm>
46790 This option gives a list of hosts for which, on encrypted connections,
46791 certificate verification will be tried but need not succeed.
46792 The <option>tls_verify_certificates</option> option must also be set.
46793 Note that unless the host is in this list
46794 TLS connections will be denied to hosts using self-signed certificates
46795 when <option>tls_verify_certificates</option> is matched.
46796 The <varname>$tls_out_certificate_verified</varname> variable is set when
46797 certificate verification succeeds.
46798 </para>
46799 <para revisionflag="changed">
46800 <indexterm role="option">
46801 <primary><option>tls_verify_cert_hostnames</option></primary>
46802 </indexterm>
46803 </para>
46804 <informaltable frame="all" revisionflag="changed">
46805 <tgroup cols="4" colsep="0" rowsep="0">
46806 <colspec colwidth="8*" align="left"/>
46807 <colspec colwidth="6*" align="center"/>
46808 <colspec colwidth="6*" align="center"/>
46809 <colspec colwidth="6*" align="right"/>
46810 <tbody>
46811 <row>
46812 <entry><option>tls_verify_cert_hostnames</option></entry>
46813 <entry>Use: <emphasis>smtp</emphasis></entry>
46814 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46815 <entry>Default: <emphasis>*</emphasis></entry>
46816 </row>
46817 </tbody>
46818 </tgroup>
46819 </informaltable>
46820 <para revisionflag="changed">
46821 <indexterm role="concept">
46822 <primary>TLS</primary>
46823 <secondary>server certificate hostname verification</secondary>
46824 </indexterm>
46825 <indexterm role="concept">
46826 <primary>certificate</primary>
46827 <secondary>verification of server</secondary>
46828 </indexterm>
46829 This option give a list of hosts for which,
46830 while verifying the server certificate,
46831 checks will be included on the host name
46832 (note that this will generally be the result of a DNS MX lookup)
46833 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
46834 limited to being the initial component of a 3-or-more component FQDN.
46835 </para>
46836 <para revisionflag="changed">
46837 There is no equivalent checking on client certificates.
46838 </para>
46839 <para revisionflag="changed">
46840 <indexterm role="option">
46841 <primary><option>tls_verify_certificates</option></primary>
46842 </indexterm>
46843 </para>
46844 <informaltable frame="all" revisionflag="changed">
46845 <tgroup cols="4" colsep="0" rowsep="0">
46846 <colspec colwidth="8*" align="left"/>
46847 <colspec colwidth="6*" align="center"/>
46848 <colspec colwidth="6*" align="center"/>
46849 <colspec colwidth="6*" align="right"/>
46850 <tbody>
46851 <row>
46852 <entry><option>tls_verify_certificates</option></entry>
46853 <entry>Use: <emphasis>smtp</emphasis></entry>
46854 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46855 <entry>Default: <emphasis>system</emphasis></entry>
46856 </row>
46857 </tbody>
46858 </tgroup>
46859 </informaltable>
46860 <para revisionflag="changed">
46861 <indexterm role="concept">
46862 <primary>TLS</primary>
46863 <secondary>server certificate verification</secondary>
46864 </indexterm>
46865 <indexterm role="concept">
46866 <primary>certificate</primary>
46867 <secondary>verification of server</secondary>
46868 </indexterm>
46869 <indexterm role="variable">
46870 <primary><varname>$host</varname></primary>
46871 </indexterm>
46872 <indexterm role="variable">
46873 <primary><varname>$host_address</varname></primary>
46874 </indexterm>
46875 The value of this option must be either the
46876 word "system"
46877 or the absolute path to
46878 a file or directory containing permitted certificates for servers,
46879 for use when setting up an encrypted connection.
46880 </para>
46881 <para revisionflag="changed">
46882 The "system" value for the option will use a location compiled into the SSL library.
46883 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
46884 is taken as empty and an explicit location
46885 must be specified.
46886 </para>
46887 <para revisionflag="changed">
46888 The use of a directory for the option value is not available for GnuTLS versions
46889 preceding 3.3.6 and a single file must be used.
46890 </para>
46891 <para>
46892 With OpenSSL the certificates specified
46893 explicitly
46894 either by file or directory
46895 are added to those given by the system default location.
46896 </para>
46897 <para>
46898 The values of <varname>$host</varname> and
46899 <varname>$host_address</varname> are set to the name and address of the server during the
46900 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46901 </para>
46902 <para>
46903 For back-compatibility,
46904 if neither tls_verify_hosts nor tls_try_verify_hosts are set
46905 (a single-colon empty list counts as being set)
46906 and certificate verification fails the TLS connection is closed.
46907 </para>
46908 <para>
46909 <indexterm role="option">
46910 <primary><option>tls_verify_hosts</option></primary>
46911 </indexterm>
46912 </para>
46913 <informaltable frame="all">
46914 <tgroup cols="4" colsep="0" rowsep="0">
46915 <colspec colwidth="8*" align="left"/>
46916 <colspec colwidth="6*" align="center"/>
46917 <colspec colwidth="6*" align="center"/>
46918 <colspec colwidth="6*" align="right"/>
46919 <tbody>
46920 <row>
46921 <entry><option>tls_verify_hosts</option></entry>
46922 <entry>Use: <emphasis>smtp</emphasis></entry>
46923 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46924 <entry>Default: <emphasis>unset</emphasis></entry>
46925 </row>
46926 </tbody>
46927 </tgroup>
46928 </informaltable>
46929 <para>
46930 <indexterm role="concept">
46931 <primary>TLS</primary>
46932 <secondary>server certificate verification</secondary>
46933 </indexterm>
46934 <indexterm role="concept">
46935 <primary>certificate</primary>
46936 <secondary>verification of server</secondary>
46937 </indexterm>
46938 This option gives a list of hosts for which. on encrypted connections,
46939 certificate verification must succeed.
46940 The <option>tls_verify_certificates</option> option must also be set.
46941 If both this option and <option>tls_try_verify_hosts</option> are unset
46942 operation is as if this option selected all hosts.
46943 </para>
46944 </section>
46945 <section id="SECTvalhosmax">
46946 <title>How the limits for the number of hosts to try are used</title>
46947 <para>
46948 <indexterm role="concept">
46949 <primary>host</primary>
46950 <secondary>maximum number to try</secondary>
46951 </indexterm>
46952 <indexterm role="concept">
46953 <primary>limit</primary>
46954 <secondary>hosts; maximum number tried</secondary>
46955 </indexterm>
46956 There are two options that are concerned with the number of hosts that are
46957 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
46958 <option>hosts_max_try_hardlimit</option>.
46959 </para>
46960 <para>
46961 The <option>hosts_max_try</option> option limits the number of hosts that are tried
46962 for a single delivery. However, despite the term <quote>host</quote> in its name, the
46963 option actually applies to each IP address independently. In other words, a
46964 multihomed host is treated as several independent hosts, just as it is for
46965 retrying.
46966 </para>
46967 <para>
46968 Many of the larger ISPs have multiple MX records which often point to
46969 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
46970 created as a result of routing one of these domains.
46971 </para>
46972 <para>
46973 Trying every single IP address on such a long list does not seem sensible; if
46974 several at the top of the list fail, it is reasonable to assume there is some
46975 problem that is likely to affect all of them. Roughly speaking, the value of
46976 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
46977 delivery. However, the logic cannot be quite that simple.
46978 </para>
46979 <para>
46980 Firstly, IP addresses that are skipped because their retry times have not
46981 arrived do not count, and in addition, addresses that are past their retry
46982 limits are also not counted, even when they are tried. This means that when
46983 some IP addresses are past their retry limits, more than the value of
46984 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
46985 that all IP addresses are considered before timing out an email address (but
46986 see below for an exception).
46987 </para>
46988 <para>
46989 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
46990 list to see if there is a subsequent host with a different (higher valued) MX.
46991 If there is, that host is considered next, and the current IP address is used
46992 but not counted. This behaviour helps in the case of a domain with a retry rule
46993 that hardly ever delays any hosts, as is now explained:
46994 </para>
46995 <para>
46996 Consider the case of a long list of hosts with one MX value, and a few with a
46997 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
46998 hosts at the top of the list are tried at first. With the default retry rule,
46999 which specifies increasing retry times, the higher MX hosts are eventually
47000 tried when those at the top of the list are skipped because they have not
47001 reached their retry times.
47002 </para>
47003 <para>
47004 However, it is common practice to put a fixed short retry time on domains for
47005 large ISPs, on the grounds that their servers are rarely down for very long.
47006 Unfortunately, these are exactly the domains that tend to resolve to long lists
47007 of hosts. The short retry time means that the lowest MX hosts are tried every
47008 time. The attempts may be in a different order because of random sorting, but
47009 without the special MX check, the higher MX hosts would never be tried until
47010 all the lower MX hosts had timed out (which might be several days), because
47011 there are always some lower MX hosts that have reached their retry times. With
47012 the special check, Exim considers at least one IP address from each MX value at
47013 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
47014 reached.
47015 </para>
47016 <para>
47017 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
47018 particular, Exim normally eventually tries all the IP addresses before timing
47019 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
47020 reasonable thing to do. Recently, however, some lunatic DNS configurations have
47021 been set up with hundreds of IP addresses for some domains. It can
47022 take a very long time indeed for an address to time out in these cases.
47023 </para>
47024 <para>
47025 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
47026 Exim never tries more than this number of IP addresses; if it hits this limit
47027 and they are all timed out, the email address is bounced, even though not all
47028 possible IP addresses have been tried.
47029 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
47030 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
47031 </para>
47032 </section>
47033 </chapter>
47034
47035 <chapter id="CHAPrewrite">
47036 <title>Address rewriting</title>
47037 <para>
47038 <indexterm role="concept" id="IIDaddrew" class="startofrange">
47039 <primary>rewriting</primary>
47040 <secondary>addresses</secondary>
47041 </indexterm>
47042 There are some circumstances in which Exim automatically rewrites domains in
47043 addresses. The two most common are when an address is given without a domain
47044 (referred to as an <quote>unqualified address</quote>) or when an address contains an
47045 abbreviated domain that is expanded by DNS lookup.
47046 </para>
47047 <para>
47048 Unqualified envelope addresses are accepted only for locally submitted
47049 messages, or for messages that are received from hosts matching
47050 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
47051 appropriate. Unqualified addresses in header lines are qualified if they are in
47052 locally submitted messages, or messages from hosts that are permitted to send
47053 unqualified envelope addresses. Otherwise, unqualified addresses in header
47054 lines are neither qualified nor rewritten.
47055 </para>
47056 <para>
47057 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
47058 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
47059 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
47060 do this. The new RFCs do not contain this suggestion.
47061 </para>
47062 <section id="SECID147">
47063 <title>Explicitly configured address rewriting</title>
47064 <para>
47065 This chapter describes the rewriting rules that can be used in the
47066 main rewrite section of the configuration file, and also in the generic
47067 <option>headers_rewrite</option> option that can be set on any transport.
47068 </para>
47069 <para>
47070 Some people believe that configured address rewriting is a Mortal Sin.
47071 Others believe that life is not possible without it. Exim provides the
47072 facility; you do not have to use it.
47073 </para>
47074 <para>
47075 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
47076 configuration file are applied to addresses in incoming messages, both envelope
47077 addresses and addresses in header lines. Each rule specifies the types of
47078 address to which it applies.
47079 </para>
47080 <para>
47081 Whether or not addresses in header lines are rewritten depends on the origin of
47082 the headers and the type of rewriting. Global rewriting, that is, rewriting
47083 rules from the rewrite section of the configuration file, is applied only to
47084 those headers that were received with the message. Header lines that are added
47085 by ACLs or by a system filter or by individual routers or transports (which
47086 are specific to individual recipient addresses) are not rewritten by the global
47087 rules.
47088 </para>
47089 <para>
47090 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
47091 applies all headers except those added by routers and transports. That is, as
47092 well as the headers that were received with the message, it also applies to
47093 headers that were added by an ACL or a system filter.
47094 </para>
47095 <para>
47096 In general, rewriting addresses from your own system or domain has some
47097 legitimacy. Rewriting other addresses should be done only with great care and
47098 in special circumstances. The author of Exim believes that rewriting should be
47099 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
47100 Although it can sometimes be used as a routing tool, this is very strongly
47101 discouraged.
47102 </para>
47103 <para>
47104 There are two commonly encountered circumstances where rewriting is used, as
47105 illustrated by these examples:
47106 </para>
47107 <itemizedlist>
47108 <listitem>
47109 <para>
47110 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
47111 exchange mail with each other behind a firewall, but there is only a single
47112 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
47113 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
47114 </para>
47115 </listitem>
47116 <listitem>
47117 <para>
47118 A host rewrites the local parts of its own users so that, for example,
47119 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
47120 </para>
47121 </listitem>
47122 </itemizedlist>
47123 </section>
47124 <section id="SECID148">
47125 <title>When does rewriting happen?</title>
47126 <para>
47127 <indexterm role="concept">
47128 <primary>rewriting</primary>
47129 <secondary>timing of</secondary>
47130 </indexterm>
47131 <indexterm role="concept">
47132 <primary>access control lists (ACLs)</primary>
47133 <secondary>rewriting addresses in</secondary>
47134 </indexterm>
47135 Configured address rewriting can take place at several different stages of a
47136 message&#x2019;s processing.
47137 </para>
47138 <para>
47139 <indexterm role="variable">
47140 <primary><varname>$sender_address</varname></primary>
47141 </indexterm>
47142 At the start of an ACL for MAIL, the sender address may have been rewritten
47143 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
47144 ordinary rewrite rules have yet been applied. If, however, the sender address
47145 is verified in the ACL, it is rewritten before verification, and remains
47146 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
47147 rewritten address. This also applies if sender verification happens in a
47148 RCPT ACL. Otherwise, when the sender address is not verified, it is
47149 rewritten as soon as a message&#x2019;s header lines have been received.
47150 </para>
47151 <para>
47152 <indexterm role="variable">
47153 <primary><varname>$domain</varname></primary>
47154 </indexterm>
47155 <indexterm role="variable">
47156 <primary><varname>$local_part</varname></primary>
47157 </indexterm>
47158 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
47159 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
47160 rewrite rules have yet been applied to it. However, the behaviour is different
47161 from the sender address when a recipient is verified. The address is rewritten
47162 for the verification, but the rewriting is not remembered at this stage. The
47163 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
47164 as they were before (that is, they contain the unrewritten &ndash; except for
47165 SMTP-time rewriting &ndash; address).
47166 </para>
47167 <para>
47168 As soon as a message&#x2019;s header lines have been received, all the envelope
47169 recipient addresses are permanently rewritten, and rewriting is also applied to
47170 the addresses in the header lines (if configured). This happens before adding
47171 any header lines that were specified in MAIL or RCPT ACLs, and
47172 <indexterm role="concept">
47173 <primary><function>local_scan()</function> function</primary>
47174 <secondary>address rewriting; timing of</secondary>
47175 </indexterm>
47176 before the DATA ACL and <function>local_scan()</function> functions are run.
47177 </para>
47178 <para>
47179 When an address is being routed, either for delivery or for verification,
47180 rewriting is applied immediately to child addresses that are generated by
47181 redirection, unless <option>no_rewrite</option> is set on the router.
47182 </para>
47183 <para>
47184 <indexterm role="concept">
47185 <primary>envelope sender</primary>
47186 <secondary>rewriting at transport time</secondary>
47187 </indexterm>
47188 <indexterm role="concept">
47189 <primary>rewriting</primary>
47190 <secondary>at transport time</secondary>
47191 </indexterm>
47192 <indexterm role="concept">
47193 <primary>header lines</primary>
47194 <secondary>rewriting at transport time</secondary>
47195 </indexterm>
47196 At transport time, additional rewriting of addresses in header lines can be
47197 specified by setting the generic <option>headers_rewrite</option> option on a transport.
47198 This option contains rules that are identical in form to those in the rewrite
47199 section of the configuration file. They are applied to the original message
47200 header lines and any that were added by ACLs or a system filter. They are not
47201 applied to header lines that are added by routers or the transport.
47202 </para>
47203 <para>
47204 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
47205 transport option. However, it is not possible to rewrite envelope recipients at
47206 transport time.
47207 </para>
47208 </section>
47209 <section id="SECID149">
47210 <title>Testing the rewriting rules that apply on input</title>
47211 <para>
47212 <indexterm role="concept">
47213 <primary>rewriting</primary>
47214 <secondary>testing</secondary>
47215 </indexterm>
47216 <indexterm role="concept">
47217 <primary>testing</primary>
47218 <secondary>rewriting</secondary>
47219 </indexterm>
47220 Exim&#x2019;s input rewriting configuration appears in a part of the run time
47221 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
47222 <option>-brw</option> command line option. This takes an address (which can be a full RFC
47223 2822 address) as its argument. The output is a list of how the address would be
47224 transformed by the rewriting rules for each of the different places it might
47225 appear in an incoming message, that is, for each different header and for the
47226 envelope sender and recipient fields. For example,
47227 </para>
47228 <literallayout class="monospaced">
47229 exim -brw ph10@exim.workshop.example
47230 </literallayout>
47231 <para>
47232 might produce the output
47233 </para>
47234 <literallayout class="monospaced">
47235 sender: Philip.Hazel@exim.workshop.example
47236 from: Philip.Hazel@exim.workshop.example
47237 to: ph10@exim.workshop.example
47238 cc: ph10@exim.workshop.example
47239 bcc: ph10@exim.workshop.example
47240 reply-to: Philip.Hazel@exim.workshop.example
47241 env-from: Philip.Hazel@exim.workshop.example
47242 env-to: ph10@exim.workshop.example
47243 </literallayout>
47244 <para>
47245 which shows that rewriting has been set up for that address when used in any of
47246 the source fields, but not when it appears as a recipient address. At the
47247 present time, there is no equivalent way of testing rewriting rules that are
47248 set for a particular transport.
47249 </para>
47250 </section>
47251 <section id="SECID150">
47252 <title>Rewriting rules</title>
47253 <para>
47254 <indexterm role="concept">
47255 <primary>rewriting</primary>
47256 <secondary>rules</secondary>
47257 </indexterm>
47258 The rewrite section of the configuration file consists of lines of rewriting
47259 rules in the form
47260 </para>
47261 <literallayout>
47262 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
47263 </literallayout>
47264 <para>
47265 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
47266 transport option are given as a colon-separated list. Each item in the list
47267 takes the same form as a line in the main rewriting configuration (except that
47268 any colons must be doubled, of course).
47269 </para>
47270 <para>
47271 The formats of source patterns and replacement strings are described below.
47272 Each is terminated by white space, unless enclosed in double quotes, in which
47273 case normal quoting conventions apply inside the quotes. The flags are single
47274 characters which may appear in any order. Spaces and tabs between them are
47275 ignored.
47276 </para>
47277 <para>
47278 For each address that could potentially be rewritten, the rules are scanned in
47279 order, and replacements for the address from earlier rules can themselves be
47280 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
47281 </para>
47282 <para>
47283 The order in which addresses are rewritten is undefined, may change between
47284 releases, and must not be relied on, with one exception: when a message is
47285 received, the envelope sender is always rewritten first, before any header
47286 lines are rewritten. For example, the replacement string for a rewrite of an
47287 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
47288 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
47289 that the envelope sender has already been rewritten.
47290 </para>
47291 <para>
47292 <indexterm role="variable">
47293 <primary><varname>$domain</varname></primary>
47294 </indexterm>
47295 <indexterm role="variable">
47296 <primary><varname>$local_part</varname></primary>
47297 </indexterm>
47298 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
47299 string to refer to the address that is being rewritten. Note that lookup-driven
47300 rewriting can be done by a rule of the form
47301 </para>
47302 <literallayout class="monospaced">
47303 *@*   ${lookup ...
47304 </literallayout>
47305 <para>
47306 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
47307 refer to the address that is being rewritten.
47308 </para>
47309 </section>
47310 <section id="SECID151">
47311 <title>Rewriting patterns</title>
47312 <para>
47313 <indexterm role="concept">
47314 <primary>rewriting</primary>
47315 <secondary>patterns</secondary>
47316 </indexterm>
47317 <indexterm role="concept">
47318 <primary>address list</primary>
47319 <secondary>in a rewriting pattern</secondary>
47320 </indexterm>
47321 The source pattern in a rewriting rule is any item which may appear in an
47322 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
47323 single-item address list, which means that it is expanded before being tested
47324 against the address. As always, if you use a regular expression as a pattern,
47325 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
47326 facility to suppress string expansion within the regular expression.
47327 </para>
47328 <para>
47329 Domains in patterns should be given in lower case. Local parts in patterns are
47330 case-sensitive. If you want to do case-insensitive matching of local parts, you
47331 can use a regular expression that starts with <literal>^(?i)</literal>.
47332 </para>
47333 <para>
47334 <indexterm role="concept">
47335 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
47336 <secondary>in rewriting rules</secondary>
47337 </indexterm>
47338 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
47339 depending on the type of match which occurred. These can be used in the
47340 replacement string to insert portions of the incoming address. <varname>$0</varname> always
47341 refers to the complete incoming address. When a regular expression is used, the
47342 numerical variables are set from its capturing subexpressions. For other types
47343 of pattern they are set as follows:
47344 </para>
47345 <itemizedlist>
47346 <listitem>
47347 <para>
47348 If a local part or domain starts with an asterisk, the numerical variables
47349 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
47350 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
47351 pattern
47352 </para>
47353 <literallayout class="monospaced">
47354 *queen@*.fict.example
47355 </literallayout>
47356 <para>
47357 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
47358 </para>
47359 <literallayout class="monospaced">
47360 $0 = hearts-queen@wonderland.fict.example
47361 $1 = hearts-
47362 $2 = wonderland
47363 </literallayout>
47364 <para>
47365 Note that if the local part does not start with an asterisk, but the domain
47366 does, it is <varname>$1</varname> that contains the wild part of the domain.
47367 </para>
47368 </listitem>
47369 <listitem>
47370 <para>
47371 If the domain part of the pattern is a partial lookup, the wild and fixed parts
47372 of the domain are placed in the next available numerical variables. Suppose,
47373 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
47374 rewriting rule of the form
47375 </para>
47376 <literallayout>
47377 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
47378 </literallayout>
47379 <para>
47380 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
47381 </para>
47382 <literallayout class="monospaced">
47383 $1 = foo
47384 $2 = bar
47385 $3 = baz.example
47386 </literallayout>
47387 <para>
47388 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
47389 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
47390 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
47391 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
47392 whole domain. For non-partial domain lookups, no numerical variables are set.
47393 </para>
47394 </listitem>
47395 </itemizedlist>
47396 </section>
47397 <section id="SECID152">
47398 <title>Rewriting replacements</title>
47399 <para>
47400 <indexterm role="concept">
47401 <primary>rewriting</primary>
47402 <secondary>replacements</secondary>
47403 </indexterm>
47404 If the replacement string for a rule is a single asterisk, addresses that
47405 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
47406 rewriting rules are scanned. For example,
47407 </para>
47408 <literallayout class="monospaced">
47409 hatta@lookingglass.fict.example  *  f
47410 </literallayout>
47411 <para>
47412 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
47413 <emphasis>From:</emphasis> headers.
47414 </para>
47415 <para>
47416 <indexterm role="variable">
47417 <primary><varname>$domain</varname></primary>
47418 </indexterm>
47419 <indexterm role="variable">
47420 <primary><varname>$local_part</varname></primary>
47421 </indexterm>
47422 If the replacement string is not a single asterisk, it is expanded, and must
47423 yield a fully qualified address. Within the expansion, the variables
47424 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
47425 Any letters they contain retain their original case &ndash; they are not lower
47426 cased. The numerical variables are set up according to the type of pattern that
47427 matched the address, as described above. If the expansion is forced to fail by
47428 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
47429 current rule is abandoned, but subsequent rules may take effect. Any other
47430 expansion failure causes the entire rewriting operation to be abandoned, and an
47431 entry written to the panic log.
47432 </para>
47433 </section>
47434 <section id="SECID153">
47435 <title>Rewriting flags</title>
47436 <para>
47437 There are three different kinds of flag that may appear on rewriting rules:
47438 </para>
47439 <itemizedlist>
47440 <listitem>
47441 <para>
47442 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
47443 c, f, h, r, s, t.
47444 </para>
47445 </listitem>
47446 <listitem>
47447 <para>
47448 A flag that specifies rewriting at SMTP time: S.
47449 </para>
47450 </listitem>
47451 <listitem>
47452 <para>
47453 Flags that control the rewriting process: Q, q, R, w.
47454 </para>
47455 </listitem>
47456 </itemizedlist>
47457 <para>
47458 For rules that are part of the <option>headers_rewrite</option> generic transport option,
47459 E, F, T, and S are not permitted.
47460 </para>
47461 </section>
47462 <section id="SECID154">
47463 <title>Flags specifying which headers and envelope addresses to rewrite</title>
47464 <para>
47465 <indexterm role="concept">
47466 <primary>rewriting</primary>
47467 <secondary>flags</secondary>
47468 </indexterm>
47469 If none of the following flag letters, nor the <quote>S</quote> flag (see section
47470 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
47471 and to both the sender and recipient fields of the envelope, whereas a
47472 transport-time rewriting rule just applies to all headers. Otherwise, the
47473 rewriting rule is skipped unless the relevant addresses are being processed.
47474 </para>
47475 <literallayout>
47476 <literal>E</literal>       rewrite all envelope fields
47477 <literal>F</literal>       rewrite the envelope From field
47478 <literal>T</literal>       rewrite the envelope To field
47479 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
47480 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
47481 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
47482 <literal>h</literal>       rewrite all headers
47483 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
47484 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
47485 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
47486 </literallayout>
47487 <para>
47488 "All headers" means all of the headers listed above that can be selected
47489 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
47490 other headers such as <emphasis>Subject:</emphasis> etc.
47491 </para>
47492 <para>
47493 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
47494 restrict this to special known cases in your own domains.
47495 </para>
47496 </section>
47497 <section id="SECTrewriteS">
47498 <title>The SMTP-time rewriting flag</title>
47499 <para>
47500 <indexterm role="concept">
47501 <primary>SMTP</primary>
47502 <secondary>rewriting malformed addresses</secondary>
47503 </indexterm>
47504 <indexterm role="concept">
47505 <primary>RCPT</primary>
47506 <secondary>rewriting argument of</secondary>
47507 </indexterm>
47508 <indexterm role="concept">
47509 <primary>MAIL</primary>
47510 <secondary>rewriting argument of</secondary>
47511 </indexterm>
47512 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
47513 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
47514 before any other processing; even before syntax checking. The pattern is
47515 required to be a regular expression, and it is matched against the whole of the
47516 data for the command, including any surrounding angle brackets.
47517 </para>
47518 <para>
47519 <indexterm role="variable">
47520 <primary><varname>$domain</varname></primary>
47521 </indexterm>
47522 <indexterm role="variable">
47523 <primary><varname>$local_part</varname></primary>
47524 </indexterm>
47525 This form of rewrite rule allows for the handling of addresses that are not
47526 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
47527 input). Because the input is not required to be a syntactically valid address,
47528 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
47529 expansion of the replacement string. The result of rewriting replaces the
47530 original address in the MAIL or RCPT command.
47531 </para>
47532 </section>
47533 <section id="SECID155">
47534 <title>Flags controlling the rewriting process</title>
47535 <para>
47536 There are four flags which control the way the rewriting process works. These
47537 take effect only when a rule is invoked, that is, when the address is of the
47538 correct type (matches the flags) and matches the pattern:
47539 </para>
47540 <itemizedlist>
47541 <listitem>
47542 <para>
47543 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
47544 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
47545 absence of <quote>Q</quote> the rewritten address must always include a domain.
47546 </para>
47547 </listitem>
47548 <listitem>
47549 <para>
47550 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
47551 even if no rewriting actually takes place because of a <quote>fail</quote> in the
47552 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
47553 (does not match the flags) or does not match the pattern.
47554 </para>
47555 </listitem>
47556 <listitem>
47557 <para>
47558 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
47559 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
47560 rewriting once it fails to match (after at least one successful rewrite).
47561 </para>
47562 </listitem>
47563 <listitem>
47564 <para>
47565 <indexterm role="concept">
47566 <primary>rewriting</primary>
47567 <secondary>whole addresses</secondary>
47568 </indexterm>
47569 When an address in a header is rewritten, the rewriting normally applies only
47570 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
47571 left unchanged. For example, rewriting might change
47572 </para>
47573 <literallayout class="monospaced">
47574 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
47575 </literallayout>
47576 <para>
47577 into
47578 </para>
47579 <literallayout class="monospaced">
47580 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
47581 </literallayout>
47582 <para>
47583 <indexterm role="concept">
47584 <primary>RFC 2047</primary>
47585 </indexterm>
47586 Sometimes there is a need to replace the whole address item, and this can be
47587 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
47588 causes an address in a header line to be rewritten, the entire address is
47589 replaced, not just the working part. The replacement must be a complete RFC
47590 2822 address, including the angle brackets if necessary. If text outside angle
47591 brackets contains a character whose value is greater than 126 or less than 32
47592 (except for tab), the text is encoded according to RFC 2047. The character set
47593 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
47594 </para>
47595 <para>
47596 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
47597 rewritten, all but the working part of the replacement address is discarded.
47598 </para>
47599 </listitem>
47600 </itemizedlist>
47601 </section>
47602 <section id="SECID156">
47603 <title>Rewriting examples</title>
47604 <para>
47605 Here is an example of the two common rewriting paradigms:
47606 </para>
47607 <literallayout class="monospaced">
47608 *@*.hitch.fict.example  $1@hitch.fict.example
47609 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
47610                      {$value}fail}@hitch.fict.example bctfrF
47611 </literallayout>
47612 <para>
47613 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
47614 the string expansion to fail if the lookup does not succeed. In this context it
47615 has the effect of leaving the original address unchanged, but Exim goes on to
47616 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
47617 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
47618 explicitly, which would cause the rewritten address to be the same as before,
47619 at the cost of a small bit of processing. Not supplying either of these is an
47620 error, since the rewritten address would then contain no local part.
47621 </para>
47622 <para>
47623 The first example above replaces the domain with a superior, more general
47624 domain. This may not be desirable for certain local parts. If the rule
47625 </para>
47626 <literallayout class="monospaced">
47627 root@*.hitch.fict.example  *
47628 </literallayout>
47629 <para>
47630 were inserted before the first rule, rewriting would be suppressed for the
47631 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
47632 </para>
47633 <para>
47634 Rewriting can be made conditional on a number of tests, by making use of
47635 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
47636 messages that originate outside the local host:
47637 </para>
47638 <literallayout class="monospaced">
47639 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
47640                          {$1@hitch.fict.example}fail}"
47641 </literallayout>
47642 <para>
47643 The replacement string is quoted in this example because it contains white
47644 space.
47645 </para>
47646 <para>
47647 <indexterm role="concept">
47648 <primary>rewriting</primary>
47649 <secondary>bang paths</secondary>
47650 </indexterm>
47651 <indexterm role="concept">
47652 <primary>bang paths</primary>
47653 <secondary>rewriting</secondary>
47654 </indexterm>
47655 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
47656 an address it treats it as an unqualified local part which it qualifies with
47657 the local qualification domain (if the source of the message is local or if the
47658 remote host is permitted to send unqualified addresses). Rewriting can
47659 sometimes be used to handle simple bang paths with a fixed number of
47660 components. For example, the rule
47661 </para>
47662 <literallayout class="monospaced">
47663 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
47664 </literallayout>
47665 <para>
47666 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
47667 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
47668 a global rewriting rule for envelope addresses. It can provide a backdoor
47669 method for using your system as a relay, because the incoming addresses appear
47670 to be local. If the bang path addresses are received via SMTP, it is safer to
47671 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
47672 can be done on the rewritten addresses.
47673 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
47674 </para>
47675 </section>
47676 </chapter>
47677
47678 <chapter id="CHAPretry">
47679 <title>Retry configuration</title>
47680 <para>
47681 <indexterm role="concept" id="IIDretconf1" class="startofrange">
47682 <primary>retry</primary>
47683 <secondary>configuration, description of</secondary>
47684 </indexterm>
47685 <indexterm role="concept" id="IIDregconf2" class="startofrange">
47686 <primary>configuration file</primary>
47687 <secondary>retry section</secondary>
47688 </indexterm>
47689 The <quote>retry</quote> section of the runtime configuration file contains a list of
47690 retry rules that control how often Exim tries to deliver messages that cannot
47691 be delivered at the first attempt. If there are no retry rules (the section is
47692 empty or not present), there are no retries. In this situation, temporary
47693 errors are treated as permanent. The default configuration contains a single,
47694 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
47695 line option can be used to test which retry rule will be used for a given
47696 address, domain and error.
47697 </para>
47698 <para>
47699 The most common cause of retries is temporary failure to deliver to a remote
47700 host because the host is down, or inaccessible because of a network problem.
47701 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
47702 address) basis, not on a per-message basis. Thus, if one message has recently
47703 been delayed, delivery of a new message to the same host is not immediately
47704 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
47705 log selector is set, the message
47706 <indexterm role="concept">
47707 <primary>retry</primary>
47708 <secondary>time not reached</secondary>
47709 </indexterm>
47710 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
47711 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
47712 the handling of errors during remote deliveries.
47713 </para>
47714 <para>
47715 Retry processing applies to routing as well as to delivering, except as covered
47716 in the next paragraph. The retry rules do not distinguish between these
47717 actions. It is not possible, for example, to specify different behaviour for
47718 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
47719 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
47720 added complication, so did not implement it. However, although they share the
47721 same retry rule, the actual retry times for routing and transporting a given
47722 domain are maintained independently.
47723 </para>
47724 <para>
47725 When a delivery is not part of a queue run (typically an immediate delivery on
47726 receipt of a message), the routers are always run, and local deliveries are
47727 always attempted, even if retry times are set for them. This makes for better
47728 behaviour if one particular message is causing problems (for example, causing
47729 quota overflow, or provoking an error in a filter file). If such a delivery
47730 suffers a temporary failure, the retry data is updated as normal, and
47731 subsequent delivery attempts from queue runs occur only when the retry time for
47732 the local address is reached.
47733 </para>
47734 <section id="SECID157">
47735 <title>Changing retry rules</title>
47736 <para>
47737 If you change the retry rules in your configuration, you should consider
47738 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
47739 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
47740 always safe; that is why they are called <quote>hints</quote>.
47741 </para>
47742 <para>
47743 The hints retry data contains suggested retry times based on the previous
47744 rules. In the case of a long-running problem with a remote host, it might
47745 record the fact that the host has timed out. If your new rules increase the
47746 timeout time for such a host, you should definitely remove the old retry data
47747 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
47748 messages that it should now be retaining.
47749 </para>
47750 </section>
47751 <section id="SECID158">
47752 <title>Format of retry rules</title>
47753 <para>
47754 <indexterm role="concept">
47755 <primary>retry</primary>
47756 <secondary>rules</secondary>
47757 </indexterm>
47758 Each retry rule occupies one line and consists of three or four parts,
47759 separated by white space: a pattern, an error name, an optional list of sender
47760 addresses, and a list of retry parameters. The pattern and sender lists must be
47761 enclosed in double quotes if they contain white space. The rules are searched
47762 in order until one is found where the pattern, error name, and sender list (if
47763 present) match the failing host or address, the error that occurred, and the
47764 message&#x2019;s sender, respectively.
47765 </para>
47766 <para>
47767 The pattern is any single item that may appear in an address list (see section
47768 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
47769 which means that it is expanded before being tested against the address that
47770 has been delayed. A negated address list item is permitted. Address
47771 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
47772 which makes it possible for many retry rules to start with just a domain. For
47773 example,
47774 </para>
47775 <literallayout class="monospaced">
47776 lookingglass.fict.example        *  F,24h,30m;
47777 </literallayout>
47778 <para>
47779 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
47780 whereas
47781 </para>
47782 <literallayout class="monospaced">
47783 alice@lookingglass.fict.example  *  F,24h,30m;
47784 </literallayout>
47785 <para>
47786 applies only to temporary failures involving the local part <option>alice</option>.
47787 In practice, almost all rules start with a domain name pattern without a local
47788 part.
47789 </para>
47790 <para>
47791 <indexterm role="concept">
47792 <primary>regular expressions</primary>
47793 <secondary>in retry rules</secondary>
47794 </indexterm>
47795 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
47796 must match a complete address, not just a domain, because that is how regular
47797 expressions work in address lists.
47798 </para>
47799 <literallayout>
47800 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
47801 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
47802 </literallayout>
47803 </section>
47804 <section id="SECID159">
47805 <title>Choosing which retry rule to use for address errors</title>
47806 <para>
47807 When Exim is looking for a retry rule after a routing attempt has failed (for
47808 example, after a DNS timeout), each line in the retry configuration is tested
47809 against the complete address only if <option>retry_use_local_part</option> is set for the
47810 router. Otherwise, only the domain is used, except when matching against a
47811 regular expression, when the local part of the address is replaced with <quote>*</quote>.
47812 A domain on its own can match a domain pattern, or a pattern that starts with
47813 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
47814 <option>check_local_user</option> is true, and false for other routers.
47815 </para>
47816 <para>
47817 Similarly, when Exim is looking for a retry rule after a local delivery has
47818 failed (for example, after a mailbox full error), each line in the retry
47819 configuration is tested against the complete address only if
47820 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
47821 local transports).
47822 </para>
47823 <para>
47824 <indexterm role="concept">
47825 <primary>4<emphasis>xx</emphasis> responses</primary>
47826 <secondary>retry rules for</secondary>
47827 </indexterm>
47828 However, when Exim is looking for a retry rule after a remote delivery attempt
47829 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
47830 whole address is always used as the key when searching the retry rules. The
47831 rule that is found is used to create a retry time for the combination of the
47832 failing address and the message&#x2019;s sender. It is the combination of sender and
47833 recipient that is delayed in subsequent queue runs until its retry time is
47834 reached. You can delay the recipient without regard to the sender by setting
47835 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
47836 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
47837 commands.
47838 </para>
47839 </section>
47840 <section id="SECID160">
47841 <title>Choosing which retry rule to use for host and message errors</title>
47842 <para>
47843 For a temporary error that is not related to an individual address (for
47844 example, a connection timeout), each line in the retry configuration is checked
47845 twice. First, the name of the remote host is used as a domain name (preceded by
47846 <quote>*@</quote> when matching a regular expression). If this does not match the line,
47847 the domain from the email address is tried in a similar fashion. For example,
47848 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
47849 </para>
47850 <literallayout class="monospaced">
47851 a.b.c.example  MX  5  x.y.z.example
47852                MX  6  p.q.r.example
47853                MX  7  m.n.o.example
47854 </literallayout>
47855 <para>
47856 and the retry rules are
47857 </para>
47858 <literallayout class="monospaced">
47859 p.q.r.example    *      F,24h,30m;
47860 a.b.c.example    *      F,4d,45m;
47861 </literallayout>
47862 <para>
47863 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
47864 first rule matches neither the host nor the domain, so Exim looks at the second
47865 rule. This does not match the host, but it does match the domain, so it is used
47866 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
47867 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
47868 first retry rule is used, because it matches the host.
47869 </para>
47870 <para>
47871 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
47872 first rule to determine retry times, but for all the other hosts for the domain
47873 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
47874 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
47875 </para>
47876 <para>
47877 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
47878 However, if a message is routed directly to an IP address without the use of a
47879 host name, for example, if a <command>manualroute</command> router contains a setting such as:
47880 </para>
47881 <literallayout class="monospaced">
47882 route_list = *.a.example  192.168.34.23
47883 </literallayout>
47884 <para>
47885 then the <quote>host name</quote> that is used when searching for a retry rule is the
47886 textual form of the IP address.
47887 </para>
47888 </section>
47889 <section id="SECID161">
47890 <title>Retry rules for specific errors</title>
47891 <para>
47892 <indexterm role="concept">
47893 <primary>retry</primary>
47894 <secondary>specific errors; specifying</secondary>
47895 </indexterm>
47896 The second field in a retry rule is the name of a particular error, or an
47897 asterisk, which matches any error. The errors that can be tested for are:
47898 </para>
47899 <variablelist>
47900 <varlistentry>
47901 <term><option>auth_failed</option></term>
47902 <listitem>
47903 <para>
47904 Authentication failed when trying to send to a host in the
47905 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
47906 </para>
47907 </listitem></varlistentry>
47908 <varlistentry>
47909 <term><option>data_4xx</option></term>
47910 <listitem>
47911 <para>
47912 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
47913 after the command, or after sending the message&#x2019;s data.
47914 </para>
47915 </listitem></varlistentry>
47916 <varlistentry>
47917 <term><option>mail_4xx</option></term>
47918 <listitem>
47919 <para>
47920 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
47921 </para>
47922 </listitem></varlistentry>
47923 <varlistentry>
47924 <term><option>rcpt_4xx</option></term>
47925 <listitem>
47926 <para>
47927 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
47928 </para>
47929 </listitem></varlistentry>
47930 </variablelist>
47931 <para>
47932 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
47933 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
47934 recognize 452 errors given to RCPT commands for addresses in a certain domain,
47935 and have retries every ten minutes with a one-hour timeout, you could set up a
47936 retry rule of this form:
47937 </para>
47938 <literallayout class="monospaced">
47939 the.domain.name  rcpt_452   F,1h,10m
47940 </literallayout>
47941 <para>
47942 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
47943 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
47944 </para>
47945 <variablelist>
47946 <varlistentry>
47947 <term><option>lost_connection</option></term>
47948 <listitem>
47949 <para>
47950 A server unexpectedly closed the SMTP connection. There may, of course,
47951 legitimate reasons for this (host died, network died), but if it repeats a lot
47952 for the same host, it indicates something odd.
47953 </para>
47954 </listitem></varlistentry>
47955 <varlistentry revisionflag="changed">
47956 <term><option>lookup</option></term>
47957 <listitem>
47958 <para revisionflag="changed">
47959 A DNS lookup for a host failed.
47960 Note that a <option>dnslookup</option> router will need to have matched
47961 its <option>fail_defer_domains</option> option for this retry type to be usable.
47962 Also note that a <option>manualroute</option> router will probably need
47963 its <option>host_find_failed</option> option set to <option>defer</option>.
47964 </para>
47965 </listitem></varlistentry>
47966 <varlistentry>
47967 <term><option>refused_MX</option></term>
47968 <listitem>
47969 <para>
47970 A connection to a host obtained from an MX record was refused.
47971 </para>
47972 </listitem></varlistentry>
47973 <varlistentry>
47974 <term><option>refused_A</option></term>
47975 <listitem>
47976 <para>
47977 A connection to a host not obtained from an MX record was refused.
47978 </para>
47979 </listitem></varlistentry>
47980 <varlistentry>
47981 <term><option>refused</option></term>
47982 <listitem>
47983 <para>
47984 A connection was refused.
47985 </para>
47986 </listitem></varlistentry>
47987 <varlistentry>
47988 <term><option>timeout_connect_MX</option></term>
47989 <listitem>
47990 <para>
47991 A connection attempt to a host obtained from an MX record timed out.
47992 </para>
47993 </listitem></varlistentry>
47994 <varlistentry>
47995 <term><option>timeout_connect_A</option></term>
47996 <listitem>
47997 <para>
47998 A connection attempt to a host not obtained from an MX record timed out.
47999 </para>
48000 </listitem></varlistentry>
48001 <varlistentry>
48002 <term><option>timeout_connect</option></term>
48003 <listitem>
48004 <para>
48005 A connection attempt timed out.
48006 </para>
48007 </listitem></varlistentry>
48008 <varlistentry>
48009 <term><option>timeout_MX</option></term>
48010 <listitem>
48011 <para>
48012 There was a timeout while connecting or during an SMTP session with a host
48013 obtained from an MX record.
48014 </para>
48015 </listitem></varlistentry>
48016 <varlistentry>
48017 <term><option>timeout_A</option></term>
48018 <listitem>
48019 <para>
48020 There was a timeout while connecting or during an SMTP session with a host not
48021 obtained from an MX record.
48022 </para>
48023 </listitem></varlistentry>
48024 <varlistentry>
48025 <term><option>timeout</option></term>
48026 <listitem>
48027 <para>
48028 There was a timeout while connecting or during an SMTP session.
48029 </para>
48030 </listitem></varlistentry>
48031 <varlistentry>
48032 <term><option>tls_required</option></term>
48033 <listitem>
48034 <para>
48035 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
48036 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
48037 to STARTTLS, or there was a problem setting up the TLS connection.
48038 </para>
48039 </listitem></varlistentry>
48040 <varlistentry>
48041 <term><option>quota</option></term>
48042 <listitem>
48043 <para>
48044 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
48045 transport.
48046 </para>
48047 </listitem></varlistentry>
48048 <varlistentry>
48049 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
48050 <listitem>
48051 <para>
48052 <indexterm role="concept">
48053 <primary>quota</primary>
48054 <secondary>error testing in retry rule</secondary>
48055 </indexterm>
48056 <indexterm role="concept">
48057 <primary>retry</primary>
48058 <secondary>quota error testing</secondary>
48059 </indexterm>
48060 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
48061 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
48062 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
48063 for four days.
48064 </para>
48065 </listitem></varlistentry>
48066 </variablelist>
48067 <para>
48068 <indexterm role="concept">
48069 <primary>mailbox</primary>
48070 <secondary>time of last read</secondary>
48071 </indexterm>
48072 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
48073 timeouts when the mailbox is full and is not being read by its owner. Ideally,
48074 it should be based on the last time that the user accessed the mailbox.
48075 However, it is not always possible to determine this. Exim uses the following
48076 heuristic rules:
48077 </para>
48078 <itemizedlist>
48079 <listitem>
48080 <para>
48081 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
48082 used. As no new messages are being delivered (because the mailbox is over
48083 quota), Exim does not access the file, so this is the time of last user access.
48084 </para>
48085 </listitem>
48086 <listitem>
48087 <para>
48088 <indexterm role="concept">
48089 <primary>maildir format</primary>
48090 <secondary>time of last read</secondary>
48091 </indexterm>
48092 For a maildir delivery, the time of last modification of the <filename>new</filename>
48093 subdirectory is used. As the mailbox is over quota, no new files are created in
48094 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
48095 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
48096 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
48097 time that is used is therefore the last time that the user read a new message.
48098 </para>
48099 </listitem>
48100 <listitem>
48101 <para>
48102 For other kinds of multi-file mailbox, the time of last access cannot be
48103 obtained, so a retry rule that uses this type of error field is never matched.
48104 </para>
48105 </listitem>
48106 </itemizedlist>
48107 <para>
48108 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
48109 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
48110 when a local delivery is deferred because a partition is full (the ENOSPC
48111 error).
48112 </para>
48113 </section>
48114 <section id="SECID162">
48115 <title>Retry rules for specified senders</title>
48116 <para>
48117 <indexterm role="concept">
48118 <primary>retry</primary>
48119 <secondary>rules; sender-specific</secondary>
48120 </indexterm>
48121 You can specify retry rules that apply only when the failing message has a
48122 specific sender. In particular, this can be used to define retry rules that
48123 apply only to bounce messages. The third item in a retry rule can be of this
48124 form:
48125 </para>
48126 <literallayout>
48127 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
48128 </literallayout>
48129 <para>
48130 The retry timings themselves are then the fourth item. For example:
48131 </para>
48132 <literallayout class="monospaced">
48133 *   rcpt_4xx   senders=:   F,1h,30m
48134 </literallayout>
48135 <para>
48136 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
48137 host. If the address list contains white space, it must be enclosed in quotes.
48138 For example:
48139 </para>
48140 <literallayout class="monospaced">
48141 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
48142 </literallayout>
48143 <para>
48144 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
48145 (which do not depend on the recipient). The reason is that the sender is used
48146 only to match the retry rule. Once the rule has been found for a host error,
48147 its contents are used to set a retry time for the host, and this will apply to
48148 all messages, not just those with specific senders.
48149 </para>
48150 <para>
48151 When testing retry rules using <option>-brt</option>, you can supply a sender using the
48152 <option>-f</option> command line option, like this:
48153 </para>
48154 <literallayout class="monospaced">
48155 exim -f "" -brt user@dom.ain
48156 </literallayout>
48157 <para>
48158 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
48159 list is never matched.
48160 </para>
48161 </section>
48162 <section id="SECID163">
48163 <title>Retry parameters</title>
48164 <para>
48165 <indexterm role="concept">
48166 <primary>retry</primary>
48167 <secondary>parameters in rules</secondary>
48168 </indexterm>
48169 The third (or fourth, if a senders list is present) field in a retry rule is a
48170 sequence of retry parameter sets, separated by semicolons. Each set consists of
48171 </para>
48172 <literallayout>
48173 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
48174 </literallayout>
48175 <para>
48176 The letter identifies the algorithm for computing a new retry time; the cutoff
48177 time is the time beyond which this algorithm no longer applies, and the
48178 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
48179 time that the first failure for the domain (combined with the local part if
48180 relevant) was detected, not from the time the message was received.
48181 </para>
48182 <para>
48183 <indexterm role="concept">
48184 <primary>retry</primary>
48185 <secondary>algorithms</secondary>
48186 </indexterm>
48187 <indexterm role="concept">
48188 <primary>retry</primary>
48189 <secondary>fixed intervals</secondary>
48190 </indexterm>
48191 <indexterm role="concept">
48192 <primary>retry</primary>
48193 <secondary>increasing intervals</secondary>
48194 </indexterm>
48195 <indexterm role="concept">
48196 <primary>retry</primary>
48197 <secondary>random intervals</secondary>
48198 </indexterm>
48199 The available algorithms are:
48200 </para>
48201 <itemizedlist>
48202 <listitem>
48203 <para>
48204 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
48205 the interval.
48206 </para>
48207 </listitem>
48208 <listitem>
48209 <para>
48210 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
48211 specifies a starting value for the interval, and the second a multiplier, which
48212 is used to increase the size of the interval at each retry.
48213 </para>
48214 </listitem>
48215 <listitem>
48216 <para>
48217 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
48218 retry, the previous interval is multiplied by the factor in order to get a
48219 maximum for the next interval. The minimum interval is the first argument of
48220 the parameter, and an actual interval is chosen randomly between them. Such a
48221 rule has been found to be helpful in cluster configurations when all the
48222 members of the cluster restart at once, and may therefore synchronize their
48223 queue processing times.
48224 </para>
48225 </listitem>
48226 </itemizedlist>
48227 <para>
48228 When computing the next retry time, the algorithm definitions are scanned in
48229 order until one whose cutoff time has not yet passed is reached. This is then
48230 used to compute a new retry time that is later than the current time. In the
48231 case of fixed interval retries, this simply means adding the interval to the
48232 current time. For geometrically increasing intervals, retry intervals are
48233 computed from the rule&#x2019;s parameters until one that is greater than the previous
48234 interval is found. The main configuration variable
48235 <indexterm role="concept">
48236 <primary>limit</primary>
48237 <secondary>retry interval</secondary>
48238 </indexterm>
48239 <indexterm role="concept">
48240 <primary>retry</primary>
48241 <secondary>interval, maximum</secondary>
48242 </indexterm>
48243 <indexterm role="option">
48244 <primary><option>retry_interval_max</option></primary>
48245 </indexterm>
48246 <option>retry_interval_max</option> limits the maximum interval between retries. It
48247 cannot be set greater than <literal>24h</literal>, which is its default value.
48248 </para>
48249 <para>
48250 A single remote domain may have a number of hosts associated with it, and each
48251 host may have more than one IP address. Retry algorithms are selected on the
48252 basis of the domain name, but are applied to each IP address independently. If,
48253 for example, a host has two IP addresses and one is unusable, Exim will
48254 generate retry times for it and will not try to use it until its next retry
48255 time comes. Thus the good IP address is likely to be tried first most of the
48256 time.
48257 </para>
48258 <para>
48259 <indexterm role="concept">
48260 <primary>hints database</primary>
48261 <secondary>use for retrying</secondary>
48262 </indexterm>
48263 Retry times are hints rather than promises. Exim does not make any attempt to
48264 run deliveries exactly at the computed times. Instead, a queue runner process
48265 starts delivery processes for delayed messages periodically, and these attempt
48266 new deliveries only for those addresses that have passed their next retry time.
48267 If a new message arrives for a deferred address, an immediate delivery attempt
48268 occurs only if the address has passed its retry time. In the absence of new
48269 messages, the minimum time between retries is the interval between queue runner
48270 processes. There is not much point in setting retry times of five minutes if
48271 your queue runners happen only once an hour, unless there are a significant
48272 number of incoming messages (which might be the case on a system that is
48273 sending everything to a smart host, for example).
48274 </para>
48275 <para>
48276 The data in the retry hints database can be inspected by using the
48277 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
48278 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
48279 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
48280 are for the hosts associated with a particular mail domain, and also for local
48281 deliveries that have been deferred.
48282 </para>
48283 </section>
48284 <section id="SECID164">
48285 <title>Retry rule examples</title>
48286 <para>
48287 Here are some example retry rules:
48288 </para>
48289 <literallayout class="monospaced">
48290 alice@wonderland.fict.example quota_5d  F,7d,3h
48291 wonderland.fict.example       quota_5d
48292 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
48293 lookingglass.fict.example     *         F,24h,30m;
48294 *                 refused_A   F,2h,20m;
48295 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
48296 </literallayout>
48297 <para>
48298 The first rule sets up special handling for mail to
48299 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
48300 mailbox has not been read for at least 5 days. Retries continue every three
48301 hours for 7 days. The second rule handles over-quota errors for all other local
48302 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
48303 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
48304 fail are bounced immediately if the mailbox has not been read for at least 5
48305 days.
48306 </para>
48307 <para>
48308 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
48309 happen every 15 minutes for an hour, then with geometrically increasing
48310 intervals until two days have passed since a delivery first failed. After the
48311 first hour there is a delay of one hour, then two hours, then four hours, and
48312 so on (this is a rather extreme example).
48313 </para>
48314 <para>
48315 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
48316 They happen every 30 minutes for 24 hours only. The remaining two rules handle
48317 all other domains, with special action for connection refusal from hosts that
48318 were not obtained from an MX record.
48319 </para>
48320 <para>
48321 The final rule in a retry configuration should always have asterisks in the
48322 first two fields so as to provide a general catch-all for any addresses that do
48323 not have their own special handling. This example tries every 15 minutes for 2
48324 hours, then with intervals starting at one hour and increasing by a factor of
48325 1.5 up to 16 hours, then every 8 hours up to 5 days.
48326 </para>
48327 </section>
48328 <section id="SECID165">
48329 <title>Timeout of retry data</title>
48330 <para>
48331 <indexterm role="concept">
48332 <primary>timeout</primary>
48333 <secondary>of retry data</secondary>
48334 </indexterm>
48335 <indexterm role="option">
48336 <primary><option>retry_data_expire</option></primary>
48337 </indexterm>
48338 <indexterm role="concept">
48339 <primary>hints database</primary>
48340 <secondary>data expiry</secondary>
48341 </indexterm>
48342 <indexterm role="concept">
48343 <primary>retry</primary>
48344 <secondary>timeout of data</secondary>
48345 </indexterm>
48346 Exim timestamps the data that it writes to its retry hints database. When it
48347 consults the data during a delivery it ignores any that is older than the value
48348 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
48349 been tried for 7 days, Exim will try to deliver to it immediately a message
48350 arrives, and if that fails, it will calculate a retry time as if it were
48351 failing for the first time.
48352 </para>
48353 <para>
48354 This improves the behaviour for messages routed to rarely-used hosts such as MX
48355 backups. If such a host was down at one time, and happens to be down again when
48356 Exim tries a month later, using the old retry data would imply that it had been
48357 down all the time, which is not a justified assumption.
48358 </para>
48359 <para>
48360 If a host really is permanently dead, this behaviour causes a burst of retries
48361 every now and again, but only if messages routed to it are rare. If there is a
48362 message at least once every 7 days the retry data never expires.
48363 </para>
48364 </section>
48365 <section id="SECID166">
48366 <title>Long-term failures</title>
48367 <para>
48368 <indexterm role="concept">
48369 <primary>delivery failure, long-term</primary>
48370 </indexterm>
48371 <indexterm role="concept">
48372 <primary>retry</primary>
48373 <secondary>after long-term failure</secondary>
48374 </indexterm>
48375 Special processing happens when an email address has been failing for so long
48376 that the cutoff time for the last algorithm is reached. For example, using the
48377 default retry rule:
48378 </para>
48379 <literallayout class="monospaced">
48380 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
48381 </literallayout>
48382 <para>
48383 the cutoff time is four days. Reaching the retry cutoff is independent of how
48384 long any specific message has been failing; it is the length of continuous
48385 failure for the recipient address that counts.
48386 </para>
48387 <para>
48388 When the cutoff time is reached for a local delivery, or for all the IP
48389 addresses associated with a remote delivery, a subsequent delivery failure
48390 causes Exim to give up on the address, and a bounce message is generated.
48391 In order to cater for new messages that use the failing address, a next retry
48392 time is still computed from the final algorithm, and is used as follows:
48393 </para>
48394 <para>
48395 For local deliveries, one delivery attempt is always made for any subsequent
48396 messages. If this delivery fails, the address fails immediately. The
48397 post-cutoff retry time is not used.
48398 </para>
48399 <para>
48400 If the delivery is remote, there are two possibilities, controlled by the
48401 <indexterm role="option">
48402 <primary><option>delay_after_cutoff</option></primary>
48403 </indexterm>
48404 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
48405 default. Until the post-cutoff retry time for one of the IP addresses is
48406 reached, the failing email address is bounced immediately, without a delivery
48407 attempt taking place. After that time, one new delivery attempt is made to
48408 those IP addresses that are past their retry times, and if that still fails,
48409 the address is bounced and new retry times are computed.
48410 </para>
48411 <para>
48412 In other words, when all the hosts for a given email address have been failing
48413 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
48414 times is reached. Then it tries once, and bounces if that attempt fails. This
48415 behaviour ensures that few resources are wasted in repeatedly trying to deliver
48416 to a broken destination, but if the host does recover, Exim will eventually
48417 notice.
48418 </para>
48419 <para>
48420 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
48421 addresses are past their final cutoff time, Exim tries to deliver to those IP
48422 addresses that have not been tried since the message arrived. If there are
48423 no suitable IP addresses, or if they all fail, the address is bounced. In other
48424 words, it does not delay when a new message arrives, but tries the expired
48425 addresses immediately, unless they have been tried since the message arrived.
48426 If there is a continuous stream of messages for the failing domains, setting
48427 <option>delay_after_cutoff</option> false means that there will be many more attempts to
48428 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
48429 true.
48430 </para>
48431 </section>
48432 <section id="SECID167">
48433 <title>Deliveries that work intermittently</title>
48434 <para>
48435 <indexterm role="concept">
48436 <primary>retry</primary>
48437 <secondary>intermittently working deliveries</secondary>
48438 </indexterm>
48439 Some additional logic is needed to cope with cases where a host is
48440 intermittently available, or when a message has some attribute that prevents
48441 its delivery when others to the same address get through. In this situation,
48442 because some messages are successfully delivered, the <quote>retry clock</quote> for the
48443 host or address keeps getting reset by the successful deliveries, and so
48444 failing messages remain on the queue for ever because the cutoff time is never
48445 reached.
48446 </para>
48447 <para>
48448 Two exceptional actions are applied to prevent this happening. The first
48449 applies to errors that are related to a message rather than a remote host.
48450 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
48451 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
48452 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
48453 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
48454 is used when scanning the retry rules to decide when to try next and when to
48455 time out the address.
48456 </para>
48457 <para>
48458 The exceptional second action applies in all cases. If a message has been on
48459 the queue for longer than the cutoff time of any applicable retry rule for a
48460 given address, a delivery is attempted for that address, even if it is not yet
48461 time, and if this delivery fails, the address is timed out. A new retry time is
48462 not computed in this case, so that other messages for the same address are
48463 considered immediately.
48464 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
48465 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
48466 </para>
48467 </section>
48468 </chapter>
48469
48470 <chapter id="CHAPSMTPAUTH">
48471 <title>SMTP authentication</title>
48472 <para>
48473 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
48474 <primary>SMTP</primary>
48475 <secondary>authentication configuration</secondary>
48476 </indexterm>
48477 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
48478 <primary>authentication</primary>
48479 </indexterm>
48480 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
48481 with SMTP authentication. This facility is an extension to the SMTP protocol,
48482 described in RFC 2554, which allows a client SMTP host to authenticate itself
48483 to a server. This is a common way for a server to recognize clients that are
48484 permitted to use it as a relay. SMTP authentication is not of relevance to the
48485 transfer of mail between servers that have no managerial connection with each
48486 other.
48487 </para>
48488 <para>
48489 <indexterm role="concept">
48490 <primary>AUTH</primary>
48491 <secondary>description of</secondary>
48492 </indexterm>
48493 Very briefly, the way SMTP authentication works is as follows:
48494 </para>
48495 <itemizedlist>
48496 <listitem>
48497 <para>
48498 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
48499 the client&#x2019;s EHLO command.
48500 </para>
48501 </listitem>
48502 <listitem>
48503 <para>
48504 The client issues an AUTH command, naming a specific mechanism. The command
48505 may, optionally, contain some authentication data.
48506 </para>
48507 </listitem>
48508 <listitem>
48509 <para>
48510 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
48511 appropriate responses. In simple authentication mechanisms, the challenges are
48512 just prompts for user names and passwords. The server does not have to issue
48513 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
48514 with the AUTH command.
48515 </para>
48516 </listitem>
48517 <listitem>
48518 <para>
48519 The server either accepts or denies authentication.
48520 </para>
48521 </listitem>
48522 <listitem>
48523 <para>
48524 If authentication succeeds, the client may optionally make use of the AUTH
48525 option on the MAIL command to pass an authenticated sender in subsequent
48526 mail transactions. Authentication lasts for the remainder of the SMTP
48527 connection.
48528 </para>
48529 </listitem>
48530 <listitem>
48531 <para>
48532 If authentication fails, the client may give up, or it may try a different
48533 authentication mechanism, or it may try transferring mail over the
48534 unauthenticated connection.
48535 </para>
48536 </listitem>
48537 </itemizedlist>
48538 <para>
48539 If you are setting up a client, and want to know which authentication
48540 mechanisms the server supports, you can use Telnet to connect to port 25 (the
48541 SMTP port) on the server, and issue an EHLO command. The response to this
48542 includes the list of supported mechanisms. For example:
48543 </para>
48544 <literallayout>
48545 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
48546 <literal>Trying 192.168.34.25...</literal>
48547 <literal>Connected to server.example.</literal>
48548 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
48549 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
48550 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
48551 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
48552 <literal>250-SIZE 52428800</literal>
48553 <literal>250-PIPELINING</literal>
48554 <literal>250-AUTH PLAIN</literal>
48555 <literal>250 HELP</literal>
48556 </literallayout>
48557 <para>
48558 The second-last line of this example output shows that the server supports
48559 authentication using the PLAIN mechanism. In Exim, the different authentication
48560 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
48561 routers and transports, which authenticators are included in the binary is
48562 controlled by build-time definitions. The following are currently available,
48563 included by setting
48564 </para>
48565 <literallayout class="monospaced">
48566 AUTH_CRAM_MD5=yes
48567 AUTH_CYRUS_SASL=yes
48568 AUTH_DOVECOT=yes
48569 AUTH_GSASL=yes
48570 AUTH_HEIMDAL_GSSAPI=yes
48571 AUTH_PLAINTEXT=yes
48572 AUTH_SPA=yes
48573 AUTH_TLS=yes
48574 </literallayout>
48575 <para>
48576 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
48577 authentication mechanism (RFC 2195), and the second provides an interface to
48578 the Cyrus SASL authentication library.
48579 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
48580 work via a socket interface.
48581 The fourth provides an interface to the GNU SASL authentication library, which
48582 provides mechanisms but typically not data sources.
48583 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
48584 supporting setting a server keytab.
48585 The sixth can be configured to support
48586 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
48587 not formally documented, but used by several MUAs. The seventh authenticator
48588 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
48589 </para>
48590 <para revisionflag="changed">
48591 The eighth is an Exim authenticator but not an SMTP one;
48592 instead it can use information from a TLS negotiation.
48593 </para>
48594 <para>
48595 The authenticators are configured using the same syntax as other drivers (see
48596 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
48597 authentication section need be present in the configuration file. Each
48598 authenticator can in principle have both server and client functions. When Exim
48599 is receiving SMTP mail, it is acting as a server; when it is sending out
48600 messages over SMTP, it is acting as a client. Authenticator configuration
48601 options are provided for use in both these circumstances.
48602 </para>
48603 <para>
48604 To make it clear which options apply to which situation, the prefixes
48605 <option>server_</option> and <option>client_</option> are used on option names that are specific to
48606 either the server or the client function, respectively. Server and client
48607 functions are disabled if none of their options are set. If an authenticator is
48608 to be used for both server and client functions, a single definition, using
48609 both sets of options, is required. For example:
48610 </para>
48611 <literallayout class="monospaced">
48612 cram:
48613   driver = cram_md5
48614   public_name = CRAM-MD5
48615   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
48616   client_name = ph10
48617   client_secret = secret2
48618 </literallayout>
48619 <para>
48620 The <option>server_</option> option is used when Exim is acting as a server, and the
48621 <option>client_</option> options when it is acting as a client.
48622 </para>
48623 <para>
48624 Descriptions of the individual authenticators are given in subsequent chapters.
48625 The remainder of this chapter covers the generic options for the
48626 authenticators, followed by general discussion of the way authentication works
48627 in Exim.
48628 </para>
48629 <para>
48630 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
48631 per-mechanism basis.  Please read carefully to determine which variables hold
48632 account labels such as usercodes and which hold passwords or other
48633 authenticating data.
48634 </para>
48635 <para>
48636 Note that some mechanisms support two different identifiers for accounts: the
48637 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
48638 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
48639 Conceptually, authentication data such as passwords are tied to the identifier
48640 used to authenticate; servers may have rules to permit one user to act as a
48641 second user, so that after login the session is treated as though that second
48642 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
48643 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
48644 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
48645 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
48646 choose to honour.
48647 </para>
48648 <para>
48649 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
48650 to a client to help it select an account and credentials to use.  In some
48651 mechanisms, the client and server provably agree on the realm, but clients
48652 typically can not treat the realm as secure data to be blindly trusted.
48653 </para>
48654 <section id="SECID168">
48655 <title>Generic options for authenticators</title>
48656 <para>
48657 <indexterm role="concept">
48658 <primary>authentication</primary>
48659 <secondary>generic options</secondary>
48660 </indexterm>
48661 <indexterm role="concept">
48662 <primary>options</primary>
48663 <secondary>generic; for authenticators</secondary>
48664 </indexterm>
48665 </para>
48666 <para>
48667 <indexterm role="option">
48668 <primary><option>client_condition</option></primary>
48669 </indexterm>
48670 </para>
48671 <informaltable frame="all">
48672 <tgroup cols="4" colsep="0" rowsep="0">
48673 <colspec colwidth="8*" align="left"/>
48674 <colspec colwidth="6*" align="center"/>
48675 <colspec colwidth="6*" align="center"/>
48676 <colspec colwidth="6*" align="right"/>
48677 <tbody>
48678 <row>
48679 <entry><option>client_condition</option></entry>
48680 <entry>Use: <emphasis>authenticators</emphasis></entry>
48681 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48682 <entry>Default: <emphasis>unset</emphasis></entry>
48683 </row>
48684 </tbody>
48685 </tgroup>
48686 </informaltable>
48687 <para>
48688 When Exim is authenticating as a client, it skips any authenticator whose
48689 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
48690 used, for example, to skip plain text authenticators when the connection is not
48691 encrypted by a setting such as:
48692 </para>
48693 <literallayout class="monospaced">
48694 client_condition = ${if !eq{$tls_out_cipher}{}}
48695 </literallayout>
48696 <para>
48697 <indexterm role="option">
48698 <primary><option>client_set_id</option></primary>
48699 </indexterm>
48700 </para>
48701 <informaltable frame="all">
48702 <tgroup cols="4" colsep="0" rowsep="0">
48703 <colspec colwidth="8*" align="left"/>
48704 <colspec colwidth="6*" align="center"/>
48705 <colspec colwidth="6*" align="center"/>
48706 <colspec colwidth="6*" align="right"/>
48707 <tbody>
48708 <row>
48709 <entry><option>client_set_id</option></entry>
48710 <entry>Use: <emphasis>authenticators</emphasis></entry>
48711 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48712 <entry>Default: <emphasis>unset</emphasis></entry>
48713 </row>
48714 </tbody>
48715 </tgroup>
48716 </informaltable>
48717 <para>
48718 When client authentication succeeds, this condition is expanded; the
48719 result is used in the log lines for outbound messages.
48720 Typically it will be the user name used for authentication.
48721 </para>
48722 <para>
48723 <indexterm role="option">
48724 <primary><option>driver</option></primary>
48725 </indexterm>
48726 </para>
48727 <informaltable frame="all">
48728 <tgroup cols="4" colsep="0" rowsep="0">
48729 <colspec colwidth="8*" align="left"/>
48730 <colspec colwidth="6*" align="center"/>
48731 <colspec colwidth="6*" align="center"/>
48732 <colspec colwidth="6*" align="right"/>
48733 <tbody>
48734 <row>
48735 <entry><option>driver</option></entry>
48736 <entry>Use: <emphasis>authenticators</emphasis></entry>
48737 <entry>Type: <emphasis>string</emphasis></entry>
48738 <entry>Default: <emphasis>unset</emphasis></entry>
48739 </row>
48740 </tbody>
48741 </tgroup>
48742 </informaltable>
48743 <para>
48744 This option must always be set. It specifies which of the available
48745 authenticators is to be used.
48746 </para>
48747 <para>
48748 <indexterm role="option">
48749 <primary><option>public_name</option></primary>
48750 </indexterm>
48751 </para>
48752 <informaltable frame="all">
48753 <tgroup cols="4" colsep="0" rowsep="0">
48754 <colspec colwidth="8*" align="left"/>
48755 <colspec colwidth="6*" align="center"/>
48756 <colspec colwidth="6*" align="center"/>
48757 <colspec colwidth="6*" align="right"/>
48758 <tbody>
48759 <row>
48760 <entry><option>public_name</option></entry>
48761 <entry>Use: <emphasis>authenticators</emphasis></entry>
48762 <entry>Type: <emphasis>string</emphasis></entry>
48763 <entry>Default: <emphasis>unset</emphasis></entry>
48764 </row>
48765 </tbody>
48766 </tgroup>
48767 </informaltable>
48768 <para>
48769 This option specifies the name of the authentication mechanism that the driver
48770 implements, and by which it is known to the outside world. These names should
48771 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
48772 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
48773 defaults to the driver&#x2019;s instance name.
48774 </para>
48775 <para>
48776 <indexterm role="option">
48777 <primary><option>server_advertise_condition</option></primary>
48778 </indexterm>
48779 </para>
48780 <informaltable frame="all">
48781 <tgroup cols="4" colsep="0" rowsep="0">
48782 <colspec colwidth="8*" align="left"/>
48783 <colspec colwidth="6*" align="center"/>
48784 <colspec colwidth="6*" align="center"/>
48785 <colspec colwidth="6*" align="right"/>
48786 <tbody>
48787 <row>
48788 <entry><option>server_advertise_condition</option></entry>
48789 <entry>Use: <emphasis>authenticators</emphasis></entry>
48790 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48791 <entry>Default: <emphasis>unset</emphasis></entry>
48792 </row>
48793 </tbody>
48794 </tgroup>
48795 </informaltable>
48796 <para>
48797 When a server is about to advertise an authentication mechanism, the condition
48798 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
48799 mechanism is not advertised.
48800 If the expansion fails, the mechanism is not advertised. If the failure was not
48801 forced, and was not caused by a lookup defer, the incident is logged.
48802 See section <xref linkend="SECTauthexiser"/> below for further discussion.
48803 </para>
48804 <para>
48805 <indexterm role="option">
48806 <primary><option>server_condition</option></primary>
48807 </indexterm>
48808 </para>
48809 <informaltable frame="all">
48810 <tgroup cols="4" colsep="0" rowsep="0">
48811 <colspec colwidth="8*" align="left"/>
48812 <colspec colwidth="6*" align="center"/>
48813 <colspec colwidth="6*" align="center"/>
48814 <colspec colwidth="6*" align="right"/>
48815 <tbody>
48816 <row>
48817 <entry><option>server_condition</option></entry>
48818 <entry>Use: <emphasis>authenticators</emphasis></entry>
48819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48820 <entry>Default: <emphasis>unset</emphasis></entry>
48821 </row>
48822 </tbody>
48823 </tgroup>
48824 </informaltable>
48825 <para>
48826 This option must be set for a <option>plaintext</option> server authenticator, where it
48827 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
48828 for details.
48829 </para>
48830 <para>
48831 For the <command>gsasl</command> authenticator, this option is required for various
48832 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
48833 </para>
48834 <para>
48835 For the other authenticators, <option>server_condition</option> can be used as an additional
48836 authentication or authorization mechanism that is applied after the other
48837 authenticator conditions succeed. If it is set, it is expanded when the
48838 authenticator would otherwise return a success code. If the expansion is forced
48839 to fail, authentication fails. Any other expansion failure causes a temporary
48840 error code to be returned. If the result of a successful expansion is an empty
48841 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48842 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
48843 other result, a temporary error code is returned, with the expanded string as
48844 the error text.
48845 </para>
48846 <para>
48847 <indexterm role="option">
48848 <primary><option>server_debug_print</option></primary>
48849 </indexterm>
48850 </para>
48851 <informaltable frame="all">
48852 <tgroup cols="4" colsep="0" rowsep="0">
48853 <colspec colwidth="8*" align="left"/>
48854 <colspec colwidth="6*" align="center"/>
48855 <colspec colwidth="6*" align="center"/>
48856 <colspec colwidth="6*" align="right"/>
48857 <tbody>
48858 <row>
48859 <entry><option>server_debug_print</option></entry>
48860 <entry>Use: <emphasis>authenticators</emphasis></entry>
48861 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48862 <entry>Default: <emphasis>unset</emphasis></entry>
48863 </row>
48864 </tbody>
48865 </tgroup>
48866 </informaltable>
48867 <para>
48868 If this option is set and authentication debugging is enabled (see the <option>-d</option>
48869 command line option), the string is expanded and included in the debugging
48870 output when the authenticator is run as a server. This can help with checking
48871 out the values of variables.
48872 If expansion of the string fails, the error message is written to the debugging
48873 output, and Exim carries on processing.
48874 </para>
48875 <para>
48876 <indexterm role="option">
48877 <primary><option>server_set_id</option></primary>
48878 </indexterm>
48879 </para>
48880 <informaltable frame="all">
48881 <tgroup cols="4" colsep="0" rowsep="0">
48882 <colspec colwidth="8*" align="left"/>
48883 <colspec colwidth="6*" align="center"/>
48884 <colspec colwidth="6*" align="center"/>
48885 <colspec colwidth="6*" align="right"/>
48886 <tbody>
48887 <row>
48888 <entry><option>server_set_id</option></entry>
48889 <entry>Use: <emphasis>authenticators</emphasis></entry>
48890 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48891 <entry>Default: <emphasis>unset</emphasis></entry>
48892 </row>
48893 </tbody>
48894 </tgroup>
48895 </informaltable>
48896 <para>
48897 <indexterm role="variable">
48898 <primary><varname>$authenticated_id</varname></primary>
48899 </indexterm>
48900 When an Exim server successfully authenticates a client, this string is
48901 expanded using data from the authentication, and preserved for any incoming
48902 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
48903 lines for incoming messages. For example, a user/password authenticator
48904 configuration might preserve the user name that was used to authenticate, and
48905 refer to it subsequently during delivery of the message.
48906 If expansion fails, the option is ignored.
48907 </para>
48908 <para>
48909 <indexterm role="option">
48910 <primary><option>server_mail_auth_condition</option></primary>
48911 </indexterm>
48912 </para>
48913 <informaltable frame="all">
48914 <tgroup cols="4" colsep="0" rowsep="0">
48915 <colspec colwidth="8*" align="left"/>
48916 <colspec colwidth="6*" align="center"/>
48917 <colspec colwidth="6*" align="center"/>
48918 <colspec colwidth="6*" align="right"/>
48919 <tbody>
48920 <row>
48921 <entry><option>server_mail_auth_condition</option></entry>
48922 <entry>Use: <emphasis>authenticators</emphasis></entry>
48923 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48924 <entry>Default: <emphasis>unset</emphasis></entry>
48925 </row>
48926 </tbody>
48927 </tgroup>
48928 </informaltable>
48929 <para>
48930 This option allows a server to discard authenticated sender addresses supplied
48931 as part of MAIL commands in SMTP connections that are authenticated by the
48932 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
48933 as part of the authentication process; instead its (unexpanded) value is
48934 remembered for later use.
48935 How it is used is described in the following section.
48936 </para>
48937 </section>
48938 <section id="SECTauthparamail">
48939 <title>The AUTH parameter on MAIL commands</title>
48940 <para>
48941 <indexterm role="concept">
48942 <primary>authentication</primary>
48943 <secondary>sender; authenticated</secondary>
48944 </indexterm>
48945 <indexterm role="concept">
48946 <primary>AUTH</primary>
48947 <secondary>on MAIL command</secondary>
48948 </indexterm>
48949 When a client supplied an AUTH= item on a MAIL command, Exim applies
48950 the following checks before accepting it as the authenticated sender of the
48951 message:
48952 </para>
48953 <itemizedlist>
48954 <listitem>
48955 <para>
48956 If the connection is not using extended SMTP (that is, HELO was used rather
48957 than EHLO), the use of AUTH= is a syntax error.
48958 </para>
48959 </listitem>
48960 <listitem>
48961 <para>
48962 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
48963 </para>
48964 </listitem>
48965 <listitem>
48966 <para>
48967 <indexterm role="variable">
48968 <primary><varname>$authenticated_sender</varname></primary>
48969 </indexterm>
48970 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
48971 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
48972 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
48973 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
48974 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
48975 given for the MAIL command.
48976 </para>
48977 </listitem>
48978 <listitem>
48979 <para>
48980 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
48981 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
48982 authenticated.
48983 </para>
48984 </listitem>
48985 <listitem>
48986 <para>
48987 If the AUTH= value was accepted by either of the two previous rules, and
48988 the client has authenticated, and the authenticator has a setting for the
48989 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
48990 valued that was saved from the authenticator is expanded. If the expansion
48991 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
48992 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
48993 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
48994 message.
48995 </para>
48996 </listitem>
48997 </itemizedlist>
48998 <para>
48999 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
49000 hosts to which Exim authenticates as a client. Do not confuse this value with
49001 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
49002 process, and which is not usually a complete email address.
49003 </para>
49004 <para>
49005 <indexterm role="variable">
49006 <primary><varname>$sender_address</varname></primary>
49007 </indexterm>
49008 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
49009 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
49010 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
49011 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
49012 ACL is run.
49013 </para>
49014 </section>
49015 <section id="SECTauthexiser">
49016 <title>Authentication on an Exim server</title>
49017 <para>
49018 <indexterm role="concept">
49019 <primary>authentication</primary>
49020 <secondary>on an Exim server</secondary>
49021 </indexterm>
49022 When Exim receives an EHLO command, it advertises the public names of those
49023 authenticators that are configured as servers, subject to the following
49024 conditions:
49025 </para>
49026 <itemizedlist>
49027 <listitem>
49028 <para>
49029 The client host must match <option>auth_advertise_hosts</option> (default *).
49030 </para>
49031 </listitem>
49032 <listitem>
49033 <para>
49034 It the <option>server_advertise_condition</option> option is set, its expansion must not
49035 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
49036 </para>
49037 </listitem>
49038 </itemizedlist>
49039 <para>
49040 The order in which the authenticators are defined controls the order in which
49041 the mechanisms are advertised.
49042 </para>
49043 <para>
49044 Some mail clients (for example, some versions of Netscape) require the user to
49045 provide a name and password for authentication whenever AUTH is advertised,
49046 even though authentication may not in fact be needed (for example, Exim may be
49047 set up to allow unconditional relaying from the client by an IP address check).
49048 You can make such clients more friendly by not advertising AUTH to them.
49049 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
49050 that runs for RCPT) to relay without authentication, you should set
49051 </para>
49052 <literallayout class="monospaced">
49053 auth_advertise_hosts = ! 10.9.8.0/24
49054 </literallayout>
49055 <para>
49056 so that no authentication mechanisms are advertised to them.
49057 </para>
49058 <para>
49059 The <option>server_advertise_condition</option> controls the advertisement of individual
49060 authentication mechanisms. For example, it can be used to restrict the
49061 advertisement of a particular mechanism to encrypted connections, by a setting
49062 such as:
49063 </para>
49064 <literallayout class="monospaced">
49065 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
49066 </literallayout>
49067 <para>
49068 <indexterm role="variable">
49069 <primary><varname>$tls_in_cipher</varname></primary>
49070 </indexterm>
49071 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
49072 yields <quote>yes</quote>, which allows the advertisement to happen.
49073 </para>
49074 <para>
49075 When an Exim server receives an AUTH command from a client, it rejects it
49076 immediately if AUTH was not advertised in response to an earlier EHLO
49077 command. This is the case if
49078 </para>
49079 <itemizedlist>
49080 <listitem>
49081 <para>
49082 The client host does not match <option>auth_advertise_hosts</option>; or
49083 </para>
49084 </listitem>
49085 <listitem>
49086 <para>
49087 No authenticators are configured with server options; or
49088 </para>
49089 </listitem>
49090 <listitem>
49091 <para>
49092 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
49093 server authenticators.
49094 </para>
49095 </listitem>
49096 </itemizedlist>
49097 <para>
49098 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
49099 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
49100 AUTH is accepted from any client host.
49101 </para>
49102 <para>
49103 If AUTH is not rejected by the ACL, Exim searches its configuration for a
49104 server authentication mechanism that was advertised in response to EHLO and
49105 that matches the one named in the AUTH command. If it finds one, it runs
49106 the appropriate authentication protocol, and authentication either succeeds or
49107 fails. If there is no matching advertised mechanism, the AUTH command is
49108 rejected with a 504 error.
49109 </para>
49110 <para>
49111 <indexterm role="variable">
49112 <primary><varname>$received_protocol</varname></primary>
49113 </indexterm>
49114 <indexterm role="variable">
49115 <primary><varname>$sender_host_authenticated</varname></primary>
49116 </indexterm>
49117 When a message is received from an authenticated host, the value of
49118 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
49119 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
49120 public name) of the authenticator driver that successfully authenticated the
49121 client from which the message was received. This variable is empty if there was
49122 no successful authentication.
49123 </para>
49124 </section>
49125 <section id="SECID169">
49126 <title>Testing server authentication</title>
49127 <para>
49128 <indexterm role="concept">
49129 <primary>authentication</primary>
49130 <secondary>testing a server</secondary>
49131 </indexterm>
49132 <indexterm role="concept">
49133 <primary>AUTH</primary>
49134 <secondary>testing a server</secondary>
49135 </indexterm>
49136 <indexterm role="concept">
49137 <primary>base64 encoding</primary>
49138 <secondary>creating authentication test data</secondary>
49139 </indexterm>
49140 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
49141 configurations. The data for the AUTH command has to be sent using base64
49142 encoding. A quick way to produce such data for testing is the following Perl
49143 script:
49144 </para>
49145 <literallayout class="monospaced">
49146 use MIME::Base64;
49147 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
49148 </literallayout>
49149 <para>
49150 <indexterm role="concept">
49151 <primary>binary zero</primary>
49152 <secondary>in authentication data</secondary>
49153 </indexterm>
49154 This interprets its argument as a Perl string, and then encodes it. The
49155 interpretation as a Perl string allows binary zeros, which are required for
49156 some kinds of authentication, to be included in the data. For example, a
49157 command line to run this script on such data might be
49158 </para>
49159 <literallayout class="monospaced">
49160 encode '\0user\0password'
49161 </literallayout>
49162 <para>
49163 Note the use of single quotes to prevent the shell interpreting the
49164 backslashes, so that they can be interpreted by Perl to specify characters
49165 whose code value is zero.
49166 </para>
49167 <para>
49168 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
49169 digit, you must use three zeros instead of one after the leading backslash. If
49170 you do not, the octal digit that starts your string will be incorrectly
49171 interpreted as part of the code for the first character.
49172 </para>
49173 <para>
49174 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
49175 specially, you must use a Perl escape to prevent them being misinterpreted. For
49176 example, a command such as
49177 </para>
49178 <literallayout class="monospaced">
49179 encode '\0user@domain.com\0pas$$word'
49180 </literallayout>
49181 <para>
49182 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
49183 </para>
49184 <para>
49185 If you have the <option>mimencode</option> command installed, another way to do produce
49186 base64-encoded strings is to run the command
49187 </para>
49188 <literallayout class="monospaced">
49189 echo -e -n `\0user\0password' | mimencode
49190 </literallayout>
49191 <para>
49192 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
49193 in the argument, and the <option>-n</option> option specifies no newline at the end of its
49194 output. However, not all versions of <option>echo</option> recognize these options, so you
49195 should check your version before relying on this suggestion.
49196 </para>
49197 </section>
49198 <section id="SECID170">
49199 <title>Authentication by an Exim client</title>
49200 <para>
49201 <indexterm role="concept">
49202 <primary>authentication</primary>
49203 <secondary>on an Exim client</secondary>
49204 </indexterm>
49205 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
49206 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
49207 announces support for authentication, and the host matches an entry in either
49208 of these options, Exim (as a client) tries to authenticate as follows:
49209 </para>
49210 <itemizedlist>
49211 <listitem>
49212 <para>
49213 For each authenticator that is configured as a client, in the order in which
49214 they are defined in the configuration, it searches the authentication
49215 mechanisms announced by the server for one whose name matches the public name
49216 of the authenticator.
49217 </para>
49218 </listitem>
49219 <listitem>
49220 <para>
49221 <indexterm role="variable">
49222 <primary><varname>$host</varname></primary>
49223 </indexterm>
49224 <indexterm role="variable">
49225 <primary><varname>$host_address</varname></primary>
49226 </indexterm>
49227 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
49228 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
49229 that the client might do. They are set to the server&#x2019;s name and IP address. If
49230 any expansion is forced to fail, the authentication attempt is abandoned, and
49231 Exim moves on to the next authenticator. Otherwise an expansion failure causes
49232 delivery to be deferred.
49233 </para>
49234 </listitem>
49235 <listitem>
49236 <para>
49237 If the result of the authentication attempt is a temporary error or a timeout,
49238 Exim abandons trying to send the message to the host for the moment. It will
49239 try again later. If there are any backup hosts available, they are tried in the
49240 usual way.
49241 </para>
49242 </listitem>
49243 <listitem>
49244 <para>
49245 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
49246 carries on searching the list of authenticators and tries another one if
49247 possible. If all authentication attempts give permanent errors, or if there are
49248 no attempts because no mechanisms match (or option expansions force failure),
49249 what happens depends on whether the host matches <option>hosts_require_auth</option> or
49250 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
49251 delivery is deferred. The error can be detected in the retry rules, and thereby
49252 turned into a permanent error if you wish. In the second case, Exim tries to
49253 deliver the message unauthenticated.
49254 </para>
49255 </listitem>
49256 </itemizedlist>
49257 <para>
49258 <indexterm role="concept">
49259 <primary>AUTH</primary>
49260 <secondary>on MAIL command</secondary>
49261 </indexterm>
49262 When Exim has authenticated itself to a remote server, it adds the AUTH
49263 parameter to the MAIL commands it sends, if it has an authenticated sender for
49264 the message. If the message came from a remote host, the authenticated sender
49265 is the one that was receiving on an incoming MAIL command, provided that the
49266 incoming connection was authenticated and the <option>server_mail_auth</option> condition
49267 allowed the authenticated sender to be retained. If a local process calls Exim
49268 to send a message, the sender address that is built from the login name and
49269 <option>qualify_domain</option> is treated as authenticated. However, if the
49270 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
49271 the authenticated sender that was received with the message.
49272 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
49273 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
49274 </para>
49275 </section>
49276 </chapter>
49277
49278 <chapter id="CHAPplaintext">
49279 <title>The plaintext authenticator</title>
49280 <para>
49281 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
49282 <primary><command>plaintext</command> authenticator</primary>
49283 </indexterm>
49284 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
49285 <primary>authenticators</primary>
49286 <secondary><command>plaintext</command></secondary>
49287 </indexterm>
49288 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
49289 LOGIN authentication mechanisms, both of which transfer authentication data as
49290 plain (unencrypted) text (though base64 encoded). The use of plain text is a
49291 security risk; you are strongly advised to insist on the use of SMTP encryption
49292 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
49293 use unencrypted plain text, you should not use the same passwords for SMTP
49294 connections as you do for login accounts.
49295 </para>
49296 <section id="SECID171">
49297 <title>Plaintext options</title>
49298 <para>
49299 <indexterm role="concept">
49300 <primary>options</primary>
49301 <secondary><command>plaintext</command> authenticator (server)</secondary>
49302 </indexterm>
49303 When configured as a server, <command>plaintext</command> uses the following options:
49304 </para>
49305 <para>
49306 <indexterm role="option">
49307 <primary><option>server_condition</option></primary>
49308 </indexterm>
49309 </para>
49310 <informaltable frame="all">
49311 <tgroup cols="4" colsep="0" rowsep="0">
49312 <colspec colwidth="8*" align="left"/>
49313 <colspec colwidth="6*" align="center"/>
49314 <colspec colwidth="6*" align="center"/>
49315 <colspec colwidth="6*" align="right"/>
49316 <tbody>
49317 <row>
49318 <entry><option>server_condition</option></entry>
49319 <entry>Use: <emphasis>authenticators</emphasis></entry>
49320 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49321 <entry>Default: <emphasis>unset</emphasis></entry>
49322 </row>
49323 </tbody>
49324 </tgroup>
49325 </informaltable>
49326 <para>
49327 This is actually a global authentication option, but it must be set in order to
49328 configure the <command>plaintext</command> driver as a server. Its use is described below.
49329 </para>
49330 <para>
49331 <indexterm role="option">
49332 <primary><option>server_prompts</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_prompts</option></entry>
49344 <entry>Use: <emphasis>plaintext</emphasis></entry>
49345 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49346 <entry>Default: <emphasis>unset</emphasis></entry>
49347 </row>
49348 </tbody>
49349 </tgroup>
49350 </informaltable>
49351 <para>
49352 The contents of this option, after expansion, must be a colon-separated list of
49353 prompt strings. If expansion fails, a temporary authentication rejection is
49354 given.
49355 </para>
49356 </section>
49357 <section id="SECTplainserver">
49358 <title>Using plaintext in a server</title>
49359 <para>
49360 <indexterm role="concept">
49361 <primary>AUTH</primary>
49362 <secondary>in <command>plaintext</command> authenticator</secondary>
49363 </indexterm>
49364 <indexterm role="concept">
49365 <primary>binary zero</primary>
49366 <secondary>in <command>plaintext</command> authenticator</secondary>
49367 </indexterm>
49368 <indexterm role="concept">
49369 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49370 <secondary>in <command>plaintext</command> authenticator</secondary>
49371 </indexterm>
49372 <indexterm role="variable">
49373 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49374 </indexterm>
49375 <indexterm role="concept">
49376 <primary>base64 encoding</primary>
49377 <secondary>in <command>plaintext</command> authenticator</secondary>
49378 </indexterm>
49379 </para>
49380 <para>
49381 When running as a server, <command>plaintext</command> performs the authentication test by
49382 expanding a string. The data sent by the client with the AUTH command, or in
49383 response to subsequent prompts, is base64 encoded, and so may contain any byte
49384 values when decoded. If any data is supplied with the command, it is treated as
49385 a list of strings, separated by NULs (binary zeros), the first three of which
49386 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
49387 (neither LOGIN nor PLAIN uses more than three strings).
49388 </para>
49389 <para>
49390 For compatibility with previous releases of Exim, the values are also placed in
49391 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
49392 variables for this purpose is now deprecated, as it can lead to confusion in
49393 string expansions that also use them for other things.
49394 </para>
49395 <para>
49396 If there are more strings in <option>server_prompts</option> than the number of strings
49397 supplied with the AUTH command, the remaining prompts are used to obtain more
49398 data. Each response from the client may be a list of NUL-separated strings.
49399 </para>
49400 <para>
49401 <indexterm role="variable">
49402 <primary><varname>$authenticated_id</varname></primary>
49403 </indexterm>
49404 Once a sufficient number of data strings have been received,
49405 <option>server_condition</option> is expanded. If the expansion is forced to fail,
49406 authentication fails. Any other expansion failure causes a temporary error code
49407 to be returned. If the result of a successful expansion is an empty string,
49408 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
49409 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
49410 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
49411 For any other result, a temporary error code is returned, with the expanded
49412 string as the error text
49413 </para>
49414 <para>
49415 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
49416 password, be sure to make the authentication fail if the user is unknown.
49417 There are good and bad examples at the end of the next section.
49418 </para>
49419 </section>
49420 <section id="SECID172">
49421 <title>The PLAIN authentication mechanism</title>
49422 <para>
49423 <indexterm role="concept">
49424 <primary>PLAIN authentication mechanism</primary>
49425 </indexterm>
49426 <indexterm role="concept">
49427 <primary>authentication</primary>
49428 <secondary>PLAIN mechanism</secondary>
49429 </indexterm>
49430 <indexterm role="concept">
49431 <primary>binary zero</primary>
49432 <secondary>in <command>plaintext</command> authenticator</secondary>
49433 </indexterm>
49434 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
49435 sent as one item of data (that is, one combined string containing two NUL
49436 separators). The data is sent either as part of the AUTH command, or
49437 subsequently in response to an empty prompt from the server.
49438 </para>
49439 <para>
49440 The second and third strings are a user name and a corresponding password.
49441 Using a single fixed user name and password as an example, this could be
49442 configured as follows:
49443 </para>
49444 <literallayout class="monospaced">
49445 fixed_plain:
49446   driver = plaintext
49447   public_name = PLAIN
49448   server_prompts = :
49449   server_condition = \
49450     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
49451   server_set_id = $auth2
49452 </literallayout>
49453 <para>
49454 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
49455 are exactly what we want here, so they need not be specified. Obviously, if the
49456 password contains expansion-significant characters such as dollar, backslash,
49457 or closing brace, they have to be escaped.
49458 </para>
49459 <para>
49460 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
49461 the end of a string list are ignored). If all the data comes as part of the
49462 AUTH command, as is commonly the case, the prompt is not used. This
49463 authenticator is advertised in the response to EHLO as
49464 </para>
49465 <literallayout class="monospaced">
49466 250-AUTH PLAIN
49467 </literallayout>
49468 <para>
49469 and a client host can authenticate itself by sending the command
49470 </para>
49471 <literallayout class="monospaced">
49472 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
49473 </literallayout>
49474 <para>
49475 As this contains three strings (more than the number of prompts), no further
49476 data is required from the client. Alternatively, the client may just send
49477 </para>
49478 <literallayout class="monospaced">
49479 AUTH PLAIN
49480 </literallayout>
49481 <para>
49482 to initiate authentication, in which case the server replies with an empty
49483 prompt. The client must respond with the combined data string.
49484 </para>
49485 <para>
49486 The data string is base64 encoded, as required by the RFC. This example,
49487 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;
49488 represents a zero byte. This is split up into three strings, the first of which
49489 is empty. The <option>server_condition</option> option in the authenticator checks that the
49490 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
49491 </para>
49492 <para>
49493 Having just one fixed user name and password, as in this example, is not very
49494 realistic, though for a small organization with only a handful of
49495 authenticating clients it could make sense.
49496 </para>
49497 <para>
49498 A more sophisticated instance of this authenticator could use the user name in
49499 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
49500 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
49501 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
49502 This is an incorrect example:
49503 </para>
49504 <literallayout class="monospaced">
49505 server_condition = \
49506   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
49507 </literallayout>
49508 <para>
49509 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
49510 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
49511 incorrect? It works fine for existing users, but consider what happens if a
49512 non-existent user name is given. The lookup fails, but as no success/failure
49513 strings are given for the lookup, it yields an empty string. Thus, to defeat
49514 the authentication, all a client has to do is to supply a non-existent user
49515 name and an empty password. The correct way of writing this test is:
49516 </para>
49517 <literallayout class="monospaced">
49518 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
49519   {${if eq{$value}{$auth3}}} {false}}
49520 </literallayout>
49521 <para>
49522 In this case, if the lookup succeeds, the result is checked; if the lookup
49523 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
49524 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
49525 always fails if its second argument is empty. However, the second way of
49526 writing the test makes the logic clearer.
49527 </para>
49528 </section>
49529 <section id="SECID173">
49530 <title>The LOGIN authentication mechanism</title>
49531 <para>
49532 <indexterm role="concept">
49533 <primary>LOGIN authentication mechanism</primary>
49534 </indexterm>
49535 <indexterm role="concept">
49536 <primary>authentication</primary>
49537 <secondary>LOGIN mechanism</secondary>
49538 </indexterm>
49539 The LOGIN authentication mechanism is not documented in any RFC, but is in use
49540 in a number of programs. No data is sent with the AUTH command. Instead, a
49541 user name and password are supplied separately, in response to prompts. The
49542 plaintext authenticator can be configured to support this as in this example:
49543 </para>
49544 <literallayout class="monospaced">
49545 fixed_login:
49546   driver = plaintext
49547   public_name = LOGIN
49548   server_prompts = User Name : Password
49549   server_condition = \
49550     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
49551   server_set_id = $auth1
49552 </literallayout>
49553 <para>
49554 Because of the way plaintext operates, this authenticator accepts data supplied
49555 with the AUTH command (in contravention of the specification of LOGIN), but
49556 if the client does not supply it (as is the case for LOGIN clients), the prompt
49557 strings are used to obtain two data items.
49558 </para>
49559 <para>
49560 Some clients are very particular about the precise text of the prompts. For
49561 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
49562 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
49563 strings. It uses the <option>ldapauth</option> expansion condition to check the user
49564 name and password by binding to an LDAP server:
49565 </para>
49566 <literallayout class="monospaced">
49567 login:
49568   driver = plaintext
49569   public_name = LOGIN
49570   server_prompts = Username:: : Password::
49571   server_condition = ${if and{{ \
49572     !eq{}{$auth1} }{ \
49573     ldapauth{\
49574       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
49575       pass=${quote:$auth2} \
49576       ldap://ldap.example.org/} }} }
49577   server_set_id = uid=$auth1,ou=people,o=example.org
49578 </literallayout>
49579 <para>
49580 We have to check that the username is not empty before using it, because LDAP
49581 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
49582 operator to correctly quote the DN for authentication. However, the basic
49583 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
49584 correct one to use for the password, because quoting is needed only to make
49585 the password conform to the Exim syntax. At the LDAP level, the password is an
49586 uninterpreted string.
49587 </para>
49588 </section>
49589 <section id="SECID174">
49590 <title>Support for different kinds of authentication</title>
49591 <para>
49592 A number of string expansion features are provided for the purpose of
49593 interfacing to different ways of user authentication. These include checking
49594 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
49595 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
49596 <xref linkend="SECTexpcond"/>.
49597 </para>
49598 </section>
49599 <section id="SECID175">
49600 <title>Using plaintext in a client</title>
49601 <para>
49602 <indexterm role="concept">
49603 <primary>options</primary>
49604 <secondary><command>plaintext</command> authenticator (client)</secondary>
49605 </indexterm>
49606 The <command>plaintext</command> authenticator has two client options:
49607 </para>
49608 <para>
49609 <indexterm role="option">
49610 <primary><option>client_ignore_invalid_base64</option></primary>
49611 </indexterm>
49612 </para>
49613 <informaltable frame="all">
49614 <tgroup cols="4" colsep="0" rowsep="0">
49615 <colspec colwidth="8*" align="left"/>
49616 <colspec colwidth="6*" align="center"/>
49617 <colspec colwidth="6*" align="center"/>
49618 <colspec colwidth="6*" align="right"/>
49619 <tbody>
49620 <row>
49621 <entry><option>client_ignore_invalid_base64</option></entry>
49622 <entry>Use: <emphasis>plaintext</emphasis></entry>
49623 <entry>Type: <emphasis>boolean</emphasis></entry>
49624 <entry>Default: <emphasis>false</emphasis></entry>
49625 </row>
49626 </tbody>
49627 </tgroup>
49628 </informaltable>
49629 <para>
49630 If the client receives a server prompt that is not a valid base64 string,
49631 authentication is abandoned by default. However, if this option is set true,
49632 the error in the challenge is ignored and the client sends the response as
49633 usual.
49634 </para>
49635 <para>
49636 <indexterm role="option">
49637 <primary><option>client_send</option></primary>
49638 </indexterm>
49639 </para>
49640 <informaltable frame="all">
49641 <tgroup cols="4" colsep="0" rowsep="0">
49642 <colspec colwidth="8*" align="left"/>
49643 <colspec colwidth="6*" align="center"/>
49644 <colspec colwidth="6*" align="center"/>
49645 <colspec colwidth="6*" align="right"/>
49646 <tbody>
49647 <row>
49648 <entry><option>client_send</option></entry>
49649 <entry>Use: <emphasis>plaintext</emphasis></entry>
49650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49651 <entry>Default: <emphasis>unset</emphasis></entry>
49652 </row>
49653 </tbody>
49654 </tgroup>
49655 </informaltable>
49656 <para>
49657 The string is a colon-separated list of authentication data strings. Each
49658 string is independently expanded before being sent to the server. The first
49659 string is sent with the AUTH command; any more strings are sent in response
49660 to prompts from the server. Before each string is expanded, the value of the
49661 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
49662 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
49663 way. Thus, the prompt that is received in response to sending the first string
49664 (with the AUTH command) can be used in the expansion of the second string, and
49665 so on. If an invalid base64 string is received when
49666 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
49667 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
49668 </para>
49669 <para>
49670 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
49671 splitting takes priority and happens first.
49672 </para>
49673 <para>
49674 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
49675 the data, further processing is applied to each string before it is sent. If
49676 there are any single circumflex characters in the string, they are converted to
49677 NULs. Should an actual circumflex be required as data, it must be doubled in
49678 the string.
49679 </para>
49680 <para>
49681 This is an example of a client configuration that implements the PLAIN
49682 authentication mechanism with a fixed user name and password:
49683 </para>
49684 <literallayout class="monospaced">
49685 fixed_plain:
49686   driver = plaintext
49687   public_name = PLAIN
49688   client_send = ^username^mysecret
49689 </literallayout>
49690 <para>
49691 The lack of colons means that the entire text is sent with the AUTH
49692 command, with the circumflex characters converted to NULs. A similar example
49693 that uses the LOGIN mechanism is:
49694 </para>
49695 <literallayout class="monospaced">
49696 fixed_login:
49697   driver = plaintext
49698   public_name = LOGIN
49699   client_send = : username : mysecret
49700 </literallayout>
49701 <para>
49702 The initial colon means that the first string is empty, so no data is sent with
49703 the AUTH command itself. The remaining strings are sent in response to
49704 prompts.
49705 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
49706 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
49707 </para>
49708 </section>
49709 </chapter>
49710
49711 <chapter id="CHID9">
49712 <title>The cram_md5 authenticator</title>
49713 <para>
49714 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
49715 <primary><command>cram_md5</command> authenticator</primary>
49716 </indexterm>
49717 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
49718 <primary>authenticators</primary>
49719 <secondary><command>cram_md5</command></secondary>
49720 </indexterm>
49721 <indexterm role="concept">
49722 <primary>CRAM-MD5 authentication mechanism</primary>
49723 </indexterm>
49724 <indexterm role="concept">
49725 <primary>authentication</primary>
49726 <secondary>CRAM-MD5 mechanism</secondary>
49727 </indexterm>
49728 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
49729 sends a challenge string to the client, and the response consists of a user
49730 name and the CRAM-MD5 digest of the challenge string combined with a secret
49731 string (password) which is known to both server and client. Thus, the secret
49732 is not sent over the network as plain text, which makes this authenticator more
49733 secure than <command>plaintext</command>. However, the downside is that the secret has to be
49734 available in plain text at either end.
49735 </para>
49736 <section id="SECID176">
49737 <title>Using cram_md5 as a server</title>
49738 <para>
49739 <indexterm role="concept">
49740 <primary>options</primary>
49741 <secondary><command>cram_md5</command> authenticator (server)</secondary>
49742 </indexterm>
49743 This authenticator has one server option, which must be set to configure the
49744 authenticator as a server:
49745 </para>
49746 <para>
49747 <indexterm role="option">
49748 <primary><option>server_secret</option></primary>
49749 </indexterm>
49750 </para>
49751 <informaltable frame="all">
49752 <tgroup cols="4" colsep="0" rowsep="0">
49753 <colspec colwidth="8*" align="left"/>
49754 <colspec colwidth="6*" align="center"/>
49755 <colspec colwidth="6*" align="center"/>
49756 <colspec colwidth="6*" align="right"/>
49757 <tbody>
49758 <row>
49759 <entry><option>server_secret</option></entry>
49760 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49761 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49762 <entry>Default: <emphasis>unset</emphasis></entry>
49763 </row>
49764 </tbody>
49765 </tgroup>
49766 </informaltable>
49767 <para>
49768 <indexterm role="concept">
49769 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49770 <secondary>in <command>cram_md5</command> authenticator</secondary>
49771 </indexterm>
49772 When the server receives the client&#x2019;s response, the user name is placed in
49773 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
49774 obtain the password for that user. The server then computes the CRAM-MD5 digest
49775 that the client should have sent, and checks that it received the correct
49776 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
49777 fails. If the expansion fails for some other reason, a temporary error code is
49778 returned to the client.
49779 </para>
49780 <para>
49781 For compatibility with previous releases of Exim, the user name is also placed
49782 in <varname>$1</varname>. However, the use of this variables for this purpose is now
49783 deprecated, as it can lead to confusion in string expansions that also use
49784 numeric variables for other things.
49785 </para>
49786 <para>
49787 For example, the following authenticator checks that the user name given by the
49788 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
49789 user name, authentication fails.
49790 </para>
49791 <literallayout class="monospaced">
49792 fixed_cram:
49793   driver = cram_md5
49794   public_name = CRAM-MD5
49795   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
49796   server_set_id = $auth1
49797 </literallayout>
49798 <para>
49799 <indexterm role="variable">
49800 <primary><varname>$authenticated_id</varname></primary>
49801 </indexterm>
49802 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
49803 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
49804 secret string in a file, using the user name as the key. For example:
49805 </para>
49806 <literallayout class="monospaced">
49807 lookup_cram:
49808   driver = cram_md5
49809   public_name = CRAM-MD5
49810   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
49811                   {$value}fail}
49812   server_set_id = $auth1
49813 </literallayout>
49814 <para>
49815 Note that this expansion explicitly forces failure if the lookup fails
49816 because <varname>$auth1</varname> contains an unknown user name.
49817 </para>
49818 <para>
49819 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
49820 using the relevant libraries, you need to know the realm to specify in the
49821 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
49822 realm, with:
49823 </para>
49824 <literallayout class="monospaced">
49825 cyrusless_crammd5:
49826   driver = cram_md5
49827   public_name = CRAM-MD5
49828   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
49829                   dbmjz{/etc/sasldb2}{$value}fail}
49830   server_set_id = $auth1
49831 </literallayout>
49832 </section>
49833 <section id="SECID177">
49834 <title>Using cram_md5 as a client</title>
49835 <para>
49836 <indexterm role="concept">
49837 <primary>options</primary>
49838 <secondary><command>cram_md5</command> authenticator (client)</secondary>
49839 </indexterm>
49840 When used as a client, the <command>cram_md5</command> authenticator has two options:
49841 </para>
49842 <para>
49843 <indexterm role="option">
49844 <primary><option>client_name</option></primary>
49845 </indexterm>
49846 </para>
49847 <informaltable frame="all">
49848 <tgroup cols="4" colsep="0" rowsep="0">
49849 <colspec colwidth="8*" align="left"/>
49850 <colspec colwidth="6*" align="center"/>
49851 <colspec colwidth="6*" align="center"/>
49852 <colspec colwidth="6*" align="right"/>
49853 <tbody>
49854 <row>
49855 <entry><option>client_name</option></entry>
49856 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49857 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49858 <entry>Default: <emphasis>the primary host name</emphasis></entry>
49859 </row>
49860 </tbody>
49861 </tgroup>
49862 </informaltable>
49863 <para>
49864 This string is expanded, and the result used as the user name data when
49865 computing the response to the server&#x2019;s challenge.
49866 </para>
49867 <para>
49868 <indexterm role="option">
49869 <primary><option>client_secret</option></primary>
49870 </indexterm>
49871 </para>
49872 <informaltable frame="all">
49873 <tgroup cols="4" colsep="0" rowsep="0">
49874 <colspec colwidth="8*" align="left"/>
49875 <colspec colwidth="6*" align="center"/>
49876 <colspec colwidth="6*" align="center"/>
49877 <colspec colwidth="6*" align="right"/>
49878 <tbody>
49879 <row>
49880 <entry><option>client_secret</option></entry>
49881 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49882 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49883 <entry>Default: <emphasis>unset</emphasis></entry>
49884 </row>
49885 </tbody>
49886 </tgroup>
49887 </informaltable>
49888 <para>
49889 This option must be set for the authenticator to work as a client. Its value is
49890 expanded and the result used as the secret string when computing the response.
49891 </para>
49892 <para>
49893 <indexterm role="variable">
49894 <primary><varname>$host</varname></primary>
49895 </indexterm>
49896 <indexterm role="variable">
49897 <primary><varname>$host_address</varname></primary>
49898 </indexterm>
49899 Different user names and secrets can be used for different servers by referring
49900 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
49901 expansion string is treated as an indication that this authenticator is not
49902 prepared to handle this case. Exim moves on to the next configured client
49903 authenticator. Any other expansion failure causes Exim to give up trying to
49904 send the message to the current server.
49905 </para>
49906 <para>
49907 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
49908 strings, is:
49909 </para>
49910 <literallayout class="monospaced">
49911 fixed_cram:
49912   driver = cram_md5
49913   public_name = CRAM-MD5
49914   client_name = ph10
49915   client_secret = secret
49916 </literallayout>
49917 <para>
49918 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
49919 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
49920 </para>
49921 </section>
49922 </chapter>
49923
49924 <chapter id="CHID10">
49925 <title>The cyrus_sasl authenticator</title>
49926 <para>
49927 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
49928 <primary><command>cyrus_sasl</command> authenticator</primary>
49929 </indexterm>
49930 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
49931 <primary>authenticators</primary>
49932 <secondary><command>cyrus_sasl</command></secondary>
49933 </indexterm>
49934 <indexterm role="concept">
49935 <primary>Cyrus</primary>
49936 <secondary>SASL library</secondary>
49937 </indexterm>
49938 <indexterm role="concept">
49939 <primary>Kerberos</primary>
49940 </indexterm>
49941 The code for this authenticator was provided by Matthew Byng-Maddick of A L
49942 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
49943 </para>
49944 <para>
49945 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
49946 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
49947 Layer</quote>). This library supports a number of authentication mechanisms,
49948 including PLAIN and LOGIN, but also several others that Exim does not support
49949 directly. In particular, there is support for Kerberos authentication.
49950 </para>
49951 <para>
49952 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
49953 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
49954 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
49955 name of the driver to determine which mechanism to support.
49956 </para>
49957 <para>
49958 Where access to some kind of secret file is required, for example in GSSAPI
49959 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
49960 user, and that the Cyrus SASL library has no way of escalating privileges
49961 by default. You may also find you need to set environment variables,
49962 depending on the driver you are using.
49963 </para>
49964 <para>
49965 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
49966 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
49967 Kerberos, note that because of limitations in the GSSAPI interface,
49968 changing the server keytab might need to be communicated down to the Kerberos
49969 layer independently. The mechanism for doing so is dependent upon the Kerberos
49970 implementation.
49971 </para>
49972 <para>
49973 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
49974 may be set to point to an alternative keytab file. Exim will pass this
49975 variable through from its own inherited environment when started as root or the
49976 Exim user. The keytab file needs to be readable by the Exim user.
49977 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
49978 environment variable.  In practice, for those releases, the Cyrus authenticator
49979 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
49980 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
49981 </para>
49982 <section id="SECID178">
49983 <title>Using cyrus_sasl as a server</title>
49984 <para>
49985 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
49986 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
49987 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
49988 use of this variable for this purpose is now deprecated, as it can lead to
49989 confusion in string expansions that also use numeric variables for other
49990 things.
49991 </para>
49992 <para>
49993 <indexterm role="option">
49994 <primary><option>server_hostname</option></primary>
49995 </indexterm>
49996 </para>
49997 <informaltable frame="all">
49998 <tgroup cols="4" colsep="0" rowsep="0">
49999 <colspec colwidth="8*" align="left"/>
50000 <colspec colwidth="6*" align="center"/>
50001 <colspec colwidth="6*" align="center"/>
50002 <colspec colwidth="6*" align="right"/>
50003 <tbody>
50004 <row>
50005 <entry><option>server_hostname</option></entry>
50006 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50007 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50008 <entry>Default: <emphasis>see below</emphasis></entry>
50009 </row>
50010 </tbody>
50011 </tgroup>
50012 </informaltable>
50013 <para>
50014 This option selects the hostname that is used when communicating with the
50015 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
50016 SASL plug-in what it does with this data.
50017 </para>
50018 <para>
50019 <indexterm role="option">
50020 <primary><option>server_mech</option></primary>
50021 </indexterm>
50022 </para>
50023 <informaltable frame="all">
50024 <tgroup cols="4" colsep="0" rowsep="0">
50025 <colspec colwidth="8*" align="left"/>
50026 <colspec colwidth="6*" align="center"/>
50027 <colspec colwidth="6*" align="center"/>
50028 <colspec colwidth="6*" align="right"/>
50029 <tbody>
50030 <row>
50031 <entry><option>server_mech</option></entry>
50032 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50033 <entry>Type: <emphasis>string</emphasis></entry>
50034 <entry>Default: <emphasis>see below</emphasis></entry>
50035 </row>
50036 </tbody>
50037 </tgroup>
50038 </informaltable>
50039 <para>
50040 This option selects the authentication mechanism this driver should use. The
50041 default is the value of the generic <option>public_name</option> option. This option allows
50042 you to use a different underlying mechanism from the advertised name. For
50043 example:
50044 </para>
50045 <literallayout class="monospaced">
50046 sasl:
50047   driver = cyrus_sasl
50048   public_name = X-ANYTHING
50049   server_mech = CRAM-MD5
50050   server_set_id = $auth1
50051 </literallayout>
50052 <para>
50053 <indexterm role="option">
50054 <primary><option>server_realm</option></primary>
50055 </indexterm>
50056 </para>
50057 <informaltable frame="all">
50058 <tgroup cols="4" colsep="0" rowsep="0">
50059 <colspec colwidth="8*" align="left"/>
50060 <colspec colwidth="6*" align="center"/>
50061 <colspec colwidth="6*" align="center"/>
50062 <colspec colwidth="6*" align="right"/>
50063 <tbody>
50064 <row>
50065 <entry><option>server_realm</option></entry>
50066 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50068 <entry>Default: <emphasis>unset</emphasis></entry>
50069 </row>
50070 </tbody>
50071 </tgroup>
50072 </informaltable>
50073 <para>
50074 This specifies the SASL realm that the server claims to be in.
50075 </para>
50076 <para>
50077 <indexterm role="option">
50078 <primary><option>server_service</option></primary>
50079 </indexterm>
50080 </para>
50081 <informaltable frame="all">
50082 <tgroup cols="4" colsep="0" rowsep="0">
50083 <colspec colwidth="8*" align="left"/>
50084 <colspec colwidth="6*" align="center"/>
50085 <colspec colwidth="6*" align="center"/>
50086 <colspec colwidth="6*" align="right"/>
50087 <tbody>
50088 <row>
50089 <entry><option>server_service</option></entry>
50090 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50091 <entry>Type: <emphasis>string</emphasis></entry>
50092 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
50093 </row>
50094 </tbody>
50095 </tgroup>
50096 </informaltable>
50097 <para>
50098 This is the SASL service that the server claims to implement.
50099 </para>
50100 <para>
50101 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
50102 private options. All you need to do is to specify an appropriate mechanism as
50103 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
50104 PLAIN, you could have two authenticators as follows:
50105 </para>
50106 <literallayout class="monospaced">
50107 sasl_cram_md5:
50108   driver = cyrus_sasl
50109   public_name = CRAM-MD5
50110   server_set_id = $auth1
50111
50112 sasl_plain:
50113   driver = cyrus_sasl
50114   public_name = PLAIN
50115   server_set_id = $auth2
50116 </literallayout>
50117 <para>
50118 Cyrus SASL does implement the LOGIN authentication method, even though it is
50119 not a standard method. It is disabled by default in the source distribution,
50120 but it is present in many binary distributions.
50121 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
50122 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
50123 </para>
50124 </section>
50125 </chapter>
50126
50127 <chapter id="CHAPdovecot">
50128 <title>The dovecot authenticator</title>
50129 <para>
50130 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
50131 <primary><command>dovecot</command> authenticator</primary>
50132 </indexterm>
50133 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
50134 <primary>authenticators</primary>
50135 <secondary><command>dovecot</command></secondary>
50136 </indexterm>
50137 This authenticator is an interface to the authentication facility of the
50138 Dovecot POP/IMAP server, which can support a number of authentication methods.
50139 Note that Dovecot must be configured to use auth-client not auth-userdb.
50140 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
50141 to use the same mechanisms for SMTP authentication. This is a server
50142 authenticator only. There is only one option:
50143 </para>
50144 <para>
50145 <indexterm role="option">
50146 <primary><option>server_socket</option></primary>
50147 </indexterm>
50148 </para>
50149 <informaltable frame="all">
50150 <tgroup cols="4" colsep="0" rowsep="0">
50151 <colspec colwidth="8*" align="left"/>
50152 <colspec colwidth="6*" align="center"/>
50153 <colspec colwidth="6*" align="center"/>
50154 <colspec colwidth="6*" align="right"/>
50155 <tbody>
50156 <row>
50157 <entry><option>server_socket</option></entry>
50158 <entry>Use: <emphasis>dovecot</emphasis></entry>
50159 <entry>Type: <emphasis>string</emphasis></entry>
50160 <entry>Default: <emphasis>unset</emphasis></entry>
50161 </row>
50162 </tbody>
50163 </tgroup>
50164 </informaltable>
50165 <para>
50166 This option must specify the socket that is the interface to Dovecot
50167 authentication. The <option>public_name</option> option must specify an authentication
50168 mechanism that Dovecot is configured to support. You can have several
50169 authenticators for different mechanisms. For example:
50170 </para>
50171 <literallayout class="monospaced">
50172 dovecot_plain:
50173   driver = dovecot
50174   public_name = PLAIN
50175   server_socket = /var/run/dovecot/auth-client
50176   server_set_id = $auth1
50177
50178 dovecot_ntlm:
50179   driver = dovecot
50180   public_name = NTLM
50181   server_socket = /var/run/dovecot/auth-client
50182   server_set_id = $auth1
50183 </literallayout>
50184 <para>
50185 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
50186 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
50187 option is passed in the Dovecot authentication command. If, for a TLS
50188 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
50189 option is passed. When authentication succeeds, the identity of the user
50190 who authenticated is placed in <varname>$auth1</varname>.
50191 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
50192 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
50193 </para>
50194 </chapter>
50195
50196 <chapter id="CHAPgsasl">
50197 <title>The gsasl authenticator</title>
50198 <para>
50199 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
50200 <primary><command>gsasl</command> authenticator</primary>
50201 </indexterm>
50202 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
50203 <primary>authenticators</primary>
50204 <secondary><command>gsasl</command></secondary>
50205 </indexterm>
50206 <indexterm role="concept">
50207 <primary>authentication</primary>
50208 <secondary>GNU SASL</secondary>
50209 </indexterm>
50210 <indexterm role="concept">
50211 <primary>authentication</primary>
50212 <secondary>SASL</secondary>
50213 </indexterm>
50214 <indexterm role="concept">
50215 <primary>authentication</primary>
50216 <secondary>EXTERNAL</secondary>
50217 </indexterm>
50218 <indexterm role="concept">
50219 <primary>authentication</primary>
50220 <secondary>ANONYMOUS</secondary>
50221 </indexterm>
50222 <indexterm role="concept">
50223 <primary>authentication</primary>
50224 <secondary>PLAIN</secondary>
50225 </indexterm>
50226 <indexterm role="concept">
50227 <primary>authentication</primary>
50228 <secondary>LOGIN</secondary>
50229 </indexterm>
50230 <indexterm role="concept">
50231 <primary>authentication</primary>
50232 <secondary>DIGEST-MD5</secondary>
50233 </indexterm>
50234 <indexterm role="concept">
50235 <primary>authentication</primary>
50236 <secondary>CRAM-MD5</secondary>
50237 </indexterm>
50238 <indexterm role="concept">
50239 <primary>authentication</primary>
50240 <secondary>SCRAM-SHA-1</secondary>
50241 </indexterm>
50242 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
50243 library and the mechanisms it provides.  This is new as of the 4.80 release
50244 and there are a few areas where the library does not let Exim smoothly
50245 scale to handle future authentication mechanisms, so no guarantee can be
50246 made that any particular new authentication mechanism will be supported
50247 without code changes in Exim.
50248 </para>
50249 <para>
50250 <indexterm role="option">
50251 <primary><option>server_channelbinding</option></primary>
50252 </indexterm>
50253 </para>
50254 <informaltable frame="all">
50255 <tgroup cols="4" colsep="0" rowsep="0">
50256 <colspec colwidth="8*" align="left"/>
50257 <colspec colwidth="6*" align="center"/>
50258 <colspec colwidth="6*" align="center"/>
50259 <colspec colwidth="6*" align="right"/>
50260 <tbody>
50261 <row>
50262 <entry><option>server_channelbinding</option></entry>
50263 <entry>Use: <emphasis>gsasl</emphasis></entry>
50264 <entry>Type: <emphasis>boolean</emphasis></entry>
50265 <entry>Default: <emphasis>false</emphasis></entry>
50266 </row>
50267 </tbody>
50268 </tgroup>
50269 </informaltable>
50270 <para>
50271 Some authentication mechanisms are able to use external context at both ends
50272 of the session to bind the authentication to that context, and fail the
50273 authentication process if that context differs.  Specifically, some TLS
50274 ciphersuites can provide identifying information about the cryptographic
50275 context.
50276 </para>
50277 <para>
50278 This means that certificate identity and verification becomes a non-issue,
50279 as a man-in-the-middle attack will cause the correct client and server to
50280 see different identifiers and authentication will fail.
50281 </para>
50282 <para>
50283 This is currently only supported when using the GnuTLS library.  This is
50284 only usable by mechanisms which support "channel binding"; at time of
50285 writing, that&#x2019;s the SCRAM family.
50286 </para>
50287 <para>
50288 This defaults off to ensure smooth upgrade across Exim releases, in case
50289 this option causes some clients to start failing.  Some future release
50290 of Exim may switch the default to be true.
50291 </para>
50292 <para>
50293 <indexterm role="option">
50294 <primary><option>server_hostname</option></primary>
50295 </indexterm>
50296 </para>
50297 <informaltable frame="all">
50298 <tgroup cols="4" colsep="0" rowsep="0">
50299 <colspec colwidth="8*" align="left"/>
50300 <colspec colwidth="6*" align="center"/>
50301 <colspec colwidth="6*" align="center"/>
50302 <colspec colwidth="6*" align="right"/>
50303 <tbody>
50304 <row>
50305 <entry><option>server_hostname</option></entry>
50306 <entry>Use: <emphasis>gsasl</emphasis></entry>
50307 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50308 <entry>Default: <emphasis>see below</emphasis></entry>
50309 </row>
50310 </tbody>
50311 </tgroup>
50312 </informaltable>
50313 <para>
50314 This option selects the hostname that is used when communicating with the
50315 library. The default value is <literal>$primary_hostname</literal>.
50316 Some mechanisms will use this data.
50317 </para>
50318 <para>
50319 <indexterm role="option">
50320 <primary><option>server_mech</option></primary>
50321 </indexterm>
50322 </para>
50323 <informaltable frame="all">
50324 <tgroup cols="4" colsep="0" rowsep="0">
50325 <colspec colwidth="8*" align="left"/>
50326 <colspec colwidth="6*" align="center"/>
50327 <colspec colwidth="6*" align="center"/>
50328 <colspec colwidth="6*" align="right"/>
50329 <tbody>
50330 <row>
50331 <entry><option>server_mech</option></entry>
50332 <entry>Use: <emphasis>gsasl</emphasis></entry>
50333 <entry>Type: <emphasis>string</emphasis></entry>
50334 <entry>Default: <emphasis>see below</emphasis></entry>
50335 </row>
50336 </tbody>
50337 </tgroup>
50338 </informaltable>
50339 <para>
50340 This option selects the authentication mechanism this driver should use. The
50341 default is the value of the generic <option>public_name</option> option. This option allows
50342 you to use a different underlying mechanism from the advertised name. For
50343 example:
50344 </para>
50345 <literallayout class="monospaced">
50346 sasl:
50347   driver = gsasl
50348   public_name = X-ANYTHING
50349   server_mech = CRAM-MD5
50350   server_set_id = $auth1
50351 </literallayout>
50352 <para>
50353 <indexterm role="option">
50354 <primary><option>server_password</option></primary>
50355 </indexterm>
50356 </para>
50357 <informaltable frame="all">
50358 <tgroup cols="4" colsep="0" rowsep="0">
50359 <colspec colwidth="8*" align="left"/>
50360 <colspec colwidth="6*" align="center"/>
50361 <colspec colwidth="6*" align="center"/>
50362 <colspec colwidth="6*" align="right"/>
50363 <tbody>
50364 <row>
50365 <entry><option>server_password</option></entry>
50366 <entry>Use: <emphasis>gsasl</emphasis></entry>
50367 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50368 <entry>Default: <emphasis>unset</emphasis></entry>
50369 </row>
50370 </tbody>
50371 </tgroup>
50372 </informaltable>
50373 <para>
50374 Various mechanisms need access to the cleartext password on the server, so
50375 that proof-of-possession can be demonstrated on the wire, without sending
50376 the password itself.
50377 </para>
50378 <para>
50379 The data available for lookup varies per mechanism.
50380 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
50381 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
50382 if available, else the empty string.
50383 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
50384 else the empty string.
50385 </para>
50386 <para>
50387 A forced failure will cause authentication to defer.
50388 </para>
50389 <para>
50390 If using this option, it may make sense to set the <option>server_condition</option>
50391 option to be simply "true".
50392 </para>
50393 <para>
50394 <indexterm role="option">
50395 <primary><option>server_realm</option></primary>
50396 </indexterm>
50397 </para>
50398 <informaltable frame="all">
50399 <tgroup cols="4" colsep="0" rowsep="0">
50400 <colspec colwidth="8*" align="left"/>
50401 <colspec colwidth="6*" align="center"/>
50402 <colspec colwidth="6*" align="center"/>
50403 <colspec colwidth="6*" align="right"/>
50404 <tbody>
50405 <row>
50406 <entry><option>server_realm</option></entry>
50407 <entry>Use: <emphasis>gsasl</emphasis></entry>
50408 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50409 <entry>Default: <emphasis>unset</emphasis></entry>
50410 </row>
50411 </tbody>
50412 </tgroup>
50413 </informaltable>
50414 <para>
50415 This specifies the SASL realm that the server claims to be in.
50416 Some mechanisms will use this data.
50417 </para>
50418 <para>
50419 <indexterm role="option">
50420 <primary><option>server_scram_iter</option></primary>
50421 </indexterm>
50422 </para>
50423 <informaltable frame="all">
50424 <tgroup cols="4" colsep="0" rowsep="0">
50425 <colspec colwidth="8*" align="left"/>
50426 <colspec colwidth="6*" align="center"/>
50427 <colspec colwidth="6*" align="center"/>
50428 <colspec colwidth="6*" align="right"/>
50429 <tbody>
50430 <row>
50431 <entry><option>server_scram_iter</option></entry>
50432 <entry>Use: <emphasis>gsasl</emphasis></entry>
50433 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50434 <entry>Default: <emphasis>unset</emphasis></entry>
50435 </row>
50436 </tbody>
50437 </tgroup>
50438 </informaltable>
50439 <para>
50440 This option provides data for the SCRAM family of mechanisms.
50441 <varname>$auth1</varname> is not available at evaluation time.
50442 (This may change, as we receive feedback on use)
50443 </para>
50444 <para>
50445 <indexterm role="option">
50446 <primary><option>server_scram_salt</option></primary>
50447 </indexterm>
50448 </para>
50449 <informaltable frame="all">
50450 <tgroup cols="4" colsep="0" rowsep="0">
50451 <colspec colwidth="8*" align="left"/>
50452 <colspec colwidth="6*" align="center"/>
50453 <colspec colwidth="6*" align="center"/>
50454 <colspec colwidth="6*" align="right"/>
50455 <tbody>
50456 <row>
50457 <entry><option>server_scram_salt</option></entry>
50458 <entry>Use: <emphasis>gsasl</emphasis></entry>
50459 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50460 <entry>Default: <emphasis>unset</emphasis></entry>
50461 </row>
50462 </tbody>
50463 </tgroup>
50464 </informaltable>
50465 <para>
50466 This option provides data for the SCRAM family of mechanisms.
50467 <varname>$auth1</varname> is not available at evaluation time.
50468 (This may change, as we receive feedback on use)
50469 </para>
50470 <para>
50471 <indexterm role="option">
50472 <primary><option>server_service</option></primary>
50473 </indexterm>
50474 </para>
50475 <informaltable frame="all">
50476 <tgroup cols="4" colsep="0" rowsep="0">
50477 <colspec colwidth="8*" align="left"/>
50478 <colspec colwidth="6*" align="center"/>
50479 <colspec colwidth="6*" align="center"/>
50480 <colspec colwidth="6*" align="right"/>
50481 <tbody>
50482 <row>
50483 <entry><option>server_service</option></entry>
50484 <entry>Use: <emphasis>gsasl</emphasis></entry>
50485 <entry>Type: <emphasis>string</emphasis></entry>
50486 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
50487 </row>
50488 </tbody>
50489 </tgroup>
50490 </informaltable>
50491 <para>
50492 This is the SASL service that the server claims to implement.
50493 Some mechanisms will use this data.
50494 </para>
50495 <section id="SECTgsaslauthvar">
50496 <title><command>gsasl</command> auth variables</title>
50497 <para>
50498 <indexterm role="variable">
50499 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50500 </indexterm>
50501 These may be set when evaluating specific options, as detailed above.
50502 They will also be set when evaluating <option>server_condition</option>.
50503 </para>
50504 <para>
50505 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
50506 meanings for these variables:
50507 </para>
50508 <itemizedlist>
50509 <listitem>
50510 <para>
50511 <indexterm role="variable">
50512 <primary><varname>$auth1</varname></primary>
50513 </indexterm>
50514 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
50515 </para>
50516 </listitem>
50517 <listitem>
50518 <para>
50519 <indexterm role="variable">
50520 <primary><varname>$auth2</varname></primary>
50521 </indexterm>
50522 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
50523 </para>
50524 </listitem>
50525 <listitem>
50526 <para>
50527 <indexterm role="variable">
50528 <primary><varname>$auth3</varname></primary>
50529 </indexterm>
50530 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
50531 </para>
50532 </listitem>
50533 </itemizedlist>
50534 <para>
50535 On a per-mechanism basis:
50536 </para>
50537 <itemizedlist>
50538 <listitem>
50539 <para>
50540 <indexterm role="concept">
50541 <primary>authentication</primary>
50542 <secondary>EXTERNAL</secondary>
50543 </indexterm>
50544 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
50545 the <option>server_condition</option> option must be present.
50546 </para>
50547 </listitem>
50548 <listitem>
50549 <para>
50550 <indexterm role="concept">
50551 <primary>authentication</primary>
50552 <secondary>ANONYMOUS</secondary>
50553 </indexterm>
50554 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
50555 the <option>server_condition</option> option must be present.
50556 </para>
50557 </listitem>
50558 <listitem>
50559 <para>
50560 <indexterm role="concept">
50561 <primary>authentication</primary>
50562 <secondary>GSSAPI</secondary>
50563 </indexterm>
50564 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
50565 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
50566 the <option>server_condition</option> option must be present.
50567 </para>
50568 </listitem>
50569 </itemizedlist>
50570 <para>
50571 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
50572 identifier; this is analogous to FTP anonymous authentication passing an
50573 email address, or software-identifier@, as the "password".
50574 </para>
50575 <para>
50576 An example showing the password having the realm specified in the callback
50577 and demonstrating a Cyrus SASL to GSASL migration approach is:
50578 </para>
50579 <literallayout class="monospaced">
50580 gsasl_cyrusless_crammd5:
50581   driver = gsasl
50582   public_name = CRAM-MD5
50583   server_realm = imap.example.org
50584   server_password = ${lookup{$auth1:$auth3:userPassword}\
50585                     dbmjz{/etc/sasldb2}{$value}fail}
50586   server_set_id = ${quote:$auth1}
50587   server_condition = yes
50588 </literallayout>
50589 </section>
50590 </chapter>
50591
50592 <chapter id="CHAPheimdalgss">
50593 <title>The heimdal_gssapi authenticator</title>
50594 <para>
50595 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
50596 <primary><command>heimdal_gssapi</command> authenticator</primary>
50597 </indexterm>
50598 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
50599 <primary>authenticators</primary>
50600 <secondary><command>heimdal_gssapi</command></secondary>
50601 </indexterm>
50602 <indexterm role="concept">
50603 <primary>authentication</primary>
50604 <secondary>GSSAPI</secondary>
50605 </indexterm>
50606 <indexterm role="concept">
50607 <primary>authentication</primary>
50608 <secondary>Kerberos</secondary>
50609 </indexterm>
50610 The <command>heimdal_gssapi</command> authenticator provides server integration for the
50611 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
50612 reliably.
50613 </para>
50614 <para>
50615 <indexterm role="option">
50616 <primary><option>server_hostname</option></primary>
50617 </indexterm>
50618 </para>
50619 <informaltable frame="all">
50620 <tgroup cols="4" colsep="0" rowsep="0">
50621 <colspec colwidth="8*" align="left"/>
50622 <colspec colwidth="6*" align="center"/>
50623 <colspec colwidth="6*" align="center"/>
50624 <colspec colwidth="6*" align="right"/>
50625 <tbody>
50626 <row>
50627 <entry><option>server_hostname</option></entry>
50628 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
50629 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50630 <entry>Default: <emphasis>see below</emphasis></entry>
50631 </row>
50632 </tbody>
50633 </tgroup>
50634 </informaltable>
50635 <para>
50636 This option selects the hostname that is used, with <option>server_service</option>,
50637 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
50638 identifier.  The default value is <literal>$primary_hostname</literal>.
50639 </para>
50640 <para>
50641 <indexterm role="option">
50642 <primary><option>server_keytab</option></primary>
50643 </indexterm>
50644 </para>
50645 <informaltable frame="all">
50646 <tgroup cols="4" colsep="0" rowsep="0">
50647 <colspec colwidth="8*" align="left"/>
50648 <colspec colwidth="6*" align="center"/>
50649 <colspec colwidth="6*" align="center"/>
50650 <colspec colwidth="6*" align="right"/>
50651 <tbody>
50652 <row>
50653 <entry><option>server_keytab</option></entry>
50654 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
50655 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50656 <entry>Default: <emphasis>unset</emphasis></entry>
50657 </row>
50658 </tbody>
50659 </tgroup>
50660 </informaltable>
50661 <para>
50662 If set, then Heimdal will not use the system default keytab (typically
50663 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
50664 The value should be a pathname, with no <quote>file:</quote> prefix.
50665 </para>
50666 <para>
50667 <indexterm role="option">
50668 <primary><option>server_service</option></primary>
50669 </indexterm>
50670 </para>
50671 <informaltable frame="all">
50672 <tgroup cols="4" colsep="0" rowsep="0">
50673 <colspec colwidth="8*" align="left"/>
50674 <colspec colwidth="6*" align="center"/>
50675 <colspec colwidth="6*" align="center"/>
50676 <colspec colwidth="6*" align="right"/>
50677 <tbody>
50678 <row>
50679 <entry><option>server_service</option></entry>
50680 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
50681 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50682 <entry>Default: <emphasis>smtp</emphasis></entry>
50683 </row>
50684 </tbody>
50685 </tgroup>
50686 </informaltable>
50687 <para>
50688 This option specifies the service identifier used, in conjunction with
50689 <option>server_hostname</option>, for building the identifier for finding credentials
50690 from the keytab.
50691 </para>
50692 <section id="SECTheimdalgssauthvar">
50693 <title><command>heimdal_gssapi</command> auth variables</title>
50694 <para>
50695 Beware that these variables will typically include a realm, thus will appear
50696 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
50697 not verified, so a malicious client can set it to anything.
50698 </para>
50699 <para>
50700 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
50701 Distribution Center.  Note that these are not quite email addresses.
50702 Each identifier is for a role, and so the left-hand-side may include a
50703 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
50704 </para>
50705 <para>
50706 <indexterm role="variable">
50707 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50708 </indexterm>
50709 </para>
50710 <itemizedlist>
50711 <listitem>
50712 <para>
50713 <indexterm role="variable">
50714 <primary><varname>$auth1</varname></primary>
50715 </indexterm>
50716 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
50717 </para>
50718 </listitem>
50719 <listitem>
50720 <para>
50721 <indexterm role="variable">
50722 <primary><varname>$auth2</varname></primary>
50723 </indexterm>
50724 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
50725 authentication.  If that was empty, this will also be set to the
50726 GSS Display Name.
50727 </para>
50728 </listitem>
50729 </itemizedlist>
50730 </section>
50731 </chapter>
50732
50733 <chapter id="CHAPspa">
50734 <title>The spa authenticator</title>
50735 <para>
50736 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
50737 <primary><command>spa</command> authenticator</primary>
50738 </indexterm>
50739 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
50740 <primary>authenticators</primary>
50741 <secondary><command>spa</command></secondary>
50742 </indexterm>
50743 <indexterm role="concept">
50744 <primary>authentication</primary>
50745 <secondary>Microsoft Secure Password</secondary>
50746 </indexterm>
50747 <indexterm role="concept">
50748 <primary>authentication</primary>
50749 <secondary>NTLM</secondary>
50750 </indexterm>
50751 <indexterm role="concept">
50752 <primary>Microsoft Secure Password Authentication</primary>
50753 </indexterm>
50754 <indexterm role="concept">
50755 <primary>NTLM authentication</primary>
50756 </indexterm>
50757 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
50758 Password Authentication</emphasis> mechanism,
50759 which is also sometimes known as NTLM (NT LanMan). The code for client side of
50760 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
50761 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
50762 server side was subsequently contributed by Tom Kistner. The mechanism works as
50763 follows:
50764 </para>
50765 <itemizedlist>
50766 <listitem>
50767 <para>
50768 After the AUTH command has been accepted, the client sends an SPA
50769 authentication request based on the user name and optional domain.
50770 </para>
50771 </listitem>
50772 <listitem>
50773 <para>
50774 The server sends back a challenge.
50775 </para>
50776 </listitem>
50777 <listitem>
50778 <para>
50779 The client builds a challenge response which makes use of the user&#x2019;s password
50780 and sends it to the server, which then accepts or rejects it.
50781 </para>
50782 </listitem>
50783 </itemizedlist>
50784 <para>
50785 Encryption is used to protect the password in transit.
50786 </para>
50787 <section id="SECID179">
50788 <title>Using spa as a server</title>
50789 <para>
50790 <indexterm role="concept">
50791 <primary>options</primary>
50792 <secondary><command>spa</command> authenticator (server)</secondary>
50793 </indexterm>
50794 The <command>spa</command> authenticator has just one server option:
50795 </para>
50796 <para>
50797 <indexterm role="option">
50798 <primary><option>server_password</option></primary>
50799 </indexterm>
50800 </para>
50801 <informaltable frame="all">
50802 <tgroup cols="4" colsep="0" rowsep="0">
50803 <colspec colwidth="8*" align="left"/>
50804 <colspec colwidth="6*" align="center"/>
50805 <colspec colwidth="6*" align="center"/>
50806 <colspec colwidth="6*" align="right"/>
50807 <tbody>
50808 <row>
50809 <entry><option>server_password</option></entry>
50810 <entry>Use: <emphasis>spa</emphasis></entry>
50811 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50812 <entry>Default: <emphasis>unset</emphasis></entry>
50813 </row>
50814 </tbody>
50815 </tgroup>
50816 </informaltable>
50817 <para>
50818 <indexterm role="concept">
50819 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50820 <secondary>in <command>spa</command> authenticator</secondary>
50821 </indexterm>
50822 This option is expanded, and the result must be the cleartext password for the
50823 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
50824 compatibility with previous releases of Exim, the user name is also placed in
50825 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
50826 it can lead to confusion in string expansions that also use numeric variables
50827 for other things. For example:
50828 </para>
50829 <literallayout class="monospaced">
50830 spa:
50831   driver = spa
50832   public_name = NTLM
50833   server_password = \
50834     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
50835 </literallayout>
50836 <para>
50837 If the expansion is forced to fail, authentication fails. Any other expansion
50838 failure causes a temporary error code to be returned.
50839 </para>
50840 </section>
50841 <section id="SECID180">
50842 <title>Using spa as a client</title>
50843 <para>
50844 <indexterm role="concept">
50845 <primary>options</primary>
50846 <secondary><command>spa</command> authenticator (client)</secondary>
50847 </indexterm>
50848 The <command>spa</command> authenticator has the following client options:
50849 </para>
50850 <para>
50851 <indexterm role="option">
50852 <primary><option>client_domain</option></primary>
50853 </indexterm>
50854 </para>
50855 <informaltable frame="all">
50856 <tgroup cols="4" colsep="0" rowsep="0">
50857 <colspec colwidth="8*" align="left"/>
50858 <colspec colwidth="6*" align="center"/>
50859 <colspec colwidth="6*" align="center"/>
50860 <colspec colwidth="6*" align="right"/>
50861 <tbody>
50862 <row>
50863 <entry><option>client_domain</option></entry>
50864 <entry>Use: <emphasis>spa</emphasis></entry>
50865 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50866 <entry>Default: <emphasis>unset</emphasis></entry>
50867 </row>
50868 </tbody>
50869 </tgroup>
50870 </informaltable>
50871 <para>
50872 This option specifies an optional domain for the authentication.
50873 </para>
50874 <para>
50875 <indexterm role="option">
50876 <primary><option>client_password</option></primary>
50877 </indexterm>
50878 </para>
50879 <informaltable frame="all">
50880 <tgroup cols="4" colsep="0" rowsep="0">
50881 <colspec colwidth="8*" align="left"/>
50882 <colspec colwidth="6*" align="center"/>
50883 <colspec colwidth="6*" align="center"/>
50884 <colspec colwidth="6*" align="right"/>
50885 <tbody>
50886 <row>
50887 <entry><option>client_password</option></entry>
50888 <entry>Use: <emphasis>spa</emphasis></entry>
50889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50890 <entry>Default: <emphasis>unset</emphasis></entry>
50891 </row>
50892 </tbody>
50893 </tgroup>
50894 </informaltable>
50895 <para>
50896 This option specifies the user&#x2019;s password, and must be set.
50897 </para>
50898 <para>
50899 <indexterm role="option">
50900 <primary><option>client_username</option></primary>
50901 </indexterm>
50902 </para>
50903 <informaltable frame="all">
50904 <tgroup cols="4" colsep="0" rowsep="0">
50905 <colspec colwidth="8*" align="left"/>
50906 <colspec colwidth="6*" align="center"/>
50907 <colspec colwidth="6*" align="center"/>
50908 <colspec colwidth="6*" align="right"/>
50909 <tbody>
50910 <row>
50911 <entry><option>client_username</option></entry>
50912 <entry>Use: <emphasis>spa</emphasis></entry>
50913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50914 <entry>Default: <emphasis>unset</emphasis></entry>
50915 </row>
50916 </tbody>
50917 </tgroup>
50918 </informaltable>
50919 <para>
50920 This option specifies the user name, and must be set. Here is an example of a
50921 configuration of this authenticator for use with the mail servers at
50922 <emphasis>msn.com</emphasis>:
50923 </para>
50924 <literallayout class="monospaced">
50925 msn:
50926   driver = spa
50927   public_name = MSN
50928   client_username = msn/msn_username
50929   client_password = msn_plaintext_password
50930   client_domain = DOMAIN_OR_UNSET
50931 </literallayout>
50932 <para>
50933 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
50934 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
50935 </para>
50936 </section>
50937 </chapter>
50938
50939 <chapter id="CHAPtlsauth" revisionflag="changed">
50940 <title>The tls authenticator</title>
50941 <para revisionflag="changed">
50942 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
50943 <primary><command>tls</command> authenticator</primary>
50944 </indexterm>
50945 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
50946 <primary>authenticators</primary>
50947 <secondary><command>tls</command></secondary>
50948 </indexterm>
50949 <indexterm role="concept">
50950 <primary>authentication</primary>
50951 <secondary>Client Certificate</secondary>
50952 </indexterm>
50953 <indexterm role="concept">
50954 <primary>authentication</primary>
50955 <secondary>X509</secondary>
50956 </indexterm>
50957 <indexterm role="concept">
50958 <primary>Certificate-based authentication</primary>
50959 </indexterm>
50960 The <command>tls</command> authenticator provides server support for
50961 authentication based on client certificates.
50962 </para>
50963 <para revisionflag="changed">
50964 It is not an SMTP authentication mechanism and is not
50965 advertised by the server as part of the SMTP EHLO response.
50966 It is an Exim authenticator in the sense that it affects
50967 the protocol element of the log line, can be tested for
50968 by the <option>authenticated</option> ACL condition, and can set
50969 the <varname>$authenticated_id</varname> variable.
50970 </para>
50971 <para revisionflag="changed">
50972 The client must present a verifiable certificate,
50973 for which it must have been requested via the
50974 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
50975 (see <xref linkend="CHAPTLS"/>).
50976 </para>
50977 <para revisionflag="changed">
50978 If an authenticator of this type is configured it is
50979 run before any SMTP-level communication is done,
50980 and can authenticate the connection.
50981 If it does, SMTP authentication is not offered.
50982 </para>
50983 <para revisionflag="changed">
50984 A maximum of one authenticator of this type may be present.
50985 </para>
50986 <para revisionflag="changed">
50987 <indexterm role="concept">
50988 <primary>options</primary>
50989 <secondary><command>tls</command> authenticator (server)</secondary>
50990 </indexterm>
50991 The <command>tls</command> authenticator has three server options:
50992 </para>
50993 <para revisionflag="changed">
50994 <indexterm role="option">
50995 <primary><option>server_param1</option></primary>
50996 </indexterm>
50997 </para>
50998 <informaltable frame="all" revisionflag="changed">
50999 <tgroup cols="4" colsep="0" rowsep="0">
51000 <colspec colwidth="8*" align="left"/>
51001 <colspec colwidth="6*" align="center"/>
51002 <colspec colwidth="6*" align="center"/>
51003 <colspec colwidth="6*" align="right"/>
51004 <tbody>
51005 <row>
51006 <entry><option>server_param1</option></entry>
51007 <entry>Use: <emphasis>tls</emphasis></entry>
51008 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51009 <entry>Default: <emphasis>unset</emphasis></entry>
51010 </row>
51011 </tbody>
51012 </tgroup>
51013 </informaltable>
51014 <para revisionflag="changed">
51015 <indexterm role="concept">
51016 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
51017 <secondary>in <command>tls</command> authenticator</secondary>
51018 </indexterm>
51019 This option is expanded after the TLS negotiation and
51020 the result is placed in <varname>$auth1</varname>.
51021 If the expansion is forced to fail, authentication fails. Any other expansion
51022 failure causes a temporary error code to be returned.
51023 </para>
51024 <para revisionflag="changed">
51025 <indexterm role="option">
51026 <primary><option>server_param2</option></primary>
51027 </indexterm>
51028 </para>
51029 <informaltable frame="all" revisionflag="changed">
51030 <tgroup cols="4" colsep="0" rowsep="0">
51031 <colspec colwidth="8*" align="left"/>
51032 <colspec colwidth="6*" align="center"/>
51033 <colspec colwidth="6*" align="center"/>
51034 <colspec colwidth="6*" align="right"/>
51035 <tbody>
51036 <row>
51037 <entry><option>server_param2</option></entry>
51038 <entry>Use: <emphasis>tls</emphasis></entry>
51039 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51040 <entry>Default: <emphasis>unset</emphasis></entry>
51041 </row>
51042 </tbody>
51043 </tgroup>
51044 </informaltable>
51045 <para revisionflag="changed">
51046 <indexterm role="option">
51047 <primary><option>server_param3</option></primary>
51048 </indexterm>
51049 </para>
51050 <informaltable frame="all" revisionflag="changed">
51051 <tgroup cols="4" colsep="0" rowsep="0">
51052 <colspec colwidth="8*" align="left"/>
51053 <colspec colwidth="6*" align="center"/>
51054 <colspec colwidth="6*" align="center"/>
51055 <colspec colwidth="6*" align="right"/>
51056 <tbody>
51057 <row>
51058 <entry><option>server_param3</option></entry>
51059 <entry>Use: <emphasis>tls</emphasis></entry>
51060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51061 <entry>Default: <emphasis>unset</emphasis></entry>
51062 </row>
51063 </tbody>
51064 </tgroup>
51065 </informaltable>
51066 <para revisionflag="changed">
51067 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
51068 </para>
51069 <para revisionflag="changed">
51070 <option>server_param1</option> may also be spelled <option>server_param</option>.
51071 </para>
51072 <para revisionflag="changed">
51073 Example:
51074 </para>
51075 <literallayout class="monospaced" revisionflag="changed">
51076 tls:
51077   driver = tls
51078   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
51079                                     {$tls_in_peercert}}
51080   server_condition =  ${if forany {$auth1} \
51081                             {!= {0} \
51082                                 {${lookup ldap{ldap:///\
51083                          mailname=${quote_ldap_dn:${lc:$item}},\
51084                          ou=users,LDAP_DC?mailid} {$value}{0} \
51085                        }    }   } }
51086   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
51087 </literallayout>
51088 <para revisionflag="changed">
51089 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
51090 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
51091 </para>
51092 <para>
51093 Note that because authentication is traditionally an SMTP operation,
51094 the <option>authenticated</option> ACL condition cannot be used in
51095 a connect- or helo-ACL.
51096 </para>
51097 </chapter>
51098
51099 <chapter id="CHAPTLS">
51100 <title>Encrypted SMTP connections using TLS/SSL</title>
51101 <titleabbrev>Encrypted SMTP connections</titleabbrev>
51102 <para>
51103 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
51104 <primary>encryption</primary>
51105 <secondary>on SMTP connection</secondary>
51106 </indexterm>
51107 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
51108 <primary>SMTP</primary>
51109 <secondary>encryption</secondary>
51110 </indexterm>
51111 <indexterm role="concept">
51112 <primary>TLS</primary>
51113 <secondary>on SMTP connection</secondary>
51114 </indexterm>
51115 <indexterm role="concept">
51116 <primary>OpenSSL</primary>
51117 </indexterm>
51118 <indexterm role="concept">
51119 <primary>GnuTLS</primary>
51120 </indexterm>
51121 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
51122 Sockets Layer), is implemented by making use of the OpenSSL library or the
51123 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
51124 cryptographic code in the Exim distribution itself for implementing TLS. In
51125 order to use this feature you must install OpenSSL or GnuTLS, and then build a
51126 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
51127 You also need to understand the basic concepts of encryption at a managerial
51128 level, and in particular, the way that public keys, private keys, and
51129 certificates are used.
51130 </para>
51131 <para>
51132 RFC 3207 defines how SMTP connections can make use of encryption. Once a
51133 connection is established, the client issues a STARTTLS command. If the
51134 server accepts this, the client and the server negotiate an encryption
51135 mechanism. If the negotiation succeeds, the data that subsequently passes
51136 between them is encrypted.
51137 </para>
51138 <para>
51139 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
51140 and if so, what cipher suite is in use, whether the client supplied a
51141 certificate, and whether or not that certificate was verified. This makes it
51142 possible for an Exim server to deny or accept certain commands based on the
51143 encryption state.
51144 </para>
51145 <para>
51146 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
51147 disrupt TLS connections. You need to turn off SMTP scanning for these products
51148 in order to get TLS to work.
51149 </para>
51150 <section id="SECID284">
51151 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
51152 <para>
51153 <indexterm role="concept">
51154 <primary>ssmtp protocol</primary>
51155 </indexterm>
51156 <indexterm role="concept">
51157 <primary>smtps protocol</primary>
51158 </indexterm>
51159 <indexterm role="concept">
51160 <primary>SMTP</primary>
51161 <secondary>ssmtp protocol</secondary>
51162 </indexterm>
51163 <indexterm role="concept">
51164 <primary>SMTP</primary>
51165 <secondary>smtps protocol</secondary>
51166 </indexterm>
51167 Early implementations of encrypted SMTP used a different TCP port from normal
51168 SMTP, and expected an encryption negotiation to start immediately, instead of
51169 waiting for a STARTTLS command from the client using the standard SMTP
51170 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
51171 allocated for this purpose.
51172 </para>
51173 <para>
51174 This approach was abandoned when encrypted SMTP was standardized, but there are
51175 still some legacy clients that use it. Exim supports these clients by means of
51176 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
51177 numbers; the most common use is expected to be:
51178 </para>
51179 <literallayout class="monospaced">
51180 tls_on_connect_ports = 465
51181 </literallayout>
51182 <para>
51183 The port numbers specified by this option apply to all SMTP connections, both
51184 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
51185 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
51186 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
51187 an extra port &ndash; rather, it specifies different behaviour on a port that is
51188 defined elsewhere.
51189 </para>
51190 <para>
51191 There is also a <option>-tls-on-connect</option> command line option. This overrides
51192 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
51193 </para>
51194 </section>
51195 <section id="SECTopenvsgnu">
51196 <title>OpenSSL vs GnuTLS</title>
51197 <para>
51198 <indexterm role="concept">
51199 <primary>TLS</primary>
51200 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
51201 </indexterm>
51202 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
51203 followed later, when the first versions of GnuTLS were released. To build Exim
51204 to use GnuTLS, you need to set
51205 </para>
51206 <literallayout class="monospaced">
51207 USE_GNUTLS=yes
51208 </literallayout>
51209 <para>
51210 in Local/Makefile, in addition to
51211 </para>
51212 <literallayout class="monospaced">
51213 SUPPORT_TLS=yes
51214 </literallayout>
51215 <para>
51216 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
51217 include files and libraries for GnuTLS can be found.
51218 </para>
51219 <para>
51220 There are some differences in usage when using GnuTLS instead of OpenSSL:
51221 </para>
51222 <itemizedlist>
51223 <listitem>
51224 <para>
51225 The <option>tls_verify_certificates</option> option
51226 cannot be the path of a directory
51227 for GnuTLS versions before 3.3.6
51228 (for later versions, or OpenSSL, it can be either).
51229 </para>
51230 </listitem>
51231 <listitem>
51232 <para>
51233 The default value for <option>tls_dhparam</option> differs for historical reasons.
51234 </para>
51235 </listitem>
51236 <listitem>
51237 <para>
51238 <indexterm role="variable">
51239 <primary><varname>$tls_in_peerdn</varname></primary>
51240 </indexterm>
51241 <indexterm role="variable">
51242 <primary><varname>$tls_out_peerdn</varname></primary>
51243 </indexterm>
51244 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
51245 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
51246 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
51247 </para>
51248 </listitem>
51249 <listitem>
51250 <para>
51251 OpenSSL identifies cipher suites using hyphens as separators, for example:
51252 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
51253 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
51254 in a cipher list. To make life simpler, Exim changes underscores to hyphens
51255 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
51256 to handle its own older variants) when processing lists of cipher suites in the
51257 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
51258 option).
51259 </para>
51260 </listitem>
51261 <listitem>
51262 <para>
51263 The <option>tls_require_ciphers</option> options operate differently, as described in the
51264 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
51265 </para>
51266 </listitem>
51267 <listitem>
51268 <para>
51269 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
51270 When using OpenSSL, this option is ignored.
51271 (If an API is found to let OpenSSL be configured in this way,
51272 let the Exim Maintainers know and we&#x2019;ll likely use it).
51273 </para>
51274 </listitem>
51275 <listitem>
51276 <para>
51277 Some other recently added features may only be available in one or the other.
51278 This should be documented with the feature.  If the documentation does not
51279 explicitly state that the feature is infeasible in the other TLS
51280 implementation, then patches are welcome.
51281 </para>
51282 </listitem>
51283 </itemizedlist>
51284 </section>
51285 <section id="SECTgnutlsparam">
51286 <title>GnuTLS parameter computation</title>
51287 <para>
51288 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
51289 an explicit path; if the latter, then the text about generation still applies,
51290 but not the chosen filename.
51291 By default, as of Exim 4.80 a hard-coded D-H prime is used.
51292 See the documentation of <option>tls_dhparam</option> for more information.
51293 </para>
51294 <para>
51295 GnuTLS uses D-H parameters that may take a substantial amount of time
51296 to compute. It is unreasonable to re-compute them for every TLS session.
51297 Therefore, Exim keeps this data in a file in its spool directory, called
51298 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
51299 of bits requested.
51300 The file is owned by the Exim user and is readable only by
51301 its owner. Every Exim process that start up GnuTLS reads the D-H
51302 parameters from this file. If the file does not exist, the first Exim process
51303 that needs it computes the data and writes it to a temporary file which is
51304 renamed once it is complete. It does not matter if several Exim processes do
51305 this simultaneously (apart from wasting a few resources). Once a file is in
51306 place, new Exim processes immediately start using it.
51307 </para>
51308 <para>
51309 For maximum security, the parameters that are stored in this file should be
51310 recalculated periodically, the frequency depending on your paranoia level.
51311 If you are avoiding using the fixed D-H primes published in RFCs, then you
51312 are concerned about some advanced attacks and will wish to do this; if you do
51313 not regenerate then you might as well stick to the standard primes.
51314 </para>
51315 <para>
51316 Arranging this is easy in principle; just delete the file when you want new
51317 values to be computed. However, there may be a problem. The calculation of new
51318 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
51319 If the system is not very active, <filename>/dev/random</filename> may delay returning data
51320 until enough randomness (entropy) is available. This may cause Exim to hang for
51321 a substantial amount of time, causing timeouts on incoming connections.
51322 </para>
51323 <para>
51324 The solution is to generate the parameters externally to Exim. They are stored
51325 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
51326 generated externally using the <command>certtool</command> command that is part of GnuTLS.
51327 </para>
51328 <para>
51329 To replace the parameters with new ones, instead of deleting the file
51330 and letting Exim re-create it, you can generate new parameters using
51331 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
51332 renaming. The relevant commands are something like this:
51333 </para>
51334 <literallayout class="monospaced">
51335 # ls
51336 [ look for file; assume gnutls-params-2236 is the most recent ]
51337 # rm -f new-params
51338 # touch new-params
51339 # chown exim:exim new-params
51340 # chmod 0600 new-params
51341 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
51342 # openssl dhparam -noout -text -in new-params | head
51343 [ check the first line, make sure it's not more than 2236;
51344   if it is, then go back to the start ("rm") and repeat
51345   until the size generated is at most the size requested ]
51346 # chmod 0400 new-params
51347 # mv new-params gnutls-params-2236
51348 </literallayout>
51349 <para>
51350 If Exim never has to generate the parameters itself, the possibility of
51351 stalling is removed.
51352 </para>
51353 <para>
51354 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
51355 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
51356 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
51357 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
51358 and Exim does so.  This attempt to remove Exim from TLS policy decisions
51359 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
51360 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
51361 which applies to all D-H usage, client or server.  If the value returned by
51362 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
51363 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
51364 limit, which is still much higher than Exim historically used.
51365 </para>
51366 <para>
51367 The filename and bits used will change as the GnuTLS maintainers change the
51368 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
51369 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
51370 2432 bits, while NSS is limited to 2236 bits.
51371 </para>
51372 <para>
51373 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
51374 increase the chance of the generated prime actually being within acceptable
51375 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
51376 procedure above.  There is no sane procedure available to Exim to double-check
51377 the size of the generated prime, so it might still be too large.
51378 </para>
51379 </section>
51380 <section id="SECTreqciphssl">
51381 <title>Requiring specific ciphers in OpenSSL</title>
51382 <para>
51383 <indexterm role="concept">
51384 <primary>TLS</primary>
51385 <secondary>requiring specific ciphers (OpenSSL)</secondary>
51386 </indexterm>
51387 <indexterm role="option">
51388 <primary><option>tls_require_ciphers</option></primary>
51389 <secondary>OpenSSL</secondary>
51390 </indexterm>
51391 There is a function in the OpenSSL library that can be passed a list of cipher
51392 suites before the cipher negotiation takes place. This specifies which ciphers
51393 are acceptable. The list is colon separated and may contain names like
51394 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
51395 directly to this function call.
51396 Many systems will install the OpenSSL manual-pages, so you may have
51397 <emphasis>ciphers(1)</emphasis> available to you.
51398 The following quotation from the OpenSSL
51399 documentation specifies what forms of item are allowed in the cipher string:
51400 </para>
51401 <itemizedlist>
51402 <listitem>
51403 <para>
51404 It can consist of a single cipher suite such as RC4-SHA.
51405 </para>
51406 </listitem>
51407 <listitem>
51408 <para>
51409 It can represent a list of cipher suites containing a certain algorithm,
51410 or cipher suites of a certain type. For example SHA1 represents all
51411 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
51412 SSL v3 algorithms.
51413 </para>
51414 </listitem>
51415 <listitem>
51416 <para>
51417 Lists of cipher suites can be combined in a single cipher string using
51418 the + character. This is used as a logical and operation. For example
51419 SHA1+DES represents all cipher suites containing the SHA1 and the DES
51420 algorithms.
51421 </para>
51422 </listitem>
51423 </itemizedlist>
51424 <para>
51425 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
51426 <literal>-</literal> or <literal>+</literal>.
51427 </para>
51428 <itemizedlist>
51429 <listitem>
51430 <para>
51431 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
51432 ciphers deleted can never reappear in the list even if they are explicitly
51433 stated.
51434 </para>
51435 </listitem>
51436 <listitem>
51437 <para>
51438 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
51439 of the ciphers can be added again by later options.
51440 </para>
51441 </listitem>
51442 <listitem>
51443 <para>
51444 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
51445 option does not add any new ciphers; it just moves matching existing ones.
51446 </para>
51447 </listitem>
51448 </itemizedlist>
51449 <para>
51450 If none of these characters is present, the string is interpreted as
51451 a list of ciphers to be appended to the current preference list. If the list
51452 includes any ciphers already present they will be ignored: that is, they will
51453 not be moved to the end of the list.
51454 </para>
51455 <para>
51456 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
51457 string:
51458 </para>
51459 <literallayout class="monospaced">
51460 # note single-quotes to get ! past any shell history expansion
51461 $ openssl ciphers 'HIGH:!MD5:!SHA1'
51462 </literallayout>
51463 <para>
51464 This example will let the library defaults be permitted on the MX port, where
51465 there&#x2019;s probably no identity verification anyway, but ups the ante on the
51466 submission ports where the administrator might have some influence on the
51467 choice of clients used:
51468 </para>
51469 <literallayout class="monospaced">
51470 # OpenSSL variant; see man ciphers(1)
51471 tls_require_ciphers = ${if =={$received_port}{25}\
51472                            {DEFAULT}\
51473                            {HIGH:!MD5:!SHA1}}
51474 </literallayout>
51475 </section>
51476 <section id="SECTreqciphgnu">
51477 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
51478 <para>
51479 <indexterm role="concept">
51480 <primary>GnuTLS</primary>
51481 <secondary>specifying parameters for</secondary>
51482 </indexterm>
51483 <indexterm role="concept">
51484 <primary>TLS</primary>
51485 <secondary>specifying ciphers (GnuTLS)</secondary>
51486 </indexterm>
51487 <indexterm role="concept">
51488 <primary>TLS</primary>
51489 <secondary>specifying key exchange methods (GnuTLS)</secondary>
51490 </indexterm>
51491 <indexterm role="concept">
51492 <primary>TLS</primary>
51493 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
51494 </indexterm>
51495 <indexterm role="concept">
51496 <primary>TLS</primary>
51497 <secondary>specifying protocols (GnuTLS)</secondary>
51498 </indexterm>
51499 <indexterm role="concept">
51500 <primary>TLS</primary>
51501 <secondary>specifying priority string (GnuTLS)</secondary>
51502 </indexterm>
51503 <indexterm role="option">
51504 <primary><option>tls_require_ciphers</option></primary>
51505 <secondary>GnuTLS</secondary>
51506 </indexterm>
51507 The GnuTLS library allows the caller to provide a "priority string", documented
51508 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
51509 ciphersuite specification in OpenSSL.
51510 </para>
51511 <para>
51512 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
51513 and controls both protocols and ciphers.
51514 </para>
51515 <para>
51516 The <option>tls_require_ciphers</option> option is available both as an global option,
51517 controlling how Exim behaves as a server, and also as an option of the
51518 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
51519 the value is string expanded.  The resulting string is not an Exim list and
51520 the string is given to the GnuTLS library, so that Exim does not need to be
51521 aware of future feature enhancements of GnuTLS.
51522 </para>
51523 <para>
51524 Documentation of the strings accepted may be found in the GnuTLS manual, under
51525 "Priority strings".  This is online as
51526 <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>,
51527 but beware that this relates to GnuTLS 3, which may be newer than the version
51528 installed on your system.  If you are using GnuTLS 3,
51529 <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>
51530 on that site can be used to test a given string.
51531 </para>
51532 <para>
51533 For example:
51534 </para>
51535 <literallayout class="monospaced">
51536 # Disable older versions of protocols
51537 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
51538 </literallayout>
51539 <para>
51540 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
51541 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
51542 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
51543 </para>
51544 <para>
51545 This example will let the library defaults be permitted on the MX port, where
51546 there&#x2019;s probably no identity verification anyway, and lowers security further
51547 by increasing compatibility; but this ups the ante on the submission ports
51548 where the administrator might have some influence on the choice of clients
51549 used:
51550 </para>
51551 <literallayout class="monospaced">
51552 # GnuTLS variant
51553 tls_require_ciphers = ${if =={$received_port}{25}\
51554                            {NORMAL:%COMPAT}\
51555                            {SECURE128}}
51556 </literallayout>
51557 </section>
51558 <section id="SECID182">
51559 <title>Configuring an Exim server to use TLS</title>
51560 <para>
51561 <indexterm role="concept">
51562 <primary>TLS</primary>
51563 <secondary>configuring an Exim server</secondary>
51564 </indexterm>
51565 When Exim has been built with TLS support, it advertises the availability of
51566 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
51567 but not to any others. The default value of this option is unset, which means
51568 that STARTTLS is not advertised at all. This default is chosen because you
51569 need to set some other options in order to make TLS available, and also it is
51570 sensible for systems that want to use TLS only as a client.
51571 </para>
51572 <para>
51573 If a client issues a STARTTLS command and there is some configuration
51574 problem in the server, the command is rejected with a 454 error. If the client
51575 persists in trying to issue SMTP commands, all except QUIT are rejected
51576 with the error
51577 </para>
51578 <literallayout class="monospaced">
51579 554 Security failure
51580 </literallayout>
51581 <para>
51582 If a STARTTLS command is issued within an existing TLS session, it is
51583 rejected with a 554 error code.
51584 </para>
51585 <para>
51586 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
51587 match some hosts. You can, of course, set it to * to match all hosts.
51588 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
51589 without some further configuration at the server end.
51590 </para>
51591 <para>
51592 It is rumoured that all existing clients that support TLS/SSL use RSA
51593 encryption. To make this work you need to set, in the server,
51594 </para>
51595 <literallayout class="monospaced">
51596 tls_certificate = /some/file/name
51597 tls_privatekey = /some/file/name
51598 </literallayout>
51599 <para>
51600 These options are, in fact, expanded strings, so you can make them depend on
51601 the identity of the client that is connected if you wish. The first file
51602 contains the server&#x2019;s X509 certificate, and the second contains the private key
51603 that goes with it. These files need to be
51604 PEM format and readable by the Exim user, and must
51605 always be given as full path names.
51606 The key must not be password-protected.
51607 They can be the same file if both the
51608 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
51609 set, or if its expansion is forced to fail or results in an empty string, this
51610 is assumed to be the case. The certificate file may also contain intermediate
51611 certificates that need to be sent to the client to enable it to authenticate
51612 the server&#x2019;s certificate.
51613 </para>
51614 <para>
51615 If you do not understand about certificates and keys, please try to find a
51616 source of this background information, which is not Exim-specific. (There are a
51617 few comments below in section <xref linkend="SECTcerandall"/>.)
51618 </para>
51619 <para>
51620 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
51621 they apply only in the case of a server. If you need to use a certificate in an
51622 Exim client, you must set the options of the same names in an <command>smtp</command>
51623 transport.
51624 </para>
51625 <para>
51626 With just these options, an Exim server will be able to use TLS. It does not
51627 require the client to have a certificate (but see below for how to insist on
51628 this). There is one other option that may be needed in other situations. If
51629 </para>
51630 <literallayout class="monospaced">
51631 tls_dhparam = /some/file/name
51632 </literallayout>
51633 <para>
51634 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
51635 with the parameters contained in the file.
51636 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
51637 available:
51638 </para>
51639 <literallayout class="monospaced">
51640 tls_dhparam = none
51641 </literallayout>
51642 <para>
51643 This may also be set to a string identifying a standard prime to be used for
51644 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
51645 used is <literal>ike23</literal>.  There are a few standard primes available, see the
51646 documentation for <option>tls_dhparam</option> for the complete list.
51647 </para>
51648 <para>
51649 See the command
51650 </para>
51651 <literallayout class="monospaced">
51652 openssl dhparam
51653 </literallayout>
51654 <para>
51655 for a way of generating file data.
51656 </para>
51657 <para>
51658 The strings supplied for these three options are expanded every time a client
51659 host connects. It is therefore possible to use different certificates and keys
51660 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
51661 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
51662 forced to fail, Exim behaves as if the option is not set.
51663 </para>
51664 <para>
51665 <indexterm role="concept">
51666 <primary>cipher</primary>
51667 <secondary>logging</secondary>
51668 </indexterm>
51669 <indexterm role="concept">
51670 <primary>log</primary>
51671 <secondary>TLS cipher</secondary>
51672 </indexterm>
51673 <indexterm role="variable">
51674 <primary><varname>$tls_in_cipher</varname></primary>
51675 </indexterm>
51676 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
51677 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
51678 incoming message (by default &ndash; you can, of course, change this), and it is
51679 also included in the log line that records a message&#x2019;s arrival, keyed by
51680 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
51681 condition can be used to test for specific cipher suites in ACLs.
51682 </para>
51683 <para>
51684 Once TLS has been established, the ACLs that run for subsequent SMTP commands
51685 can check the name of the cipher suite and vary their actions accordingly. The
51686 cipher suite names vary, depending on which TLS library is being used. For
51687 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
51688 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
51689 documentation for more details.
51690 </para>
51691 <para>
51692 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
51693 (again depending on the <option>tls_cipher</option> log selector).
51694 </para>
51695 </section>
51696 <section id="SECID183">
51697 <title>Requesting and verifying client certificates</title>
51698 <para>
51699 <indexterm role="concept">
51700 <primary>certificate</primary>
51701 <secondary>verification of client</secondary>
51702 </indexterm>
51703 <indexterm role="concept">
51704 <primary>TLS</primary>
51705 <secondary>client certificate verification</secondary>
51706 </indexterm>
51707 If you want an Exim server to request a certificate when negotiating a TLS
51708 session with a client, you must set either <option>tls_verify_hosts</option> or
51709 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
51710 apply to all TLS connections. For any host that matches one of these options,
51711 Exim requests a certificate as part of the setup of the TLS session. The
51712 contents of the certificate are verified by comparing it with a list of
51713 expected certificates.
51714 </para>
51715 <para revisionflag="changed">
51716 These may be the system default set (depending on library version),
51717 </para>
51718 <para>
51719 an explicit file or,
51720 depending on library version, a directory, identified by
51721 <option>tls_verify_certificates</option>.
51722 </para>
51723 <para>
51724 A file can contain multiple certificates, concatenated end to end. If a
51725 directory is used
51726 (OpenSSL only),
51727 each certificate must be in a separate file, with a name (or a symbolic link)
51728 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
51729 certificate. You can compute the relevant hash by running the command
51730 </para>
51731 <literallayout class="monospaced">
51732 openssl x509 -hash -noout -in /cert/file
51733 </literallayout>
51734 <para>
51735 where <filename>/cert/file</filename> contains a single certificate.
51736 </para>
51737 <para>
51738 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
51739 what happens if the client does not supply a certificate, or if the certificate
51740 does not match any of the certificates in the collection named by
51741 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
51742 attempt to set up a TLS session is aborted, and the incoming connection is
51743 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
51744 session continues. ACLs that run for subsequent SMTP commands can detect the
51745 fact that no certificate was verified, and vary their actions accordingly. For
51746 example, you can insist on a certificate before accepting a message for
51747 relaying, but not when the message is destined for local delivery.
51748 </para>
51749 <para>
51750 <indexterm role="variable">
51751 <primary><varname>$tls_in_peerdn</varname></primary>
51752 </indexterm>
51753 When a client supplies a certificate (whether it verifies or not), the value of
51754 the Distinguished Name of the certificate is made available in the variable
51755 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
51756 </para>
51757 <para>
51758 <indexterm role="concept">
51759 <primary>log</primary>
51760 <secondary>distinguished name</secondary>
51761 </indexterm>
51762 Because it is often a long text string, it is not included in the log line or
51763 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
51764 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
51765 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
51766 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
51767 </para>
51768 </section>
51769 <section id="SECID184">
51770 <title>Revoked certificates</title>
51771 <para>
51772 <indexterm role="concept">
51773 <primary>TLS</primary>
51774 <secondary>revoked certificates</secondary>
51775 </indexterm>
51776 <indexterm role="concept">
51777 <primary>revocation list</primary>
51778 </indexterm>
51779 <indexterm role="concept">
51780 <primary>certificate</primary>
51781 <secondary>revocation list</secondary>
51782 </indexterm>
51783 <indexterm role="concept">
51784 <primary>OCSP</primary>
51785 <secondary>stapling</secondary>
51786 </indexterm>
51787 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
51788 certificates are revoked. If you have such a list, you can pass it to an Exim
51789 server using the global option called <option>tls_crl</option> and to an Exim client using
51790 an identically named option for the <command>smtp</command> transport. In each case, the value
51791 of the option is expanded and must then be the name of a file that contains a
51792 CRL in PEM format.
51793 The downside is that clients have to periodically re-download a potentially huge
51794 file from every certificate authority they know of.
51795 </para>
51796 <para>
51797 The way with most moving parts at query time is Online Certificate
51798 Status Protocol (OCSP), where the client verifies the certificate
51799 against an OCSP server run by the CA.  This lets the CA track all
51800 usage of the certs.  It requires running software with access to the
51801 private key of the CA, to sign the responses to the OCSP queries.  OCSP
51802 is based on HTTP and can be proxied accordingly.
51803 </para>
51804 <para>
51805 The only widespread OCSP server implementation (known to this writer)
51806 comes as part of OpenSSL and aborts on an invalid request, such as
51807 connecting to the port and then disconnecting.  This requires
51808 re-entering the passphrase each time some random client does this.
51809 </para>
51810 <para>
51811 The third way is OCSP Stapling; in this, the server using a certificate
51812 issued by the CA periodically requests an OCSP proof of validity from
51813 the OCSP server, then serves it up inline as part of the TLS
51814 negotiation.   This approach adds no extra round trips, does not let the
51815 CA track users, scales well with number of certs issued by the CA and is
51816 resilient to temporary OCSP server failures, as long as the server
51817 starts retrying to fetch an OCSP proof some time before its current
51818 proof expires.  The downside is that it requires server support.
51819 </para>
51820 <para>
51821 Unless Exim is built with the support disabled,
51822 or with GnuTLS earlier than version 3.1.3,
51823 support for OCSP stapling is included.
51824 </para>
51825 <para>
51826 There is a global option called <option>tls_ocsp_file</option>.
51827 The file specified therein is expected to be in DER format, and contain
51828 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
51829 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
51830 contains <literal>tls_in_sni</literal>, as per other TLS options.
51831 </para>
51832 <para>
51833 Exim does not at this time implement any support for fetching a new OCSP
51834 proof.  The burden is on the administrator to handle this, outside of
51835 Exim.  The file specified should be replaced atomically, so that the
51836 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
51837 on each connection, so a new file will be handled transparently on the
51838 next connection.
51839 </para>
51840 <para>
51841 When built with OpenSSL Exim will check for a valid next update timestamp
51842 in the OCSP proof; if not present, or if the proof has expired, it will be
51843 ignored.
51844 </para>
51845 <para>
51846 For the client to be able to verify the stapled OCSP the server must
51847 also supply, in its stapled information, any intermediate
51848 certificates for the chain leading to the OCSP proof from the signer
51849 of the server certificate.  There may be zero or one such. These
51850 intermediate certificates should be added to the server OCSP stapling
51851 file named by <option>tls_ocsp_file</option>.
51852 </para>
51853 <para>
51854 Note that the proof only covers the terminal server certificate,
51855 not any of the chain from CA to it.
51856 </para>
51857 <para>
51858 There is no current way to staple a proof for a client certificate.
51859 </para>
51860 <literallayout class="monospaced">
51861   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
51862   OCSP server is supplied.  The server URL may be included in the
51863   server certificate, if the CA is helpful.
51864
51865   One failure mode seen was the OCSP Signer cert expiring before the end
51866   of validity of the OCSP proof. The checking done by Exim/OpenSSL
51867   noted this as invalid overall, but the re-fetch script did not.
51868 </literallayout>
51869 </section>
51870 <section id="SECID185">
51871 <title>Configuring an Exim client to use TLS</title>
51872 <para>
51873 <indexterm role="concept">
51874 <primary>cipher</primary>
51875 <secondary>logging</secondary>
51876 </indexterm>
51877 <indexterm role="concept">
51878 <primary>log</primary>
51879 <secondary>TLS cipher</secondary>
51880 </indexterm>
51881 <indexterm role="concept">
51882 <primary>log</primary>
51883 <secondary>distinguished name</secondary>
51884 </indexterm>
51885 <indexterm role="concept">
51886 <primary>TLS</primary>
51887 <secondary>configuring an Exim client</secondary>
51888 </indexterm>
51889 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
51890 deliveries as well as to incoming, the latter one causing logging of the
51891 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
51892 within the <command>smtp</command> transport.
51893 </para>
51894 <para>
51895 It is not necessary to set any options to have TLS work in the <command>smtp</command>
51896 transport. If Exim is built with TLS support, and TLS is advertised by a
51897 server, the <command>smtp</command> transport always tries to start a TLS session. However,
51898 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
51899 transport) to a list of server hosts for which TLS should not be used.
51900 </para>
51901 <para>
51902 If you do not want Exim to attempt to send messages unencrypted when an attempt
51903 to set up an encrypted connection fails in any way, you can set
51904 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
51905 those hosts, delivery is always deferred if an encrypted connection cannot be
51906 set up. If there are any other hosts for the address, they are tried in the
51907 usual way.
51908 </para>
51909 <para>
51910 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
51911 the message unencrypted. It always does this if the response to STARTTLS is
51912 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
51913 session after a success response code, what happens is controlled by the
51914 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
51915 delivery to this host is deferred, and other hosts (if available) are tried. If
51916 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
51917 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
51918 negotiation fails, Exim closes the current connection (because it is in an
51919 unknown state), opens a new one to the same host, and then tries the delivery
51920 unencrypted.
51921 </para>
51922 <para>
51923 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
51924 transport provide the client with a certificate, which is passed to the server
51925 if it requests it. If the server is Exim, it will request a certificate only if
51926 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
51927 </para>
51928 <para>
51929 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
51930 specifies a collection of expected server certificates.
51931 </para>
51932 <para revisionflag="changed">
51933 These may be the system default set (depending on library version),
51934 </para>
51935 <para>
51936 a file or,
51937 depending on library version, a directory,
51938 must name a file or,
51939 for OpenSSL only (not GnuTLS), a directory.
51940 The client verifies the server&#x2019;s certificate
51941 against this collection, taking into account any revoked certificates that are
51942 in the list defined by <option>tls_crl</option>.
51943 Failure to verify fails the TLS connection unless either of the
51944 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
51945 </para>
51946 <para>
51947 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
51948 certificate verification to the listed servers.  Verification either must
51949 or need not succeed respectively.
51950 </para>
51951 <para>
51952 The <command>smtp</command> transport has two OCSP-related options:
51953 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
51954 is requested and required for the connection to proceed.  The default
51955 value is empty.
51956 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
51957 a Certificate Status is requested (but not necessarily verified).  The default
51958 value is "*" meaning that requests are made unless configured
51959 otherwise.
51960 </para>
51961 <para>
51962 The host(s) should also be in <option>hosts_require_tls</option>, and
51963 <option>tls_verify_certificates</option> configured for the transport,
51964 for OCSP to be relevant.
51965 </para>
51966 <para>
51967 If
51968 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
51969 list of permitted cipher suites. If either of these checks fails, delivery to
51970 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
51971 alternative hosts, if any.
51972 </para>
51973 <para>
51974  <emphasis role="bold">Note</emphasis>:
51975 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
51976 is operating as a client. Exim does not assume that a server certificate (set
51977 by the global options of the same name) should also be used when operating as a
51978 client.
51979 </para>
51980 <para>
51981 <indexterm role="variable">
51982 <primary><varname>$host</varname></primary>
51983 </indexterm>
51984 <indexterm role="variable">
51985 <primary><varname>$host_address</varname></primary>
51986 </indexterm>
51987 All the TLS options in the <command>smtp</command> transport are expanded before use, with
51988 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
51989 which the client is connected. Forced failure of an expansion causes Exim to
51990 behave as if the relevant option were unset.
51991 </para>
51992 <para>
51993 <indexterm role="variable">
51994 <primary><varname>$tls_out_bits</varname></primary>
51995 </indexterm>
51996 <indexterm role="variable">
51997 <primary><varname>$tls_out_cipher</varname></primary>
51998 </indexterm>
51999 <indexterm role="variable">
52000 <primary><varname>$tls_out_peerdn</varname></primary>
52001 </indexterm>
52002 <indexterm role="variable">
52003 <primary><varname>$tls_out_sni</varname></primary>
52004 </indexterm>
52005 Before an SMTP connection is established, the
52006 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
52007 variables are emptied. (Until the first connection, they contain the values
52008 that were set when the message was received.) If STARTTLS is subsequently
52009 successfully obeyed, these variables are set to the relevant values for the
52010 outgoing connection.
52011 </para>
52012 </section>
52013 <section id="SECTtlssni">
52014 <title>Use of TLS Server Name Indication</title>
52015 <para>
52016 <indexterm role="concept">
52017 <primary>TLS</primary>
52018 <secondary>Server Name Indication</secondary>
52019 </indexterm>
52020 <indexterm role="variable">
52021 <primary><varname>$tls_in_sni</varname></primary>
52022 </indexterm>
52023 <indexterm role="option">
52024 <primary><option>tls_in_sni</option></primary>
52025 </indexterm>
52026 With TLS1.0 or above, there is an extension mechanism by which extra
52027 information can be included at various points in the protocol.  One of these
52028 extensions, documented in RFC 6066 (and before that RFC 4366) is
52029 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
52030 client in the initial handshake, so that the server can examine the servername
52031 within and possibly choose to use different certificates and keys (and more)
52032 for this session.
52033 </para>
52034 <para>
52035 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
52036 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
52037 address.
52038 </para>
52039 <para>
52040 With SMTP to MX, there are the same problems here as in choosing the identity
52041 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
52042 provide the identity which you then cryptographically verify.  So this will
52043 be of limited use in that environment.
52044 </para>
52045 <para>
52046 With SMTP to Submission, there is a well-defined hostname which clients are
52047 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
52048 choose to include this information in the TLS negotiation.  If this becomes
52049 wide-spread, then hosters can choose to present different certificates to
52050 different clients.  Or even negotiate different cipher suites.
52051 </para>
52052 <para>
52053 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
52054 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
52055 nothing more to it.  Choosing a sensible value not derived insecurely is the
52056 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
52057 for the lifetime of the client connection (including during authentication).
52058 </para>
52059 <para>
52060 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
52061 received from a client.
52062 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
52063 </para>
52064 <para>
52065 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
52066 option (prior to expansion) then the following options will be re-expanded
52067 during TLS session handshake, to permit alternative values to be chosen:
52068 </para>
52069 <itemizedlist>
52070 <listitem>
52071 <para>
52072 <indexterm role="variable">
52073 <primary><option>tls_certificate</option></primary>
52074 </indexterm>
52075 <option>tls_certificate</option>
52076 </para>
52077 </listitem>
52078 <listitem>
52079 <para>
52080 <indexterm role="variable">
52081 <primary><option>tls_crl</option></primary>
52082 </indexterm>
52083 <option>tls_crl</option>
52084 </para>
52085 </listitem>
52086 <listitem>
52087 <para>
52088 <indexterm role="variable">
52089 <primary><option>tls_privatekey</option></primary>
52090 </indexterm>
52091 <option>tls_privatekey</option>
52092 </para>
52093 </listitem>
52094 <listitem>
52095 <para>
52096 <indexterm role="variable">
52097 <primary><option>tls_verify_certificates</option></primary>
52098 </indexterm>
52099 <option>tls_verify_certificates</option>
52100 </para>
52101 </listitem>
52102 <listitem>
52103 <para>
52104 <indexterm role="variable">
52105 <primary><option>tls_ocsp_file</option></primary>
52106 </indexterm>
52107 <option>tls_ocsp_file</option>
52108 </para>
52109 </listitem>
52110 </itemizedlist>
52111 <para>
52112 Great care should be taken to deal with matters of case, various injection
52113 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
52114 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
52115 arbitrary unverified data provided prior to authentication.
52116 </para>
52117 <para>
52118 The Exim developers are proceeding cautiously and so far no other TLS options
52119 are re-expanded.
52120 </para>
52121 <para>
52122 When Exim is built against OpenSSL, OpenSSL must have been built with support
52123 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
52124 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
52125 see <literal>-servername</literal> in the output, then OpenSSL has support.
52126 </para>
52127 <para>
52128 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
52129 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
52130 built, then you have SNI support).
52131 </para>
52132 </section>
52133 <section id="SECTmulmessam">
52134 <title>Multiple messages on the same encrypted TCP/IP connection</title>
52135 <para>
52136 <indexterm role="concept">
52137 <primary>multiple SMTP deliveries with TLS</primary>
52138 </indexterm>
52139 <indexterm role="concept">
52140 <primary>TLS</primary>
52141 <secondary>multiple message deliveries</secondary>
52142 </indexterm>
52143 Exim sends multiple messages down the same TCP/IP connection by starting up
52144 an entirely new delivery process for each message, passing the socket from
52145 one process to the next. This implementation does not fit well with the use
52146 of TLS, because there is quite a lot of state information associated with a TLS
52147 connection, not just a socket identification. Passing all the state information
52148 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
52149 session before passing the socket to a new process. The new process may then
52150 try to start a new TLS session, and if successful, may try to re-authenticate
52151 if AUTH is in use, before sending the next message.
52152 </para>
52153 <para>
52154 The RFC is not clear as to whether or not an SMTP session continues in clear
52155 after TLS has been shut down, or whether TLS may be restarted again later, as
52156 just described. However, if the server is Exim, this shutdown and
52157 reinitialization works. It is not known which (if any) other servers operate
52158 successfully if the client closes a TLS session and continues with unencrypted
52159 SMTP, but there are certainly some that do not work. For such servers, Exim
52160 should not pass the socket to another process, because the failure of the
52161 subsequent attempt to use it would cause Exim to record a temporary host error,
52162 and delay other deliveries to that host.
52163 </para>
52164 <para>
52165 To test for this case, Exim sends an EHLO command to the server after
52166 closing down the TLS session. If this fails in any way, the connection is
52167 closed instead of being passed to a new delivery process, but no retry
52168 information is recorded.
52169 </para>
52170 <para>
52171 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
52172 <command>smtp</command> transport to match those hosts for which Exim should not pass
52173 connections to new processes if TLS has been used.
52174 </para>
52175 </section>
52176 <section id="SECTcerandall">
52177 <title>Certificates and all that</title>
52178 <para>
52179 <indexterm role="concept">
52180 <primary>certificate</primary>
52181 <secondary>references to discussion</secondary>
52182 </indexterm>
52183 In order to understand fully how TLS works, you need to know about
52184 certificates, certificate signing, and certificate authorities. This is not the
52185 place to give a tutorial, especially as I do not know very much about it
52186 myself. Some helpful introduction can be found in the FAQ for the SSL addition
52187 to Apache, currently at
52188 </para>
52189 <literallayout>
52190 <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>
52191 </literallayout>
52192 <para>
52193 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
52194 links to further files.
52195 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
52196 0-201-61598-3), contains both introductory and more in-depth descriptions.
52197 Some sample programs taken from the book are available from
52198 </para>
52199 <literallayout>
52200 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
52201 </literallayout>
52202 </section>
52203 <section id="SECID186">
52204 <title>Certificate chains</title>
52205 <para>
52206 The file named by <option>tls_certificate</option> may contain more than one
52207 certificate. This is useful in the case where the certificate that is being
52208 sent is validated by an intermediate certificate which the other end does
52209 not have. Multiple certificates must be in the correct order in the file.
52210 First the host&#x2019;s certificate itself, then the first intermediate
52211 certificate to validate the issuer of the host certificate, then the next
52212 intermediate certificate to validate the issuer of the first intermediate
52213 certificate, and so on, until finally (optionally) the root certificate.
52214 The root certificate must already be trusted by the recipient for
52215 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
52216 root certificate along with the rest makes it available for the user to
52217 install if the receiving end is a client MUA that can interact with a user.
52218 </para>
52219 <para>
52220 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
52221 even if your libraries allow loading them for use in Exim when acting as a
52222 server, increasingly clients will not accept such certificates.  The error
52223 diagnostics in such a case can be frustratingly vague.
52224 </para>
52225 </section>
52226 <section id="SECID187">
52227 <title>Self-signed certificates</title>
52228 <para>
52229 <indexterm role="concept">
52230 <primary>certificate</primary>
52231 <secondary>self-signed</secondary>
52232 </indexterm>
52233 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
52234 with OpenSSL, like this:
52235 </para>
52236 <literallayout class="monospaced">
52237 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
52238             -days 9999 -nodes
52239 </literallayout>
52240 <para>
52241 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
52242 delimited and so can be identified independently. The <option>-days</option> option
52243 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
52244 important: if you do not set it, the key is encrypted with a passphrase
52245 that you are prompted for, and any use that is made of the key causes more
52246 prompting for the passphrase. This is not helpful if you are going to use
52247 this certificate and key in an MTA, where prompting is not possible.
52248 </para>
52249 <para>
52250 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
52251 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
52252 the above command might produce a date in the past.  Think carefully about
52253 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
52254 of the certificate or reconsider your platform deployment.  (At time of
52255 writing, reducing the duration is the most likely choice, but the inexorable
52256 progression of time takes us steadily towards an era where this will not
52257 be a sensible resolution).
52258 </para>
52259 <para>
52260 A self-signed certificate made in this way is sufficient for testing, and
52261 may be adequate for all your requirements if you are mainly interested in
52262 encrypting transfers, and not in secure identification.
52263 </para>
52264 <para>
52265 However, many clients require that the certificate presented by the server be a
52266 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
52267 certificate. In this situation, the self-signed certificate described above
52268 must be installed on the client host as a trusted root <emphasis>certification
52269 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
52270 signed with that self-signed certificate.
52271 </para>
52272 <para>
52273 For information on creating self-signed CA certificates and using them to sign
52274 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
52275 Open-source PKI book, available online at
52276 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
52277 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
52278 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
52279 </para>
52280 </section>
52281 </chapter>
52282
52283 <chapter id="CHAPACL">
52284 <title>Access control lists</title>
52285 <para>
52286 <indexterm role="concept" id="IIDacl" class="startofrange">
52287 <primary>access control lists (ACLs)</primary>
52288 <secondary>description</secondary>
52289 </indexterm>
52290 <indexterm role="concept">
52291 <primary>control of incoming mail</primary>
52292 </indexterm>
52293 <indexterm role="concept">
52294 <primary>message</primary>
52295 <secondary>controlling incoming</secondary>
52296 </indexterm>
52297 <indexterm role="concept">
52298 <primary>policy control</primary>
52299 <secondary>access control lists</secondary>
52300 </indexterm>
52301 Access Control Lists (ACLs) are defined in a separate section of the run time
52302 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
52303 name, terminated by a colon. Here is a complete ACL section that contains just
52304 one very small ACL:
52305 </para>
52306 <literallayout class="monospaced">
52307 begin acl
52308 small_acl:
52309   accept   hosts = one.host.only
52310 </literallayout>
52311 <para>
52312 You can have as many lists as you like in the ACL section, and the order in
52313 which they appear does not matter. The lists are self-terminating.
52314 </para>
52315 <para>
52316 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
52317 certain SMTP commands. This applies both to incoming TCP/IP connections, and
52318 when a local process submits a message using SMTP by specifying the <option>-bs</option>
52319 option. The most common use is for controlling which recipients are accepted
52320 in incoming messages. In addition, you can define an ACL that is used to check
52321 local non-SMTP messages. The default configuration file contains an example of
52322 a realistic ACL for checking RCPT commands. This is discussed in chapter
52323 <xref linkend="CHAPdefconfil"/>.
52324 </para>
52325 <section id="SECID188">
52326 <title>Testing ACLs</title>
52327 <para>
52328 The <option>-bh</option> command line option provides a way of testing your ACL
52329 configuration locally by running a fake SMTP session with which you interact.
52330 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
52331 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
52332 </para>
52333 </section>
52334 <section id="SECID189">
52335 <title>Specifying when ACLs are used</title>
52336 <para>
52337 <indexterm role="concept">
52338 <primary>access control lists (ACLs)</primary>
52339 <secondary>options for specifying</secondary>
52340 </indexterm>
52341 In order to cause an ACL to be used, you have to name it in one of the relevant
52342 options in the main part of the configuration. These options are:
52343 <indexterm role="concept">
52344 <primary>AUTH</primary>
52345 <secondary>ACL for</secondary>
52346 </indexterm>
52347 <indexterm role="concept">
52348 <primary>DATA</primary>
52349 <secondary>ACLs for</secondary>
52350 </indexterm>
52351 <indexterm role="concept">
52352 <primary>ETRN</primary>
52353 <secondary>ACL for</secondary>
52354 </indexterm>
52355 <indexterm role="concept">
52356 <primary>EXPN</primary>
52357 <secondary>ACL for</secondary>
52358 </indexterm>
52359 <indexterm role="concept">
52360 <primary>HELO</primary>
52361 <secondary>ACL for</secondary>
52362 </indexterm>
52363 <indexterm role="concept">
52364 <primary>EHLO</primary>
52365 <secondary>ACL for</secondary>
52366 </indexterm>
52367 <indexterm role="concept">
52368 <primary>DKIM</primary>
52369 <secondary>ACL for</secondary>
52370 </indexterm>
52371 <indexterm role="concept">
52372 <primary>MAIL</primary>
52373 <secondary>ACL for</secondary>
52374 </indexterm>
52375 <indexterm role="concept">
52376 <primary>QUIT, ACL for</primary>
52377 </indexterm>
52378 <indexterm role="concept">
52379 <primary>RCPT</primary>
52380 <secondary>ACL for</secondary>
52381 </indexterm>
52382 <indexterm role="concept">
52383 <primary>STARTTLS, ACL for</primary>
52384 </indexterm>
52385 <indexterm role="concept">
52386 <primary>VRFY</primary>
52387 <secondary>ACL for</secondary>
52388 </indexterm>
52389 <indexterm role="concept">
52390 <primary>SMTP</primary>
52391 <secondary>connection, ACL for</secondary>
52392 </indexterm>
52393 <indexterm role="concept">
52394 <primary>non-SMTP messages</primary>
52395 <secondary>ACLs for</secondary>
52396 </indexterm>
52397 <indexterm role="concept">
52398 <primary>MIME content scanning</primary>
52399 <secondary>ACL for</secondary>
52400 </indexterm>
52401 <indexterm role="concept">
52402 <primary>PRDR</primary>
52403 <secondary>ACL for</secondary>
52404 </indexterm>
52405 </para>
52406 <informaltable frame="none">
52407 <tgroup cols="2" colsep="0" rowsep="0">
52408 <colspec colwidth="140pt" align="left"/>
52409 <colspec colwidth="254pt" align="left"/>
52410 <tbody>
52411 <row>
52412 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
52413 <entry>ACL for non-SMTP messages</entry>
52414 </row>
52415 <row>
52416 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
52417 <entry>ACL for non-SMTP MIME parts</entry>
52418 </row>
52419 <row>
52420 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
52421 <entry>ACL at start of non-SMTP message</entry>
52422 </row>
52423 <row>
52424 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
52425 <entry>ACL for AUTH</entry>
52426 </row>
52427 <row>
52428 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
52429 <entry>ACL for start of SMTP connection</entry>
52430 </row>
52431 <row>
52432 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
52433 <entry>ACL after DATA is complete</entry>
52434 </row>
52435 <row>
52436 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
52437 <entry>ACL for each recipient, after DATA is complete</entry>
52438 </row>
52439 <row>
52440 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
52441 <entry>ACL for each DKIM signer</entry>
52442 </row>
52443 <row>
52444 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
52445 <entry>ACL for ETRN</entry>
52446 </row>
52447 <row>
52448 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
52449 <entry>ACL for EXPN</entry>
52450 </row>
52451 <row>
52452 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
52453 <entry>ACL for HELO or EHLO</entry>
52454 </row>
52455 <row>
52456 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
52457 <entry>ACL for MAIL</entry>
52458 </row>
52459 <row>
52460 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
52461 <entry>ACL for the AUTH parameter of MAIL</entry>
52462 </row>
52463 <row>
52464 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
52465 <entry>ACL for content-scanning MIME parts</entry>
52466 </row>
52467 <row>
52468 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
52469 <entry>ACL for non-QUIT terminations</entry>
52470 </row>
52471 <row>
52472 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
52473 <entry>ACL at start of DATA command</entry>
52474 </row>
52475 <row>
52476 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
52477 <entry>ACL for QUIT</entry>
52478 </row>
52479 <row>
52480 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
52481 <entry>ACL for RCPT</entry>
52482 </row>
52483 <row>
52484 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
52485 <entry>ACL for STARTTLS</entry>
52486 </row>
52487 <row>
52488 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
52489 <entry>ACL for VRFY</entry>
52490 </row>
52491 </tbody>
52492 </tgroup>
52493 </informaltable>
52494 <para>
52495 For example, if you set
52496 </para>
52497 <literallayout class="monospaced">
52498 acl_smtp_rcpt = small_acl
52499 </literallayout>
52500 <para>
52501 the little ACL defined above is used whenever Exim receives a RCPT command
52502 in an SMTP dialogue. The majority of policy tests on incoming messages can be
52503 done when RCPT commands arrive. A rejection of RCPT should cause the
52504 sending MTA to give up on the recipient address contained in the RCPT
52505 command, whereas rejection at other times may cause the client MTA to keep on
52506 trying to deliver the message. It is therefore recommended that you do as much
52507 testing as possible at RCPT time.
52508 </para>
52509 </section>
52510 <section id="SECID190">
52511 <title>The non-SMTP ACLs</title>
52512 <para>
52513 <indexterm role="concept">
52514 <primary>non-SMTP messages</primary>
52515 <secondary>ACLs for</secondary>
52516 </indexterm>
52517 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
52518 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
52519 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
52520 the state of the SMTP connection such as encryption and authentication) are not
52521 relevant and are forbidden in these ACLs. However, the sender and recipients
52522 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
52523 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
52524 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
52525 in any of these ACLs.
52526 </para>
52527 <para>
52528 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
52529 non-SMTP message, before any of the message has been read. (This is the
52530 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
52531 batched SMTP input, it runs after the DATA command has been reached. The
52532 result of this ACL is ignored; it cannot be used to reject a message. If you
52533 really need to, you could set a value in an ACL variable here and reject based
52534 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
52535 controls, and in particular, it can be used to set
52536 </para>
52537 <literallayout class="monospaced">
52538 control = suppress_local_fixups
52539 </literallayout>
52540 <para>
52541 This cannot be used in the other non-SMTP ACLs because by the time they are
52542 run, it is too late.
52543 </para>
52544 <para>
52545 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
52546 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
52547 </para>
52548 <para>
52549 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
52550 kind of rejection is treated as permanent, because there is no way of sending a
52551 temporary error for these kinds of message.
52552 </para>
52553 </section>
52554 <section id="SECID191">
52555 <title>The SMTP connect ACL</title>
52556 <para>
52557 <indexterm role="concept">
52558 <primary>SMTP</primary>
52559 <secondary>connection, ACL for</secondary>
52560 </indexterm>
52561 <indexterm role="option">
52562 <primary><option>smtp_banner</option></primary>
52563 </indexterm>
52564 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
52565 session, after the test specified by <option>host_reject_connection</option> (which is now
52566 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
52567 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
52568 the message override the banner message that is otherwise specified by the
52569 <option>smtp_banner</option> option.
52570 </para>
52571 </section>
52572 <section id="SECID192">
52573 <title>The EHLO/HELO ACL</title>
52574 <para>
52575 <indexterm role="concept">
52576 <primary>EHLO</primary>
52577 <secondary>ACL for</secondary>
52578 </indexterm>
52579 <indexterm role="concept">
52580 <primary>HELO</primary>
52581 <secondary>ACL for</secondary>
52582 </indexterm>
52583 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
52584 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
52585 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
52586 Note that a client may issue more than one EHLO or HELO command in an SMTP
52587 session, and indeed is required to issue a new EHLO or HELO after successfully
52588 setting up encryption following a STARTTLS command.
52589 </para>
52590 <para>
52591 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
52592 modifier, the message may not contain more than one line (it will be truncated
52593 at the first newline and a panic logged if it does). Such a message cannot
52594 affect the EHLO options that are listed on the second and subsequent lines of
52595 an EHLO response.
52596 </para>
52597 </section>
52598 <section id="SECID193">
52599 <title>The DATA ACLs</title>
52600 <para>
52601 <indexterm role="concept">
52602 <primary>DATA</primary>
52603 <secondary>ACLs for</secondary>
52604 </indexterm>
52605 Two ACLs are associated with the DATA command, because it is two-stage
52606 command, with two responses being sent to the client.
52607 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
52608 is obeyed. This gives you control after all the RCPT commands, but before
52609 the message itself is received. It offers the opportunity to give a negative
52610 response to the DATA command before the data is transmitted. Header lines
52611 added by MAIL or RCPT ACLs are not visible at this time, but any that
52612 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
52613 </para>
52614 <para>
52615 You cannot test the contents of the message, for example, to verify addresses
52616 in the headers, at RCPT time or when the DATA command is received. Such
52617 tests have to appear in the ACL that is run after the message itself has been
52618 received, before the final response to the DATA command is sent. This is
52619 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
52620 associated with the DATA command.
52621 </para>
52622 <para>
52623 For both of these ACLs, it is not possible to reject individual recipients. An
52624 error response rejects the entire message. Unfortunately, it is known that some
52625 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
52626 before or after the data) correctly &ndash; they keep the message on their queues
52627 and try again later, but that is their problem, though it does waste some of
52628 your resources.
52629 </para>
52630 <para>
52631 The <option>acl_smtp_data</option> ACL is run after
52632 the <option>acl_smtp_data_prdr</option>,
52633 the <option>acl_smtp_dkim</option>
52634 and the <option>acl_smtp_mime</option> ACLs.
52635 </para>
52636 </section>
52637 <section id="SECTDKIMACL">
52638 <title>The SMTP DKIM ACL</title>
52639 <para>
52640 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
52641 enabled (which is the default).
52642 </para>
52643 <para>
52644 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
52645 received, and is executed for each DKIM signature found in a message.  If not
52646 otherwise specified, the default action is to accept.
52647 </para>
52648 <para>
52649 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
52650 </para>
52651 <para>
52652 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
52653 </para>
52654 </section>
52655 <section id="SECID194">
52656 <title>The SMTP MIME ACL</title>
52657 <para>
52658 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
52659 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
52660 </para>
52661 <para>
52662 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
52663 </para>
52664 </section>
52665 <section id="SECTPRDRACL">
52666 <title>The SMTP PRDR ACL</title>
52667 <para>
52668 <indexterm role="concept">
52669 <primary>PRDR</primary>
52670 <secondary>ACL for</secondary>
52671 </indexterm>
52672 <indexterm role="option">
52673 <primary><option>prdr_enable</option></primary>
52674 </indexterm>
52675 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
52676 with PRDR support enabled (which is the default).
52677 It becomes active only when the PRDR feature is negotiated between
52678 client and server for a message, and more than one recipient
52679 has been accepted.
52680 </para>
52681 <para>
52682 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
52683 has been received, and is executed once for each recipient of the message
52684 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
52685 The test may accept, defer or deny for individual recipients.
52686 The <option>acl_smtp_data</option> will still be called after this ACL and
52687 can reject the message overall, even if this ACL has accepted it
52688 for some or all recipients.
52689 </para>
52690 <para>
52691 PRDR may be used to support per-user content filtering.  Without it
52692 one must defer any recipient after the first that has a different
52693 content-filter configuration.  With PRDR, the RCPT-time check
52694 for this can be disabled when the MAIL-time $smtp_command included
52695 "PRDR".  Any required difference in behaviour of the main DATA-time
52696 ACL should however depend on the PRDR-time ACL having run, as Exim
52697 will avoid doing so in some situations (e.g.  single-recipient mails).
52698 </para>
52699 <para>
52700 See also the <option>prdr_enable</option> global option
52701 and the <option>hosts_try_prdr</option> smtp transport option.
52702 </para>
52703 <para>
52704 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
52705 If the ACL is not defined, processing completes as if
52706 the feature was not requested by the client.
52707 </para>
52708 </section>
52709 <section id="SECTQUITACL">
52710 <title>The QUIT ACL</title>
52711 <para>
52712 <indexterm role="concept">
52713 <primary>QUIT, ACL for</primary>
52714 </indexterm>
52715 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
52716 does not affect the response code to QUIT, which is always 221. Thus, the ACL
52717 does not in fact control any access.
52718 </para>
52719 <para revisionflag="changed">
52720 For this reason, it may only accept
52721 or warn as its final result.
52722 </para>
52723 <para>
52724 This ACL can be used for tasks such as custom logging at the end of an SMTP
52725 session. For example, you can use ACL variables in other ACLs to count
52726 messages, recipients, etc., and log the totals at QUIT time using one or
52727 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
52728 </para>
52729 <para>
52730 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
52731 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
52732 </para>
52733 <para>
52734 You do not need to have a final <option>accept</option>, but if you do, you can use a
52735 <option>message</option> modifier to specify custom text that is sent as part of the 221
52736 response to QUIT.
52737 </para>
52738 <para>
52739 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
52740 failure (for example, failure to open a log file, or when Exim is bombing out
52741 because it has detected an unrecoverable error), all SMTP commands from the
52742 client are given temporary error responses until QUIT is received or the
52743 connection is closed. In these special cases, the QUIT ACL does not run.
52744 </para>
52745 </section>
52746 <section id="SECTNOTQUITACL">
52747 <title>The not-QUIT ACL</title>
52748 <para>
52749 <indexterm role="variable">
52750 <primary><varname>$acl_smtp_notquit</varname></primary>
52751 </indexterm>
52752 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
52753 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
52754 trouble, such as being unable to write to its log files, this ACL is not run,
52755 because it might try to do things (such as write to log files) that make the
52756 situation even worse.
52757 </para>
52758 <para>
52759 Like the QUIT ACL, this ACL is provided to make it possible to do customized
52760 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
52761 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
52762 and <option>warn</option>.
52763 </para>
52764 <para>
52765 <indexterm role="variable">
52766 <primary><varname>$smtp_notquit_reason</varname></primary>
52767 </indexterm>
52768 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
52769 to a string that indicates the reason for the termination of the SMTP
52770 connection. The possible values are:
52771 </para>
52772 <informaltable frame="none">
52773 <tgroup cols="2" colsep="0" rowsep="0">
52774 <colspec colwidth="196pt" align="left"/>
52775 <colspec colwidth="254pt" align="left"/>
52776 <tbody>
52777 <row>
52778 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
52779 <entry>Another ACL issued a <option>drop</option> command</entry>
52780 </row>
52781 <row>
52782 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
52783 <entry>Too many unknown or non-mail commands</entry>
52784 </row>
52785 <row>
52786 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
52787 <entry>Timeout while reading SMTP commands</entry>
52788 </row>
52789 <row>
52790 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
52791 <entry>The SMTP connection has been lost</entry>
52792 </row>
52793 <row>
52794 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
52795 <entry>Timeout while reading message data</entry>
52796 </row>
52797 <row>
52798 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
52799 <entry>The <function>local_scan()</function> function crashed</entry>
52800 </row>
52801 <row>
52802 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
52803 <entry>The <function>local_scan()</function> function timed out</entry>
52804 </row>
52805 <row>
52806 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
52807 <entry>SIGTERM or SIGINT</entry>
52808 </row>
52809 <row>
52810 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
52811 <entry>SMTP synchronization error</entry>
52812 </row>
52813 <row>
52814 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
52815 <entry>TLS failed to start</entry>
52816 </row>
52817 </tbody>
52818 </tgroup>
52819 </informaltable>
52820 <para>
52821 In most cases when an SMTP connection is closed without having received QUIT,
52822 Exim sends an SMTP response message before actually closing the connection.
52823 With the exception of the <literal>acl-drop</literal> case, the default message can be
52824 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
52825 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
52826 used.
52827 </para>
52828 </section>
52829 <section id="SECID195">
52830 <title>Finding an ACL to use</title>
52831 <para>
52832 <indexterm role="concept">
52833 <primary>access control lists (ACLs)</primary>
52834 <secondary>finding which to use</secondary>
52835 </indexterm>
52836 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
52837 you can use different ACLs in different circumstances. For example,
52838 </para>
52839 <literallayout class="monospaced">
52840 acl_smtp_rcpt = ${if ={25}{$interface_port} \
52841                      {acl_check_rcpt} {acl_check_rcpt_submit} }
52842 </literallayout>
52843 <para>
52844 In the default configuration file there are some example settings for
52845 providing an RFC 4409 message submission service on port 587 and a
52846 non-standard <quote>smtps</quote> service on port 465. You can use a string
52847 expansion like this to choose an ACL for MUAs on these ports which is
52848 more appropriate for this purpose than the default ACL on port 25.
52849 </para>
52850 <para>
52851 The expanded string does not have to be the name of an ACL in the
52852 configuration file; there are other possibilities. Having expanded the
52853 string, Exim searches for an ACL as follows:
52854 </para>
52855 <itemizedlist>
52856 <listitem>
52857 <para>
52858 If the string begins with a slash, Exim uses it as a file name, and reads its
52859 contents as an ACL. The lines are processed in the same way as lines in the
52860 Exim configuration file. In particular, continuation lines are supported, blank
52861 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
52862 If the file does not exist or cannot be read, an error occurs (typically
52863 causing a temporary failure of whatever caused the ACL to be run). For example:
52864 </para>
52865 <literallayout class="monospaced">
52866 acl_smtp_data = /etc/acls/\
52867   ${lookup{$sender_host_address}lsearch\
52868   {/etc/acllist}{$value}{default}}
52869 </literallayout>
52870 <para>
52871 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
52872 back to a default if the lookup fails. If an ACL is successfully read from a
52873 file, it is retained in memory for the duration of the Exim process, so that it
52874 can be re-used without having to re-read the file.
52875 </para>
52876 </listitem>
52877 <listitem>
52878 <para>
52879 If the string does not start with a slash, and does not contain any spaces,
52880 Exim searches the ACL section of the configuration for an ACL whose name
52881 matches the string.
52882 </para>
52883 </listitem>
52884 <listitem>
52885 <para>
52886 If no named ACL is found, or if the string contains spaces, Exim parses
52887 the string as an inline ACL. This can save typing in cases where you just
52888 want to have something like
52889 </para>
52890 <literallayout class="monospaced">
52891 acl_smtp_vrfy = accept
52892 </literallayout>
52893 <para>
52894 in order to allow free use of the VRFY command. Such a string may contain
52895 newlines; it is processed in the same way as an ACL that is read from a file.
52896 </para>
52897 </listitem>
52898 </itemizedlist>
52899 </section>
52900 <section id="SECID196">
52901 <title>ACL return codes</title>
52902 <para>
52903 <indexterm role="concept">
52904 <primary>access control lists (ACLs)</primary>
52905 <secondary>return codes</secondary>
52906 </indexterm>
52907 Except for the QUIT ACL, which does not affect the SMTP return code (see
52908 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
52909 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
52910 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
52911 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
52912 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
52913 This also causes a 4<emphasis>xx</emphasis> return code.
52914 </para>
52915 <para>
52916 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
52917 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
52918 submitters of non-SMTP messages.
52919 </para>
52920 <para>
52921 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
52922 has the effect of <quote>accept</quote>, but causes either the entire message or an
52923 individual recipient address to be discarded. In other words, it is a
52924 blackholing facility. Use it with care.
52925 </para>
52926 <para>
52927 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
52928 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
52929 RCPT ACL is to discard just the one recipient address. If there are no
52930 recipients left when the message&#x2019;s data is received, the DATA ACL is not
52931 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
52932 remaining recipients. The <quote>discard</quote> return is not permitted for the
52933 <option>acl_smtp_predata</option> ACL.
52934 </para>
52935 <para>
52936 <indexterm role="concept">
52937 <primary><function>local_scan()</function> function</primary>
52938 <secondary>when all recipients discarded</secondary>
52939 </indexterm>
52940 The <function>local_scan()</function> function is always run, even if there are no remaining
52941 recipients; it may create new recipients.
52942 </para>
52943 </section>
52944 <section id="SECID197">
52945 <title>Unset ACL options</title>
52946 <para>
52947 <indexterm role="concept">
52948 <primary>access control lists (ACLs)</primary>
52949 <secondary>unset options</secondary>
52950 </indexterm>
52951 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
52952 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
52953 not defined at all. For any defined ACL, the default action when control
52954 reaches the end of the ACL statements is <quote>deny</quote>.
52955 </para>
52956 <para>
52957 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
52958 these two are ACLs that are used only for their side effects. They cannot be
52959 used to accept or reject anything.
52960 </para>
52961 <para>
52962 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
52963 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
52964 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
52965 when the ACL is not defined is <quote>accept</quote>.
52966 </para>
52967 <para>
52968 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
52969 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
52970 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
52971 messages over an SMTP connection. For an example, see the ACL in the default
52972 configuration file.
52973 </para>
52974 </section>
52975 <section id="SECID198">
52976 <title>Data for message ACLs</title>
52977 <para>
52978 <indexterm role="concept">
52979 <primary>access control lists (ACLs)</primary>
52980 <secondary>data for message ACL</secondary>
52981 </indexterm>
52982 <indexterm role="variable">
52983 <primary><varname>$domain</varname></primary>
52984 </indexterm>
52985 <indexterm role="variable">
52986 <primary><varname>$local_part</varname></primary>
52987 </indexterm>
52988 <indexterm role="variable">
52989 <primary><varname>$sender_address</varname></primary>
52990 </indexterm>
52991 <indexterm role="variable">
52992 <primary><varname>$sender_host_address</varname></primary>
52993 </indexterm>
52994 <indexterm role="variable">
52995 <primary><varname>$smtp_command</varname></primary>
52996 </indexterm>
52997 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
52998 that contain information about the host and the message&#x2019;s sender (for example,
52999 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
53000 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
53001 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
53002 is available in <varname>$smtp_command</varname>.
53003 </para>
53004 <para>
53005 When an ACL for the AUTH parameter of MAIL is running, the variables that
53006 contain information about the host are set, but <varname>$sender_address</varname> is not yet
53007 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
53008 how it is used.
53009 </para>
53010 <para>
53011 <indexterm role="variable">
53012 <primary><varname>$message_size</varname></primary>
53013 </indexterm>
53014 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
53015 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
53016 that parameter is not given. The value is updated to the true message size by
53017 the time the final DATA ACL is run (after the message data has been
53018 received).
53019 </para>
53020 <para>
53021 <indexterm role="variable">
53022 <primary><varname>$rcpt_count</varname></primary>
53023 </indexterm>
53024 <indexterm role="variable">
53025 <primary><varname>$recipients_count</varname></primary>
53026 </indexterm>
53027 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
53028 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
53029 accepted, so while an ACL for RCPT is being processed, it contains the number
53030 of previously accepted recipients. At DATA time (for both the DATA ACLs),
53031 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
53032 <varname>$recipients_count</varname> contains the total number of accepted recipients.
53033 </para>
53034 </section>
53035 <section id="SECTdatfornon">
53036 <title>Data for non-message ACLs</title>
53037 <para>
53038 <indexterm role="concept">
53039 <primary>access control lists (ACLs)</primary>
53040 <secondary>data for non-message ACL</secondary>
53041 </indexterm>
53042 <indexterm role="variable">
53043 <primary><varname>$smtp_command_argument</varname></primary>
53044 </indexterm>
53045 <indexterm role="variable">
53046 <primary><varname>$smtp_command</varname></primary>
53047 </indexterm>
53048 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
53049 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
53050 and the entire SMTP command is available in <varname>$smtp_command</varname>.
53051 These variables can be tested using a <option>condition</option> condition. For example,
53052 here is an ACL for use with AUTH, which insists that either the session is
53053 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
53054 does not permit authentication methods that use cleartext passwords on
53055 unencrypted connections.
53056 </para>
53057 <literallayout class="monospaced">
53058 acl_check_auth:
53059   accept encrypted = *
53060   accept condition = ${if eq{${uc:$smtp_command_argument}}\
53061                      {CRAM-MD5}}
53062   deny   message   = TLS encryption or CRAM-MD5 required
53063 </literallayout>
53064 <para>
53065 (Another way of applying this restriction is to arrange for the authenticators
53066 that use cleartext passwords not to be advertised when the connection is not
53067 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
53068 option to do this.)
53069 </para>
53070 </section>
53071 <section id="SECID199">
53072 <title>Format of an ACL</title>
53073 <para>
53074 <indexterm role="concept">
53075 <primary>access control lists (ACLs)</primary>
53076 <secondary>format of</secondary>
53077 </indexterm>
53078 <indexterm role="concept">
53079 <primary>access control lists (ACLs)</primary>
53080 <secondary>verbs, definition of</secondary>
53081 </indexterm>
53082 An individual ACL consists of a number of statements. Each statement starts
53083 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
53084 Modifiers can change the way the verb operates, define error and log messages,
53085 set variables, insert delays, and vary the processing of accepted messages.
53086 </para>
53087 <para>
53088 If all the conditions are met, the verb is obeyed. The same condition may be
53089 used (with different arguments) more than once in the same statement. This
53090 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
53091 example:
53092 </para>
53093 <literallayout class="monospaced">
53094 deny  dnslists = list1.example
53095 dnslists = list2.example
53096 </literallayout>
53097 <para>
53098 If there are no conditions, the verb is always obeyed. Exim stops evaluating
53099 the conditions and modifiers when it reaches a condition that fails. What
53100 happens then depends on the verb (and in one case, on a special modifier). Not
53101 all the conditions make sense at every testing point. For example, you cannot
53102 test a sender address in the ACL that is run for a VRFY command.
53103 </para>
53104 </section>
53105 <section id="SECID200">
53106 <title>ACL verbs</title>
53107 <para>
53108 The ACL verbs are as follows:
53109 </para>
53110 <itemizedlist>
53111 <listitem>
53112 <para>
53113 <indexterm role="concept">
53114 <primary><option>accept</option> ACL verb</primary>
53115 </indexterm>
53116 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
53117 of the conditions are not met, what happens depends on whether <option>endpass</option>
53118 appears among the conditions (for syntax see below). If the failing condition
53119 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
53120 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
53121 check a RCPT command:
53122 </para>
53123 <literallayout class="monospaced">
53124 accept domains = +local_domains
53125 endpass
53126 verify = recipient
53127 </literallayout>
53128 <para>
53129 If the recipient domain does not match the <option>domains</option> condition, control
53130 passes to the next statement. If it does match, the recipient is verified, and
53131 the command is accepted if verification succeeds. However, if verification
53132 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
53133 <option>endpass</option>.
53134 </para>
53135 <para>
53136 The <option>endpass</option> feature has turned out to be confusing to many people, so its
53137 use is not recommended nowadays. It is always possible to rewrite an ACL so
53138 that <option>endpass</option> is not needed, and it is no longer used in the default
53139 configuration.
53140 </para>
53141 <para>
53142 <indexterm role="concept">
53143 <primary><option>message</option> ACL modifier</primary>
53144 <secondary>with <option>accept</option></secondary>
53145 </indexterm>
53146 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
53147 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
53148 (when an <option>accept</option> verb either accepts or passes control to the next
53149 statement), <option>message</option> can be used to vary the message that is sent when an
53150 SMTP command is accepted. For example, in a RCPT ACL you could have:
53151 </para>
53152 <literallayout>
53153 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53154 <literal>        message = OK, I will allow you through today</literal>
53155 </literallayout>
53156 <para>
53157 You can specify an SMTP response code, optionally followed by an <quote>extended
53158 response code</quote> at the start of the message, but the first digit must be the
53159 same as would be sent by default, which is 2 for an <option>accept</option> verb.
53160 </para>
53161 <para>
53162 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
53163 an error message that is used when access is denied. This behaviour is retained
53164 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
53165 of <option>endpass</option>.
53166 </para>
53167 </listitem>
53168 <listitem>
53169 <para>
53170 <indexterm role="concept">
53171 <primary><option>defer</option> ACL verb</primary>
53172 </indexterm>
53173 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
53174 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
53175 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
53176 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
53177 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
53178 be used in any ACL, and even for a recipient it might be a simpler approach.
53179 </para>
53180 </listitem>
53181 <listitem>
53182 <para>
53183 <indexterm role="concept">
53184 <primary><option>deny</option> ACL verb</primary>
53185 </indexterm>
53186 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
53187 the conditions are not met, control is passed to the next ACL statement. For
53188 example,
53189 </para>
53190 <literallayout class="monospaced">
53191 deny dnslists = blackholes.mail-abuse.org
53192 </literallayout>
53193 <para>
53194 rejects commands from hosts that are on a DNS black list.
53195 </para>
53196 </listitem>
53197 <listitem>
53198 <para>
53199 <indexterm role="concept">
53200 <primary><option>discard</option> ACL verb</primary>
53201 </indexterm>
53202 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
53203 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
53204 that are concerned with receiving messages. When all the conditions are true,
53205 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
53206 recipients to be discarded. If it is used in an ACL for RCPT, just the one
53207 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
53208 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
53209 do not appear in the log line when the <option>received_recipients</option> log selector is set.
53210 </para>
53211 <para>
53212 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
53213 its contents are added to the line that is automatically written to the log.
53214 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
53215 </para>
53216 </listitem>
53217 <listitem>
53218 <para>
53219 <indexterm role="concept">
53220 <primary><option>drop</option> ACL verb</primary>
53221 </indexterm>
53222 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
53223 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
53224 </para>
53225 <literallayout class="monospaced">
53226 drop   message   = I don't take more than 20 RCPTs
53227        condition = ${if &gt; {$rcpt_count}{20}}
53228 </literallayout>
53229 <para>
53230 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
53231 The connection is always dropped after sending a 550 response.
53232 </para>
53233 </listitem>
53234 <listitem>
53235 <para>
53236 <indexterm role="concept">
53237 <primary><option>require</option> ACL verb</primary>
53238 </indexterm>
53239 <option>require</option>: If all the conditions are met, control is passed to the next ACL
53240 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
53241 example, when checking a RCPT command,
53242 </para>
53243 <literallayout class="monospaced">
53244 require message = Sender did not verify
53245         verify  = sender
53246 </literallayout>
53247 <para>
53248 passes control to subsequent statements only if the message&#x2019;s sender can be
53249 verified. Otherwise, it rejects the command. Note the positioning of the
53250 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
53251 discussed in section <xref linkend="SECTcondmodproc"/>.
53252 </para>
53253 </listitem>
53254 <listitem>
53255 <para>
53256 <indexterm role="concept">
53257 <primary><option>warn</option> ACL verb</primary>
53258 </indexterm>
53259 <option>warn</option>: If all the conditions are true, a line specified by the
53260 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
53261 to the next ACL statement. If any condition is false, the log line is not
53262 written. If an identical log line is requested several times in the same
53263 message, only one copy is actually written to the log. If you want to force
53264 duplicates to be written, use the <option>logwrite</option> modifier instead.
53265 </para>
53266 <para>
53267 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
53268 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
53269 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
53270 first failing condition. There is more about adding header lines in section
53271 <xref linkend="SECTaddheadacl"/>.
53272 </para>
53273 <para>
53274 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
53275 some sort of defer), the log line specified by <option>log_message</option> is not written.
53276 This does not include the case of a forced failure from a lookup, which
53277 is considered to be a successful completion. After a defer, no further
53278 conditions or modifiers in the <option>warn</option> statement are processed. The incident
53279 is logged, and the ACL continues to be processed, from the next statement
53280 onwards.
53281 </para>
53282 <para>
53283 <indexterm role="variable">
53284 <primary><varname>$acl_verify_message</varname></primary>
53285 </indexterm>
53286 When one of the <option>warn</option> conditions is an address verification that fails, the
53287 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
53288 want this logged, you must set it up explicitly. For example:
53289 </para>
53290 <literallayout class="monospaced">
53291 warn   !verify = sender
53292        log_message = sender verify failed: $acl_verify_message
53293 </literallayout>
53294 </listitem>
53295 </itemizedlist>
53296 <para>
53297 At the end of each ACL there is an implicit unconditional <option>deny</option>.
53298 </para>
53299 <para>
53300 As you can see from the examples above, the conditions and modifiers are
53301 written one to a line, with the first one on the same line as the verb, and
53302 subsequent ones on following lines. If you have a very long condition, you can
53303 continue it onto several physical lines by the usual backslash continuation
53304 mechanism. It is conventional to align the conditions vertically.
53305 </para>
53306 </section>
53307 <section id="SECTaclvariables">
53308 <title>ACL variables</title>
53309 <para>
53310 <indexterm role="concept">
53311 <primary>access control lists (ACLs)</primary>
53312 <secondary>variables</secondary>
53313 </indexterm>
53314 There are some special variables that can be set during ACL processing. They
53315 can be used to pass information between different ACLs, different invocations
53316 of the same ACL in the same SMTP connection, and between ACLs and the routers,
53317 transports, and filters that are used to deliver a message. The names of these
53318 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
53319 an underscore, but the remainder of the name can be any sequence of
53320 alphanumeric characters and underscores that you choose. There is no limit on
53321 the number of ACL variables. The two sets act as follows:
53322 </para>
53323 <itemizedlist>
53324 <listitem>
53325 <para>
53326 The values of those variables whose names begin with <varname>$acl_c</varname> persist
53327 throughout an SMTP connection. They are never reset. Thus, a value that is set
53328 while receiving one message is still available when receiving the next message
53329 on the same SMTP connection.
53330 </para>
53331 </listitem>
53332 <listitem>
53333 <para>
53334 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
53335 while a message is being received. They are reset afterwards. They are also
53336 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
53337 </para>
53338 </listitem>
53339 </itemizedlist>
53340 <para>
53341 When a message is accepted, the current values of all the ACL variables are
53342 preserved with the message and are subsequently made available at delivery
53343 time. The ACL variables are set by a modifier called <option>set</option>. For example:
53344 </para>
53345 <literallayout class="monospaced">
53346 accept hosts = whatever
53347        set acl_m4 = some value
53348 accept authenticated = *
53349        set acl_c_auth = yes
53350 </literallayout>
53351 <para>
53352 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
53353 be set. If you want to set a variable without taking any action, you can use a
53354 <option>warn</option> verb without any other modifiers or conditions.
53355 </para>
53356 <para>
53357 <indexterm role="option">
53358 <primary><option>strict_acl_vars</option></primary>
53359 </indexterm>
53360 What happens if a syntactically valid but undefined ACL variable is
53361 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
53362 false (the default), an empty string is substituted; if it is true, an
53363 error is generated.
53364 </para>
53365 <para>
53366 Versions of Exim before 4.64 have a limited set of numbered variables, but
53367 their names are compatible, so there is no problem with upgrading.
53368 </para>
53369 </section>
53370 <section id="SECTcondmodproc">
53371 <title>Condition and modifier processing</title>
53372 <para>
53373 <indexterm role="concept">
53374 <primary>access control lists (ACLs)</primary>
53375 <secondary>conditions; processing</secondary>
53376 </indexterm>
53377 <indexterm role="concept">
53378 <primary>access control lists (ACLs)</primary>
53379 <secondary>modifiers; processing</secondary>
53380 </indexterm>
53381 An exclamation mark preceding a condition negates its result. For example:
53382 </para>
53383 <literallayout class="monospaced">
53384 deny   domains = *.dom.example
53385       !verify  = recipient
53386 </literallayout>
53387 <para>
53388 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
53389 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
53390 negation can be used on the right-hand side of a condition. For example, these
53391 two statements are equivalent:
53392 </para>
53393 <literallayout class="monospaced">
53394 deny  hosts = !192.168.3.4
53395 deny !hosts =  192.168.3.4
53396 </literallayout>
53397 <para>
53398 However, for many conditions (<option>verify</option> being a good example), only left-hand
53399 side negation of the whole condition is possible.
53400 </para>
53401 <para>
53402 The arguments of conditions and modifiers are expanded. A forced failure
53403 of an expansion causes a condition to be ignored, that is, it behaves as if the
53404 condition is true. Consider these two statements:
53405 </para>
53406 <literallayout class="monospaced">
53407 accept  senders = ${lookup{$host_name}lsearch\
53408                   {/some/file}{$value}fail}
53409 accept  senders = ${lookup{$host_name}lsearch\
53410                   {/some/file}{$value}{}}
53411 </literallayout>
53412 <para>
53413 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
53414 the returned list is searched, but if the lookup fails the behaviour is
53415 different in the two cases. The <option>fail</option> in the first statement causes the
53416 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
53417 therefore succeeds. The second statement, however, generates an empty list when
53418 the lookup fails. No sender can match an empty list, so the condition fails,
53419 and therefore the <option>accept</option> also fails.
53420 </para>
53421 <para>
53422 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
53423 specify actions that are taken as the conditions for a statement are checked;
53424 others specify text for messages that are used when access is denied or a
53425 warning is generated. The <option>control</option> modifier affects the way an incoming
53426 message is handled.
53427 </para>
53428 <para>
53429 The positioning of the modifiers in an ACL statement is important, because the
53430 processing of a verb ceases as soon as its outcome is known. Only those
53431 modifiers that have already been encountered will take effect. For example,
53432 consider this use of the <option>message</option> modifier:
53433 </para>
53434 <literallayout class="monospaced">
53435 require message = Can't verify sender
53436         verify  = sender
53437         message = Can't verify recipient
53438         verify  = recipient
53439         message = This message cannot be used
53440 </literallayout>
53441 <para>
53442 If sender verification fails, Exim knows that the result of the statement is
53443 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
53444 so its text is used as the error message. If sender verification succeeds, but
53445 recipient verification fails, the second message is used. If recipient
53446 verification succeeds, the third message becomes <quote>current</quote>, but is never used
53447 because there are no more conditions to cause failure.
53448 </para>
53449 <para>
53450 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
53451 modifier that is used, because all the conditions must be true for rejection to
53452 happen. Specifying more than one <option>message</option> modifier does not make sense, and
53453 the message can even be specified after all the conditions. For example:
53454 </para>
53455 <literallayout class="monospaced">
53456 deny   hosts = ...
53457       !senders = *@my.domain.example
53458        message = Invalid sender from client host
53459 </literallayout>
53460 <para>
53461 The <quote>deny</quote> result does not happen until the end of the statement is reached,
53462 by which time Exim has set up the message.
53463 </para>
53464 </section>
53465 <section id="SECTACLmodi">
53466 <title>ACL modifiers</title>
53467 <para>
53468 <indexterm role="concept">
53469 <primary>access control lists (ACLs)</primary>
53470 <secondary>modifiers; list of</secondary>
53471 </indexterm>
53472 The ACL modifiers are as follows:
53473 </para>
53474 <variablelist>
53475 <varlistentry>
53476 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53477 <listitem>
53478 <para>
53479 This modifier specifies one or more header lines that are to be added to an
53480 incoming message, assuming, of course, that the message is ultimately
53481 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
53482 </para>
53483 </listitem></varlistentry>
53484 <varlistentry>
53485 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53486 <listitem>
53487 <para>
53488 <indexterm role="concept">
53489 <primary><option>continue</option> ACL modifier</primary>
53490 </indexterm>
53491 <indexterm role="concept">
53492 <primary>database</primary>
53493 <secondary>updating in ACL</secondary>
53494 </indexterm>
53495 This modifier does nothing of itself, and processing of the ACL always
53496 continues with the next condition or modifier. The value of <option>continue</option> is in
53497 the side effects of expanding its argument. Typically this could be used to
53498 update a database. It is really just a syntactic tidiness, to avoid having to
53499 write rather ugly lines like this:
53500 </para>
53501 <literallayout>
53502 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
53503 </literallayout>
53504 <para>
53505 Instead, all you need is
53506 </para>
53507 <literallayout>
53508 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
53509 </literallayout>
53510 </listitem></varlistentry>
53511 <varlistentry>
53512 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53513 <listitem>
53514 <para>
53515 <indexterm role="concept">
53516 <primary><option>control</option> ACL modifier</primary>
53517 </indexterm>
53518 This modifier affects the subsequent processing of the SMTP connection or of an
53519 incoming message that is accepted. The effect of the first type of control
53520 lasts for the duration of the connection, whereas the effect of the second type
53521 lasts only until the current message has been received. The message-specific
53522 controls always apply to the whole message, not to individual recipients,
53523 even if the <option>control</option> modifier appears in a RCPT ACL.
53524 </para>
53525 <para>
53526 As there are now quite a few controls that can be applied, they are described
53527 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
53528 in several different ways. For example:
53529 </para>
53530 <itemizedlist>
53531 <listitem>
53532 <para>
53533 It can be at the end of an <option>accept</option> statement:
53534 </para>
53535 <literallayout class="monospaced">
53536     accept  ...some conditions
53537             control = queue_only
53538 </literallayout>
53539 <para>
53540 In this case, the control is applied when this statement yields <quote>accept</quote>, in
53541 other words, when the conditions are all true.
53542 </para>
53543 </listitem>
53544 <listitem>
53545 <para>
53546 It can be in the middle of an <option>accept</option> statement:
53547 </para>
53548 <literallayout class="monospaced">
53549     accept  ...some conditions...
53550             control = queue_only
53551             ...some more conditions...
53552 </literallayout>
53553 <para>
53554 If the first set of conditions are true, the control is applied, even if the
53555 statement does not accept because one of the second set of conditions is false.
53556 In this case, some subsequent statement must yield <quote>accept</quote> for the control
53557 to be relevant.
53558 </para>
53559 </listitem>
53560 <listitem>
53561 <para>
53562 It can be used with <option>warn</option> to apply the control, leaving the
53563 decision about accepting or denying to a subsequent verb. For
53564 example:
53565 </para>
53566 <literallayout class="monospaced">
53567     warn    ...some conditions...
53568             control = freeze
53569     accept  ...
53570 </literallayout>
53571 <para>
53572 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
53573 <option>logwrite</option>, so it does not add anything to the message and does not write a
53574 log entry.
53575 </para>
53576 </listitem>
53577 <listitem>
53578 <para>
53579 If you want to apply a control unconditionally, you can use it with a
53580 <option>require</option> verb. For example:
53581 </para>
53582 <literallayout class="monospaced">
53583     require  control = no_multiline_responses
53584 </literallayout>
53585 </listitem>
53586 </itemizedlist>
53587 </listitem></varlistentry>
53588 <varlistentry>
53589 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
53590 <listitem>
53591 <para>
53592 <indexterm role="concept">
53593 <primary><option>delay</option> ACL modifier</primary>
53594 </indexterm>
53595 <indexterm role="option">
53596 <primary><option>-bh</option></primary>
53597 </indexterm>
53598 This modifier may appear in any ACL except notquit. It causes Exim to wait for
53599 the time interval before proceeding. However, when testing Exim using the
53600 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
53601 output instead). The time is given in the usual Exim notation, and the delay
53602 happens as soon as the modifier is processed. In an SMTP session, pending
53603 output is flushed before the delay is imposed.
53604 </para>
53605 <para>
53606 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
53607 example:
53608 </para>
53609 <literallayout class="monospaced">
53610 deny    ...some conditions...
53611         delay = 30s
53612 </literallayout>
53613 <para>
53614 The delay happens if all the conditions are true, before the statement returns
53615 <quote>deny</quote>. Compare this with:
53616 </para>
53617 <literallayout class="monospaced">
53618 deny    delay = 30s
53619         ...some conditions...
53620 </literallayout>
53621 <para>
53622 which waits for 30s before processing the conditions. The <option>delay</option> modifier
53623 can also be used with <option>warn</option> and together with <option>control</option>:
53624 </para>
53625 <literallayout class="monospaced">
53626 warn    ...some conditions...
53627         delay = 2m
53628         control = freeze
53629 accept  ...
53630 </literallayout>
53631 <para>
53632 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
53633 responses to several commands are no longer buffered and sent in one packet (as
53634 they would normally be) because all output is flushed before imposing the
53635 delay. This optimization is disabled so that a number of small delays do not
53636 appear to the client as one large aggregated delay that might provoke an
53637 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
53638 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
53639 </para>
53640 </listitem></varlistentry>
53641 <varlistentry>
53642 <term><emphasis role="bold">endpass</emphasis></term>
53643 <listitem>
53644 <para>
53645 <indexterm role="concept">
53646 <primary><option>endpass</option> ACL modifier</primary>
53647 </indexterm>
53648 This modifier, which has no argument, is recognized only in <option>accept</option> and
53649 <option>discard</option> statements. It marks the boundary between the conditions whose
53650 failure causes control to pass to the next statement, and the conditions whose
53651 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
53652 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
53653 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
53654 </para>
53655 </listitem></varlistentry>
53656 <varlistentry>
53657 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53658 <listitem>
53659 <para>
53660 <indexterm role="concept">
53661 <primary><option>log_message</option> ACL modifier</primary>
53662 </indexterm>
53663 This modifier sets up a message that is used as part of the log message if the
53664 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
53665 </para>
53666 <literallayout class="monospaced">
53667 require log_message = wrong cipher suite $tls_in_cipher
53668         encrypted   = DES-CBC3-SHA
53669 </literallayout>
53670 <para>
53671 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
53672 example:
53673 </para>
53674 <literallayout>
53675 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53676 <literal>        log_message = Discarded $local_part@$domain because...</literal>
53677 </literallayout>
53678 <para>
53679 When access is denied, <option>log_message</option> adds to any underlying error message
53680 that may exist because of a condition failure. For example, while verifying a
53681 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
53682 message.
53683 </para>
53684 <para>
53685 The message may be defined before the conditions to which it applies, because
53686 the string expansion does not happen until Exim decides that access is to be
53687 denied. This means that any variables that are set by the condition are
53688 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
53689 variables are set after a DNS black list lookup succeeds. If the expansion of
53690 <option>log_message</option> fails, or if the result is an empty string, the modifier is
53691 ignored.
53692 </para>
53693 <para>
53694 <indexterm role="variable">
53695 <primary><varname>$acl_verify_message</varname></primary>
53696 </indexterm>
53697 If you want to use a <option>warn</option> statement to log the result of an address
53698 verification, you can use <varname>$acl_verify_message</varname> to include the verification
53699 error message.
53700 </para>
53701 <para>
53702 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
53703 the start of the logged message. If the same warning log message is requested
53704 more than once while receiving  a single email message, only one copy is
53705 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
53706 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
53707 is logged for a successful <option>warn</option> statement.
53708 </para>
53709 <para>
53710 If <option>log_message</option> is not present and there is no underlying error message (for
53711 example, from the failure of address verification), but <option>message</option> is present,
53712 the <option>message</option> text is used for logging rejections. However, if any text for
53713 logging contains newlines, only the first line is logged. In the absence of
53714 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
53715 logging rejections.
53716 </para>
53717 </listitem></varlistentry>
53718 <varlistentry>
53719 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
53720 <listitem>
53721 <para>
53722 <indexterm role="concept">
53723 <primary><option>log_reject_target</option> ACL modifier</primary>
53724 </indexterm>
53725 <indexterm role="concept">
53726 <primary>logging in ACL</primary>
53727 <secondary>specifying which log</secondary>
53728 </indexterm>
53729 This modifier makes it possible to specify which logs are used for messages
53730 about ACL rejections. Its argument is a colon-separated list of words that can
53731 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
53732 may be empty, in which case a rejection is not logged at all. For example, this
53733 ACL fragment writes no logging information when access is denied:
53734 </para>
53735 <literallayout>
53736 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53737 <literal>     log_reject_target =</literal>
53738 </literallayout>
53739 <para>
53740 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
53741 permanent and temporary rejections. Its effect lasts for the rest of the
53742 current ACL.
53743 </para>
53744 </listitem></varlistentry>
53745 <varlistentry>
53746 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53747 <listitem>
53748 <para>
53749 <indexterm role="concept">
53750 <primary><option>logwrite</option> ACL modifier</primary>
53751 </indexterm>
53752 <indexterm role="concept">
53753 <primary>logging in ACL</primary>
53754 <secondary>immediate</secondary>
53755 </indexterm>
53756 This modifier writes a message to a log file as soon as it is encountered when
53757 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
53758 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
53759 access.) The <option>logwrite</option> modifier can be used to log special incidents in
53760 ACLs. For example:
53761 </para>
53762 <literallayout>
53763 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
53764 <literal>       control  = freeze</literal>
53765 <literal>       logwrite = froze message because ...</literal>
53766 </literallayout>
53767 <para>
53768 By default, the message is written to the main log. However, it may begin
53769 with a colon, followed by a comma-separated list of log names, and then
53770 another colon, to specify exactly which logs are to be written. For
53771 example:
53772 </para>
53773 <literallayout class="monospaced">
53774 logwrite = :main,reject: text for main and reject logs
53775 logwrite = :panic: text for panic log only
53776 </literallayout>
53777 </listitem></varlistentry>
53778 <varlistentry>
53779 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53780 <listitem>
53781 <para>
53782 <indexterm role="concept">
53783 <primary><option>message</option> ACL modifier</primary>
53784 </indexterm>
53785 This modifier sets up a text string that is expanded and used as a response
53786 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
53787 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
53788 there is some complication if <option>endpass</option> is involved; see the description of
53789 <option>accept</option> for details.)
53790 </para>
53791 <para>
53792 The expansion of the message happens at the time Exim decides that the ACL is
53793 to end, not at the time it processes <option>message</option>. If the expansion fails, or
53794 generates an empty string, the modifier is ignored. Here is an example where
53795 <option>message</option> must be specified first, because the ACL ends with a rejection if
53796 the <option>hosts</option> condition fails:
53797 </para>
53798 <literallayout class="monospaced">
53799 require  message = Host not recognized
53800          hosts = 10.0.0.0/8
53801 </literallayout>
53802 <para>
53803 (Once a condition has failed, no further conditions or modifiers are
53804 processed.)
53805 </para>
53806 <para>
53807 <indexterm role="concept">
53808 <primary>SMTP</primary>
53809 <secondary>error codes</secondary>
53810 </indexterm>
53811 <indexterm role="option">
53812 <primary><option>smtp_banner</option></primary>
53813 </indexterm>
53814 For ACLs that are triggered by SMTP commands, the message is returned as part
53815 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
53816 is meaningful only for SMTP, as no message is returned when a non-SMTP message
53817 is accepted. In the case of the connect ACL, accepting with a message modifier
53818 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
53819 accept message may not contain more than one line (otherwise it will be
53820 truncated at the first newline and a panic logged), and it cannot affect the
53821 EHLO options.
53822 </para>
53823 <para>
53824 When SMTP is involved, the message may begin with an overriding response code,
53825 consisting of three digits optionally followed by an <quote>extended response code</quote>
53826 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
53827 </para>
53828 <literallayout class="monospaced">
53829 deny  message = 599 1.2.3 Host not welcome
53830       hosts = 192.168.34.0/24
53831 </literallayout>
53832 <para>
53833 The first digit of the supplied response code must be the same as would be sent
53834 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
53835 access, but for the predata ACL, note that the default success code is 354, not
53836 2<emphasis>xx</emphasis>.
53837 </para>
53838 <para>
53839 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
53840 the message modifier cannot override the 221 response code.
53841 </para>
53842 <para>
53843 The text in a <option>message</option> modifier is literal; any quotes are taken as
53844 literals, but because the string is expanded, backslash escapes are processed
53845 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
53846 response.
53847 </para>
53848 <para>
53849 <indexterm role="variable">
53850 <primary><varname>$acl_verify_message</varname></primary>
53851 </indexterm>
53852 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
53853 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
53854 </para>
53855 <para>
53856 If <option>message</option> is used on a statement that verifies an address, the message
53857 specified overrides any message that is generated by the verification process.
53858 However, the original message is available in the variable
53859 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
53860 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
53861 routers to be passed back as part of the SMTP response, you should either not
53862 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
53863 </para>
53864 <para>
53865 For compatibility with previous releases of Exim, a <option>message</option> modifier that
53866 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
53867 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
53868 all the conditions are true, wherever it appears in an ACL command, whereas
53869 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
53870 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
53871 effect.
53872 </para>
53873 </listitem></varlistentry>
53874 <varlistentry>
53875 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53876 <listitem>
53877 <para>
53878 This modifier specifies one or more header names in a colon-separated list
53879  that are to be removed from an incoming message, assuming, of course, that
53880 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
53881 </para>
53882 </listitem></varlistentry>
53883 <varlistentry>
53884 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
53885 <listitem>
53886 <para>
53887 <indexterm role="concept">
53888 <primary><option>set</option> ACL modifier</primary>
53889 </indexterm>
53890 This modifier puts a value into one of the ACL variables (see section
53891 <xref linkend="SECTaclvariables"/>).
53892 </para>
53893 </listitem></varlistentry>
53894 <varlistentry>
53895 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
53896 <listitem>
53897 <para>
53898 This modifier sends a UDP packet, for purposes such as statistics
53899 collection or behaviour monitoring. The parameters are expanded, and
53900 the result of the expansion must be a colon-separated list consisting
53901 of a destination server, port number, and the packet contents. The
53902 server can be specified as a host name or IPv4 or IPv6 address. The
53903 separator can be changed with the usual angle bracket syntax. For
53904 example, you might want to collect information on which hosts connect
53905 when:
53906 </para>
53907 <literallayout class="monospaced">
53908 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
53909              $tod_zulu $sender_host_address
53910 </literallayout>
53911 </listitem></varlistentry>
53912 </variablelist>
53913 </section>
53914 <section id="SECTcontrols">
53915 <title>Use of the control modifier</title>
53916 <para>
53917 <indexterm role="concept">
53918 <primary><option>control</option> ACL modifier</primary>
53919 </indexterm>
53920 The <option>control</option> modifier supports the following settings:
53921 </para>
53922 <variablelist>
53923 <varlistentry>
53924 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
53925 <listitem>
53926 <para>
53927 This modifier allows a client host to use the SMTP AUTH command even when it
53928 has not been advertised in response to EHLO. Furthermore, because there are
53929 apparently some really broken clients that do this, Exim will accept AUTH after
53930 HELO (rather than EHLO) when this control is set. It should be used only if you
53931 really need it, and you should limit its use to those broken clients that do
53932 not work without it. For example:
53933 </para>
53934 <literallayout class="monospaced">
53935 warn hosts   = 192.168.34.25
53936      control = allow_auth_unadvertised
53937 </literallayout>
53938 <para>
53939 Normally, when an Exim server receives an AUTH command, it checks the name of
53940 the authentication mechanism that is given in the command to ensure that it
53941 matches an advertised mechanism. When this control is set, the check that a
53942 mechanism has been advertised is bypassed. Any configured mechanism can be used
53943 by the client. This control is permitted only in the connection and HELO ACLs.
53944 </para>
53945 </listitem></varlistentry>
53946 <varlistentry>
53947 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
53948 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
53949 <listitem>
53950 <para>
53951 <indexterm role="concept">
53952 <primary>access control lists (ACLs)</primary>
53953 <secondary>case of local part in</secondary>
53954 </indexterm>
53955 <indexterm role="concept">
53956 <primary>case of local parts</primary>
53957 </indexterm>
53958 <indexterm role="variable">
53959 <primary><varname>$local_part</varname></primary>
53960 </indexterm>
53961 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
53962 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
53963 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
53964 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
53965 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
53966 is encountered.
53967 </para>
53968 <para>
53969 These controls affect only the current recipient. Moreover, they apply only to
53970 local part handling that takes place directly in the ACL (for example, as a key
53971 in lookups). If a test to verify the recipient is obeyed, the case-related
53972 handling of the local part during the verification is controlled by the router
53973 configuration (see the <option>caseful_local_part</option> generic router option).
53974 </para>
53975 <para>
53976 This facility could be used, for example, to add a spam score to local parts
53977 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
53978 spam score:
53979 </para>
53980 <literallayout class="monospaced">
53981 warn  control = caseful_local_part
53982       set acl_m4 = ${eval:\
53983                      $acl_m4 + \
53984                      ${if match{$local_part}{[A-Z]}{1}{0}}\
53985                     }
53986       control = caselower_local_part
53987 </literallayout>
53988 <para>
53989 Notice that we put back the lower cased version afterwards, assuming that
53990 is what is wanted for subsequent tests.
53991 </para>
53992 </listitem></varlistentry>
53993 <varlistentry>
53994 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
53995 <listitem>
53996 <para>
53997 <indexterm role="concept">
53998 <primary>access control lists (ACLs)</primary>
53999 <secondary>cutthrough routing</secondary>
54000 </indexterm>
54001 <indexterm role="concept">
54002 <primary>cutthrough</primary>
54003 <secondary>requesting</secondary>
54004 </indexterm>
54005 This option requests delivery be attempted while the item is being received.
54006 </para>
54007 <para>
54008 The option is usable in the RCPT ACL.
54009 If enabled for a message received via smtp and routed to an smtp transport,
54010 </para>
54011 <para revisionflag="changed">
54012 and only one transport, interface, destination host and port combination
54013 is used for all recipients of the message,
54014 </para>
54015 <para>
54016 then the delivery connection is made while the receiving connection is open
54017 and data is copied from one to the other.
54018 </para>
54019 <para>
54020 An attempt to set this option for any recipient but the first
54021 for a mail will be quietly ignored.
54022 If a recipient-verify callout connection is subsequently
54023 requested in the same ACL it is held open and used for
54024 </para>
54025 <para revisionflag="changed">
54026 any subsequent recipients and the data,
54027 </para>
54028 <para>
54029 otherwise one is made after the initial RCPT ACL completes.
54030 </para>
54031 <para>
54032 Note that routers are used in verify mode,
54033 and cannot depend on content of received headers.
54034 Note also that headers cannot be
54035 modified by any of the post-data ACLs (DATA, MIME and DKIM).
54036 Headers may be modified by routers (subject to the above) and transports.
54037 </para>
54038 <para>
54039 Cutthrough delivery is not supported via transport-filters or when DKIM signing
54040 of outgoing messages is done, because it sends data to the ultimate destination
54041 before the entire message has been received from the source.
54042 </para>
54043 <para revisionflag="changed">
54044 It is not supported for messages received with the SMTP PRDR option in use.
54045 </para>
54046 <para>
54047 Should the ultimate destination system positively accept or reject the mail,
54048 a corresponding indication is given to the source system and nothing is queued.
54049 If there is a temporary error the item is queued for later delivery in the
54050 usual fashion. If the item is successfully delivered in cutthrough mode
54051 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
54052 before the acceptance "&lt;=" line.
54053 </para>
54054 <para>
54055 Delivery in this mode avoids the generation of a bounce mail to a
54056 (possibly faked)
54057 sender when the destination system is doing content-scan based rejection.
54058 </para>
54059 </listitem></varlistentry>
54060 <varlistentry>
54061 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54062 <listitem>
54063 <para>
54064 <indexterm role="concept">
54065 <primary>access control lists (ACLs)</primary>
54066 <secondary>enabling debug logging</secondary>
54067 </indexterm>
54068 <indexterm role="concept">
54069 <primary>debugging</primary>
54070 <secondary>enabling from an ACL</secondary>
54071 </indexterm>
54072 This control turns on debug logging, almost as though Exim had been invoked
54073 with <literal>-d</literal>, with the output going to a new logfile, by default called
54074 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
54075 may access any variables already defined.  The logging may be adjusted with
54076 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
54077 option.  Some examples (which depend on variables that don&#x2019;t exist in all
54078 contexts):
54079 </para>
54080 <literallayout class="monospaced">
54081       control = debug
54082       control = debug/tag=.$sender_host_address
54083       control = debug/opts=+expand+acl
54084       control = debug/tag=.$message_exim_id/opts=+expand
54085 </literallayout>
54086 </listitem></varlistentry>
54087 <varlistentry>
54088 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
54089 <listitem>
54090 <para>
54091 <indexterm role="concept">
54092 <primary>disable DKIM verify</primary>
54093 </indexterm>
54094 <indexterm role="concept">
54095 <primary>DKIM</primary>
54096 <secondary>disable verify</secondary>
54097 </indexterm>
54098 This control turns off DKIM verification processing entirely.  For details on
54099 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
54100 </para>
54101 </listitem></varlistentry>
54102 <varlistentry>
54103 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
54104 <listitem>
54105 <para>
54106 <indexterm role="concept">
54107 <primary>access control lists (ACLs)</primary>
54108 <secondary>setting DSCP value</secondary>
54109 </indexterm>
54110 <indexterm role="concept">
54111 <primary>DSCP</primary>
54112 <secondary>inbound</secondary>
54113 </indexterm>
54114 This option causes the DSCP value associated with the socket for the inbound
54115 connection to be adjusted to a given value, given as one of a number of fixed
54116 strings or to numeric value.
54117 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
54118 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
54119 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
54120 </para>
54121 <para>
54122 The outbound packets from Exim will be marked with this value in the header
54123 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
54124 that these values will have any effect, not be stripped by networking
54125 equipment, or do much of anything without cooperation with your Network
54126 Engineer and those of all network operators between the source and destination.
54127 </para>
54128 </listitem></varlistentry>
54129 <varlistentry>
54130 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
54131 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
54132 <listitem>
54133 <para>
54134 <indexterm role="concept">
54135 <primary>SMTP</primary>
54136 <secondary>synchronization checking</secondary>
54137 </indexterm>
54138 <indexterm role="concept">
54139 <primary>synchronization checking in SMTP</primary>
54140 </indexterm>
54141 These controls make it possible to be selective about when SMTP synchronization
54142 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
54143 state of the switch (it is true by default). See the description of this option
54144 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
54145 </para>
54146 <para>
54147 The effect of these two controls lasts for the remainder of the SMTP
54148 connection. They can appear in any ACL except the one for the non-SMTP
54149 messages. The most straightforward place to put them is in the ACL defined by
54150 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
54151 before the first synchronization check. The expected use is to turn off the
54152 synchronization checks for badly-behaved hosts that you nevertheless need to
54153 work with.
54154 </para>
54155 </listitem></varlistentry>
54156 <varlistentry>
54157 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
54158 <listitem>
54159 <para>
54160 <indexterm role="concept">
54161 <primary>fake defer</primary>
54162 </indexterm>
54163 <indexterm role="concept">
54164 <primary>defer, fake</primary>
54165 </indexterm>
54166 This control works in exactly the same way as <option>fakereject</option> (described below)
54167 except that it causes an SMTP 450 response after the message data instead of a
54168 550 response. You must take care when using <option>fakedefer</option> because it causes the
54169 messages to be duplicated when the sender retries. Therefore, you should not
54170 use <option>fakedefer</option> if the message is to be delivered normally.
54171 </para>
54172 </listitem></varlistentry>
54173 <varlistentry>
54174 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
54175 <listitem>
54176 <para>
54177 <indexterm role="concept">
54178 <primary>fake rejection</primary>
54179 </indexterm>
54180 <indexterm role="concept">
54181 <primary>rejection, fake</primary>
54182 </indexterm>
54183 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
54184 words, only when an SMTP message is being received. If Exim accepts the
54185 message, instead the final 250 response, a 550 rejection message is sent.
54186 However, Exim proceeds to deliver the message as normal. The control applies
54187 only to the current message, not to any subsequent ones that may be received in
54188 the same SMTP connection.
54189 </para>
54190 <para>
54191 The text for the 550 response is taken from the <option>control</option> modifier. If no
54192 message is supplied, the following is used:
54193 </para>
54194 <literallayout class="monospaced">
54195 550-Your message has been rejected but is being
54196 550-kept for evaluation.
54197 550-If it was a legitimate message, it may still be
54198 550 delivered to the target recipient(s).
54199 </literallayout>
54200 <para>
54201 This facility should be used with extreme caution.
54202 </para>
54203 </listitem></varlistentry>
54204 <varlistentry>
54205 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
54206 <listitem>
54207 <para>
54208 <indexterm role="concept">
54209 <primary>frozen messages</primary>
54210 <secondary>forcing in ACL</secondary>
54211 </indexterm>
54212 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
54213 other words, only when a message is being received. If the message is accepted,
54214 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
54215 current message, not to any subsequent ones that may be received in the same
54216 SMTP connection.
54217 </para>
54218 <para>
54219 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
54220 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
54221 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
54222 are obeyed for the current message have the <literal>/no_tell</literal> option.
54223 </para>
54224 </listitem></varlistentry>
54225 <varlistentry>
54226 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
54227 <listitem>
54228 <para>
54229 <indexterm role="concept">
54230 <primary>SMTP</primary>
54231 <secondary>output flushing, disabling for delay</secondary>
54232 </indexterm>
54233 Exim normally flushes SMTP output before implementing a delay in an ACL, to
54234 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
54235 use. This control, as long as it is encountered before the <option>delay</option> modifier,
54236 disables such output flushing.
54237 </para>
54238 </listitem></varlistentry>
54239 <varlistentry>
54240 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
54241 <listitem>
54242 <para>
54243 <indexterm role="concept">
54244 <primary>SMTP</primary>
54245 <secondary>output flushing, disabling for callout</secondary>
54246 </indexterm>
54247 Exim normally flushes SMTP output before performing a callout in an ACL, to
54248 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
54249 use. This control, as long as it is encountered before the <option>verify</option> condition
54250 that causes the callout, disables such output flushing.
54251 </para>
54252 </listitem></varlistentry>
54253 <varlistentry>
54254 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
54255 <listitem>
54256 <para>
54257 This control is available when Exim is compiled with the content scanning
54258 extension. Content scanning may require a copy of the current message, or parts
54259 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
54260 or spam scanner. Normally, such copies are deleted when they are no longer
54261 needed. If this control is set, the copies are not deleted. The control applies
54262 only to the current message, not to any subsequent ones that may be received in
54263 the same SMTP connection. It is provided for debugging purposes and is unlikely
54264 to be useful in production.
54265 </para>
54266 </listitem></varlistentry>
54267 <varlistentry>
54268 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
54269 <listitem>
54270 <para>
54271 <indexterm role="concept">
54272 <primary>multiline responses, suppressing</primary>
54273 </indexterm>
54274 This control is permitted for any ACL except the one for non-SMTP messages.
54275 It seems that there are broken clients in use that cannot handle multiline
54276 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
54277 </para>
54278 <para>
54279 If this control is set, multiline SMTP responses from ACL rejections are
54280 suppressed. One way of doing this would have been to put out these responses as
54281 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
54282 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
54283 responses might get close to that. So this facility, which is after all only a
54284 sop to broken clients, is implemented by doing two very easy things:
54285 </para>
54286 <itemizedlist>
54287 <listitem>
54288 <para>
54289 Extra information that is normally output as part of a rejection caused by
54290 sender verification failure is omitted. Only the final line (typically <quote>sender
54291 verification failed</quote>) is sent.
54292 </para>
54293 </listitem>
54294 <listitem>
54295 <para>
54296 If a <option>message</option> modifier supplies a multiline response, only the first
54297 line is output.
54298 </para>
54299 </listitem>
54300 </itemizedlist>
54301 <para>
54302 The setting of the switch can, of course, be made conditional on the
54303 calling host. Its effect lasts until the end of the SMTP connection.
54304 </para>
54305 </listitem></varlistentry>
54306 <varlistentry>
54307 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
54308 <listitem>
54309 <para>
54310 <indexterm role="concept">
54311 <primary>PIPELINING</primary>
54312 <secondary>suppressing advertising</secondary>
54313 </indexterm>
54314 This control turns off the advertising of the PIPELINING extension to SMTP in
54315 the current session. To be useful, it must be obeyed before Exim sends its
54316 response to an EHLO command. Therefore, it should normally appear in an ACL
54317 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
54318 <option>pipelining_advertise_hosts</option>.
54319 </para>
54320 </listitem></varlistentry>
54321 <varlistentry>
54322 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
54323 <listitem>
54324 <para>
54325 <indexterm role="option">
54326 <primary><option>queue_only</option></primary>
54327 </indexterm>
54328 <indexterm role="concept">
54329 <primary>queueing incoming messages</primary>
54330 </indexterm>
54331 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
54332 other words, only when a message is being received. If the message is accepted,
54333 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
54334 runner. No immediate delivery process is started. In other words, it has the
54335 effect as the <option>queue_only</option> global option. However, the control applies only
54336 to the current message, not to any subsequent ones that may be received in the
54337 same SMTP connection.
54338 </para>
54339 </listitem></varlistentry>
54340 <varlistentry>
54341 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54342 <listitem>
54343 <para>
54344 <indexterm role="concept">
54345 <primary>message</primary>
54346 <secondary>submission</secondary>
54347 </indexterm>
54348 <indexterm role="concept">
54349 <primary>submission mode</primary>
54350 </indexterm>
54351 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
54352 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
54353 the current message is a submission from a local MUA. In this case, Exim
54354 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
54355 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
54356 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
54357 late (the message has already been created).
54358 </para>
54359 <para>
54360 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
54361 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
54362 submission mode; the available options for this control are described there.
54363 The control applies only to the current message, not to any subsequent ones
54364 that may be received in the same SMTP connection.
54365 </para>
54366 </listitem></varlistentry>
54367 <varlistentry>
54368 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
54369 <listitem>
54370 <para>
54371 <indexterm role="concept">
54372 <primary>submission fixups, suppressing</primary>
54373 </indexterm>
54374 This control applies to locally submitted (non TCP/IP) messages, and is the
54375 complement of <literal>control = submission</literal>. It disables the fixups that are
54376 normally applied to locally-submitted messages. Specifically:
54377 </para>
54378 <itemizedlist>
54379 <listitem>
54380 <para>
54381 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
54382 dynamic version of <option>local_sender_retain</option>).
54383 </para>
54384 </listitem>
54385 <listitem>
54386 <para>
54387 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
54388 </para>
54389 </listitem>
54390 <listitem>
54391 <para>
54392 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
54393 </para>
54394 </listitem>
54395 </itemizedlist>
54396 <para>
54397 This control may be useful when a remotely-originated message is accepted,
54398 passed to some scanning program, and then re-submitted for delivery. It can be
54399 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
54400 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
54401 data is read.
54402 </para>
54403 <para>
54404 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
54405 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
54406 </para>
54407 </listitem></varlistentry>
54408 </variablelist>
54409 </section>
54410 <section id="SECTsummesfix">
54411 <title>Summary of message fixup control</title>
54412 <para>
54413 All four possibilities for message fixups can be specified:
54414 </para>
54415 <itemizedlist>
54416 <listitem>
54417 <para>
54418 Locally submitted, fixups applied: the default.
54419 </para>
54420 </listitem>
54421 <listitem>
54422 <para>
54423 Locally submitted, no fixups applied: use
54424 <literal>control = suppress_local_fixups</literal>.
54425 </para>
54426 </listitem>
54427 <listitem>
54428 <para>
54429 Remotely submitted, no fixups applied: the default.
54430 </para>
54431 </listitem>
54432 <listitem>
54433 <para>
54434 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
54435 </para>
54436 </listitem>
54437 </itemizedlist>
54438 </section>
54439 <section id="SECTaddheadacl">
54440 <title>Adding header lines in ACLs</title>
54441 <para>
54442 <indexterm role="concept">
54443 <primary>header lines</primary>
54444 <secondary>adding in an ACL</secondary>
54445 </indexterm>
54446 <indexterm role="concept">
54447 <primary>header lines</primary>
54448 <secondary>position of added lines</secondary>
54449 </indexterm>
54450 <indexterm role="concept">
54451 <primary><option>add_header</option> ACL modifier</primary>
54452 </indexterm>
54453 The <option>add_header</option> modifier can be used to add one or more extra header lines
54454 to an incoming message, as in this example:
54455 </para>
54456 <literallayout class="monospaced">
54457 warn dnslists = sbl.spamhaus.org : \
54458                 dialup.mail-abuse.org
54459      add_header = X-blacklisted-at: $dnslist_domain
54460 </literallayout>
54461 <para>
54462 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
54463 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
54464 receiving a message). The message must ultimately be accepted for
54465 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
54466 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
54467 RCPT ACL).
54468 </para>
54469 <para>
54470 Headers will not be added to the message if the modifier is used in
54471 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
54472 </para>
54473 <para>
54474 Leading and trailing newlines are removed from
54475 the data for the <option>add_header</option> modifier; if it then
54476 contains one or more newlines that
54477 are not followed by a space or a tab, it is assumed to contain multiple header
54478 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
54479 front of any line that is not a valid header line.
54480 </para>
54481 <para>
54482 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
54483 They are added to the message before processing the DATA and MIME ACLs.
54484 However, if an identical header line is requested more than once, only one copy
54485 is actually added to the message. Further header lines may be accumulated
54486 during the DATA and MIME ACLs, after which they are added to the message, again
54487 with duplicates suppressed. Thus, it is possible to add two identical header
54488 lines to an SMTP message, but only if one is added before DATA and one after.
54489 In the case of non-SMTP messages, new headers are accumulated during the
54490 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
54491 message is rejected after DATA or by the non-SMTP ACL, all added header lines
54492 are included in the entry that is written to the reject log.
54493 </para>
54494 <para>
54495 <indexterm role="concept">
54496 <primary>header lines</primary>
54497 <secondary>added; visibility of</secondary>
54498 </indexterm>
54499 Header lines are not visible in string expansions
54500 of message headers
54501 until they are added to the
54502 message. It follows that header lines defined in the MAIL, RCPT, and predata
54503 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
54504 header lines that are added by the DATA or MIME ACLs are not visible in those
54505 ACLs. Because of this restriction, you cannot use header lines as a way of
54506 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
54507 this, you can use ACL variables, as described in section
54508 <xref linkend="SECTaclvariables"/>.
54509 </para>
54510 <para>
54511 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
54512 </para>
54513 <para>
54514 The <option>add_header</option> modifier acts immediately as it is encountered during the
54515 processing of an ACL. Notice the difference between these two cases:
54516 </para>
54517 <literallayout>
54518 <literal>accept add_header = ADDED: some text</literal>
54519 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
54520
54521 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
54522 <literal>       add_header = ADDED: some text</literal>
54523 </literallayout>
54524 <para>
54525 In the first case, the header line is always added, whether or not the
54526 condition is true. In the second case, the header line is added only if the
54527 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
54528 ACL statement. All those that are encountered before a condition fails are
54529 honoured.
54530 </para>
54531 <para>
54532 <indexterm role="concept">
54533 <primary><option>warn</option> ACL verb</primary>
54534 </indexterm>
54535 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
54536 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
54537 effect only if all the conditions are true, even if it appears before some of
54538 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
54539 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
54540 are present on a <option>warn</option> verb, both are processed according to their
54541 specifications.
54542 </para>
54543 <para>
54544 By default, new header lines are added to a message at the end of the existing
54545 header lines. However, you can specify that any particular header line should
54546 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
54547 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
54548 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
54549 </para>
54550 <para>
54551 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
54552 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
54553 header line, respectively. (Header text cannot start with a colon, as there has
54554 to be a header name first.) For example:
54555 </para>
54556 <literallayout class="monospaced">
54557 warn add_header = \
54558        :after_received:X-My-Header: something or other...
54559 </literallayout>
54560 <para>
54561 If more than one header line is supplied in a single <option>add_header</option> modifier,
54562 each one is treated independently and can therefore be placed differently. If
54563 you add more than one line at the start, or after the Received: block, they end
54564 up in reverse order.
54565 </para>
54566 <para>
54567 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
54568 added in an ACL. It does NOT work for header lines that are added in a
54569 system filter or in a router or transport.
54570 </para>
54571 </section>
54572 <section id="SECTremoveheadacl">
54573 <title>Removing header lines in ACLs</title>
54574 <para>
54575 <indexterm role="concept">
54576 <primary>header lines</primary>
54577 <secondary>removing in an ACL</secondary>
54578 </indexterm>
54579 <indexterm role="concept">
54580 <primary>header lines</primary>
54581 <secondary>position of removed lines</secondary>
54582 </indexterm>
54583 <indexterm role="concept">
54584 <primary><option>remove_header</option> ACL modifier</primary>
54585 </indexterm>
54586 The <option>remove_header</option> modifier can be used to remove one or more header lines
54587 from an incoming message, as in this example:
54588 </para>
54589 <literallayout class="monospaced">
54590 warn   message        = Remove internal headers
54591        remove_header  = x-route-mail1 : x-route-mail2
54592 </literallayout>
54593 <para>
54594 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
54595 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
54596 receiving a message). The message must ultimately be accepted for
54597 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
54598 with any ACL verb, including <option>deny</option>, though this is really not useful for
54599 any verb that doesn&#x2019;t result in a delivered message.
54600 </para>
54601 <para>
54602 Headers will not be removed to the message if the modifier is used in
54603 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
54604 </para>
54605 <para>
54606 More than one header can be removed at the same time by using a colon separated
54607 list of header names. The header matching is case insensitive. Wildcards are
54608 not permitted, nor is list expansion performed, so you cannot use hostlists to
54609 create a list of headers, however both connection and message variable expansion
54610 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
54611 </para>
54612 <literallayout class="monospaced">
54613 warn   hosts           = +internal_hosts
54614        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
54615 warn   message         = Remove internal headers
54616        remove_header   = $acl_c_ihdrs
54617 </literallayout>
54618 <para>
54619 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
54620 They are removed from the message before processing the DATA and MIME ACLs.
54621 There is no harm in attempting to remove the same header twice nor is removing
54622 a non-existent header. Further header lines to be removed may be accumulated
54623 during the DATA and MIME ACLs, after which they are removed from the message,
54624 if present. In the case of non-SMTP messages, headers to be removed are
54625 accumulated during the non-SMTP ACLs, and are removed from the message after
54626 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
54627 ACL, there really is no effect because there is no logging of what headers
54628 would have been removed.
54629 </para>
54630 <para>
54631 <indexterm role="concept">
54632 <primary>header lines</primary>
54633 <secondary>removed; visibility of</secondary>
54634 </indexterm>
54635 Header lines are not visible in string expansions until the DATA phase when it
54636 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
54637 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
54638 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
54639 this restriction, you cannot use header lines as a way of controlling data
54640 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
54641 you should instead use ACL variables, as described in section
54642 <xref linkend="SECTaclvariables"/>.
54643 </para>
54644 <para>
54645 The <option>remove_header</option> modifier acts immediately as it is encountered during the
54646 processing of an ACL. Notice the difference between these two cases:
54647 </para>
54648 <literallayout>
54649 <literal>accept remove_header = X-Internal</literal>
54650 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
54651
54652 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
54653 <literal>       remove_header = X-Internal</literal>
54654 </literallayout>
54655 <para>
54656 In the first case, the header line is always removed, whether or not the
54657 condition is true. In the second case, the header line is removed only if the
54658 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
54659 same ACL statement. All those that are encountered before a condition fails
54660 are honoured.
54661 </para>
54662 <para>
54663 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
54664 present during ACL processing. It does NOT remove header lines that are added
54665 in a system filter or in a router or transport.
54666 </para>
54667 </section>
54668 <section id="SECTaclconditions">
54669 <title>ACL conditions</title>
54670 <para>
54671 <indexterm role="concept">
54672 <primary>access control lists (ACLs)</primary>
54673 <secondary>conditions; list of</secondary>
54674 </indexterm>
54675 Some of the conditions listed in this section are available only when Exim is
54676 compiled with the content-scanning extension. They are included here briefly
54677 for completeness. More detailed descriptions can be found in the discussion on
54678 content scanning in chapter <xref linkend="CHAPexiscan"/>.
54679 </para>
54680 <para>
54681 Not all conditions are relevant in all circumstances. For example, testing
54682 senders and recipients does not make sense in an ACL that is being run as the
54683 result of the arrival of an ETRN command, and checks on message headers can be
54684 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
54685 can use the same condition (with different parameters) more than once in the
54686 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
54687 The conditions are as follows:
54688 </para>
54689 <variablelist>
54690 <varlistentry>
54691 <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>
54692 <listitem>
54693 <para>
54694 <indexterm role="concept">
54695 <primary>access control lists (ACLs)</primary>
54696 <secondary>nested</secondary>
54697 </indexterm>
54698 <indexterm role="concept">
54699 <primary>access control lists (ACLs)</primary>
54700 <secondary>indirect</secondary>
54701 </indexterm>
54702 <indexterm role="concept">
54703 <primary>access control lists (ACLs)</primary>
54704 <secondary>arguments</secondary>
54705 </indexterm>
54706 <indexterm role="concept">
54707 <primary><option>acl</option> ACL condition</primary>
54708 </indexterm>
54709 The possible values of the argument are the same as for the
54710 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
54711 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
54712 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
54713 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
54714 condition false. This means that further processing of the <option>warn</option> verb
54715 ceases, but processing of the ACL continues.
54716 </para>
54717 <para>
54718 If the argument is a named ACL, up to nine space-separated optional values
54719 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
54720 and $acl_narg is set to the count of values.
54721 Previous values of these variables are restored after the call returns.
54722 The name and values are expanded separately.
54723 Note that spaces in complex expansions which are used as arguments
54724 will act as argument separators.
54725 </para>
54726 <para>
54727 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
54728 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
54729 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
54730 conditions are tested.
54731 </para>
54732 <para>
54733 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
54734 loops. This condition allows you to use different ACLs in different
54735 circumstances. For example, different ACLs can be used to handle RCPT commands
54736 for different local users or different local domains.
54737 </para>
54738 </listitem></varlistentry>
54739 <varlistentry>
54740 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
54741 <listitem>
54742 <para>
54743 <indexterm role="concept">
54744 <primary><option>authenticated</option> ACL condition</primary>
54745 </indexterm>
54746 <indexterm role="concept">
54747 <primary>authentication</primary>
54748 <secondary>ACL checking</secondary>
54749 </indexterm>
54750 <indexterm role="concept">
54751 <primary>access control lists (ACLs)</primary>
54752 <secondary>testing for authentication</secondary>
54753 </indexterm>
54754 If the SMTP connection is not authenticated, the condition is false. Otherwise,
54755 the name of the authenticator is tested against the list. To test for
54756 authentication by any authenticator, you can set
54757 </para>
54758 <literallayout class="monospaced">
54759 authenticated = *
54760 </literallayout>
54761 </listitem></varlistentry>
54762 <varlistentry>
54763 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
54764 <listitem>
54765 <para>
54766 <indexterm role="concept">
54767 <primary><option>condition</option> ACL condition</primary>
54768 </indexterm>
54769 <indexterm role="concept">
54770 <primary>customizing</primary>
54771 <secondary>ACL condition</secondary>
54772 </indexterm>
54773 <indexterm role="concept">
54774 <primary>access control lists (ACLs)</primary>
54775 <secondary>customized test</secondary>
54776 </indexterm>
54777 <indexterm role="concept">
54778 <primary>access control lists (ACLs)</primary>
54779 <secondary>testing, customized</secondary>
54780 </indexterm>
54781 This feature allows you to make up custom conditions. If the result of
54782 expanding the string is an empty string, the number zero, or one of the strings
54783 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
54784 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
54785 any other value, some error is assumed to have occurred, and the ACL returns
54786 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
54787 ignored. The effect is to treat it as true, whether it is positive or
54788 negative.
54789 </para>
54790 </listitem></varlistentry>
54791 <varlistentry>
54792 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
54793 <listitem>
54794 <para>
54795 <indexterm role="concept">
54796 <primary><option>decode</option> ACL condition</primary>
54797 </indexterm>
54798 This condition is available only when Exim is compiled with the
54799 content-scanning extension, and it is allowed only in the ACL defined by
54800 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
54801 If all goes well, the condition is true. It is false only if there are
54802 problems such as a syntax error or a memory shortage. For more details, see
54803 chapter <xref linkend="CHAPexiscan"/>.
54804 </para>
54805 </listitem></varlistentry>
54806 <varlistentry>
54807 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
54808 <listitem>
54809 <para>
54810 <indexterm role="concept">
54811 <primary><option>demime</option> ACL condition</primary>
54812 </indexterm>
54813 This condition is available only when Exim is compiled with the
54814 content-scanning extension. Its use is described in section
54815 <xref linkend="SECTdemimecond"/>.
54816 </para>
54817 </listitem></varlistentry>
54818 <varlistentry>
54819 <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>
54820 <listitem>
54821 <para>
54822 <indexterm role="concept">
54823 <primary><option>dnslists</option> ACL condition</primary>
54824 </indexterm>
54825 <indexterm role="concept">
54826 <primary>DNS list</primary>
54827 <secondary>in ACL</secondary>
54828 </indexterm>
54829 <indexterm role="concept">
54830 <primary>black list (DNS)</primary>
54831 </indexterm>
54832 <indexterm role="concept">
54833 <primary>access control lists (ACLs)</primary>
54834 <secondary>testing a DNS list</secondary>
54835 </indexterm>
54836 This condition checks for entries in DNS black lists. These are also known as
54837 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
54838 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
54839 different variants of this condition to describe briefly here. See sections
54840 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
54841 </para>
54842 </listitem></varlistentry>
54843 <varlistentry>
54844 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
54845 <listitem>
54846 <para>
54847 <indexterm role="concept">
54848 <primary><option>domains</option> ACL condition</primary>
54849 </indexterm>
54850 <indexterm role="concept">
54851 <primary>domain</primary>
54852 <secondary>ACL checking</secondary>
54853 </indexterm>
54854 <indexterm role="concept">
54855 <primary>access control lists (ACLs)</primary>
54856 <secondary>testing a recipient domain</secondary>
54857 </indexterm>
54858 <indexterm role="variable">
54859 <primary><varname>$domain_data</varname></primary>
54860 </indexterm>
54861 This condition is relevant only after a RCPT command. It checks that the domain
54862 of the recipient address is in the domain list. If percent-hack processing is
54863 enabled, it is done before this test is done. If the check succeeds with a
54864 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
54865 <option>domains</option> test.
54866 </para>
54867 <para>
54868 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
54869 use <option>domains</option> in a DATA ACL.
54870 </para>
54871 </listitem></varlistentry>
54872 <varlistentry>
54873 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
54874 <listitem>
54875 <para>
54876 <indexterm role="concept">
54877 <primary><option>encrypted</option> ACL condition</primary>
54878 </indexterm>
54879 <indexterm role="concept">
54880 <primary>encryption</primary>
54881 <secondary>checking in an ACL</secondary>
54882 </indexterm>
54883 <indexterm role="concept">
54884 <primary>access control lists (ACLs)</primary>
54885 <secondary>testing for encryption</secondary>
54886 </indexterm>
54887 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
54888 name of the cipher suite in use is tested against the list. To test for
54889 encryption without testing for any specific cipher suite(s), set
54890 </para>
54891 <literallayout class="monospaced">
54892 encrypted = *
54893 </literallayout>
54894 </listitem></varlistentry>
54895 <varlistentry>
54896 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
54897 <listitem>
54898 <para>
54899 <indexterm role="concept">
54900 <primary><option>hosts</option> ACL condition</primary>
54901 </indexterm>
54902 <indexterm role="concept">
54903 <primary>host</primary>
54904 <secondary>ACL checking</secondary>
54905 </indexterm>
54906 <indexterm role="concept">
54907 <primary>access control lists (ACLs)</primary>
54908 <secondary>testing the client host</secondary>
54909 </indexterm>
54910 This condition tests that the calling host matches the host list. If you have
54911 name lookups or wildcarded host names and IP addresses in the same host list,
54912 you should normally put the IP addresses first. For example, you could have:
54913 </para>
54914 <literallayout class="monospaced">
54915 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
54916 </literallayout>
54917 <para>
54918 The lookup in this example uses the host name for its key. This is implied by
54919 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
54920 and it wouldn&#x2019;t matter which way round you had these two items.)
54921 </para>
54922 <para>
54923 The reason for the problem with host names lies in the left-to-right way that
54924 Exim processes lists. It can test IP addresses without doing any DNS lookups,
54925 but when it reaches an item that requires a host name, it fails if it cannot
54926 find a host name to compare with the pattern. If the above list is given in the
54927 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
54928 found, even if its IP address is 10.9.8.7.
54929 </para>
54930 <para>
54931 If you really do want to do the name check first, and still recognize the IP
54932 address even if the name lookup fails, you can rewrite the ACL like this:
54933 </para>
54934 <literallayout class="monospaced">
54935 accept hosts = dbm;/etc/friendly/hosts
54936 accept hosts = 10.9.8.7
54937 </literallayout>
54938 <para>
54939 The default action on failing to find the host name is to assume that the host
54940 is not in the list, so the first <option>accept</option> statement fails. The second
54941 statement can then check the IP address.
54942 </para>
54943 <para>
54944 <indexterm role="variable">
54945 <primary><varname>$host_data</varname></primary>
54946 </indexterm>
54947 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
54948 of the lookup is made available in the <varname>$host_data</varname> variable. This
54949 allows you, for example, to set up a statement like this:
54950 </para>
54951 <literallayout class="monospaced">
54952 deny  hosts = net-lsearch;/some/file
54953 message = $host_data
54954 </literallayout>
54955 <para>
54956 which gives a custom error message for each denied host.
54957 </para>
54958 </listitem></varlistentry>
54959 <varlistentry>
54960 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
54961 <listitem>
54962 <para>
54963 <indexterm role="concept">
54964 <primary><option>local_parts</option> ACL condition</primary>
54965 </indexterm>
54966 <indexterm role="concept">
54967 <primary>local part</primary>
54968 <secondary>ACL checking</secondary>
54969 </indexterm>
54970 <indexterm role="concept">
54971 <primary>access control lists (ACLs)</primary>
54972 <secondary>testing a local part</secondary>
54973 </indexterm>
54974 <indexterm role="variable">
54975 <primary><varname>$local_part_data</varname></primary>
54976 </indexterm>
54977 This condition is relevant only after a RCPT command. It checks that the local
54978 part of the recipient address is in the list. If percent-hack processing is
54979 enabled, it is done before this test. If the check succeeds with a lookup, the
54980 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
54981 the next <option>local_parts</option> test.
54982 </para>
54983 </listitem></varlistentry>
54984 <varlistentry>
54985 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
54986 <listitem>
54987 <para>
54988 <indexterm role="concept">
54989 <primary><option>malware</option> ACL condition</primary>
54990 </indexterm>
54991 <indexterm role="concept">
54992 <primary>access control lists (ACLs)</primary>
54993 <secondary>virus scanning</secondary>
54994 </indexterm>
54995 <indexterm role="concept">
54996 <primary>access control lists (ACLs)</primary>
54997 <secondary>scanning for viruses</secondary>
54998 </indexterm>
54999 This condition is available only when Exim is compiled with the
55000 content-scanning extension. It causes the incoming message to be scanned for
55001 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
55002 </para>
55003 </listitem></varlistentry>
55004 <varlistentry>
55005 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
55006 <listitem>
55007 <para>
55008 <indexterm role="concept">
55009 <primary><option>mime_regex</option> ACL condition</primary>
55010 </indexterm>
55011 <indexterm role="concept">
55012 <primary>access control lists (ACLs)</primary>
55013 <secondary>testing by regex matching</secondary>
55014 </indexterm>
55015 This condition is available only when Exim is compiled with the
55016 content-scanning extension, and it is allowed only in the ACL defined by
55017 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
55018 with any of the regular expressions. For details, see chapter
55019 <xref linkend="CHAPexiscan"/>.
55020 </para>
55021 </listitem></varlistentry>
55022 <varlistentry>
55023 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
55024 <listitem>
55025 <para>
55026 <indexterm role="concept">
55027 <primary>rate limiting</primary>
55028 </indexterm>
55029 This condition can be used to limit the rate at which a user or host submits
55030 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
55031 </para>
55032 </listitem></varlistentry>
55033 <varlistentry>
55034 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
55035 <listitem>
55036 <para>
55037 <indexterm role="concept">
55038 <primary><option>recipients</option> ACL condition</primary>
55039 </indexterm>
55040 <indexterm role="concept">
55041 <primary>recipient</primary>
55042 <secondary>ACL checking</secondary>
55043 </indexterm>
55044 <indexterm role="concept">
55045 <primary>access control lists (ACLs)</primary>
55046 <secondary>testing a recipient</secondary>
55047 </indexterm>
55048 This condition is relevant only after a RCPT command. It checks the entire
55049 recipient address against a list of recipients.
55050 </para>
55051 </listitem></varlistentry>
55052 <varlistentry>
55053 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
55054 <listitem>
55055 <para>
55056 <indexterm role="concept">
55057 <primary><option>regex</option> ACL condition</primary>
55058 </indexterm>
55059 <indexterm role="concept">
55060 <primary>access control lists (ACLs)</primary>
55061 <secondary>testing by regex matching</secondary>
55062 </indexterm>
55063 This condition is available only when Exim is compiled with the
55064 content-scanning extension, and is available only in the DATA, MIME, and
55065 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
55066 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
55067 </para>
55068 </listitem></varlistentry>
55069 <varlistentry>
55070 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
55071 <listitem>
55072 <para>
55073 <indexterm role="concept">
55074 <primary><option>sender_domains</option> ACL condition</primary>
55075 </indexterm>
55076 <indexterm role="concept">
55077 <primary>sender</primary>
55078 <secondary>ACL checking</secondary>
55079 </indexterm>
55080 <indexterm role="concept">
55081 <primary>access control lists (ACLs)</primary>
55082 <secondary>testing a sender domain</secondary>
55083 </indexterm>
55084 <indexterm role="variable">
55085 <primary><varname>$domain</varname></primary>
55086 </indexterm>
55087 <indexterm role="variable">
55088 <primary><varname>$sender_address_domain</varname></primary>
55089 </indexterm>
55090 This condition tests the domain of the sender of the message against the given
55091 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
55092 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
55093 of this condition. This is an exception to the general rule for testing domain
55094 lists. It is done this way so that, if this condition is used in an ACL for a
55095 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
55096 influence the sender checking.
55097 </para>
55098 <para>
55099 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
55100 relaying, because sender addresses are easily, and commonly, forged.
55101 </para>
55102 </listitem></varlistentry>
55103 <varlistentry>
55104 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
55105 <listitem>
55106 <para>
55107 <indexterm role="concept">
55108 <primary><option>senders</option> ACL condition</primary>
55109 </indexterm>
55110 <indexterm role="concept">
55111 <primary>sender</primary>
55112 <secondary>ACL checking</secondary>
55113 </indexterm>
55114 <indexterm role="concept">
55115 <primary>access control lists (ACLs)</primary>
55116 <secondary>testing a sender</secondary>
55117 </indexterm>
55118 This condition tests the sender of the message against the given list. To test
55119 for a bounce message, which has an empty sender, set
55120 </para>
55121 <literallayout class="monospaced">
55122 senders = :
55123 </literallayout>
55124 <para>
55125 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
55126 relaying, because sender addresses are easily, and commonly, forged.
55127 </para>
55128 </listitem></varlistentry>
55129 <varlistentry>
55130 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
55131 <listitem>
55132 <para>
55133 <indexterm role="concept">
55134 <primary><option>spam</option> ACL condition</primary>
55135 </indexterm>
55136 <indexterm role="concept">
55137 <primary>access control lists (ACLs)</primary>
55138 <secondary>scanning for spam</secondary>
55139 </indexterm>
55140 This condition is available only when Exim is compiled with the
55141 content-scanning extension. It causes the incoming message to be scanned by
55142 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
55143 </para>
55144 </listitem></varlistentry>
55145 <varlistentry>
55146 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
55147 <listitem>
55148 <para>
55149 <indexterm role="concept">
55150 <primary><option>verify</option> ACL condition</primary>
55151 </indexterm>
55152 <indexterm role="concept">
55153 <primary>TLS</primary>
55154 <secondary>client certificate verification</secondary>
55155 </indexterm>
55156 <indexterm role="concept">
55157 <primary>certificate</primary>
55158 <secondary>verification of client</secondary>
55159 </indexterm>
55160 <indexterm role="concept">
55161 <primary>access control lists (ACLs)</primary>
55162 <secondary>certificate verification</secondary>
55163 </indexterm>
55164 <indexterm role="concept">
55165 <primary>access control lists (ACLs)</primary>
55166 <secondary>testing a TLS certificate</secondary>
55167 </indexterm>
55168 This condition is true in an SMTP session if the session is encrypted, and a
55169 certificate was received from the client, and the certificate was verified. The
55170 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
55171 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
55172 </para>
55173 </listitem></varlistentry>
55174 <varlistentry>
55175 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
55176 <listitem>
55177 <para>
55178 <indexterm role="concept">
55179 <primary>CSA verification</primary>
55180 </indexterm>
55181 This condition checks whether the sending host (the client) is authorized to
55182 send email. Details of how this works are given in section
55183 <xref linkend="SECTverifyCSA"/>.
55184 </para>
55185 </listitem></varlistentry>
55186 <varlistentry>
55187 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
55188 <listitem>
55189 <para>
55190 <indexterm role="concept">
55191 <primary><option>verify</option> ACL condition</primary>
55192 </indexterm>
55193 <indexterm role="concept">
55194 <primary>access control lists (ACLs)</primary>
55195 <secondary>verifying header names only ASCII</secondary>
55196 </indexterm>
55197 <indexterm role="concept">
55198 <primary>header lines</primary>
55199 <secondary>verifying header names only ASCII</secondary>
55200 </indexterm>
55201 <indexterm role="concept">
55202 <primary>verifying</primary>
55203 <secondary>header names only ASCII</secondary>
55204 </indexterm>
55205 This condition is relevant only in an ACL that is run after a message has been
55206 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
55207 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
55208 there are no non-ASCII characters, also excluding control characters.  The
55209 allowable characters are decimal ASCII values 33 through 126.
55210 </para>
55211 <para>
55212 Exim itself will handle headers with non-ASCII characters, but it can cause
55213 problems for downstream applications, so this option will allow their
55214 detection and rejection in the DATA ACL&#x2019;s.
55215 </para>
55216 </listitem></varlistentry>
55217 <varlistentry>
55218 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55219 <listitem>
55220 <para>
55221 <indexterm role="concept">
55222 <primary><option>verify</option> ACL condition</primary>
55223 </indexterm>
55224 <indexterm role="concept">
55225 <primary>access control lists (ACLs)</primary>
55226 <secondary>verifying sender in the header</secondary>
55227 </indexterm>
55228 <indexterm role="concept">
55229 <primary>header lines</primary>
55230 <secondary>verifying the sender in</secondary>
55231 </indexterm>
55232 <indexterm role="concept">
55233 <primary>sender</primary>
55234 <secondary>verifying in header</secondary>
55235 </indexterm>
55236 <indexterm role="concept">
55237 <primary>verifying</primary>
55238 <secondary>sender in header</secondary>
55239 </indexterm>
55240 This condition is relevant only in an ACL that is run after a message has been
55241 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
55242 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
55243 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
55244 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
55245 However, an address that appears in one of these headers need not be an address
55246 that accepts bounce messages; only sender addresses in envelopes are required
55247 to accept bounces. Therefore, if you use the callout option on this check, you
55248 might want to arrange for a non-empty address in the MAIL command.
55249 </para>
55250 <para>
55251 Details of address verification and the options are given later, starting at
55252 section <xref linkend="SECTaddressverification"/> (callouts are described in section
55253 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
55254 condition to restrict it to bounce messages only:
55255 </para>
55256 <literallayout class="monospaced">
55257 deny    senders = :
55258         message = A valid sender header is required for bounces
55259        !verify  = header_sender
55260 </literallayout>
55261 </listitem></varlistentry>
55262 <varlistentry>
55263 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
55264 <listitem>
55265 <para>
55266 <indexterm role="concept">
55267 <primary><option>verify</option> ACL condition</primary>
55268 </indexterm>
55269 <indexterm role="concept">
55270 <primary>access control lists (ACLs)</primary>
55271 <secondary>verifying header syntax</secondary>
55272 </indexterm>
55273 <indexterm role="concept">
55274 <primary>header lines</primary>
55275 <secondary>verifying syntax</secondary>
55276 </indexterm>
55277 <indexterm role="concept">
55278 <primary>verifying</primary>
55279 <secondary>header syntax</secondary>
55280 </indexterm>
55281 This condition is relevant only in an ACL that is run after a message has been
55282 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
55283 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
55284 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
55285 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
55286 permitted only in locally generated messages and from hosts that match
55287 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
55288 appropriate.
55289 </para>
55290 <para>
55291 Note that this condition is a syntax check only. However, a common spamming
55292 ploy used to be to send syntactically invalid headers such as
55293 </para>
55294 <literallayout class="monospaced">
55295 To: @
55296 </literallayout>
55297 <para>
55298 and this condition can be used to reject such messages, though they are not as
55299 common as they used to be.
55300 </para>
55301 </listitem></varlistentry>
55302 <varlistentry>
55303 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
55304 <listitem>
55305 <para>
55306 <indexterm role="concept">
55307 <primary><option>verify</option> ACL condition</primary>
55308 </indexterm>
55309 <indexterm role="concept">
55310 <primary>access control lists (ACLs)</primary>
55311 <secondary>verifying HELO/EHLO</secondary>
55312 </indexterm>
55313 <indexterm role="concept">
55314 <primary>HELO</primary>
55315 <secondary>verifying</secondary>
55316 </indexterm>
55317 <indexterm role="concept">
55318 <primary>EHLO</primary>
55319 <secondary>verifying</secondary>
55320 </indexterm>
55321 <indexterm role="concept">
55322 <primary>verifying</primary>
55323 <secondary>EHLO</secondary>
55324 </indexterm>
55325 <indexterm role="concept">
55326 <primary>verifying</primary>
55327 <secondary>HELO</secondary>
55328 </indexterm>
55329 This condition is true if a HELO or EHLO command has been received from the
55330 client host, and its contents have been verified. If there has been no previous
55331 attempt to verify the HELO/EHLO contents, it is carried out when this
55332 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
55333 <option>helo_try_verify_hosts</option> options for details of how to request verification
55334 independently of this condition.
55335 </para>
55336 <para>
55337 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
55338 option), this condition is always true.
55339 </para>
55340 </listitem></varlistentry>
55341 <varlistentry>
55342 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
55343 <listitem>
55344 <para>
55345 <indexterm role="concept">
55346 <primary>verifying</primary>
55347 <secondary>not blind</secondary>
55348 </indexterm>
55349 <indexterm role="concept">
55350 <primary>bcc recipients, verifying none</primary>
55351 </indexterm>
55352 This condition checks that there are no blind (bcc) recipients in the message.
55353 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
55354 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
55355 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
55356 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
55357 used only in a DATA or non-SMTP ACL.
55358 </para>
55359 <para>
55360 There are, of course, many legitimate messages that make use of blind (bcc)
55361 recipients. This check should not be used on its own for blocking messages.
55362 </para>
55363 </listitem></varlistentry>
55364 <varlistentry>
55365 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55366 <listitem>
55367 <para>
55368 <indexterm role="concept">
55369 <primary><option>verify</option> ACL condition</primary>
55370 </indexterm>
55371 <indexterm role="concept">
55372 <primary>access control lists (ACLs)</primary>
55373 <secondary>verifying recipient</secondary>
55374 </indexterm>
55375 <indexterm role="concept">
55376 <primary>recipient</primary>
55377 <secondary>verifying</secondary>
55378 </indexterm>
55379 <indexterm role="concept">
55380 <primary>verifying</primary>
55381 <secondary>recipient</secondary>
55382 </indexterm>
55383 <indexterm role="variable">
55384 <primary><varname>$address_data</varname></primary>
55385 </indexterm>
55386 This condition is relevant only after a RCPT command. It verifies the current
55387 recipient. Details of address verification are given later, starting at section
55388 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
55389 of <varname>$address_data</varname> is the last value that was set while routing the address.
55390 This applies even if the verification fails. When an address that is being
55391 verified is redirected to a single address, verification continues with the new
55392 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
55393 value for the child address.
55394 </para>
55395 </listitem></varlistentry>
55396 <varlistentry>
55397 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55398 <listitem>
55399 <para>
55400 <indexterm role="concept">
55401 <primary><option>verify</option> ACL condition</primary>
55402 </indexterm>
55403 <indexterm role="concept">
55404 <primary>access control lists (ACLs)</primary>
55405 <secondary>verifying host reverse lookup</secondary>
55406 </indexterm>
55407 <indexterm role="concept">
55408 <primary>host</primary>
55409 <secondary>verifying reverse lookup</secondary>
55410 </indexterm>
55411 This condition ensures that a verified host name has been looked up from the IP
55412 address of the client host. (This may have happened already if the host name
55413 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
55414 Verification ensures that the host name obtained from a reverse DNS lookup, or
55415 one of its aliases, does, when it is itself looked up in the DNS, yield the
55416 original IP address.
55417 </para>
55418 <para revisionflag="changed">
55419 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
55420 DNS operation returns a temporary error, the verify condition succeeds.
55421 </para>
55422 <para>
55423 If this condition is used for a locally generated message (that is, when there
55424 is no client host involved), it always succeeds.
55425 </para>
55426 </listitem></varlistentry>
55427 <varlistentry>
55428 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55429 <listitem>
55430 <para>
55431 <indexterm role="concept">
55432 <primary><option>verify</option> ACL condition</primary>
55433 </indexterm>
55434 <indexterm role="concept">
55435 <primary>access control lists (ACLs)</primary>
55436 <secondary>verifying sender</secondary>
55437 </indexterm>
55438 <indexterm role="concept">
55439 <primary>sender</primary>
55440 <secondary>verifying</secondary>
55441 </indexterm>
55442 <indexterm role="concept">
55443 <primary>verifying</primary>
55444 <secondary>sender</secondary>
55445 </indexterm>
55446 This condition is relevant only after a MAIL or RCPT command, or after a
55447 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
55448 the message&#x2019;s sender is empty (that is, this is a bounce message), the
55449 condition is true. Otherwise, the sender address is verified.
55450 </para>
55451 <para>
55452 <indexterm role="variable">
55453 <primary><varname>$address_data</varname></primary>
55454 </indexterm>
55455 <indexterm role="variable">
55456 <primary><varname>$sender_address_data</varname></primary>
55457 </indexterm>
55458 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
55459 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
55460 value can be used in subsequent conditions and modifiers in the same ACL
55461 statement. It does not persist after the end of the current statement. If you
55462 want to preserve the value for longer, you can save it in an ACL variable.
55463 </para>
55464 <para>
55465 Details of verification are given later, starting at section
55466 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
55467 to avoid doing it more than once per message.
55468 </para>
55469 </listitem></varlistentry>
55470 <varlistentry>
55471 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55472 <listitem>
55473 <para>
55474 <indexterm role="concept">
55475 <primary><option>verify</option> ACL condition</primary>
55476 </indexterm>
55477 This is a variation of the previous option, in which a modified address is
55478 verified as a sender.
55479 </para>
55480 </listitem></varlistentry>
55481 </variablelist>
55482 </section>
55483 <section id="SECTmorednslists">
55484 <title>Using DNS lists</title>
55485 <para>
55486 <indexterm role="concept">
55487 <primary>DNS list</primary>
55488 <secondary>in ACL</secondary>
55489 </indexterm>
55490 <indexterm role="concept">
55491 <primary>black list (DNS)</primary>
55492 </indexterm>
55493 <indexterm role="concept">
55494 <primary>access control lists (ACLs)</primary>
55495 <secondary>testing a DNS list</secondary>
55496 </indexterm>
55497 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
55498 is on at least one of a number of DNS lists by looking up the inverted IP
55499 address in one or more DNS domains. (Note that DNS list domains are not mail
55500 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
55501 special options instead.) For example, if the calling host&#x2019;s IP
55502 address is 192.168.62.43, and the ACL statement is
55503 </para>
55504 <literallayout class="monospaced">
55505 deny dnslists = blackholes.mail-abuse.org : \
55506                 dialups.mail-abuse.org
55507 </literallayout>
55508 <para>
55509 the following records are looked up:
55510 </para>
55511 <literallayout class="monospaced">
55512 43.62.168.192.blackholes.mail-abuse.org
55513 43.62.168.192.dialups.mail-abuse.org
55514 </literallayout>
55515 <para>
55516 As soon as Exim finds an existing DNS record, processing of the list stops.
55517 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
55518 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
55519 use two separate conditions:
55520 </para>
55521 <literallayout class="monospaced">
55522 deny dnslists = blackholes.mail-abuse.org
55523      dnslists = dialups.mail-abuse.org
55524 </literallayout>
55525 <para>
55526 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
55527 behaves as if the host does not match the list item, that is, as if the DNS
55528 record does not exist. If there are further items in the DNS list, they are
55529 processed.
55530 </para>
55531 <para>
55532 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
55533 (which is the most common usage), because it prevents a DNS failure from
55534 blocking mail. However, you can change this behaviour by putting one of the
55535 following special items in the list:
55536 </para>
55537 <literallayout>
55538 <literal>+include_unknown </literal>   behave as if the item is on the list
55539 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
55540 <literal>+defer_unknown   </literal>   give a temporary error
55541 </literallayout>
55542 <para>
55543 <indexterm role="concept">
55544 <primary><literal>+include_unknown</literal></primary>
55545 </indexterm>
55546 <indexterm role="concept">
55547 <primary><literal>+exclude_unknown</literal></primary>
55548 </indexterm>
55549 <indexterm role="concept">
55550 <primary><literal>+defer_unknown</literal></primary>
55551 </indexterm>
55552 Each of these applies to any subsequent items on the list. For example:
55553 </para>
55554 <literallayout class="monospaced">
55555 deny dnslists = +defer_unknown : foo.bar.example
55556 </literallayout>
55557 <para>
55558 Testing the list of domains stops as soon as a match is found. If you want to
55559 warn for one list and block for another, you can use two different statements:
55560 </para>
55561 <literallayout class="monospaced">
55562 deny  dnslists = blackholes.mail-abuse.org
55563 warn  message  = X-Warn: sending host is on dialups list
55564       dnslists = dialups.mail-abuse.org
55565 </literallayout>
55566 <para>
55567 DNS list lookups are cached by Exim for the duration of the SMTP session,
55568 so a lookup based on the IP address is done at most once for any incoming
55569 connection. Exim does not share information between multiple incoming
55570 connections (but your local name server cache should be active).
55571 </para>
55572 </section>
55573 <section id="SECID201">
55574 <title>Specifying the IP address for a DNS list lookup</title>
55575 <para>
55576 <indexterm role="concept">
55577 <primary>DNS list</primary>
55578 <secondary>keyed by explicit IP address</secondary>
55579 </indexterm>
55580 By default, the IP address that is used in a DNS list lookup is the IP address
55581 of the calling host. However, you can specify another IP address by listing it
55582 after the domain name, introduced by a slash. For example:
55583 </para>
55584 <literallayout class="monospaced">
55585 deny dnslists = black.list.tld/192.168.1.2
55586 </literallayout>
55587 <para>
55588 This feature is not very helpful with explicit IP addresses; it is intended for
55589 use with IP addresses that are looked up, for example, the IP addresses of the
55590 MX hosts or nameservers of an email sender address. For an example, see section
55591 <xref linkend="SECTmulkeyfor"/> below.
55592 </para>
55593 </section>
55594 <section id="SECID202">
55595 <title>DNS lists keyed on domain names</title>
55596 <para>
55597 <indexterm role="concept">
55598 <primary>DNS list</primary>
55599 <secondary>keyed by domain name</secondary>
55600 </indexterm>
55601 There are some lists that are keyed on domain names rather than inverted IP
55602 addresses (see for example the <emphasis>domain based zones</emphasis> link at
55603 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
55604 with these lists. You can change the name that is looked up in a DNS list by
55605 listing it after the domain name, introduced by a slash. For example,
55606 </para>
55607 <literallayout class="monospaced">
55608 deny  message  = Sender's domain is listed at $dnslist_domain
55609       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
55610 </literallayout>
55611 <para>
55612 This particular example is useful only in ACLs that are obeyed after the
55613 RCPT or DATA commands, when a sender address is available. If (for
55614 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
55615 up by this example is
55616 </para>
55617 <literallayout class="monospaced">
55618 tld.example.dsn.rfc-ignorant.org
55619 </literallayout>
55620 <para>
55621 A single <option>dnslists</option> condition can contain entries for both names and IP
55622 addresses. For example:
55623 </para>
55624 <literallayout class="monospaced">
55625 deny dnslists = sbl.spamhaus.org : \
55626                 dsn.rfc-ignorant.org/$sender_address_domain
55627 </literallayout>
55628 <para>
55629 The first item checks the sending host&#x2019;s IP address; the second checks a domain
55630 name. The whole condition is true if either of the DNS lookups succeeds.
55631 </para>
55632 </section>
55633 <section id="SECTmulkeyfor">
55634 <title>Multiple explicit keys for a DNS list</title>
55635 <para>
55636 <indexterm role="concept">
55637 <primary>DNS list</primary>
55638 <secondary>multiple keys for</secondary>
55639 </indexterm>
55640 The syntax described above for looking up explicitly-defined values (either
55641 names or IP addresses) in a DNS blacklist is a simplification. After the domain
55642 name for the DNS list, what follows the slash can in fact be a list of items.
55643 As with all lists in Exim, the default separator is a colon. However, because
55644 this is a sublist within the list of DNS blacklist domains, it is necessary
55645 either to double the separators like this:
55646 </para>
55647 <literallayout class="monospaced">
55648 dnslists = black.list.tld/name.1::name.2
55649 </literallayout>
55650 <para>
55651 or to change the separator character, like this:
55652 </para>
55653 <literallayout class="monospaced">
55654 dnslists = black.list.tld/&lt;;name.1;name.2
55655 </literallayout>
55656 <para>
55657 If an item in the list is an IP address, it is inverted before the DNS
55658 blacklist domain is appended. If it is not an IP address, no inversion
55659 occurs. Consider this condition:
55660 </para>
55661 <literallayout class="monospaced">
55662 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
55663 </literallayout>
55664 <para>
55665 The DNS lookups that occur are:
55666 </para>
55667 <literallayout class="monospaced">
55668 2.1.168.192.black.list.tld
55669 a.domain.black.list.tld
55670 </literallayout>
55671 <para>
55672 Once a DNS record has been found (that matches a specific IP return
55673 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
55674 are done. If there is a temporary DNS error, the rest of the sublist of domains
55675 or IP addresses is tried. A temporary error for the whole dnslists item occurs
55676 only if no other DNS lookup in this sublist succeeds. In other words, a
55677 successful lookup for any of the items in the sublist overrides a temporary
55678 error for a previous item.
55679 </para>
55680 <para>
55681 The ability to supply a list of items after the slash is in some sense just a
55682 syntactic convenience. These two examples have the same effect:
55683 </para>
55684 <literallayout class="monospaced">
55685 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
55686 dnslists = black.list.tld/a.domain::b.domain
55687 </literallayout>
55688 <para>
55689 However, when the data for the list is obtained from a lookup, the second form
55690 is usually much more convenient. Consider this example:
55691 </para>
55692 <literallayout class="monospaced">
55693 deny message  = The mail servers for the domain \
55694                 $sender_address_domain \
55695                 are listed at $dnslist_domain ($dnslist_value); \
55696                 see $dnslist_text.
55697      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
55698                                    ${lookup dnsdb {&gt;|mxh=\
55699                                    $sender_address_domain} }} }
55700 </literallayout>
55701 <para>
55702 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
55703 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
55704 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
55705 of expanding the condition might be something like this:
55706 </para>
55707 <literallayout class="monospaced">
55708 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
55709 </literallayout>
55710 <para>
55711 Thus, this example checks whether or not the IP addresses of the sender
55712 domain&#x2019;s mail servers are on the Spamhaus black list.
55713 </para>
55714 <para>
55715 The key that was used for a successful DNS list lookup is put into the variable
55716 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
55717 </para>
55718 </section>
55719 <section id="SECID203">
55720 <title>Data returned by DNS lists</title>
55721 <para>
55722 <indexterm role="concept">
55723 <primary>DNS list</primary>
55724 <secondary>data returned from</secondary>
55725 </indexterm>
55726 DNS lists are constructed using address records in the DNS. The original RBL
55727 just used the address 127.0.0.1 on the right hand side of each record, but the
55728 RBL+ list and some other lists use a number of values with different meanings.
55729 The values used on the RBL+ list are:
55730 </para>
55731 <literallayout>
55732 127.1.0.1  RBL
55733 127.1.0.2  DUL
55734 127.1.0.3  DUL and RBL
55735 127.1.0.4  RSS
55736 127.1.0.5  RSS and RBL
55737 127.1.0.6  RSS and DUL
55738 127.1.0.7  RSS and DUL and RBL
55739 </literallayout>
55740 <para>
55741 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
55742 different values. Some DNS lists may return more than one address record;
55743 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
55744 </para>
55745 </section>
55746 <section id="SECID204">
55747 <title>Variables set from DNS lists</title>
55748 <para>
55749 <indexterm role="concept">
55750 <primary>expansion</primary>
55751 <secondary>variables, set from DNS list</secondary>
55752 </indexterm>
55753 <indexterm role="concept">
55754 <primary>DNS list</primary>
55755 <secondary>variables set from</secondary>
55756 </indexterm>
55757 <indexterm role="variable">
55758 <primary><varname>$dnslist_domain</varname></primary>
55759 </indexterm>
55760 <indexterm role="variable">
55761 <primary><varname>$dnslist_matched</varname></primary>
55762 </indexterm>
55763 <indexterm role="variable">
55764 <primary><varname>$dnslist_text</varname></primary>
55765 </indexterm>
55766 <indexterm role="variable">
55767 <primary><varname>$dnslist_value</varname></primary>
55768 </indexterm>
55769 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
55770 the name of the overall domain that matched (for example,
55771 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
55772 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
55773 the DNS record. When the key is an IP address, it is not reversed in
55774 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
55775 cases, for example:
55776 </para>
55777 <literallayout class="monospaced">
55778 deny dnslists = spamhaus.example
55779 </literallayout>
55780 <para>
55781 the key is also available in another variable (in this case,
55782 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
55783 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
55784 might generate a dnslists lookup like this:
55785 </para>
55786 <literallayout class="monospaced">
55787 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
55788 </literallayout>
55789 <para>
55790 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
55791 <literal>192.168.6.7</literal> (for example).
55792 </para>
55793 <para>
55794 If more than one address record is returned by the DNS lookup, all the IP
55795 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
55796 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
55797 record. For lists such as RBL+ the TXT record for a merged entry is often not
55798 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
55799 information.
55800 </para>
55801 <para>
55802 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
55803 &ndash; although these appear before the condition in the ACL, they are not
55804 expanded until after it has failed. For example:
55805 </para>
55806 <literallayout class="monospaced">
55807 deny    hosts = !+local_networks
55808         message = $sender_host_address is listed \
55809                   at $dnslist_domain
55810         dnslists = rbl-plus.mail-abuse.example
55811 </literallayout>
55812 </section>
55813 <section id="SECTaddmatcon">
55814 <title>Additional matching conditions for DNS lists</title>
55815 <para>
55816 <indexterm role="concept">
55817 <primary>DNS list</primary>
55818 <secondary>matching specific returned data</secondary>
55819 </indexterm>
55820 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
55821 in order to restrict its action to DNS records with a matching right hand side.
55822 For example,
55823 </para>
55824 <literallayout class="monospaced">
55825 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
55826 </literallayout>
55827 <para>
55828 rejects only those hosts that yield 127.0.0.2. Without this additional data,
55829 any address record is considered to be a match. For the moment, we assume
55830 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
55831 describes how multiple records are handled.
55832 </para>
55833 <para>
55834 More than one IP address may be given for checking, using a comma as a
55835 separator. These are alternatives &ndash; if any one of them matches, the
55836 <option>dnslists</option> condition is true. For example:
55837 </para>
55838 <literallayout class="monospaced">
55839 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
55840 </literallayout>
55841 <para>
55842 If you want to specify a constraining address list and also specify names or IP
55843 addresses to be looked up, the constraining address list must be specified
55844 first. For example:
55845 </para>
55846 <literallayout class="monospaced">
55847 deny dnslists = dsn.rfc-ignorant.org\
55848                 =127.0.0.2/$sender_address_domain
55849 </literallayout>
55850 <para>
55851 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
55852 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
55853 In other words, the listed addresses are used as bit masks. The comparison is
55854 true if all the bits in the mask are present in the address that is being
55855 tested. For example:
55856 </para>
55857 <literallayout class="monospaced">
55858 dnslists = a.b.c&amp;0.0.0.3
55859 </literallayout>
55860 <para>
55861 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
55862 want to test whether one bit or another bit is present (as opposed to both
55863 being present), you must use multiple values. For example:
55864 </para>
55865 <literallayout class="monospaced">
55866 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
55867 </literallayout>
55868 <para>
55869 matches if the final component of the address is an odd number or two times
55870 an odd number.
55871 </para>
55872 </section>
55873 <section id="SECID205">
55874 <title>Negated DNS matching conditions</title>
55875 <para>
55876 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
55877 condition. Whereas
55878 </para>
55879 <literallayout class="monospaced">
55880 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
55881 </literallayout>
55882 <para>
55883 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
55884 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
55885 </para>
55886 <literallayout class="monospaced">
55887 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
55888 </literallayout>
55889 <para>
55890 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
55891 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
55892 words, the result of the test is inverted if an exclamation mark appears before
55893 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
55894 </para>
55895 <para>
55896 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
55897 host, or address list (which is why the syntax is different).
55898 </para>
55899 <para>
55900 If you are using just one list, the negation syntax does not gain you much. The
55901 previous example is precisely equivalent to
55902 </para>
55903 <literallayout class="monospaced">
55904 deny  dnslists = a.b.c
55905      !dnslists = a.b.c=127.0.0.2,127.0.0.3
55906 </literallayout>
55907 <para>
55908 However, if you are using multiple lists, the negation syntax is clearer.
55909 Consider this example:
55910 </para>
55911 <literallayout class="monospaced">
55912 deny  dnslists = sbl.spamhaus.org : \
55913                  list.dsbl.org : \
55914                  dnsbl.njabl.org!=127.0.0.3 : \
55915                  relays.ordb.org
55916 </literallayout>
55917 <para>
55918 Using only positive lists, this would have to be:
55919 </para>
55920 <literallayout class="monospaced">
55921 deny  dnslists = sbl.spamhaus.org : \
55922                  list.dsbl.org
55923 deny  dnslists = dnsbl.njabl.org
55924      !dnslists = dnsbl.njabl.org=127.0.0.3
55925 deny  dnslists = relays.ordb.org
55926 </literallayout>
55927 <para>
55928 which is less clear, and harder to maintain.
55929 </para>
55930 </section>
55931 <section id="SECThanmuldnsrec">
55932 <title>Handling multiple DNS records from a DNS list</title>
55933 <para>
55934 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
55935 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
55936 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
55937 the match to specific results from the DNS lookup, there are two ways in which
55938 the checking can be handled. For example, consider the condition:
55939 </para>
55940 <literallayout class="monospaced">
55941 dnslists = a.b.c=127.0.0.1
55942 </literallayout>
55943 <para>
55944 What happens if the DNS lookup for the incoming IP address yields both
55945 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
55946 condition true because at least one given value was found, or is it false
55947 because at least one of the found values was not listed? And how does this
55948 affect negated conditions? Both possibilities are provided for with the help of
55949 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
55950 </para>
55951 <itemizedlist>
55952 <listitem>
55953 <para>
55954 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
55955 IP addresses matches one of the listed addresses. For the example above, the
55956 condition is true because 127.0.0.1 matches.
55957 </para>
55958 </listitem>
55959 <listitem>
55960 <para>
55961 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
55962 looked up IP addresses matches one of the listed addresses. If the condition is
55963 changed to:
55964 </para>
55965 <literallayout class="monospaced">
55966 dnslists = a.b.c==127.0.0.1
55967 </literallayout>
55968 <para>
55969 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55970 false because 127.0.0.2 is not listed. You would need to have:
55971 </para>
55972 <literallayout class="monospaced">
55973 dnslists = a.b.c==127.0.0.1,127.0.0.2
55974 </literallayout>
55975 <para>
55976 for the condition to be true.
55977 </para>
55978 </listitem>
55979 </itemizedlist>
55980 <para>
55981 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
55982 the precise opposite of the behaviour above. Thus:
55983 </para>
55984 <itemizedlist>
55985 <listitem>
55986 <para>
55987 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
55988 addresses matches one of the listed addresses. Consider:
55989 </para>
55990 <literallayout class="monospaced">
55991 dnslists = a.b.c!&amp;0.0.0.1
55992 </literallayout>
55993 <para>
55994 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55995 false because 127.0.0.1 matches.
55996 </para>
55997 </listitem>
55998 <listitem>
55999 <para>
56000 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
56001 looked up IP address that does not match. Consider:
56002 </para>
56003 <literallayout class="monospaced">
56004 dnslists = a.b.c!=&amp;0.0.0.1
56005 </literallayout>
56006 <para>
56007 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
56008 true, because 127.0.0.2 does not match. You would need to have:
56009 </para>
56010 <literallayout class="monospaced">
56011 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
56012 </literallayout>
56013 <para>
56014 for the condition to be false.
56015 </para>
56016 </listitem>
56017 </itemizedlist>
56018 <para>
56019 When the DNS lookup yields only a single IP address, there is no difference
56020 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
56021 </para>
56022 </section>
56023 <section id="SECTmordetinf">
56024 <title>Detailed information from merged DNS lists</title>
56025 <para>
56026 <indexterm role="concept">
56027 <primary>DNS list</primary>
56028 <secondary>information from merged</secondary>
56029 </indexterm>
56030 When the facility for restricting the matching IP values in a DNS list is used,
56031 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
56032 the true reason for rejection. This happens when lists are merged and the IP
56033 address in the A record is used to distinguish them; unfortunately there is
56034 only one TXT record. One way round this is not to use merged lists, but that
56035 can be inefficient because it requires multiple DNS lookups where one would do
56036 in the vast majority of cases when the host of interest is not on any of the
56037 lists.
56038 </para>
56039 <para>
56040 A less inefficient way of solving this problem is available. If
56041 two domain names, comma-separated, are given, the second is used first to
56042 do an initial check, making use of any IP value restrictions that are set.
56043 If there is a match, the first domain is used, without any IP value
56044 restrictions, to get the TXT record. As a byproduct of this, there is also
56045 a check that the IP being tested is indeed on the first list. The first
56046 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
56047 </para>
56048 <literallayout class="monospaced">
56049 reject message  = \
56050          rejected because $sender_host_address is blacklisted \
56051          at $dnslist_domain\n$dnslist_text
56052        dnslists = \
56053          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
56054          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
56055 </literallayout>
56056 <para>
56057 For the first blacklist item, this starts by doing a lookup in
56058 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
56059 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
56060 value, and as long as something is found, it looks for the corresponding TXT
56061 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
56062 The second blacklist item is processed similarly.
56063 </para>
56064 <para>
56065 If you are interested in more than one merged list, the same list must be
56066 given several times, but because the results of the DNS lookups are cached,
56067 the DNS calls themselves are not repeated. For example:
56068 </para>
56069 <literallayout class="monospaced">
56070 reject dnslists = \
56071          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
56072          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
56073          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
56074          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
56075 </literallayout>
56076 <para>
56077 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
56078 values matches (or if no record is found), this is the only lookup that is
56079 done. Only if there is a match is one of the more specific lists consulted.
56080 </para>
56081 </section>
56082 <section id="SECTmorednslistslast">
56083 <title>DNS lists and IPv6</title>
56084 <para>
56085 <indexterm role="concept">
56086 <primary>IPv6</primary>
56087 <secondary>DNS black lists</secondary>
56088 </indexterm>
56089 <indexterm role="concept">
56090 <primary>DNS list</primary>
56091 <secondary>IPv6 usage</secondary>
56092 </indexterm>
56093 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
56094 nibble by nibble. For example, if the calling host&#x2019;s IP address is
56095 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
56096 </para>
56097 <literallayout class="monospaced">
56098 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
56099   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
56100 </literallayout>
56101 <para>
56102 (split over two lines here to fit on the page). Unfortunately, some of the DNS
56103 lists contain wildcard records, intended for IPv4, that interact badly with
56104 IPv6. For example, the DNS entry
56105 </para>
56106 <literallayout class="monospaced">
56107 *.3.some.list.example.    A    127.0.0.1
56108 </literallayout>
56109 <para>
56110 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
56111 Unfortunately, it also matches the entire 3::/4 IPv6 network.
56112 </para>
56113 <para>
56114 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
56115 <option>condition</option> condition, as in this example:
56116 </para>
56117 <literallayout class="monospaced">
56118 deny   condition = ${if isip4{$sender_host_address}}
56119        dnslists  = some.list.example
56120 </literallayout>
56121 <para>
56122 If an explicit key is being used for a DNS lookup and it may be an IPv6
56123 address you should specify alternate list separators for both the outer
56124 (DNS list name) list and inner (lookup keys) list:
56125 </para>
56126 <literallayout class="monospaced">
56127        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
56128 </literallayout>
56129 </section>
56130 <section id="SECTratelimiting">
56131 <title>Rate limiting incoming messages</title>
56132 <para>
56133 <indexterm role="concept">
56134 <primary>rate limiting</primary>
56135 <secondary>client sending</secondary>
56136 </indexterm>
56137 <indexterm role="concept">
56138 <primary>limiting client sending rates</primary>
56139 </indexterm>
56140 <indexterm role="option">
56141 <primary><option>smtp_ratelimit_*</option></primary>
56142 </indexterm>
56143 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
56144 which clients can send email. This is more powerful than the
56145 <option>smtp_ratelimit_*</option> options, because those options control the rate of
56146 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
56147 works across all connections (concurrent and sequential) from the same client
56148 host. The syntax of the <option>ratelimit</option> condition is:
56149 </para>
56150 <literallayout>
56151 <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;
56152 </literallayout>
56153 <para>
56154 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
56155 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
56156 </para>
56157 <para>
56158 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
56159 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
56160 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
56161 of <emphasis>p</emphasis>.
56162 </para>
56163 <para>
56164 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
56165 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
56166 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
56167 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
56168 send in each time interval. It also specifies the number of messages permitted
56169 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
56170 constant, you can allow a client to send more messages in a burst without
56171 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
56172 both small, messages must be sent at an even rate.
56173 </para>
56174 <para>
56175 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
56176 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
56177 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
56178 instructions when it is run with no arguments.
56179 </para>
56180 <para>
56181 The key is used to look up the data for calculating the client&#x2019;s average
56182 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
56183 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
56184 which means Exim computes the sending rate of each client host IP address.
56185 By changing the key you can change how Exim identifies clients for the purpose
56186 of ratelimiting. For example, to limit the sending rate of each authenticated
56187 user, independent of the computer they are sending from, set the key to
56188 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
56189 example, <varname>$authenticated_id</varname> is only meaningful if the client has
56190 authenticated (which you can check with the <option>authenticated</option> ACL condition).
56191 </para>
56192 <para>
56193 The lookup key does not have to identify clients: If you want to limit the
56194 rate at which a recipient receives messages, you can use the key
56195 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
56196 ACL.
56197 </para>
56198 <para>
56199 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
56200 specifies what Exim measures the rate of, for example messages or recipients
56201 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
56202 <option>count=</option> options. You can also control when Exim updates the recorded rate
56203 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
56204 separated by a slash, like the other parameters. They may appear in any order.
56205 </para>
56206 <para>
56207 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
56208 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
56209 stored, so you can alter the configured maximum rate and Exim will still
56210 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
56211 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
56212 behaviour. The lookup key is not affected by changes to the update mode and
56213 the <option>count=</option> option.
56214 </para>
56215 </section>
56216 <section id="ratoptmea">
56217 <title>Ratelimit options for what is being measured</title>
56218 <para>
56219 <indexterm role="concept">
56220 <primary>rate limiting</primary>
56221 <secondary>per_* options</secondary>
56222 </indexterm>
56223 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
56224 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
56225 <option>acl_not_smtp_start</option> ACLs.
56226 </para>
56227 <para>
56228 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
56229 the default if none of the <option>per_*</option> options is specified. It can be used in
56230 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
56231 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
56232 </para>
56233 <para>
56234 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
56235 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
56236 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
56237 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
56238 in its MAIL command, which may be inaccurate or completely missing. You can
56239 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
56240 in kilobytes, megabytes, or gigabytes, respectively.
56241 </para>
56242 <para>
56243 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
56244 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
56245 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
56246 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
56247 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
56248 in either case the rate limiting engine will see a message with many
56249 recipients as a large high-speed burst.
56250 </para>
56251 <para>
56252 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
56253 number of different recipients that the client has sent messages to in the
56254 last time period. That is, if the client repeatedly sends messages to the same
56255 recipient, its measured rate is not increased. This option can only be used in
56256 <option>acl_smtp_rcpt</option>.
56257 </para>
56258 <para>
56259 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
56260 condition is processed. This can be used to limit the rate of any SMTP
56261 command. If it is used in multiple ACLs it can limit the aggregate rate of
56262 multiple different commands.
56263 </para>
56264 <para>
56265 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
56266 measured rate. For example, the <option>per_byte</option> option is equivalent to
56267 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
56268 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
56269 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
56270 </para>
56271 <para>
56272 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
56273 </para>
56274 </section>
56275 <section id="ratoptupd">
56276 <title>Ratelimit update modes</title>
56277 <para>
56278 <indexterm role="concept">
56279 <primary>rate limiting</primary>
56280 <secondary>reading data without updating</secondary>
56281 </indexterm>
56282 You can specify one of three options with the <option>ratelimit</option> condition to
56283 control when its database is updated. This section describes the <option>readonly</option>
56284 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
56285 </para>
56286 <para>
56287 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
56288 previously-computed rate to check against the limit.
56289 </para>
56290 <para>
56291 For example, you can test the client&#x2019;s sending rate and deny it access (when
56292 it is too fast) in the connect ACL. If the client passes this check then it
56293 can go on to send a message, in which case its recorded rate will be updated
56294 in the MAIL ACL. Subsequent connections from the same client will check this
56295 new rate.
56296 </para>
56297 <literallayout class="monospaced">
56298 acl_check_connect:
56299  deny ratelimit = 100 / 5m / readonly
56300     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
56301                   (max $sender_rate_limit)
56302 # ...
56303 acl_check_mail:
56304  warn ratelimit = 100 / 5m / strict
56305     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
56306                   (max $sender_rate_limit)
56307 </literallayout>
56308 <para>
56309 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
56310 processing a message then it may increase the client&#x2019;s measured rate more than
56311 it should. For example, this will happen if you check the <option>per_rcpt</option> option
56312 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
56313 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
56314 multiple update problems by using the <option>readonly</option> option on later ratelimit
56315 checks.
56316 </para>
56317 <para>
56318 The <option>per_*</option> options described above do not make sense in some ACLs. If you
56319 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
56320 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
56321 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
56322 next section) so you must specify the <option>readonly</option> option explicitly.
56323 </para>
56324 </section>
56325 <section id="ratoptfast">
56326 <title>Ratelimit options for handling fast clients</title>
56327 <para>
56328 <indexterm role="concept">
56329 <primary>rate limiting</primary>
56330 <secondary>strict and leaky modes</secondary>
56331 </indexterm>
56332 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
56333 engine can react in two possible ways, depending on the presence of the
56334 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
56335 counter-measures (such as rejecting the message) that may be specified by the
56336 rest of the ACL.
56337 </para>
56338 <para>
56339 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
56340 updated if it is above the limit. The effect of this is that Exim measures the
56341 client&#x2019;s average rate of successfully sent email, which cannot be greater than
56342 the maximum allowed. If the client is over the limit it may suffer some
56343 counter-measures (as specified in the ACL), but it will still be able to send
56344 email at the configured maximum rate, whatever the rate of its attempts. This
56345 is generally the better choice if you have clients that retry automatically.
56346 For example, it does not prevent a sender with an over-aggressive retry rate
56347 from getting any email through.
56348 </para>
56349 <para>
56350 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
56351 updated. The effect of this is that Exim measures the client&#x2019;s average rate
56352 of attempts to send email, which can be much higher than the maximum it is
56353 actually allowed. If the client is over the limit it may be subjected to
56354 counter-measures by the ACL. It must slow down and allow sufficient time to
56355 pass that its computed rate falls below the maximum before it can send email
56356 again. The time (the number of smoothing periods) it must wait and not
56357 attempt to send mail can be calculated with this formula:
56358 </para>
56359 <literallayout class="monospaced">
56360         ln(peakrate/maxrate)
56361 </literallayout>
56362 </section>
56363 <section id="ratoptuniq">
56364 <title>Limiting the rate of different events</title>
56365 <para>
56366 <indexterm role="concept">
56367 <primary>rate limiting</primary>
56368 <secondary>counting unique events</secondary>
56369 </indexterm>
56370 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
56371 rate of different events. For example, the <option>per_addr</option> option uses this
56372 mechanism to count the number of different recipients that the client has
56373 sent messages to in the last time period; it is equivalent to
56374 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
56375 measure the rate that a client uses different sender addresses with the
56376 options <literal>per_mail/unique=$sender_address</literal>.
56377 </para>
56378 <para>
56379 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
56380 has seen for that key. The whole set is thrown away when it is older than the
56381 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
56382 per period. In the <option>leaky</option> update mode, an event that causes the client to
56383 go over the limit is not added to the set, in the same way that the client&#x2019;s
56384 recorded rate is not updated in the same situation.
56385 </para>
56386 <para>
56387 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
56388 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
56389 rate.
56390 </para>
56391 <para>
56392 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
56393 other <option>ratelimit</option> options in order to store the event set. The number of
56394 unique values is potentially as large as the rate limit, so the extra space
56395 required increases with larger limits.
56396 </para>
56397 <para>
56398 The uniqueification is not perfect: there is a small probability that Exim
56399 will think a new event has happened before. If the sender&#x2019;s rate is less than
56400 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
56401 the measured rate can go above the limit, in which case Exim may under-count
56402 events by a significant margin. Fortunately, if the rate is high enough (2.7
56403 times the limit) that the false positive rate goes above 9%, then Exim will
56404 throw away the over-full event set before the measured rate falls below the
56405 limit. Therefore the only harm should be that exceptionally high sending rates
56406 are logged incorrectly; any countermeasures you configure will be as effective
56407 as intended.
56408 </para>
56409 </section>
56410 <section id="useratlim">
56411 <title>Using rate limiting</title>
56412 <para>
56413 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
56414 when the rate limit is exceeded. This might be anything from logging a warning
56415 (for example, while measuring existing sending rates in order to define
56416 policy), through time delays to slow down fast senders, up to rejecting the
56417 message. For example:
56418 </para>
56419 <literallayout class="monospaced">
56420 # Log all senders' rates
56421 warn ratelimit = 0 / 1h / strict
56422      log_message = Sender rate $sender_rate / $sender_rate_period
56423
56424 # Slow down fast senders; note the need to truncate $sender_rate
56425 # at the decimal point.
56426 warn ratelimit = 100 / 1h / per_rcpt / strict
56427      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
56428                    $sender_rate_limit }s
56429
56430 # Keep authenticated users under control
56431 deny authenticated = *
56432      ratelimit = 100 / 1d / strict / $authenticated_id
56433
56434 # System-wide rate limit
56435 defer message = Sorry, too busy. Try again later.
56436      ratelimit = 10 / 1s / $primary_hostname
56437
56438 # Restrict incoming rate from each host, with a default
56439 # set using a macro and special cases looked up in a table.
56440 defer message = Sender rate exceeds $sender_rate_limit \
56441                messages per $sender_rate_period
56442      ratelimit = ${lookup {$sender_host_address} \
56443                    cdb {DB/ratelimits.cdb} \
56444                    {$value} {RATELIMIT} }
56445 </literallayout>
56446 <para>
56447 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
56448 especially with the <option>per_rcpt</option> option, you may suffer from a performance
56449 bottleneck caused by locking on the ratelimit hints database. Apart from
56450 making your ACLs less complicated, you can reduce the problem by using a
56451 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
56452 this means that Exim will lose its hints data after a reboot (including retry
56453 hints, the callout cache, and ratelimit data).
56454 </para>
56455 </section>
56456 <section id="SECTaddressverification">
56457 <title>Address verification</title>
56458 <para>
56459 <indexterm role="concept">
56460 <primary>verifying address</primary>
56461 <secondary>options for</secondary>
56462 </indexterm>
56463 <indexterm role="concept">
56464 <primary>policy control</primary>
56465 <secondary>address verification</secondary>
56466 </indexterm>
56467 Several of the <option>verify</option> conditions described in section
56468 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
56469 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
56470 The verification conditions can be followed by options that modify the
56471 verification process. The options are separated from the keyword and from each
56472 other by slashes, and some of them contain parameters. For example:
56473 </para>
56474 <literallayout class="monospaced">
56475 verify = sender/callout
56476 verify = recipient/defer_ok/callout=10s,defer_ok
56477 </literallayout>
56478 <para>
56479 The first stage of address verification, which always happens, is to run the
56480 address through the routers, in <quote>verify mode</quote>. Routers can detect the
56481 difference between verification and routing for delivery, and their actions can
56482 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
56483 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
56484 The available options are as follows:
56485 </para>
56486 <itemizedlist>
56487 <listitem>
56488 <para>
56489 If the <option>callout</option> option is specified, successful routing to one or more
56490 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
56491 check. Callouts and their sub-options are discussed in the next section.
56492 </para>
56493 </listitem>
56494 <listitem>
56495 <para>
56496 If there is a defer error while doing verification routing, the ACL
56497 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
56498 options, the condition is forced to be true instead. Note that this is a main
56499 verification option as well as a suboption for callouts.
56500 </para>
56501 </listitem>
56502 <listitem>
56503 <para>
56504 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
56505 discusses the reporting of sender address verification failures.
56506 </para>
56507 </listitem>
56508 <listitem>
56509 <para>
56510 The <option>success_on_redirect</option> option causes verification always to succeed
56511 immediately after a successful redirection. By default, if a redirection
56512 generates just one address, that address is also verified. See further
56513 discussion in section <xref linkend="SECTredirwhilveri"/>.
56514 </para>
56515 </listitem>
56516 </itemizedlist>
56517 <para>
56518 <indexterm role="concept">
56519 <primary>verifying address</primary>
56520 <secondary>differentiating failures</secondary>
56521 </indexterm>
56522 <indexterm role="variable">
56523 <primary><varname>$recipient_verify_failure</varname></primary>
56524 </indexterm>
56525 <indexterm role="variable">
56526 <primary><varname>$sender_verify_failure</varname></primary>
56527 </indexterm>
56528 <indexterm role="variable">
56529 <primary><varname>$acl_verify_message</varname></primary>
56530 </indexterm>
56531 After an address verification failure, <varname>$acl_verify_message</varname> contains the
56532 error message that is associated with the failure. It can be preserved by
56533 coding like this:
56534 </para>
56535 <literallayout class="monospaced">
56536 warn  !verify = sender
56537        set acl_m0 = $acl_verify_message
56538 </literallayout>
56539 <para>
56540 If you are writing your own custom rejection message or log message when
56541 denying access, you can use this variable to include information about the
56542 verification failure.
56543 </para>
56544 <para>
56545 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
56546 appropriate) contains one of the following words:
56547 </para>
56548 <itemizedlist>
56549 <listitem>
56550 <para>
56551 <option>qualify</option>: The address was unqualified (no domain), and the message
56552 was neither local nor came from an exempted host.
56553 </para>
56554 </listitem>
56555 <listitem>
56556 <para>
56557 <option>route</option>: Routing failed.
56558 </para>
56559 </listitem>
56560 <listitem>
56561 <para>
56562 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
56563 occurred at or before the MAIL command (that is, on initial
56564 connection, HELO, or MAIL).
56565 </para>
56566 </listitem>
56567 <listitem>
56568 <para>
56569 <option>recipient</option>: The RCPT command in a callout was rejected.
56570 </para>
56571 </listitem>
56572 <listitem>
56573 <para>
56574 <option>postmaster</option>: The postmaster check in a callout was rejected.
56575 </para>
56576 </listitem>
56577 </itemizedlist>
56578 <para>
56579 The main use of these variables is expected to be to distinguish between
56580 rejections of MAIL and rejections of RCPT in callouts.
56581 </para>
56582 </section>
56583 <section id="SECTcallver">
56584 <title>Callout verification</title>
56585 <para>
56586 <indexterm role="concept">
56587 <primary>verifying address</primary>
56588 <secondary>by callout</secondary>
56589 </indexterm>
56590 <indexterm role="concept">
56591 <primary>callout</primary>
56592 <secondary>verification</secondary>
56593 </indexterm>
56594 <indexterm role="concept">
56595 <primary>SMTP</primary>
56596 <secondary>callout verification</secondary>
56597 </indexterm>
56598 For non-local addresses, routing verifies the domain, but is unable to do any
56599 checking of the local part. There are situations where some means of verifying
56600 the local part is desirable. One way this can be done is to make an SMTP
56601 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
56602 a subsequent host for a recipient address, to see if the host accepts the
56603 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
56604 sender address, the callback is not to the client host that is trying to
56605 deliver the message, but to one of the hosts that accepts incoming mail for the
56606 sender&#x2019;s domain.
56607 </para>
56608 <para>
56609 Exim does not do callouts by default. If you want them to happen, you must
56610 request them by setting appropriate options on the <option>verify</option> condition, as
56611 described below. This facility should be used with care, because it can add a
56612 lot of resource usage to the cost of verifying an address. However, Exim does
56613 cache the results of callouts, which helps to reduce the cost. Details of
56614 caching are in section <xref linkend="SECTcallvercache"/>.
56615 </para>
56616 <para>
56617 Recipient callouts are usually used only between hosts that are controlled by
56618 the same administration. For example, a corporate gateway host could use
56619 callouts to check for valid recipients on an internal mailserver. A successful
56620 callout does not guarantee that a real delivery to the address would succeed;
56621 on the other hand, a failing callout does guarantee that a delivery would fail.
56622 </para>
56623 <para>
56624 If the <option>callout</option> option is present on a condition that verifies an address, a
56625 second stage of verification occurs if the address is successfully routed to
56626 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
56627 <command>manualroute</command> router, where the router specifies the hosts. However, if a
56628 router that does not set up hosts routes to an <command>smtp</command> transport with a
56629 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
56630 <option>hosts_override</option> set, its hosts are always used, whether or not the router
56631 supplies a host list.
56632 Callouts are only supported on <command>smtp</command> transports.
56633 </para>
56634 <para>
56635 The port that is used is taken from the transport, if it is specified and is a
56636 remote transport. (For routers that do verification only, no transport need be
56637 specified.) Otherwise, the default SMTP port is used. If a remote transport
56638 specifies an outgoing interface, this is used; otherwise the interface is not
56639 specified. Likewise, the text that is used for the HELO command is taken from
56640 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
56641 <varname>$smtp_active_hostname</varname> is used.
56642 </para>
56643 <para>
56644 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
56645 test whether a bounce message could be delivered to the sender address. The
56646 following SMTP commands are sent:
56647 </para>
56648 <literallayout>
56649 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
56650 <literal>MAIL FROM:&lt;&gt;</literal>
56651 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
56652 <literal>QUIT</literal>
56653 </literallayout>
56654 <para>
56655 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
56656 set to <quote>lmtp</quote>.
56657 </para>
56658 <para>
56659 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
56660 settings.
56661 </para>
56662 <para>
56663 A recipient callout check is similar. By default, it also uses an empty address
56664 for the sender. This default is chosen because most hosts do not make use of
56665 the sender address when verifying a recipient. Using the same address means
56666 that a single cache entry can be used for each recipient. Some sites, however,
56667 do make use of the sender address when verifying. These are catered for by the
56668 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
56669 </para>
56670 <para>
56671 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
56672 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
56673 Exim tries the next host, if any. If there is a problem with all the remote
56674 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
56675 <option>callout</option> option is given, in which case the condition is forced to succeed.
56676 </para>
56677 <para>
56678 <indexterm role="concept">
56679 <primary>SMTP</primary>
56680 <secondary>output flushing, disabling for callout</secondary>
56681 </indexterm>
56682 A callout may take a little time. For this reason, Exim normally flushes SMTP
56683 output before performing a callout in an ACL, to avoid unexpected timeouts in
56684 clients when the SMTP PIPELINING extension is in use. The flushing can be
56685 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
56686 </para>
56687 </section>
56688 <section id="CALLaddparcall">
56689 <title>Additional parameters for callouts</title>
56690 <para>
56691 <indexterm role="concept">
56692 <primary>callout</primary>
56693 <secondary>additional parameters for</secondary>
56694 </indexterm>
56695 The <option>callout</option> option can be followed by an equals sign and a number of
56696 optional parameters, separated by commas. For example:
56697 </para>
56698 <literallayout class="monospaced">
56699 verify = recipient/callout=10s,defer_ok
56700 </literallayout>
56701 <para>
56702 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
56703 separate verify options, is retained for backwards compatibility, but is now
56704 deprecated. The additional parameters for <option>callout</option> are as follows:
56705 </para>
56706 <variablelist>
56707 <varlistentry>
56708 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
56709 <listitem>
56710 <para>
56711 <indexterm role="concept">
56712 <primary>callout</primary>
56713 <secondary>timeout, specifying</secondary>
56714 </indexterm>
56715 This specifies the timeout that applies for the callout attempt to each host.
56716 For example:
56717 </para>
56718 <literallayout class="monospaced">
56719 verify = sender/callout=5s
56720 </literallayout>
56721 <para>
56722 The default is 30 seconds. The timeout is used for each response from the
56723 remote host. It is also used for the initial connection, unless overridden by
56724 the <option>connect</option> parameter.
56725 </para>
56726 </listitem></varlistentry>
56727 <varlistentry>
56728 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
56729 <listitem>
56730 <para>
56731 <indexterm role="concept">
56732 <primary>callout</primary>
56733 <secondary>connection timeout, specifying</secondary>
56734 </indexterm>
56735 This parameter makes it possible to set a different (usually smaller) timeout
56736 for making the SMTP connection. For example:
56737 </para>
56738 <literallayout class="monospaced">
56739 verify = sender/callout=5s,connect=1s
56740 </literallayout>
56741 <para>
56742 If not specified, this timeout defaults to the general timeout value.
56743 </para>
56744 </listitem></varlistentry>
56745 <varlistentry>
56746 <term><emphasis role="bold">defer_ok</emphasis></term>
56747 <listitem>
56748 <para>
56749 <indexterm role="concept">
56750 <primary>callout</primary>
56751 <secondary>defer, action on</secondary>
56752 </indexterm>
56753 When this parameter is present, failure to contact any host, or any other kind
56754 of temporary error, is treated as success by the ACL. However, the cache is not
56755 updated in this circumstance.
56756 </para>
56757 </listitem></varlistentry>
56758 <varlistentry>
56759 <term><emphasis role="bold">fullpostmaster</emphasis></term>
56760 <listitem>
56761 <para>
56762 <indexterm role="concept">
56763 <primary>callout</primary>
56764 <secondary>full postmaster check</secondary>
56765 </indexterm>
56766 This operates like the <option>postmaster</option> option (see below), but if the check for
56767 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
56768 accordance with the specification in RFC 2821. The RFC states that the
56769 unqualified address <emphasis>postmaster</emphasis> should be accepted.
56770 </para>
56771 </listitem></varlistentry>
56772 <varlistentry>
56773 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
56774 <listitem>
56775 <para>
56776 <indexterm role="concept">
56777 <primary>callout</primary>
56778 <secondary>sender when verifying header</secondary>
56779 </indexterm>
56780 When verifying addresses in header lines using the <option>header_sender</option>
56781 verification option, Exim behaves by default as if the addresses are envelope
56782 sender addresses from a message. Callout verification therefore tests to see
56783 whether a bounce message could be delivered, by using an empty address in the
56784 MAIL command. However, it is arguable that these addresses might never be used
56785 as envelope senders, and could therefore justifiably reject bounce messages
56786 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
56787 address to use in the MAIL command. For example:
56788 </para>
56789 <literallayout class="monospaced">
56790 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
56791 </literallayout>
56792 <para>
56793 This parameter is available only for the <option>header_sender</option> verification option.
56794 </para>
56795 </listitem></varlistentry>
56796 <varlistentry>
56797 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
56798 <listitem>
56799 <para>
56800 <indexterm role="concept">
56801 <primary>callout</primary>
56802 <secondary>overall timeout, specifying</secondary>
56803 </indexterm>
56804 This parameter sets an overall timeout for performing a callout verification.
56805 For example:
56806 </para>
56807 <literallayout class="monospaced">
56808 verify = sender/callout=5s,maxwait=30s
56809 </literallayout>
56810 <para>
56811 This timeout defaults to four times the callout timeout for individual SMTP
56812 commands. The overall timeout applies when there is more than one host that can
56813 be tried. The timeout is checked before trying the next host. This prevents
56814 very long delays if there are a large number of hosts and all are timing out
56815 (for example, when network connections are timing out).
56816 </para>
56817 </listitem></varlistentry>
56818 <varlistentry>
56819 <term><emphasis role="bold">no_cache</emphasis></term>
56820 <listitem>
56821 <para>
56822 <indexterm role="concept">
56823 <primary>callout</primary>
56824 <secondary>cache, suppressing</secondary>
56825 </indexterm>
56826 <indexterm role="concept">
56827 <primary>caching callout, suppressing</primary>
56828 </indexterm>
56829 When this parameter is given, the callout cache is neither read nor updated.
56830 </para>
56831 </listitem></varlistentry>
56832 <varlistentry>
56833 <term><emphasis role="bold">postmaster</emphasis></term>
56834 <listitem>
56835 <para>
56836 <indexterm role="concept">
56837 <primary>callout</primary>
56838 <secondary>postmaster; checking</secondary>
56839 </indexterm>
56840 When this parameter is set, a successful callout check is followed by a similar
56841 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
56842 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
56843 the postmaster check is recorded in a cache record; if it is a failure, this is
56844 used to fail subsequent callouts for the domain without a connection being
56845 made, until the cache record expires.
56846 </para>
56847 </listitem></varlistentry>
56848 <varlistentry>
56849 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
56850 <listitem>
56851 <para>
56852 The postmaster check uses an empty sender in the MAIL command by default.
56853 You can use this parameter to do a postmaster check using a different address.
56854 For example:
56855 </para>
56856 <literallayout class="monospaced">
56857 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
56858 </literallayout>
56859 <para>
56860 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
56861 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
56862 </para>
56863 <literallayout class="monospaced">
56864 require  verify = sender/callout=postmaster_mailfrom=
56865 </literallayout>
56866 <para>
56867 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
56868 account of the sender address. It is assumed that either the empty address or
56869 a fixed non-empty address will be used. All that Exim remembers is that the
56870 postmaster check for the domain succeeded or failed.
56871 </para>
56872 </listitem></varlistentry>
56873 <varlistentry>
56874 <term><emphasis role="bold">random</emphasis></term>
56875 <listitem>
56876 <para>
56877 <indexterm role="concept">
56878 <primary>callout</primary>
56879 <secondary><quote>random</quote> check</secondary>
56880 </indexterm>
56881 When this parameter is set, before doing the normal callout check, Exim does a
56882 check for a <quote>random</quote> local part at the same domain. The local part is not
56883 really random &ndash; it is defined by the expansion of the option
56884 <option>callout_random_local_part</option>, which defaults to
56885 </para>
56886 <literallayout class="monospaced">
56887 $primary_hostname-$tod_epoch-testing
56888 </literallayout>
56889 <para>
56890 The idea here is to try to determine whether the remote host accepts all local
56891 parts without checking. If it does, there is no point in doing callouts for
56892 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
56893 a cache record, and used to force the current and subsequent callout checks to
56894 succeed without a connection being made, until the cache record expires.
56895 </para>
56896 </listitem></varlistentry>
56897 <varlistentry>
56898 <term><emphasis role="bold">use_postmaster</emphasis></term>
56899 <listitem>
56900 <para>
56901 <indexterm role="concept">
56902 <primary>callout</primary>
56903 <secondary>sender for recipient check</secondary>
56904 </indexterm>
56905 This parameter applies to recipient callouts only. For example:
56906 </para>
56907 <literallayout class="monospaced">
56908 deny  !verify = recipient/callout=use_postmaster
56909 </literallayout>
56910 <para>
56911 <indexterm role="variable">
56912 <primary><varname>$qualify_domain</varname></primary>
56913 </indexterm>
56914 It causes a non-empty postmaster address to be used in the MAIL command when
56915 performing the callout for the recipient, and also for a <quote>random</quote> check if
56916 that is configured. The local part of the address is <literal>postmaster</literal> and the
56917 domain is the contents of <varname>$qualify_domain</varname>.
56918 </para>
56919 </listitem></varlistentry>
56920 <varlistentry>
56921 <term><emphasis role="bold">use_sender</emphasis></term>
56922 <listitem>
56923 <para>
56924 This option applies to recipient callouts only. For example:
56925 </para>
56926 <literallayout class="monospaced">
56927 require  verify = recipient/callout=use_sender
56928 </literallayout>
56929 <para>
56930 It causes the message&#x2019;s actual sender address to be used in the MAIL
56931 command when performing the callout, instead of an empty address. There is no
56932 need to use this option unless you know that the called hosts make use of the
56933 sender when checking recipients. If used indiscriminately, it reduces the
56934 usefulness of callout caching.
56935 </para>
56936 </listitem></varlistentry>
56937 </variablelist>
56938 <para>
56939 If you use any of the parameters that set a non-empty sender for the MAIL
56940 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
56941 <option>use_sender</option>), you should think about possible loops. Recipient checking is
56942 usually done between two hosts that are under the same management, and the host
56943 that receives the callouts is not normally configured to do callouts itself.
56944 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
56945 these circumstances.
56946 </para>
56947 <para>
56948 However, if you use a non-empty sender address for a callout to an arbitrary
56949 host, there is the likelihood that the remote host will itself initiate a
56950 callout check back to your host. As it is checking what appears to be a message
56951 sender, it is likely to use an empty address in MAIL, thus avoiding a
56952 callout loop. However, to be on the safe side it would be best to set up your
56953 own ACLs so that they do not do sender verification checks when the recipient
56954 is the address you use for header sender or postmaster callout checking.
56955 </para>
56956 <para>
56957 Another issue to think about when using non-empty senders for callouts is
56958 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
56959 by the sender/recipient combination; thus, for any given recipient, many more
56960 actual callouts are performed than when an empty sender or postmaster is used.
56961 </para>
56962 </section>
56963 <section id="SECTcallvercache">
56964 <title>Callout caching</title>
56965 <para>
56966 <indexterm role="concept">
56967 <primary>hints database</primary>
56968 <secondary>callout cache</secondary>
56969 </indexterm>
56970 <indexterm role="concept">
56971 <primary>callout</primary>
56972 <secondary>cache, description of</secondary>
56973 </indexterm>
56974 <indexterm role="concept">
56975 <primary>caching</primary>
56976 <secondary>callout</secondary>
56977 </indexterm>
56978 Exim caches the results of callouts in order to reduce the amount of resources
56979 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
56980 option. A hints database called <quote>callout</quote> is used for the cache. Two
56981 different record types are used: one records the result of a callout check for
56982 a specific address, and the other records information that applies to the
56983 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
56984 </para>
56985 <para>
56986 When an original callout fails, a detailed SMTP error message is given about
56987 the failure. However, for subsequent failures use the cache data, this message
56988 is not available.
56989 </para>
56990 <para>
56991 The expiry times for negative and positive address cache records are
56992 independent, and can be set by the global options <option>callout_negative_expire</option>
56993 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
56994 </para>
56995 <para>
56996 If a host gives a negative response to an SMTP connection, or rejects any
56997 commands up to and including
56998 </para>
56999 <literallayout class="monospaced">
57000 MAIL FROM:&lt;&gt;
57001 </literallayout>
57002 <para>
57003 (but not including the MAIL command with a non-empty address),
57004 any callout attempt is bound to fail. Exim remembers such failures in a
57005 domain cache record, which it uses to fail callouts for the domain without
57006 making new connections, until the domain record times out. There are two
57007 separate expiry times for domain cache records:
57008 <option>callout_domain_negative_expire</option> (default 3h) and
57009 <option>callout_domain_positive_expire</option> (default 7d).
57010 </para>
57011 <para>
57012 Domain records expire when the negative expiry time is reached if callouts
57013 cannot be made for the domain, or if the postmaster check failed.
57014 Otherwise, they expire when the positive expiry time is reached. This
57015 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
57016 will eventually be noticed.
57017 </para>
57018 <para>
57019 The callout caching mechanism is based on the domain of the address that is
57020 being tested. If the domain routes to several hosts, it is assumed that their
57021 behaviour will be the same.
57022 </para>
57023 </section>
57024 <section id="SECTsenaddver">
57025 <title>Sender address verification reporting</title>
57026 <para>
57027 <indexterm role="concept">
57028 <primary>verifying</primary>
57029 <secondary>suppressing error details</secondary>
57030 </indexterm>
57031 See section <xref linkend="SECTaddressverification"/> for a general discussion of
57032 verification. When sender verification fails in an ACL, the details of the
57033 failure are given as additional output lines before the 550 response to the
57034 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
57035 you might see:
57036 </para>
57037 <literallayout class="monospaced">
57038 MAIL FROM:&lt;xyz@abc.example&gt;
57039 250 OK
57040 RCPT TO:&lt;pqr@def.example&gt;
57041 550-Verification failed for &lt;xyz@abc.example&gt;
57042 550-Called:   192.168.34.43
57043 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
57044 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
57045 550 Sender verification failed
57046 </literallayout>
57047 <para>
57048 If more than one RCPT command fails in the same way, the details are given
57049 only for the first of them. However, some administrators do not want to send
57050 out this much information. You can suppress the details by adding
57051 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
57052 example:
57053 </para>
57054 <literallayout class="monospaced">
57055 verify = sender/no_details
57056 </literallayout>
57057 </section>
57058 <section id="SECTredirwhilveri">
57059 <title>Redirection while verifying</title>
57060 <para>
57061 <indexterm role="concept">
57062 <primary>verifying</primary>
57063 <secondary>redirection while</secondary>
57064 </indexterm>
57065 <indexterm role="concept">
57066 <primary>address redirection</primary>
57067 <secondary>while verifying</secondary>
57068 </indexterm>
57069 A dilemma arises when a local address is redirected by aliasing or forwarding
57070 during verification: should the generated addresses themselves be verified,
57071 or should the successful expansion of the original address be enough to verify
57072 it? By default, Exim takes the following pragmatic approach:
57073 </para>
57074 <itemizedlist>
57075 <listitem>
57076 <para>
57077 When an incoming address is redirected to just one child address, verification
57078 continues with the child address, and if that fails to verify, the original
57079 verification also fails.
57080 </para>
57081 </listitem>
57082 <listitem>
57083 <para>
57084 When an incoming address is redirected to more than one child address,
57085 verification does not continue. A success result is returned.
57086 </para>
57087 </listitem>
57088 </itemizedlist>
57089 <para>
57090 This seems the most reasonable behaviour for the common use of aliasing as a
57091 way of redirecting different local parts to the same mailbox. It means, for
57092 example, that a pair of alias entries of the form
57093 </para>
57094 <literallayout class="monospaced">
57095 A.Wol:   aw123
57096 aw123:   :fail: Gone away, no forwarding address
57097 </literallayout>
57098 <para>
57099 work as expected, with both local parts causing verification failure. When a
57100 redirection generates more than one address, the behaviour is more like a
57101 mailing list, where the existence of the alias itself is sufficient for
57102 verification to succeed.
57103 </para>
57104 <para>
57105 It is possible, however, to change the default behaviour so that all successful
57106 redirections count as successful verifications, however many new addresses are
57107 generated. This is specified by the <option>success_on_redirect</option> verification
57108 option. For example:
57109 </para>
57110 <literallayout class="monospaced">
57111 require verify = recipient/success_on_redirect/callout=10s
57112 </literallayout>
57113 <para>
57114 In this example, verification succeeds if a router generates a new address, and
57115 the callout does not occur, because no address was routed to a remote host.
57116 </para>
57117 <para>
57118 When verification is being tested via the <option>-bv</option> option, the treatment of
57119 redirections is as just described, unless the <option>-v</option> or any debugging option is
57120 also specified. In that case, full verification is done for every generated
57121 address and a report is output for each of them.
57122 </para>
57123 </section>
57124 <section id="SECTverifyCSA">
57125 <title>Client SMTP authorization (CSA)</title>
57126 <para>
57127 <indexterm role="concept">
57128 <primary>CSA</primary>
57129 <secondary>verifying</secondary>
57130 </indexterm>
57131 Client SMTP Authorization is a system that allows a site to advertise
57132 which machines are and are not permitted to send email. This is done by placing
57133 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
57134 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
57135 Authorization checks in Exim are performed by the ACL condition:
57136 </para>
57137 <literallayout class="monospaced">
57138 verify = csa
57139 </literallayout>
57140 <para>
57141 This fails if the client is not authorized. If there is a DNS problem, or if no
57142 valid CSA SRV record is found, or if the client is authorized, the condition
57143 succeeds. These three cases can be distinguished using the expansion variable
57144 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
57145 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
57146 be likely to cause problems for legitimate email.
57147 </para>
57148 <para>
57149 The error messages produced by the CSA code include slightly more
57150 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
57151 looking up the CSA SRV record, or problems looking up the CSA target
57152 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
57153 </para>
57154 <itemizedlist>
57155 <listitem>
57156 <para>
57157 The client&#x2019;s host name is explicitly not authorized.
57158 </para>
57159 </listitem>
57160 <listitem>
57161 <para>
57162 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
57163 </para>
57164 </listitem>
57165 <listitem>
57166 <para>
57167 The client&#x2019;s host name is authorized but it has no valid target IP addresses
57168 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
57169 </para>
57170 </listitem>
57171 <listitem>
57172 <para>
57173 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
57174 that all subdomains must be explicitly authorized.
57175 </para>
57176 </listitem>
57177 </itemizedlist>
57178 <para>
57179 The <option>csa</option> verification condition can take an argument which is the domain to
57180 use for the DNS query. The default is:
57181 </para>
57182 <literallayout class="monospaced">
57183 verify = csa/$sender_helo_name
57184 </literallayout>
57185 <para>
57186 This implementation includes an extension to CSA. If the query domain
57187 is an address literal such as [192.0.2.95], or if it is a bare IP
57188 address, Exim searches for CSA SRV records in the reverse DNS as if
57189 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
57190 meaningful to say:
57191 </para>
57192 <literallayout class="monospaced">
57193 verify = csa/$sender_host_address
57194 </literallayout>
57195 <para>
57196 In fact, this is the check that Exim performs if the client does not say HELO.
57197 This extension can be turned off by setting the main configuration option
57198 <option>dns_csa_use_reverse</option> to be false.
57199 </para>
57200 <para>
57201 If a CSA SRV record is not found for the domain itself, a search
57202 is performed through its parent domains for a record which might be
57203 making assertions about subdomains. The maximum depth of this search is limited
57204 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
57205 default. Exim does not look for CSA SRV records in a top level domain, so the
57206 default settings handle HELO domains as long as seven
57207 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
57208 of legitimate HELO domains.
57209 </para>
57210 <para>
57211 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
57212 direct SRV lookups, this is not sufficient because of the extra parent domain
57213 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
57214 addresses into lookups in the reverse DNS space. The result of a successful
57215 lookup such as:
57216 </para>
57217 <literallayout class="monospaced">
57218 ${lookup dnsdb {csa=$sender_helo_name}}
57219 </literallayout>
57220 <para>
57221 has two space-separated fields: an authorization code and a target host name.
57222 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
57223 authorization required but absent, or <quote>?</quote> for unknown.
57224 </para>
57225 </section>
57226 <section id="SECTverifyPRVS">
57227 <title>Bounce address tag validation</title>
57228 <para>
57229 <indexterm role="concept">
57230 <primary>BATV, verifying</primary>
57231 </indexterm>
57232 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
57233 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
57234 Genuine incoming bounce messages should therefore always be addressed to
57235 recipients that have a valid tag. This scheme is a way of detecting unwanted
57236 bounce messages caused by sender address forgeries (often called <quote>collateral
57237 spam</quote>), because the recipients of such messages do not include valid tags.
57238 </para>
57239 <para>
57240 There are two expansion items to help with the implementation of the BATV
57241 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
57242 the original envelope sender address by using a simple key to add a hash of the
57243 address and some time-based randomizing information. The <option>prvs</option> expansion
57244 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
57245 The syntax of these expansion items is described in section
57246 <xref linkend="SECTexpansionitems"/>.
57247 </para>
57248 <para>
57249 As an example, suppose the secret per-address keys are stored in an MySQL
57250 database. A query to look up the key for an address could be defined as a macro
57251 like this:
57252 </para>
57253 <literallayout class="monospaced">
57254 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
57255                 WHERE sender='${quote_mysql:$prvscheck_address}'\
57256                 }{$value}}
57257 </literallayout>
57258 <para>
57259 Suppose also that the senders who make use of BATV are defined by an address
57260 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
57261 use this:
57262 </para>
57263 <literallayout class="monospaced">
57264 # Bounces: drop unsigned addresses for BATV senders
57265 deny message = This address does not send an unsigned reverse path
57266      senders = :
57267      recipients = +batv_senders
57268
57269 # Bounces: In case of prvs-signed address, check signature.
57270 deny message = Invalid reverse path signature.
57271      senders = :
57272      condition  = ${prvscheck {$local_part@$domain}\
57273                   {PRVSCHECK_SQL}{1}}
57274      !condition = $prvscheck_result
57275 </literallayout>
57276 <para>
57277 The first statement rejects recipients for bounce messages that are addressed
57278 to plain BATV sender addresses, because it is known that BATV senders do not
57279 send out messages with plain sender addresses. The second statement rejects
57280 recipients that are prvs-signed, but with invalid signatures (either because
57281 the key is wrong, or the signature has timed out).
57282 </para>
57283 <para>
57284 A non-prvs-signed address is not rejected by the second statement, because the
57285 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
57286 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
57287 the first argument is a syntactically valid prvs-signed address, the yield is
57288 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
57289 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
57290 of the checks (empty for failure, <quote>1</quote> for success).
57291 </para>
57292 <para>
57293 There is one more issue you must consider when implementing prvs-signing:
57294 you have to ensure that the routers accept prvs-signed addresses and
57295 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
57296 router to remove the signature with a configuration along these lines:
57297 </para>
57298 <literallayout class="monospaced">
57299 batv_redirect:
57300   driver = redirect
57301   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
57302 </literallayout>
57303 <para>
57304 This works because, if the third argument of <option>prvscheck</option> is empty, the result
57305 of the expansion of a prvs-signed address is the decoded value of the original
57306 address. This router should probably be the first of your routers that handles
57307 local addresses.
57308 </para>
57309 <para>
57310 To create BATV-signed addresses in the first place, a transport of this form
57311 can be used:
57312 </para>
57313 <literallayout class="monospaced">
57314 external_smtp_batv:
57315   driver = smtp
57316   return_path = ${prvs {$return_path} \
57317                        {${lookup mysql{SELECT \
57318                        secret FROM batv_prvs WHERE \
57319                        sender='${quote_mysql:$sender_address}'} \
57320                        {$value}fail}}}
57321 </literallayout>
57322 <para>
57323 If no key can be found for the existing return path, no signing takes place.
57324 </para>
57325 </section>
57326 <section id="SECTrelaycontrol">
57327 <title>Using an ACL to control relaying</title>
57328 <para>
57329 <indexterm role="concept">
57330 <primary>access control lists (ACLs)</primary>
57331 <secondary>relay control</secondary>
57332 </indexterm>
57333 <indexterm role="concept">
57334 <primary>relaying</primary>
57335 <secondary>control by ACL</secondary>
57336 </indexterm>
57337 <indexterm role="concept">
57338 <primary>policy control</primary>
57339 <secondary>relay control</secondary>
57340 </indexterm>
57341 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
57342 delivers it directly to another host as a result of a remote address contained
57343 within it. Redirecting a local address via an alias or forward file and then
57344 passing the message on to another host is not relaying,
57345 <indexterm role="concept">
57346 <primary><quote>percent hack</quote></primary>
57347 </indexterm>
57348 but a redirection as a result of the <quote>percent hack</quote> is.
57349 </para>
57350 <para>
57351 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
57352 A host which is acting as a gateway or an MX backup is concerned with incoming
57353 relaying from arbitrary hosts to a specific set of domains. On the other hand,
57354 a host which is acting as a smart host for a number of clients is concerned
57355 with outgoing relaying from those clients to the Internet at large. Often the
57356 same host is fulfilling both functions,
57357 but in principle these two kinds of relaying are entirely independent. What is
57358 not wanted is the transmission of mail from arbitrary remote hosts through your
57359 system to arbitrary domains.
57360 </para>
57361 <para>
57362 You can implement relay control by means of suitable statements in the ACL that
57363 runs for each RCPT command. For convenience, it is often easiest to use
57364 Exim&#x2019;s named list facility to define the domains and hosts involved. For
57365 example, suppose you want to do the following:
57366 </para>
57367 <itemizedlist>
57368 <listitem>
57369 <para>
57370 Deliver a number of domains to mailboxes on the local host (or process them
57371 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
57372 <emphasis>my.dom2.example</emphasis>.
57373 </para>
57374 </listitem>
57375 <listitem>
57376 <para>
57377 Relay mail for a number of other domains for which you are the secondary MX.
57378 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
57379 </para>
57380 </listitem>
57381 <listitem>
57382 <para>
57383 Relay mail from the hosts on your local LAN, to whatever domains are involved.
57384 Suppose your LAN is 192.168.45.0/24.
57385 </para>
57386 </listitem>
57387 </itemizedlist>
57388 <para>
57389 In the main part of the configuration, you put the following definitions:
57390 </para>
57391 <literallayout class="monospaced">
57392 domainlist local_domains    = my.dom1.example : my.dom2.example
57393 domainlist relay_to_domains = friend1.example : friend2.example
57394 hostlist   relay_from_hosts = 192.168.45.0/24
57395 </literallayout>
57396 <para>
57397 Now you can use these definitions in the ACL that is run for every RCPT
57398 command:
57399 </para>
57400 <literallayout class="monospaced">
57401 acl_check_rcpt:
57402   accept domains = +local_domains : +relay_to_domains
57403   accept hosts   = +relay_from_hosts
57404 </literallayout>
57405 <para>
57406 The first statement accepts any RCPT command that contains an address in
57407 the local or relay domains. For any other domain, control passes to the second
57408 statement, which accepts the command only if it comes from one of the relay
57409 hosts. In practice, you will probably want to make your ACL more sophisticated
57410 than this, for example, by including sender and recipient verification. The
57411 default configuration includes a more comprehensive example, which is described
57412 in chapter <xref linkend="CHAPdefconfil"/>.
57413 </para>
57414 </section>
57415 <section id="SECTcheralcon">
57416 <title>Checking a relay configuration</title>
57417 <para>
57418 <indexterm role="concept">
57419 <primary>relaying</primary>
57420 <secondary>checking control of</secondary>
57421 </indexterm>
57422 You can check the relay characteristics of your configuration in the same way
57423 that you can test any ACL behaviour for an incoming SMTP connection, by using
57424 the <option>-bh</option> option to run a fake SMTP session with which you interact.
57425 </para>
57426 <para>
57427 For specifically testing for unwanted relaying, the host
57428 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
57429 host from the host on which Exim is running, using the normal telnet port, you
57430 will see a normal telnet connection message and then quite a long delay. Be
57431 patient. The remote host is making an SMTP connection back to your host, and
57432 trying a number of common probes to test for open relay vulnerability. The
57433 results of the tests will eventually appear on your terminal.
57434 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
57435 </para>
57436 </section>
57437 </chapter>
57438
57439 <chapter id="CHAPexiscan">
57440 <title>Content scanning at ACL time</title>
57441 <para>
57442 <indexterm role="concept" id="IIDcosca" class="startofrange">
57443 <primary>content scanning</primary>
57444 <secondary>at ACL time</secondary>
57445 </indexterm>
57446 The extension of Exim to include content scanning at ACL time, formerly known
57447 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
57448 was integrated into the main source for Exim release 4.50, and Tom continues to
57449 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
57450 specification.
57451 </para>
57452 <para>
57453 It is also possible to scan the content of messages at other times. The
57454 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
57455 scanning after all the ACLs have run. A transport filter can be used to scan
57456 messages at delivery time (see the <option>transport_filter</option> option, described in
57457 chapter <xref linkend="CHAPtransportgeneric"/>).
57458 </para>
57459 <para>
57460 If you want to include the ACL-time content-scanning features when you compile
57461 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
57462 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
57463 </para>
57464 <itemizedlist>
57465 <listitem>
57466 <para>
57467 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
57468 for all MIME parts for SMTP and non-SMTP messages, respectively.
57469 </para>
57470 </listitem>
57471 <listitem>
57472 <para>
57473 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
57474 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
57475 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
57476 </para>
57477 </listitem>
57478 <listitem>
57479 <para>
57480 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
57481 of messages, or parts of messages, for debugging purposes.
57482 </para>
57483 </listitem>
57484 <listitem>
57485 <para>
57486 Additional expansion variables that are set in the new ACL and by the new
57487 conditions.
57488 </para>
57489 </listitem>
57490 <listitem>
57491 <para>
57492 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
57493 </para>
57494 </listitem>
57495 </itemizedlist>
57496 <para>
57497 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
57498 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
57499 condition is compiled, in addition to all the other content-scanning features.
57500 </para>
57501 <para>
57502 Content-scanning is continually evolving, and new features are still being
57503 added. While such features are still unstable and liable to incompatible
57504 changes, they are made available in Exim by setting options whose names begin
57505 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
57506 this manual. You can find out about them by reading the file called
57507 <filename>doc/experimental.txt</filename>.
57508 </para>
57509 <para>
57510 All the content-scanning facilities work on a MBOX copy of the message that is
57511 temporarily created in a file called:
57512 </para>
57513 <literallayout>
57514 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
57515 </literallayout>
57516 <para>
57517 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
57518 expect an MBOX-like structure inside that file. The file is created when the
57519 first content scanning facility is called. Subsequent calls to content
57520 scanning conditions open the same file again. The directory is recursively
57521 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
57522 </para>
57523 <literallayout class="monospaced">
57524 control = no_mbox_unspool
57525 </literallayout>
57526 <para>
57527 has been encountered. When the MIME ACL decodes files, they are put into the
57528 same directory by default.
57529 </para>
57530 <section id="SECTscanvirus">
57531 <title>Scanning for viruses</title>
57532 <para>
57533 <indexterm role="concept">
57534 <primary>virus scanning</primary>
57535 </indexterm>
57536 <indexterm role="concept">
57537 <primary>content scanning</primary>
57538 <secondary>for viruses</secondary>
57539 </indexterm>
57540 <indexterm role="concept">
57541 <primary>content scanning</primary>
57542 <secondary>the <option>malware</option> condition</secondary>
57543 </indexterm>
57544 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
57545 It supports a <quote>generic</quote> interface to scanners called via the shell, and
57546 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
57547 in memory and thus are much faster.
57548 </para>
57549 <para revisionflag="changed">
57550 A timeout of 2 minutes is applied to a scanner call (by default);
57551 if it expires then a defer action is taken.
57552 </para>
57553 <para>
57554 <indexterm role="option">
57555 <primary><option>av_scanner</option></primary>
57556 </indexterm>
57557 You can set the <option>av_scanner</option> option in the main part of the configuration
57558 to specify which scanner to use, together with any additional options that
57559 are needed. The basic syntax is as follows:
57560 </para>
57561 <literallayout>
57562 <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>
57563 </literallayout>
57564 <para>
57565 If you do not set <option>av_scanner</option>, it defaults to
57566 </para>
57567 <literallayout class="monospaced">
57568 av_scanner = sophie:/var/run/sophie
57569 </literallayout>
57570 <para>
57571 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
57572 before use.
57573 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
57574 The following scanner types are supported in this release:
57575 </para>
57576 <variablelist>
57577 <varlistentry revisionflag="changed">
57578 <term><option>avast</option></term>
57579 <listitem>
57580 <para revisionflag="changed">
57581 <indexterm role="concept">
57582 <primary>virus scanners</primary>
57583 <secondary>avast</secondary>
57584 </indexterm>
57585 This is the scanner daemon of Avast. It has been tested with Avast Core
57586 Security (currently at version 1.1.7).
57587 You can get a trial version at <emphasis role="bold"><ulink url="http://www.avast.com">http://www.avast.com</ulink></emphasis> or for Linux
57588 at <emphasis role="bold"><ulink url="http://www.avast.com/linux-server-antivirus">http://www.avast.com/linux-server-antivirus</ulink></emphasis>.
57589 This scanner type takes one option,
57590 which can be either a full path to a UNIX socket,
57591 or host and port specifiers separated by white space.
57592 The host may be a name or an IP address; the port is either a
57593 single number or a pair of numbers with a dash between.
57594 Any further options are given, on separate lines,
57595 to the daemon as options before the main scan command.
57596 For example:
57597 </para>
57598 <literallayout class="monospaced" revisionflag="changed">
57599 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
57600 av_scanner = avast:192.168.2.22 5036
57601 </literallayout>
57602 <para revisionflag="changed">
57603 If you omit the argument, the default path
57604 <filename>/var/run/avast/scan.sock</filename>
57605 is used.
57606 If you use a remote host,
57607 you need to make Exim&#x2019;s spool directory available to it,
57608 as the scanner is passed a file path, not file contents.
57609 For information about available commands and their options you may use
57610 </para>
57611 <literallayout class="monospaced" revisionflag="changed">
57612 $ socat UNIX:/var/run/avast/scan.sock STDIO:
57613     FLAGS
57614     SENSITIVITY
57615     PACK
57616 </literallayout>
57617 </listitem></varlistentry>
57618 <varlistentry>
57619 <term><option>aveserver</option></term>
57620 <listitem>
57621 <para>
57622 <indexterm role="concept">
57623 <primary>virus scanners</primary>
57624 <secondary>Kaspersky</secondary>
57625 </indexterm>
57626 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
57627 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
57628 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
57629 example:
57630 </para>
57631 <literallayout class="monospaced">
57632 av_scanner = aveserver:/var/run/aveserver
57633 </literallayout>
57634 </listitem></varlistentry>
57635 <varlistentry>
57636 <term><option>clamd</option></term>
57637 <listitem>
57638 <para>
57639 <indexterm role="concept">
57640 <primary>virus scanners</primary>
57641 <secondary>clamd</secondary>
57642 </indexterm>
57643 This daemon-type scanner is GPL and free. You can get it at
57644 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
57645 unpack MIME containers, so it used to be recommended to unpack MIME attachments
57646 in the MIME ACL. This is no longer believed to be necessary.
57647 </para>
57648 <para>
57649 The options are a list of server specifiers, which may be
57650 a UNIX socket specification,
57651 a TCP socket specification,
57652 or a (global) option.
57653 </para>
57654 <para>
57655 A socket specification consists of a space-separated list.
57656 For a Unix socket the first element is a full path for the socket,
57657 for a TCP socket the first element is the IP address
57658 and the second a port number,
57659 Any further elements are per-server (non-global) options.
57660 These per-server options are supported:
57661 </para>
57662 <literallayout class="monospaced">
57663 retry=&lt;timespec&gt;  Retry on connect fail
57664 </literallayout>
57665 <para>
57666 The <literal>retry</literal> option specifies a time after which a single retry for
57667 a failed connect is made.  The default is to not retry.
57668 </para>
57669 <para>
57670 If a Unix socket file is specified, only one server is supported.
57671 </para>
57672 <para>
57673 Examples:
57674 </para>
57675 <literallayout class="monospaced">
57676 av_scanner = clamd:/opt/clamd/socket
57677 av_scanner = clamd:192.0.2.3 1234
57678 av_scanner = clamd:192.0.2.3 1234:local
57679 av_scanner = clamd:192.0.2.3 1234 retry=10s
57680 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
57681 </literallayout>
57682 <para>
57683 If the value of av_scanner points to a UNIX socket file or contains the
57684 <literal>local</literal>
57685 option, then the ClamAV interface will pass a filename containing the data
57686 to be scanned, which will should normally result in less I/O happening and be
57687 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
57688 Exim does not assume that there is a common filesystem with the remote host.
57689 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
57690 you be running a version of ClamAV prior to 0.95.
57691 </para>
57692 <para>
57693 The final example shows that multiple TCP targets can be specified.  Exim will
57694 randomly use one for each incoming email (i.e. it load balances them).  Note
57695 that only TCP targets may be used if specifying a list of scanners; a UNIX
57696 socket cannot be mixed in with TCP targets.  If one of the servers becomes
57697 unavailable, Exim will try the remaining one(s) until it finds one that works.
57698 When a clamd server becomes unreachable, Exim will log a message.  Exim does
57699 not keep track of scanner state between multiple messages, and the scanner
57700 selection is random, so the message will get logged in the mainlog for each
57701 email that the down scanner gets chosen first (message wrapped to be readable):
57702 </para>
57703 <literallayout class="monospaced">
57704 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
57705    clamd: connection to localhost, port 3310 failed
57706    (Connection refused)
57707 </literallayout>
57708 <para>
57709 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
57710 contributing the code for this scanner.
57711 </para>
57712 </listitem></varlistentry>
57713 <varlistentry>
57714 <term><option>cmdline</option></term>
57715 <listitem>
57716 <para>
57717 <indexterm role="concept">
57718 <primary>virus scanners</primary>
57719 <secondary>command line interface</secondary>
57720 </indexterm>
57721 This is the keyword for the generic command line scanner interface. It can be
57722 used to attach virus scanners that are invoked from the shell. This scanner
57723 type takes 3 mandatory options:
57724 </para>
57725 <orderedlist numeration="arabic">
57726 <listitem>
57727 <para>
57728 The full path and name of the scanner binary, with all command line options,
57729 and a placeholder (<literal>%s</literal>) for the directory to scan.
57730 </para>
57731 </listitem>
57732 <listitem>
57733 <para>
57734 A regular expression to match against the STDOUT and STDERR output of the
57735 virus scanner. If the expression matches, a virus was found. You must make
57736 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
57737 the <quote>trigger</quote> expression.
57738 </para>
57739 </listitem>
57740 <listitem>
57741 <para>
57742 Another regular expression, containing exactly one pair of parentheses, to
57743 match the name of the virus found in the scanners output. This is called the
57744 <quote>name</quote> expression.
57745 </para>
57746 </listitem>
57747 </orderedlist>
57748 <para>
57749 For example, Sophos Sweep reports a virus on a line like this:
57750 </para>
57751 <literallayout class="monospaced">
57752 Virus 'W32/Magistr-B' found in file ./those.bat
57753 </literallayout>
57754 <para>
57755 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
57756 name expression, we want to extract the W32/Magistr-B string, so we can match
57757 for the single quotes left and right of it. Altogether, this makes the
57758 configuration setting:
57759 </para>
57760 <literallayout class="monospaced">
57761 av_scanner = cmdline:\
57762              /path/to/sweep -ss -all -rec -archive %s:\
57763              found in file:'(.+)'
57764 </literallayout>
57765 </listitem></varlistentry>
57766 <varlistentry>
57767 <term><option>drweb</option></term>
57768 <listitem>
57769 <para>
57770 <indexterm role="concept">
57771 <primary>virus scanners</primary>
57772 <secondary>DrWeb</secondary>
57773 </indexterm>
57774 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
57775 takes one option,
57776 either a full path to a UNIX socket,
57777 or host and port specifiers separated by white space.
57778 The host may be a name or an IP address; the port is either a
57779 single number or a pair of numbers with a dash between.
57780 For example:
57781 </para>
57782 <literallayout class="monospaced">
57783 av_scanner = drweb:/var/run/drwebd.sock
57784 av_scanner = drweb:192.168.2.20 31337
57785 </literallayout>
57786 <para>
57787 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
57788 is used. Thanks to Alex Miller for contributing the code for this scanner.
57789 </para>
57790 </listitem></varlistentry>
57791 <varlistentry>
57792 <term><option>f-protd</option></term>
57793 <listitem>
57794 <para>
57795 <indexterm role="concept">
57796 <primary>virus scanners</primary>
57797 <secondary>f-protd</secondary>
57798 </indexterm>
57799 The f-protd scanner is accessed via HTTP over TCP.
57800 One argument is taken, being a space-separated hostname and port number
57801 (or port-range).
57802 For example:
57803 </para>
57804 <literallayout class="monospaced">
57805 av_scanner = f-protd:localhost 10200-10204
57806 </literallayout>
57807 <para>
57808 If you omit the argument, the default values show above are used.
57809 </para>
57810 </listitem></varlistentry>
57811 <varlistentry>
57812 <term><option>fsecure</option></term>
57813 <listitem>
57814 <para>
57815 <indexterm role="concept">
57816 <primary>virus scanners</primary>
57817 <secondary>F-Secure</secondary>
57818 </indexterm>
57819 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
57820 argument which is the path to a UNIX socket. For example:
57821 </para>
57822 <literallayout class="monospaced">
57823 av_scanner = fsecure:/path/to/.fsav
57824 </literallayout>
57825 <para>
57826 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
57827 Thelmen for contributing the code for this scanner.
57828 </para>
57829 </listitem></varlistentry>
57830 <varlistentry>
57831 <term><option>kavdaemon</option></term>
57832 <listitem>
57833 <para>
57834 <indexterm role="concept">
57835 <primary>virus scanners</primary>
57836 <secondary>Kaspersky</secondary>
57837 </indexterm>
57838 This is the scanner daemon of Kaspersky Version 4. This version of the
57839 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
57840 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
57841 For example:
57842 </para>
57843 <literallayout class="monospaced">
57844 av_scanner = kavdaemon:/opt/AVP/AvpCtl
57845 </literallayout>
57846 <para>
57847 The default path is <filename>/var/run/AvpCtl</filename>.
57848 </para>
57849 </listitem></varlistentry>
57850 <varlistentry>
57851 <term><option>mksd</option></term>
57852 <listitem>
57853 <para>
57854 <indexterm role="concept">
57855 <primary>virus scanners</primary>
57856 <secondary>mksd</secondary>
57857 </indexterm>
57858 This is a daemon type scanner that is aimed mainly at Polish users, though some
57859 parts of documentation are now available in English. You can get it at
57860 <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
57861 the maximum number of processes used simultaneously to scan the attachments,
57862 provided that the demime facility is employed and also provided that mksd has
57863 been run with at least the same number of child processes. For example:
57864 </para>
57865 <literallayout class="monospaced">
57866 av_scanner = mksd:2
57867 </literallayout>
57868 <para>
57869 You can safely omit this option (the default value is 1).
57870 </para>
57871 </listitem></varlistentry>
57872 <varlistentry>
57873 <term><option>sock</option></term>
57874 <listitem>
57875 <para>
57876 <indexterm role="concept">
57877 <primary>virus scanners</primary>
57878 <secondary>simple socket-connected</secondary>
57879 </indexterm>
57880 This is a general-purpose way of talking to simple scanner daemons
57881 running on the local machine.
57882 There are four options:
57883 an address (which may be an IP address and port, or the path of a Unix socket),
57884 a commandline to send (may include a single %s which will be replaced with
57885 the path to the mail file to be scanned),
57886 an RE to trigger on from the returned data,
57887 an RE to extract malware_name from the returned data.
57888 For example:
57889 </para>
57890 <literallayout class="monospaced">
57891 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
57892 </literallayout>
57893 <para>
57894 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
57895 Default for the commandline is <filename>%s\n</filename>.
57896 Both regular-expressions are required.
57897 </para>
57898 </listitem></varlistentry>
57899 <varlistentry>
57900 <term><option>sophie</option></term>
57901 <listitem>
57902 <para>
57903 <indexterm role="concept">
57904 <primary>virus scanners</primary>
57905 <secondary>Sophos and Sophie</secondary>
57906 </indexterm>
57907 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
57908 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
57909 for this scanner type is the path to the UNIX socket that Sophie uses for
57910 client communication. For example:
57911 </para>
57912 <literallayout class="monospaced">
57913 av_scanner = sophie:/tmp/sophie
57914 </literallayout>
57915 <para>
57916 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
57917 the option.
57918 </para>
57919 </listitem></varlistentry>
57920 </variablelist>
57921 <para>
57922 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
57923 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
57924 ACL.
57925 </para>
57926 <para>
57927 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
57928 makes it possible to use different scanners. See further below for an example.
57929 The <option>malware</option> condition caches its results, so when you use it multiple times
57930 for the same message, the actual scanning process is only carried out once.
57931 However, using expandable items in <option>av_scanner</option> disables this caching, in
57932 which case each use of the <option>malware</option> condition causes a new scan of the
57933 message.
57934 </para>
57935 <para>
57936 The <option>malware</option> condition takes a right-hand argument that is expanded before
57937 </para>
57938 <para revisionflag="changed">
57939 use and taken as a list, slash-separated by default.
57940 </para>
57941 <para>
57942 The first element can then be one of
57943 </para>
57944 <itemizedlist>
57945 <listitem>
57946 <para>
57947 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
57948 The condition succeeds if a virus was found, and fail otherwise. This is the
57949 recommended usage.
57950 </para>
57951 </listitem>
57952 <listitem>
57953 <para>
57954 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
57955 the condition fails immediately.
57956 </para>
57957 </listitem>
57958 <listitem>
57959 <para>
57960 A regular expression, in which case the message is scanned for viruses. The
57961 condition succeeds if a virus is found and its name matches the regular
57962 expression. This allows you to take special actions on certain types of virus.
57963 </para>
57964 <para revisionflag="changed">
57965 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
57966 unless the separator is changed (in the usual way).
57967 </para>
57968 </listitem>
57969 </itemizedlist>
57970 <para>
57971 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
57972 messages even if there is a problem with the virus scanner.
57973 Otherwise, such a problem causes the ACL to defer.
57974 </para>
57975 <para revisionflag="changed">
57976 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
57977 specify a non-default timeout.  The default is two minutes.
57978 For example:
57979 </para>
57980 <literallayout class="monospaced" revisionflag="changed">
57981 malware = * / defer_ok / tmo=10s
57982 </literallayout>
57983 <para revisionflag="changed">
57984 A timeout causes the ACL to defer.
57985 </para>
57986 <para>
57987 <indexterm role="variable">
57988 <primary><varname>$malware_name</varname></primary>
57989 </indexterm>
57990 When a virus is found, the condition sets up an expansion variable called
57991 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
57992 <option>message</option> modifier that specifies the error returned to the sender, and/or in
57993 logging data.
57994 </para>
57995 <para>
57996 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
57997 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
57998 <option>malware</option> condition.
57999 </para>
58000 <para>
58001 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
58002 imposed by your anti-virus scanner.
58003 </para>
58004 <para>
58005 Here is a very simple scanning example:
58006 </para>
58007 <literallayout class="monospaced">
58008 deny message = This message contains malware ($malware_name)
58009      demime = *
58010      malware = *
58011 </literallayout>
58012 <para>
58013 The next example accepts messages when there is a problem with the scanner:
58014 </para>
58015 <literallayout class="monospaced">
58016 deny message = This message contains malware ($malware_name)
58017      demime = *
58018      malware = */defer_ok
58019 </literallayout>
58020 <para>
58021 The next example shows how to use an ACL variable to scan with both sophie and
58022 aveserver. It assumes you have set:
58023 </para>
58024 <literallayout class="monospaced">
58025 av_scanner = $acl_m0
58026 </literallayout>
58027 <para>
58028 in the main Exim configuration.
58029 </para>
58030 <literallayout class="monospaced">
58031 deny message = This message contains malware ($malware_name)
58032      set acl_m0 = sophie
58033      malware = *
58034
58035 deny message = This message contains malware ($malware_name)
58036      set acl_m0 = aveserver
58037      malware = *
58038 </literallayout>
58039 </section>
58040 <section id="SECTscanspamass">
58041 <title>Scanning with SpamAssassin and Rspamd</title>
58042 <para>
58043 <indexterm role="concept">
58044 <primary>content scanning</primary>
58045 <secondary>for spam</secondary>
58046 </indexterm>
58047 <indexterm role="concept">
58048 <primary>spam scanning</primary>
58049 </indexterm>
58050 <indexterm role="concept">
58051 <primary>SpamAssassin</primary>
58052 </indexterm>
58053 <indexterm role="concept">
58054 <primary>Rspamd</primary>
58055 </indexterm>
58056 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
58057 score and a report for the message.
58058 </para>
58059 <para revisionflag="changed">
58060 Support is also provided for Rspamd.
58061 </para>
58062 <para revisionflag="changed">
58063 For more information about installation and configuration of SpamAssassin or
58064 Rspamd refer to their respective websites at
58065 <emphasis role="bold"><ulink url="http://spamassassin.apache.org">http://spamassassin.apache.org</ulink></emphasis> and <emphasis role="bold"><ulink url="http://www.rspamd.com">http://www.rspamd.com</ulink></emphasis>
58066 </para>
58067 <para>
58068 SpamAssassin can be installed with CPAN by running:
58069 </para>
58070 <literallayout class="monospaced">
58071 perl -MCPAN -e 'install Mail::SpamAssassin'
58072 </literallayout>
58073 <para>
58074 SpamAssassin has its own set of configuration files. Please review its
58075 documentation to see how you can tweak it. The default installation should work
58076 nicely, however.
58077 </para>
58078 <para>
58079 <indexterm role="option">
58080 <primary><option>spamd_address</option></primary>
58081 </indexterm>
58082 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
58083 intend to use an instance running on the local host you do not need to set
58084 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
58085 you must set the <option>spamd_address</option> option in the global part of the Exim
58086 configuration as follows (example):
58087 </para>
58088 <literallayout class="monospaced">
58089 spamd_address = 192.168.99.45 387
58090 </literallayout>
58091 <para revisionflag="changed">
58092 To use Rspamd (which by default listens on all local addresses
58093 on TCP port 11333)
58094 you should add <option>variant=rspamd</option> after the address/port pair, for example:
58095 </para>
58096 <literallayout class="monospaced" revisionflag="changed">
58097 spamd_address = 127.0.0.1 11333 variant=rspamd
58098 </literallayout>
58099 <para>
58100 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
58101 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
58102 file name instead of an address/port pair:
58103 </para>
58104 <literallayout class="monospaced">
58105 spamd_address = /var/run/spamd_socket
58106 </literallayout>
58107 <para>
58108 You can have multiple <option>spamd</option> servers to improve scalability. These can
58109 reside on other hardware reachable over the network. To specify multiple
58110 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
58111 option, separated with colons (the separator can be changed in the usual way):
58112 </para>
58113 <literallayout class="monospaced">
58114 spamd_address = 192.168.2.10 783 : \
58115                 192.168.2.11 783 : \
58116                 192.168.2.12 783
58117 </literallayout>
58118 <para>
58119 Up to 32 <option>spamd</option> servers are supported.
58120 When a server fails to respond to the connection attempt, all other
58121 servers are tried until one succeeds. If no server responds, the <option>spam</option>
58122 condition defers.
58123 </para>
58124 <para revisionflag="changed">
58125 Unix and TCP socket specifications may be mixed in any order.
58126 Each element of the list is a list itself, space-separated by default
58127 and changeable in the usual way.
58128 </para>
58129 <para revisionflag="changed">
58130 For TCP socket specifications a host name or IP (v4 or v6, but
58131 subject to list-separator quoting rules) address can be used,
58132 and the port can be one or a dash-separated pair.
58133 In the latter case, the range is tried in strict order.
58134 </para>
58135 <para revisionflag="changed">
58136 Elements after the first for Unix sockets, or second for TCP socket,
58137 are options.
58138 The supported option are:
58139 </para>
58140 <literallayout class="monospaced" revisionflag="changed">
58141 pri=&lt;priority&gt;      Selection priority
58142 weight=&lt;value&gt;      Selection bias
58143 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
58144 retry=&lt;timespec&gt;    Retry on connect fail
58145 tmo=&lt;timespec&gt;      Connection time limit
58146 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
58147 </literallayout>
58148 <para revisionflag="changed">
58149 The <literal>pri</literal> option specifies a priority for the server within the list,
58150 higher values being tried first.
58151 The default priority is 1.
58152 </para>
58153 <para revisionflag="changed">
58154 The <literal>weight</literal> option specifies a selection bias.
58155 Within a priority set
58156 servers are queried in a random fashion, weighted by this value.
58157 The default value for selection bias is 1.
58158 </para>
58159 <para revisionflag="changed">
58160 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
58161 in the local time zone; each element being one or more digits.
58162 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
58163 characters, may be omitted and will be taken as zero.
58164 </para>
58165 <para revisionflag="changed">
58166 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
58167 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
58168 </para>
58169 <para revisionflag="changed">
58170 The <literal>tmo</literal> option specifies an overall timeout for communication.
58171 The default value is two minutes.
58172 </para>
58173 <para revisionflag="changed">
58174 The <literal>retry</literal> option specifies a time after which a single retry for
58175 a failed connect is made.
58176 The default is to not retry.
58177 </para>
58178 <para>
58179 The <option>spamd_address</option> variable is expanded before use if it starts with
58180 a dollar sign. In this case, the expansion may return a string that is
58181 used as the list so that multiple spamd servers can be the result of an
58182 expansion.
58183 </para>
58184 </section>
58185 <section id="SECID206">
58186 <title>Calling SpamAssassin from an Exim ACL</title>
58187 <para>
58188 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
58189 </para>
58190 <literallayout class="monospaced">
58191 deny message = This message was classified as SPAM
58192      spam = joe
58193 </literallayout>
58194 <para>
58195 The right-hand side of the <option>spam</option> condition specifies a name. This is
58196 relevant if you have set up multiple SpamAssassin profiles. If you do not want
58197 to scan using a specific profile, but rather use the SpamAssassin system-wide
58198 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
58199 </para>
58200 <para revisionflag="changed">
58201 Rspamd does not use this setting. However, you must put something on the
58202 right-hand side.
58203 </para>
58204 <para>
58205 The name allows you to use per-domain or per-user antispam profiles in
58206 principle, but this is not straightforward in practice, because a message may
58207 have multiple recipients, not necessarily all in the same domain. Because the
58208 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
58209 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
58210 are not set.
58211 </para>
58212 <para revisionflag="changed">
58213 Careful enforcement of single-recipient messages
58214 (e.g. by responding with defer in the recipient ACL for all recipients
58215 after the first),
58216 or the use of PRDR,
58217 <indexterm role="concept">
58218 <primary>PRDR</primary>
58219 <secondary>use for per-user SpamAssassin profiles</secondary>
58220 </indexterm>
58221 are needed to use this feature.
58222 </para>
58223 <para>
58224 The right-hand side of the <option>spam</option> condition is expanded before being used, so
58225 you can put lookups or conditions there. When the right-hand side evaluates to
58226 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
58227 </para>
58228 <para>
58229 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
58230 large ones may cause significant performance degradation. As most spam messages
58231 are quite small, it is recommended that you do not scan the big ones. For
58232 example:
58233 </para>
58234 <literallayout class="monospaced">
58235 deny message = This message was classified as SPAM
58236      condition = ${if &lt; {$message_size}{10K}}
58237      spam = nobody
58238 </literallayout>
58239 <para>
58240 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
58241 SpamAssassin profile has been matched or exceeded. If you want to use the
58242 <option>spam</option> condition for its side effects (see the variables below), you can make
58243 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
58244 </para>
58245 <para>
58246 <indexterm role="concept">
58247 <primary>spam scanning</primary>
58248 <secondary>returned variables</secondary>
58249 </indexterm>
58250 When the <option>spam</option> condition is run, it sets up a number of expansion
58251 variables.
58252 </para>
58253 <para revisionflag="changed">
58254 Except for <varname>$spam_report</varname>,
58255 </para>
58256 <para>
58257 these variables are saved with the received message so are
58258 available for use at delivery time.
58259 </para>
58260 <variablelist>
58261 <varlistentry>
58262 <term><varname>$spam_score</varname></term>
58263 <listitem>
58264 <para>
58265 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
58266 for inclusion in log or reject messages.
58267 </para>
58268 </listitem></varlistentry>
58269 <varlistentry>
58270 <term><varname>$spam_score_int</varname></term>
58271 <listitem>
58272 <para>
58273 The spam score of the message, multiplied by ten, as an integer value. For
58274 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
58275 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
58276 The integer value is useful for numeric comparisons in conditions.
58277 </para>
58278 </listitem></varlistentry>
58279 <varlistentry>
58280 <term><varname>$spam_bar</varname></term>
58281 <listitem>
58282 <para>
58283 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
58284 integer part of the spam score value. A spam score of 4.4 would have a
58285 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
58286 headers, since MUAs can match on such strings.
58287 </para>
58288 </listitem></varlistentry>
58289 <varlistentry>
58290 <term><varname>$spam_report</varname></term>
58291 <listitem>
58292 <para>
58293 A multiline text table, containing the full SpamAssassin report for the
58294 message. Useful for inclusion in headers or reject messages.
58295 </para>
58296 <para revisionflag="changed">
58297 This variable is only usable in a DATA-time ACL.
58298 </para>
58299 </listitem></varlistentry>
58300 <varlistentry revisionflag="changed">
58301 <term><varname>$spam_action</varname></term>
58302 <listitem>
58303 <para revisionflag="changed">
58304 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
58305 spam score versus threshold.
58306 For Rspamd, the recommended action.
58307 </para>
58308 </listitem></varlistentry>
58309 </variablelist>
58310 <para>
58311 The <option>spam</option> condition caches its results unless expansion in
58312 spamd_address was used. If you call it again with the same user name, it
58313 does not scan again, but rather returns the same values as before.
58314 </para>
58315 <para>
58316 The <option>spam</option> condition returns DEFER if there is any error while running
58317 the message through SpamAssassin or if the expansion of spamd_address
58318 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
58319 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
58320 spam condition, like this:
58321 </para>
58322 <literallayout class="monospaced">
58323 deny message = This message was classified as SPAM
58324      spam    = joe/defer_ok
58325 </literallayout>
58326 <para>
58327 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
58328 </para>
58329 <para>
58330 Here is a longer, commented example of the use of the <option>spam</option>
58331 condition:
58332 </para>
58333 <literallayout class="monospaced">
58334 # put headers in all messages (no matter if spam or not)
58335 warn  spam = nobody:true
58336       add_header = X-Spam-Score: $spam_score ($spam_bar)
58337       add_header = X-Spam-Report: $spam_report
58338
58339 # add second subject line with *SPAM* marker when message
58340 # is over threshold
58341 warn  spam = nobody
58342       add_header = Subject: *SPAM* $h_Subject:
58343
58344 # reject spam at high scores (&gt; 12)
58345 deny  message = This message scored $spam_score spam points.
58346       spam = nobody:true
58347       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
58348 </literallayout>
58349 </section>
58350 <section id="SECTscanmimepart">
58351 <title>Scanning MIME parts</title>
58352 <para>
58353 <indexterm role="concept">
58354 <primary>content scanning</primary>
58355 <secondary>MIME parts</secondary>
58356 </indexterm>
58357 <indexterm role="concept">
58358 <primary>MIME content scanning</primary>
58359 </indexterm>
58360 <indexterm role="option">
58361 <primary><option>acl_smtp_mime</option></primary>
58362 </indexterm>
58363 <indexterm role="option">
58364 <primary><option>acl_not_smtp_mime</option></primary>
58365 </indexterm>
58366 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
58367 each MIME part of an SMTP message, including multipart types, in the sequence
58368 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
58369 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
58370 options may both refer to the same ACL if you want the same processing in both
58371 cases.
58372 </para>
58373 <para>
58374 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
58375 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
58376 the case of a non-SMTP message. However, a MIME ACL is called only if the
58377 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
58378 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
58379 result code is sent to the client. In the case of an SMTP message, the
58380 <option>acl_smtp_data</option> ACL is not called when this happens.
58381 </para>
58382 <para>
58383 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
58384 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
58385 condition to match against the raw MIME part. You can also use the
58386 <option>mime_regex</option> condition to match against the decoded MIME part (see section
58387 <xref linkend="SECTscanregex"/>).
58388 </para>
58389 <para>
58390 At the start of a MIME ACL, a number of variables are set from the header
58391 information for the relevant MIME part. These are described below. The contents
58392 of the MIME part are not by default decoded into a disk file except for MIME
58393 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
58394 part into a disk file, you can use the <option>decode</option> condition. The general
58395 syntax is:
58396 </para>
58397 <literallayout>
58398 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
58399 </literallayout>
58400 <para>
58401 The right hand side is expanded before use. After expansion,
58402 the value can be:
58403 </para>
58404 <orderedlist numeration="arabic">
58405 <listitem>
58406 <para>
58407 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
58408 </para>
58409 </listitem>
58410 <listitem>
58411 <para>
58412 The string <quote>default</quote>. In that case, the file is put in the temporary
58413 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
58414 a sequential file name consisting of the message id and a sequence number. The
58415 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
58416 </para>
58417 </listitem>
58418 <listitem>
58419 <para>
58420 A full path name starting with a slash. If the full name is an existing
58421 directory, it is used as a replacement for the default directory. The filename
58422 is then sequentially assigned. If the path does not exist, it is used as
58423 the full path and file name.
58424 </para>
58425 </listitem>
58426 <listitem>
58427 <para>
58428 If the string does not start with a slash, it is used as the
58429 filename, and the default path is then used.
58430 </para>
58431 </listitem>
58432 </orderedlist>
58433 <para>
58434 The <option>decode</option> condition normally succeeds. It is only false for syntax
58435 errors or unusual circumstances such as memory shortages. You can easily decode
58436 a file with its original, proposed filename using
58437 </para>
58438 <literallayout class="monospaced">
58439 decode = $mime_filename
58440 </literallayout>
58441 <para>
58442 However, you should keep in mind that <varname>$mime_filename</varname> might contain
58443 anything. If you place files outside of the default path, they are not
58444 automatically unlinked.
58445 </para>
58446 <para>
58447 For RFC822 attachments (these are messages attached to messages, with a
58448 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
58449 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
58450 variable is set (see below). Attached messages are always decoded to disk
58451 before being checked, and the files are unlinked once the check is done.
58452 </para>
58453 <para>
58454 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
58455 used to match regular expressions against raw and decoded MIME parts,
58456 respectively. They are described in section <xref linkend="SECTscanregex"/>.
58457 </para>
58458 <para>
58459 <indexterm role="concept">
58460 <primary>MIME content scanning</primary>
58461 <secondary>returned variables</secondary>
58462 </indexterm>
58463 The following list describes all expansion variables that are
58464 available in the MIME ACL:
58465 </para>
58466 <variablelist>
58467 <varlistentry>
58468 <term><varname>$mime_boundary</varname></term>
58469 <listitem>
58470 <para>
58471 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
58472 have a boundary string, which is stored in this variable. If the current part
58473 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
58474 contains the empty string.
58475 </para>
58476 </listitem></varlistentry>
58477 <varlistentry>
58478 <term><varname>$mime_charset</varname></term>
58479 <listitem>
58480 <para>
58481 This variable contains the character set identifier, if one was found in the
58482 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
58483 </para>
58484 <literallayout class="monospaced">
58485 us-ascii
58486 gb2312 (Chinese)
58487 iso-8859-1
58488 </literallayout>
58489 <para>
58490 Please note that this value is not normalized, so you should do matches
58491 case-insensitively.
58492 </para>
58493 </listitem></varlistentry>
58494 <varlistentry>
58495 <term><varname>$mime_content_description</varname></term>
58496 <listitem>
58497 <para>
58498 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
58499 header. It can contain a human-readable description of the parts content. Some
58500 implementations repeat the filename for attachments here, but they are usually
58501 only used for display purposes.
58502 </para>
58503 </listitem></varlistentry>
58504 <varlistentry>
58505 <term><varname>$mime_content_disposition</varname></term>
58506 <listitem>
58507 <para>
58508 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
58509 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
58510 </para>
58511 </listitem></varlistentry>
58512 <varlistentry>
58513 <term><varname>$mime_content_id</varname></term>
58514 <listitem>
58515 <para>
58516 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
58517 This is a unique ID that can be used to reference a part from another part.
58518 </para>
58519 </listitem></varlistentry>
58520 <varlistentry>
58521 <term><varname>$mime_content_size</varname></term>
58522 <listitem>
58523 <para>
58524 This variable is set only after the <option>decode</option> modifier (see above) has been
58525 successfully run. It contains the size of the decoded part in kilobytes. The
58526 size is always rounded up to full kilobytes, so only a completely empty part
58527 has a <varname>$mime_content_size</varname> of zero.
58528 </para>
58529 </listitem></varlistentry>
58530 <varlistentry>
58531 <term><varname>$mime_content_transfer_encoding</varname></term>
58532 <listitem>
58533 <para>
58534 This variable contains the normalized content of the
58535 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
58536 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
58537 </para>
58538 </listitem></varlistentry>
58539 <varlistentry>
58540 <term><varname>$mime_content_type</varname></term>
58541 <listitem>
58542 <para>
58543 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
58544 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
58545 are some examples of popular MIME types, as they may appear in this variable:
58546 </para>
58547 <literallayout class="monospaced">
58548 text/plain
58549 text/html
58550 application/octet-stream
58551 image/jpeg
58552 audio/midi
58553 </literallayout>
58554 <para>
58555 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
58556 empty string.
58557 </para>
58558 </listitem></varlistentry>
58559 <varlistentry>
58560 <term><varname>$mime_decoded_filename</varname></term>
58561 <listitem>
58562 <para>
58563 This variable is set only after the <option>decode</option> modifier (see above) has been
58564 successfully run. It contains the full path and file name of the file
58565 containing the decoded data.
58566 </para>
58567 </listitem></varlistentry>
58568 </variablelist>
58569 <para>
58570 <indexterm role="concept">
58571 <primary>RFC 2047</primary>
58572 </indexterm>
58573 </para>
58574 <variablelist>
58575 <varlistentry>
58576 <term><varname>$mime_filename</varname></term>
58577 <listitem>
58578 <para>
58579 This is perhaps the most important of the MIME variables. It contains a
58580 proposed filename for an attachment, if one was found in either the
58581 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
58582 RFC2047
58583 </para>
58584 <para revisionflag="changed">
58585 or RFC2231
58586 </para>
58587 <para>
58588 decoded, but no additional sanity checks are done.
58589  If no filename was
58590 found, this variable contains the empty string.
58591 </para>
58592 </listitem></varlistentry>
58593 <varlistentry>
58594 <term><varname>$mime_is_coverletter</varname></term>
58595 <listitem>
58596 <para>
58597 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
58598 attached data. It can be used to clamp down on flashy or unnecessarily encoded
58599 content in the cover letter, while not restricting attachments at all.
58600 </para>
58601 <para>
58602 The variable contains 1 (true) for a MIME part believed to be part of the
58603 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
58604 follows:
58605 </para>
58606 <orderedlist numeration="arabic">
58607 <listitem>
58608 <para>
58609 The outermost MIME part of a message is always a cover letter.
58610 </para>
58611 </listitem>
58612 <listitem>
58613 <para>
58614 If a multipart/alternative or multipart/related MIME part is a cover letter,
58615 so are all MIME subparts within that multipart.
58616 </para>
58617 </listitem>
58618 <listitem>
58619 <para>
58620 If any other multipart is a cover letter, the first subpart is a cover letter,
58621 and the rest are attachments.
58622 </para>
58623 </listitem>
58624 <listitem>
58625 <para>
58626 All parts contained within an attachment multipart are attachments.
58627 </para>
58628 </listitem>
58629 </orderedlist>
58630 <para>
58631 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
58632 alternative plain text), while allowing HTML files to be attached. HTML
58633 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
58634 </para>
58635 <literallayout class="monospaced">
58636 deny message = HTML mail is not accepted here
58637 !condition = $mime_is_rfc822
58638 condition = $mime_is_coverletter
58639 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
58640 </literallayout>
58641 </listitem></varlistentry>
58642 <varlistentry>
58643 <term><varname>$mime_is_multipart</varname></term>
58644 <listitem>
58645 <para>
58646 This variable has the value 1 (true) when the current part has the main type
58647 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
58648 Since multipart entities only serve as containers for other parts, you may not
58649 want to carry out specific actions on them.
58650 </para>
58651 </listitem></varlistentry>
58652 <varlistentry>
58653 <term><varname>$mime_is_rfc822</varname></term>
58654 <listitem>
58655 <para>
58656 This variable has the value 1 (true) if the current part is not a part of the
58657 checked message itself, but part of an attached message. Attached message
58658 decoding is fully recursive.
58659 </para>
58660 </listitem></varlistentry>
58661 <varlistentry>
58662 <term><varname>$mime_part_count</varname></term>
58663 <listitem>
58664 <para>
58665 This variable is a counter that is raised for each processed MIME part. It
58666 starts at zero for the very first part (which is usually a multipart). The
58667 counter is per-message, so it is reset when processing RFC822 attachments (see
58668 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
58669 complete, so you can use it in the DATA ACL to determine the number of MIME
58670 parts of a message. For non-MIME messages, this variable contains the value -1.
58671 </para>
58672 </listitem></varlistentry>
58673 </variablelist>
58674 </section>
58675 <section id="SECTscanregex">
58676 <title>Scanning with regular expressions</title>
58677 <para>
58678 <indexterm role="concept">
58679 <primary>content scanning</primary>
58680 <secondary>with regular expressions</secondary>
58681 </indexterm>
58682 <indexterm role="concept">
58683 <primary>regular expressions</primary>
58684 <secondary>content scanning with</secondary>
58685 </indexterm>
58686 You can specify your own custom regular expression matches on the full body of
58687 the message, or on individual MIME parts.
58688 </para>
58689 <para>
58690 The <option>regex</option> condition takes one or more regular expressions as arguments and
58691 matches them against the full message (when called in the DATA ACL) or a raw
58692 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
58693 linewise, with a maximum line length of 32K characters. That means you cannot
58694 have multiline matches with the <option>regex</option> condition.
58695 </para>
58696 <para>
58697 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
58698 to 32K of decoded content (the whole content at once, not linewise). If the
58699 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
58700 is decoded automatically when <option>mime_regex</option> is executed (using default path
58701 and filename values). If the decoded data is larger than  32K, only the first
58702 32K characters are checked.
58703 </para>
58704 <para>
58705 The regular expressions are passed as a colon-separated list. To include a
58706 literal colon, you must double it. Since the whole right-hand side string is
58707 expanded before being used, you must also escape dollar signs and backslashes
58708 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
58709 Here is a simple example that contains two regular expressions:
58710 </para>
58711 <literallayout class="monospaced">
58712 deny message = contains blacklisted regex ($regex_match_string)
58713      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
58714 </literallayout>
58715 <para>
58716 The conditions returns true if any one of the regular expressions matches. The
58717 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
58718 matching regular expression.
58719 </para>
58720 <para>
58721 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
58722 CPU-intensive.
58723 </para>
58724 </section>
58725 <section id="SECTdemimecond">
58726 <title>The demime condition</title>
58727 <para>
58728 <indexterm role="concept">
58729 <primary>content scanning</primary>
58730 <secondary>MIME checking</secondary>
58731 </indexterm>
58732 <indexterm role="concept">
58733 <primary>MIME content scanning</primary>
58734 </indexterm>
58735 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
58736 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
58737 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
58738 ACL functionality, but provides no additional facilities. Please note that this
58739 condition is deprecated and kept only for backward compatibility. You must set
58740 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
58741 use the <option>demime</option> condition.
58742 </para>
58743 <para>
58744 The <option>demime</option> condition unpacks MIME containers in the message. It detects
58745 errors in MIME containers and can match file extensions found in the message
58746 against a list. Using this facility produces files containing the unpacked MIME
58747 parts of the message in the temporary scan directory. If you do antivirus
58748 scanning, it is recommended that you use the <option>demime</option> condition before the
58749 antivirus (<option>malware</option>) condition.
58750 </para>
58751 <para>
58752 On the right-hand side of the <option>demime</option> condition you can pass a
58753 colon-separated list of file extensions that it should match against. For
58754 example:
58755 </para>
58756 <literallayout class="monospaced">
58757 deny message = Found blacklisted file attachment
58758      demime  = vbs:com:bat:pif:prf:lnk
58759 </literallayout>
58760 <para>
58761 If one of the file extensions is found, the condition is true, otherwise it is
58762 false. If there is a temporary error while demimeing (for example, <quote>disk
58763 full</quote>), the condition defers, and the message is temporarily rejected (unless
58764 the condition is on a <option>warn</option> verb).
58765 </para>
58766 <para>
58767 The right-hand side is expanded before being treated as a list, so you can have
58768 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
58769 zero (<quote>0</quote>), no demimeing is done and the condition is false.
58770 </para>
58771 <para>
58772 The <option>demime</option> condition set the following variables:
58773 </para>
58774 <variablelist>
58775 <varlistentry>
58776 <term><varname>$demime_errorlevel</varname></term>
58777 <listitem>
58778 <para>
58779 <indexterm role="variable">
58780 <primary><varname>$demime_errorlevel</varname></primary>
58781 </indexterm>
58782 When an error is detected in a MIME container, this variable contains the
58783 severity of the error, as an integer number. The higher the value, the more
58784 severe the error (the current maximum value is 3). If this variable is unset or
58785 zero, no error occurred.
58786 </para>
58787 </listitem></varlistentry>
58788 <varlistentry>
58789 <term><varname>$demime_reason</varname></term>
58790 <listitem>
58791 <para>
58792 <indexterm role="variable">
58793 <primary><varname>$demime_reason</varname></primary>
58794 </indexterm>
58795 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
58796 human-readable text string describing the MIME error that occurred.
58797 </para>
58798 </listitem></varlistentry>
58799 </variablelist>
58800 <variablelist>
58801 <varlistentry>
58802 <term><varname>$found_extension</varname></term>
58803 <listitem>
58804 <para>
58805 <indexterm role="variable">
58806 <primary><varname>$found_extension</varname></primary>
58807 </indexterm>
58808 When the <option>demime</option> condition is true, this variable contains the file
58809 extension it found.
58810 </para>
58811 </listitem></varlistentry>
58812 </variablelist>
58813 <para>
58814 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
58815 the <option>demime</option> condition, and are not changed on subsequent calls.
58816 </para>
58817 <para>
58818 If you do not want to check for file extensions, but rather use the <option>demime</option>
58819 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
58820 right-hand side value. Here is a more elaborate example of how to use this
58821 facility:
58822 </para>
58823 <literallayout class="monospaced">
58824 # Reject messages with serious MIME container errors
58825 deny  message = Found MIME error ($demime_reason).
58826       demime = *
58827       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
58828
58829 # Reject known virus spreading file extensions.
58830 # Accepting these is pretty much braindead.
58831 deny  message = contains $found_extension file (blacklisted).
58832       demime  = com:vbs:bat:pif:scr
58833
58834 # Freeze .exe and .doc files. Postmaster can
58835 # examine them and eventually thaw them.
58836 deny  log_message = Another $found_extension file.
58837       demime = exe:doc
58838       control = freeze
58839 </literallayout>
58840 <para>
58841 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
58842 </para>
58843 </section>
58844 </chapter>
58845
58846 <chapter id="CHAPlocalscan">
58847 <title>Adding a local scan function to Exim</title>
58848 <titleabbrev>Local scan function</titleabbrev>
58849 <para>
58850 <indexterm role="concept" id="IIDlosca" class="startofrange">
58851 <primary><function>local_scan()</function> function</primary>
58852 <secondary>description of</secondary>
58853 </indexterm>
58854 <indexterm role="concept">
58855 <primary>customizing</primary>
58856 <secondary>input scan using C function</secondary>
58857 </indexterm>
58858 <indexterm role="concept">
58859 <primary>policy control</primary>
58860 <secondary>by local scan function</secondary>
58861 </indexterm>
58862 In these days of email worms, viruses, and ever-increasing spam, some sites
58863 want to apply a lot of checking to messages before accepting them.
58864 </para>
58865 <para>
58866 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
58867 passing messages to external virus and spam scanning software. You can also do
58868 a certain amount in Exim itself through string expansions and the <option>condition</option>
58869 condition in the ACL that runs after the SMTP DATA command or the ACL for
58870 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
58871 </para>
58872 <para>
58873 To allow for further customization to a site&#x2019;s own requirements, there is the
58874 possibility of linking Exim with a private message scanning function, written
58875 in C. If you want to run code that is written in something other than C, you
58876 can of course use a little C stub to call it.
58877 </para>
58878 <para>
58879 The local scan function is run once for every incoming message, at the point
58880 when Exim is just about to accept the message.
58881 It can therefore be used to control non-SMTP messages from local processes as
58882 well as messages arriving via SMTP.
58883 </para>
58884 <para>
58885 Exim applies a timeout to calls of the local scan function, and there is an
58886 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
58887 Zero means <quote>no timeout</quote>.
58888 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
58889 before calling the local scan function, so that the most common types of crash
58890 are caught. If the timeout is exceeded or one of those signals is caught, the
58891 incoming message is rejected with a temporary error if it is an SMTP message.
58892 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
58893 code. The incident is logged on the main and reject logs.
58894 </para>
58895 <section id="SECID207">
58896 <title>Building Exim to use a local scan function</title>
58897 <para>
58898 <indexterm role="concept">
58899 <primary><function>local_scan()</function> function</primary>
58900 <secondary>building Exim to use</secondary>
58901 </indexterm>
58902 To make use of the local scan function feature, you must tell Exim where your
58903 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
58904 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
58905 directory, so you might set
58906 </para>
58907 <literallayout class="monospaced">
58908 LOCAL_SCAN_SOURCE=Local/local_scan.c
58909 </literallayout>
58910 <para>
58911 for example. The function must be called <function>local_scan()</function>. It is called by
58912 Exim after it has received a message, when the success return code is about to
58913 be sent. This is after all the ACLs have been run. The return code from your
58914 function controls whether the message is actually accepted or not. There is a
58915 commented template function (that just accepts the message) in the file
58916 _src/local_scan.c_.
58917 </para>
58918 <para>
58919 If you want to make use of Exim&#x2019;s run time configuration file to set options
58920 for your <function>local_scan()</function> function, you must also set
58921 </para>
58922 <literallayout class="monospaced">
58923 LOCAL_SCAN_HAS_OPTIONS=yes
58924 </literallayout>
58925 <para>
58926 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
58927 </para>
58928 </section>
58929 <section id="SECTapiforloc">
58930 <title>API for local_scan()</title>
58931 <para>
58932 <indexterm role="concept">
58933 <primary><function>local_scan()</function> function</primary>
58934 <secondary>API description</secondary>
58935 </indexterm>
58936 You must include this line near the start of your code:
58937 </para>
58938 <literallayout class="monospaced">
58939 #include "local_scan.h"
58940 </literallayout>
58941 <para>
58942 This header file defines a number of variables and other values, and the
58943 prototype for the function itself. Exim is coded to use unsigned char values
58944 almost exclusively, and one of the things this header defines is a shorthand
58945 for <literal>unsigned char</literal> called <literal>uschar</literal>.
58946 It also contains the following macro definitions, to simplify casting character
58947 strings and pointers to character strings:
58948 </para>
58949 <literallayout class="monospaced">
58950 #define CS   (char *)
58951 #define CCS  (const char *)
58952 #define CSS  (char **)
58953 #define US   (unsigned char *)
58954 #define CUS  (const unsigned char *)
58955 #define USS  (unsigned char **)
58956 </literallayout>
58957 <para>
58958 The function prototype for <function>local_scan()</function> is:
58959 </para>
58960 <literallayout class="monospaced">
58961 extern int local_scan(int fd, uschar **return_text);
58962 </literallayout>
58963 <para>
58964 The arguments are as follows:
58965 </para>
58966 <itemizedlist>
58967 <listitem>
58968 <para>
58969 <option>fd</option> is a file descriptor for the file that contains the body of the message
58970 (the -D file). The file is open for reading and writing, but updating it is not
58971 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
58972 </para>
58973 <para>
58974 The descriptor is positioned at character 19 of the file, which is the first
58975 character of the body itself, because the first 19 characters are the message
58976 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
58977 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
58978 case this changes in some future version.
58979 </para>
58980 </listitem>
58981 <listitem>
58982 <para>
58983 <option>return_text</option> is an address which you can use to return a pointer to a text
58984 string at the end of the function. The value it points to on entry is NULL.
58985 </para>
58986 </listitem>
58987 </itemizedlist>
58988 <para>
58989 The function must return an <option>int</option> value which is one of the following macros:
58990 </para>
58991 <variablelist>
58992 <varlistentry>
58993 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
58994 <listitem>
58995 <para>
58996 <indexterm role="variable">
58997 <primary><varname>$local_scan_data</varname></primary>
58998 </indexterm>
58999 The message is accepted. If you pass back a string of text, it is saved with
59000 the message, and made available in the variable <varname>$local_scan_data</varname>. No
59001 newlines are permitted (if there are any, they are turned into spaces) and the
59002 maximum length of text is 1000 characters.
59003 </para>
59004 </listitem></varlistentry>
59005 <varlistentry>
59006 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
59007 <listitem>
59008 <para>
59009 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
59010 queued without immediate delivery, and is frozen.
59011 </para>
59012 </listitem></varlistentry>
59013 <varlistentry>
59014 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
59015 <listitem>
59016 <para>
59017 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
59018 queued without immediate delivery.
59019 </para>
59020 </listitem></varlistentry>
59021 <varlistentry>
59022 <term><literal>LOCAL_SCAN_REJECT</literal></term>
59023 <listitem>
59024 <para>
59025 The message is rejected; the returned text is used as an error message which is
59026 passed back to the sender and which is also logged. Newlines are permitted &ndash;
59027 they cause a multiline response for SMTP rejections, but are converted to
59028 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
59029 used.
59030 </para>
59031 </listitem></varlistentry>
59032 <varlistentry>
59033 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
59034 <listitem>
59035 <para>
59036 The message is temporarily rejected; the returned text is used as an error
59037 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
59038 problem</quote> is used.
59039 </para>
59040 </listitem></varlistentry>
59041 <varlistentry>
59042 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
59043 <listitem>
59044 <para>
59045 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
59046 message is not written to the reject log. It has the effect of unsetting the
59047 <option>rejected_header</option> log selector for just this rejection. If
59048 <option>rejected_header</option> is already unset (see the discussion of the
59049 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
59050 same as LOCAL_SCAN_REJECT.
59051 </para>
59052 </listitem></varlistentry>
59053 <varlistentry>
59054 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
59055 <listitem>
59056 <para>
59057 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
59058 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
59059 </para>
59060 </listitem></varlistentry>
59061 </variablelist>
59062 <para>
59063 If the message is not being received by interactive SMTP, rejections are
59064 reported by writing to <option>stderr</option> or by sending an email, as configured by the
59065 <option>-oe</option> command line options.
59066 </para>
59067 </section>
59068 <section id="SECTconoptloc">
59069 <title>Configuration options for local_scan()</title>
59070 <para>
59071 <indexterm role="concept">
59072 <primary><function>local_scan()</function> function</primary>
59073 <secondary>configuration options</secondary>
59074 </indexterm>
59075 It is possible to have option settings in the main configuration file
59076 that set values in static variables in the <function>local_scan()</function> module. If you
59077 want to do this, you must have the line
59078 </para>
59079 <literallayout class="monospaced">
59080 LOCAL_SCAN_HAS_OPTIONS=yes
59081 </literallayout>
59082 <para>
59083 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
59084 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
59085 file, you must define static variables to hold the option values, and a table
59086 to define them.
59087 </para>
59088 <para>
59089 The table must be a vector called <option>local_scan_options</option>, of type
59090 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
59091 and a pointer to the variable that holds the value. The entries must appear in
59092 alphabetical order. Following <option>local_scan_options</option> you must also define a
59093 variable called <option>local_scan_options_count</option> that contains the number of
59094 entries in the table. Here is a short example, showing two kinds of option:
59095 </para>
59096 <literallayout class="monospaced">
59097 static int my_integer_option = 42;
59098 static uschar *my_string_option = US"a default string";
59099
59100 optionlist local_scan_options[] = {
59101   { "my_integer", opt_int,       &amp;my_integer_option },
59102   { "my_string",  opt_stringptr, &amp;my_string_option }
59103 };
59104
59105 int local_scan_options_count =
59106   sizeof(local_scan_options)/sizeof(optionlist);
59107 </literallayout>
59108 <para>
59109 The values of the variables can now be changed from Exim&#x2019;s runtime
59110 configuration file by including a local scan section as in this example:
59111 </para>
59112 <literallayout class="monospaced">
59113 begin local_scan
59114 my_integer = 99
59115 my_string = some string of text...
59116 </literallayout>
59117 <para>
59118 The available types of option data are as follows:
59119 </para>
59120 <variablelist>
59121 <varlistentry>
59122 <term><emphasis role="bold">opt_bool</emphasis></term>
59123 <listitem>
59124 <para>
59125 This specifies a boolean (true/false) option. The address should point to a
59126 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
59127 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
59128 whether such a variable has been set at all, you can initialize it to
59129 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
59130 values.)
59131 </para>
59132 </listitem></varlistentry>
59133 <varlistentry>
59134 <term><emphasis role="bold">opt_fixed</emphasis></term>
59135 <listitem>
59136 <para>
59137 This specifies a fixed point number, such as is used for load averages.
59138 The address should point to a variable of type <literal>int</literal>. The value is stored
59139 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
59140 </para>
59141 </listitem></varlistentry>
59142 <varlistentry>
59143 <term><emphasis role="bold">opt_int</emphasis></term>
59144 <listitem>
59145 <para>
59146 This specifies an integer; the address should point to a variable of type
59147 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
59148 Exim.
59149 </para>
59150 </listitem></varlistentry>
59151 <varlistentry>
59152 <term><emphasis role="bold">opt_mkint</emphasis></term>
59153 <listitem>
59154 <para>
59155 This is the same as <option>opt_int</option>, except that when such a value is output in a
59156 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
59157 printed with the suffix K or M.
59158 </para>
59159 </listitem></varlistentry>
59160 <varlistentry>
59161 <term><emphasis role="bold">opt_octint</emphasis></term>
59162 <listitem>
59163 <para>
59164 This also specifies an integer, but the value is always interpreted as an
59165 octal integer, whether or not it starts with the digit zero, and it is
59166 always output in octal.
59167 </para>
59168 </listitem></varlistentry>
59169 <varlistentry>
59170 <term><emphasis role="bold">opt_stringptr</emphasis></term>
59171 <listitem>
59172 <para>
59173 This specifies a string value; the address must be a pointer to a
59174 variable that points to a string (for example, of type <literal>uschar *</literal>).
59175 </para>
59176 </listitem></varlistentry>
59177 <varlistentry>
59178 <term><emphasis role="bold">opt_time</emphasis></term>
59179 <listitem>
59180 <para>
59181 This specifies a time interval value. The address must point to a variable of
59182 type <literal>int</literal>. The value that is placed there is a number of seconds.
59183 </para>
59184 </listitem></varlistentry>
59185 </variablelist>
59186 <para>
59187 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
59188 out the values of all the <function>local_scan()</function> options.
59189 </para>
59190 </section>
59191 <section id="SECID208">
59192 <title>Available Exim variables</title>
59193 <para>
59194 <indexterm role="concept">
59195 <primary><function>local_scan()</function> function</primary>
59196 <secondary>available Exim variables</secondary>
59197 </indexterm>
59198 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
59199 are the only ones that are guaranteed to be maintained from release to release.
59200 Note, however, that you can obtain the value of any Exim expansion variable,
59201 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
59202 C variables are as follows:
59203 </para>
59204 <variablelist>
59205 <varlistentry>
59206 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
59207 <listitem>
59208 <para>
59209 This variable contains the number of lines in the message&#x2019;s body.
59210 </para>
59211 </listitem></varlistentry>
59212 <varlistentry>
59213 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
59214 <listitem>
59215 <para>
59216 This variable contains the number of binary zero bytes in the message&#x2019;s body.
59217 </para>
59218 </listitem></varlistentry>
59219 <varlistentry>
59220 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
59221 <listitem>
59222 <para>
59223 This variable is set to zero when no debugging is taking place. Otherwise, it
59224 is a bitmap of debugging selectors. Two bits are identified for use in
59225 <function>local_scan()</function>; they are defined as macros:
59226 </para>
59227 <itemizedlist>
59228 <listitem>
59229 <para>
59230 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
59231 testing option that is not privileged &ndash; any caller may set it. All the
59232 other selector bits can be set only by admin users.
59233 </para>
59234 </listitem>
59235 <listitem>
59236 <para>
59237 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
59238 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
59239 of debugging bits.
59240 </para>
59241 </listitem>
59242 </itemizedlist>
59243 <para>
59244 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
59245 selected, you should use code like this:
59246 </para>
59247 <literallayout class="monospaced">
59248 if ((debug_selector &amp; D_local_scan) != 0)
59249   debug_printf("xxx", ...);
59250 </literallayout>
59251 </listitem></varlistentry>
59252 <varlistentry>
59253 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
59254 <listitem>
59255 <para>
59256 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
59257 variable <option>expand_string_message</option> contains the error message, zero-terminated.
59258 </para>
59259 </listitem></varlistentry>
59260 <varlistentry>
59261 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
59262 <listitem>
59263 <para>
59264 A pointer to a chain of header lines. The <option>header_line</option> structure is
59265 discussed below.
59266 </para>
59267 </listitem></varlistentry>
59268 <varlistentry>
59269 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
59270 <listitem>
59271 <para>
59272 A pointer to the last of the header lines.
59273 </para>
59274 </listitem></varlistentry>
59275 <varlistentry>
59276 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
59277 <listitem>
59278 <para>
59279 The value of the <option>headers_charset</option> configuration option.
59280 </para>
59281 </listitem></varlistentry>
59282 <varlistentry>
59283 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
59284 <listitem>
59285 <para>
59286 This variable is TRUE during a host checking session that is initiated by the
59287 <option>-bh</option> command line option.
59288 </para>
59289 </listitem></varlistentry>
59290 <varlistentry>
59291 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
59292 <listitem>
59293 <para>
59294 The IP address of the interface that received the message, as a string. This
59295 is NULL for locally submitted messages.
59296 </para>
59297 </listitem></varlistentry>
59298 <varlistentry>
59299 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
59300 <listitem>
59301 <para>
59302 The port on which this message was received. When testing with the <option>-bh</option>
59303 command line option, the value of this variable is -1 unless a port has been
59304 specified via the <option>-oMi</option> option.
59305 </para>
59306 </listitem></varlistentry>
59307 <varlistentry>
59308 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
59309 <listitem>
59310 <para>
59311 This variable contains Exim&#x2019;s message id for the incoming message (the value of
59312 <varname>$message_exim_id</varname>) as a zero-terminated string.
59313 </para>
59314 </listitem></varlistentry>
59315 <varlistentry>
59316 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
59317 <listitem>
59318 <para>
59319 The name of the protocol by which the message was received.
59320 </para>
59321 </listitem></varlistentry>
59322 <varlistentry>
59323 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
59324 <listitem>
59325 <para>
59326 The number of accepted recipients.
59327 </para>
59328 </listitem></varlistentry>
59329 <varlistentry>
59330 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
59331 <listitem>
59332 <para>
59333 <indexterm role="concept">
59334 <primary>recipient</primary>
59335 <secondary>adding in local scan</secondary>
59336 </indexterm>
59337 <indexterm role="concept">
59338 <primary>recipient</primary>
59339 <secondary>removing in local scan</secondary>
59340 </indexterm>
59341 The list of accepted recipients, held in a vector of length
59342 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
59343 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
59344 below). You can delete recipients by removing them from the vector and
59345 adjusting the value in <option>recipients_count</option>. In particular, by setting
59346 <option>recipients_count</option> to zero you remove all recipients. If you then return the
59347 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
59348 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
59349 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
59350 </para>
59351 </listitem></varlistentry>
59352 <varlistentry>
59353 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
59354 <listitem>
59355 <para>
59356 The envelope sender address. For bounce messages this is the empty string.
59357 </para>
59358 </listitem></varlistentry>
59359 <varlistentry>
59360 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
59361 <listitem>
59362 <para>
59363 The IP address of the sending host, as a string. This is NULL for
59364 locally-submitted messages.
59365 </para>
59366 </listitem></varlistentry>
59367 <varlistentry>
59368 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
59369 <listitem>
59370 <para>
59371 The name of the authentication mechanism that was used, or NULL if the message
59372 was not received over an authenticated SMTP connection.
59373 </para>
59374 </listitem></varlistentry>
59375 <varlistentry>
59376 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
59377 <listitem>
59378 <para>
59379 The name of the sending host, if known.
59380 </para>
59381 </listitem></varlistentry>
59382 <varlistentry>
59383 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
59384 <listitem>
59385 <para>
59386 The port on the sending host.
59387 </para>
59388 </listitem></varlistentry>
59389 <varlistentry>
59390 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
59391 <listitem>
59392 <para>
59393 This variable is TRUE for all SMTP input, including BSMTP.
59394 </para>
59395 </listitem></varlistentry>
59396 <varlistentry>
59397 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
59398 <listitem>
59399 <para>
59400 This variable is TRUE for BSMTP input.
59401 </para>
59402 </listitem></varlistentry>
59403 <varlistentry>
59404 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
59405 <listitem>
59406 <para>
59407 The contents of this variable control which pool of memory is used for new
59408 requests. See section <xref linkend="SECTmemhanloc"/> for details.
59409 </para>
59410 </listitem></varlistentry>
59411 </variablelist>
59412 </section>
59413 <section id="SECID209">
59414 <title>Structure of header lines</title>
59415 <para>
59416 The <option>header_line</option> structure contains the members listed below.
59417 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
59418 (see below). You can cause header lines to be ignored (deleted) by setting
59419 their type to *.
59420 </para>
59421 <variablelist>
59422 <varlistentry>
59423 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
59424 <listitem>
59425 <para>
59426 A pointer to the next header line, or NULL for the last line.
59427 </para>
59428 </listitem></varlistentry>
59429 <varlistentry>
59430 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
59431 <listitem>
59432 <para>
59433 A code identifying certain headers that Exim recognizes. The codes are printing
59434 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
59435 Notice in particular that any header line whose type is * is not transmitted
59436 with the message. This flagging is used for header lines that have been
59437 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
59438 lines.) Effectively, * means <quote>deleted</quote>.
59439 </para>
59440 </listitem></varlistentry>
59441 <varlistentry>
59442 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
59443 <listitem>
59444 <para>
59445 The number of characters in the header line, including the terminating and any
59446 internal newlines.
59447 </para>
59448 </listitem></varlistentry>
59449 <varlistentry>
59450 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
59451 <listitem>
59452 <para>
59453 A pointer to the text of the header. It always ends with a newline, followed by
59454 a zero byte. Internal newlines are preserved.
59455 </para>
59456 </listitem></varlistentry>
59457 </variablelist>
59458 </section>
59459 <section id="SECID210">
59460 <title>Structure of recipient items</title>
59461 <para>
59462 The <option>recipient_item</option> structure contains these members:
59463 </para>
59464 <variablelist>
59465 <varlistentry>
59466 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
59467 <listitem>
59468 <para>
59469 This is a pointer to the recipient address as it was received.
59470 </para>
59471 </listitem></varlistentry>
59472 <varlistentry>
59473 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
59474 <listitem>
59475 <para>
59476 This is used in later Exim processing when top level addresses are created by
59477 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
59478 and must always contain -1 at this stage.
59479 </para>
59480 </listitem></varlistentry>
59481 <varlistentry>
59482 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
59483 <listitem>
59484 <para>
59485 If this value is not NULL, bounce messages caused by failing to deliver to the
59486 recipient are sent to the address it contains. In other words, it overrides the
59487 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
59488 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
59489 an unqualified address, Exim qualifies it using the domain from
59490 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
59491 is NULL for all recipients.
59492 </para>
59493 </listitem></varlistentry>
59494 </variablelist>
59495 </section>
59496 <section id="SECID211">
59497 <title>Available Exim functions</title>
59498 <para>
59499 <indexterm role="concept">
59500 <primary><function>local_scan()</function> function</primary>
59501 <secondary>available Exim functions</secondary>
59502 </indexterm>
59503 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
59504 These are the only ones that are guaranteed to be maintained from release to
59505 release:
59506 </para>
59507 <variablelist>
59508 <varlistentry>
59509 <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>
59510 <listitem>
59511 <para>
59512 This function creates a child process that runs the command specified by
59513 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
59514 be NULL if no environment variables are to be passed. A new umask is supplied
59515 for the process in <option>newumask</option>.
59516 </para>
59517 <para>
59518 Pipes to the standard input and output of the new process are set up
59519 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
59520 standard error is cloned to the standard output. If there are any file
59521 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
59522 argument is TRUE, the new process is made into a process group leader.
59523 </para>
59524 <para>
59525 The function returns the pid of the new process, or -1 if things go wrong.
59526 </para>
59527 </listitem></varlistentry>
59528 <varlistentry>
59529 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
59530 <listitem>
59531 <para>
59532 This function waits for a child process to terminate, or for a timeout (in
59533 seconds) to expire. A timeout value of zero means wait as long as it takes. The
59534 return value is as follows:
59535 </para>
59536 <itemizedlist>
59537 <listitem>
59538 <para>
59539 &gt;= 0
59540 </para>
59541 <para>
59542 The process terminated by a normal exit and the value is the process
59543 ending status.
59544 </para>
59545 </listitem>
59546 <listitem>
59547 <para>
59548 &lt; 0 and &gt; &ndash;256
59549 </para>
59550 <para>
59551 The process was terminated by a signal and the value is the negation of the
59552 signal number.
59553 </para>
59554 </listitem>
59555 <listitem>
59556 <para>
59557 &ndash;256
59558 </para>
59559 <para>
59560 The process timed out.
59561 </para>
59562 </listitem>
59563 <listitem>
59564 <para>
59565 &ndash;257
59566 </para>
59567 <para>
59568 The was some other error in wait(); <option>errno</option> is still set.
59569 </para>
59570 </listitem>
59571 </itemizedlist>
59572 </listitem></varlistentry>
59573 <varlistentry>
59574 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
59575 <listitem>
59576 <para>
59577 This function provide you with a means of submitting a new message to
59578 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
59579 want, but this packages it all up for you.) The function creates a pipe,
59580 forks a subprocess that is running
59581 </para>
59582 <literallayout class="monospaced">
59583 exim -t -oem -oi -f &lt;&gt;
59584 </literallayout>
59585 <para>
59586 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
59587 that is connected to the standard input. The yield of the function is the PID
59588 of the subprocess. You can then write a message to the file descriptor, with
59589 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
59590 </para>
59591 <para>
59592 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
59593 finish and to collect its ending status. A timeout value of zero is usually
59594 fine in this circumstance. Unless you have made a mistake with the recipient
59595 addresses, you should get a return code of zero.
59596 </para>
59597 </listitem></varlistentry>
59598 <varlistentry>
59599 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
59600 <listitem>
59601 <para>
59602 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
59603 that it runs is:
59604 </para>
59605 <literallayout>
59606 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
59607 </literallayout>
59608 <para>
59609 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
59610 </para>
59611 </listitem></varlistentry>
59612 <varlistentry>
59613 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
59614 <listitem>
59615 <para>
59616 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
59617 output is written to the standard error stream. If no debugging is selected,
59618 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
59619 conditional on the <literal>local_scan</literal> debug selector by coding like this:
59620 </para>
59621 <literallayout class="monospaced">
59622 if ((debug_selector &amp; D_local_scan) != 0)
59623   debug_printf("xxx", ...);
59624 </literallayout>
59625 </listitem></varlistentry>
59626 <varlistentry>
59627 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
59628 <listitem>
59629 <para>
59630 This is an interface to Exim&#x2019;s string expansion code. The return value is the
59631 expanded string, or NULL if there was an expansion failure.
59632 The C variable <option>expand_string_message</option> contains an error message after an
59633 expansion failure. If expansion does not change the string, the return value is
59634 the pointer to the input string. Otherwise, the return value points to a new
59635 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
59636 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
59637 </para>
59638 </listitem></varlistentry>
59639 <varlistentry>
59640 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
59641 <listitem>
59642 <para>
59643 This function allows you to an add additional header line at the end of the
59644 existing ones. The first argument is the type, and should normally be a space
59645 character. The second argument is a format string and any number of
59646 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
59647 if you want, and you must ensure that the string ends with a newline.
59648 </para>
59649 </listitem></varlistentry>
59650 <varlistentry>
59651 <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>
59652 <listitem>
59653 <para>
59654 This function adds a new header line at a specified point in the header
59655 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
59656 </para>
59657 <para>
59658 If <option>name</option> is NULL, the new header is added at the end of the chain if
59659 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
59660 NULL, the header lines are searched for the first non-deleted header that
59661 matches the name. If one is found, the new header is added before it if
59662 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
59663 found header and any adjacent subsequent ones with the same name (even if
59664 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
59665 option controls where the header is added. If it is true, addition is at the
59666 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
59667 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
59668 </para>
59669 <literallayout class="monospaced">
59670 header_add_at_position(TRUE, US"Received", TRUE,
59671   ' ', "X-xxx: ...");
59672 </literallayout>
59673 <para>
59674 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
59675 there may not be if <option>received_header_text</option> expands to an empty string.
59676 </para>
59677 </listitem></varlistentry>
59678 <varlistentry>
59679 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
59680 <listitem>
59681 <para>
59682 This function removes header lines. If <option>occurrence</option> is zero or negative, all
59683 occurrences of the header are removed. If occurrence is greater than zero, that
59684 particular instance of the header is removed. If no header(s) can be found that
59685 match the specification, the function does nothing.
59686 </para>
59687 </listitem></varlistentry>
59688 <varlistentry>
59689 <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>
59690 <listitem>
59691 <para>
59692 This function tests whether the given header has the given name. It is not just
59693 a string comparison, because white space is permitted between the name and the
59694 colon. If the <option>notdel</option> argument is true, a false return is forced for all
59695 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
59696 </para>
59697 <literallayout class="monospaced">
59698 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
59699 </literallayout>
59700 </listitem></varlistentry>
59701 <varlistentry>
59702 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
59703 <listitem>
59704 <para>
59705 <indexterm role="concept">
59706 <primary>base64 encoding</primary>
59707 <secondary>functions for <function>local_scan()</function> use</secondary>
59708 </indexterm>
59709 This function base64-encodes a string, which is passed by address and length.
59710 The text may contain bytes of any value, including zero. The result is passed
59711 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
59712 zero-terminated.
59713 </para>
59714 </listitem></varlistentry>
59715 <varlistentry>
59716 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
59717 <listitem>
59718 <para>
59719 This function decodes a base64-encoded string. Its arguments are a
59720 zero-terminated base64-encoded string and the address of a variable that is set
59721 to point to the result, which is in dynamic memory. The length of the decoded
59722 string is the yield of the function. If the input is invalid base64 data, the
59723 yield is -1. A zero byte is added to the end of the output string to make it
59724 easy to interpret as a C string (assuming it contains no zeros of its own). The
59725 added zero byte is not included in the returned count.
59726 </para>
59727 </listitem></varlistentry>
59728 <varlistentry>
59729 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
59730 <listitem>
59731 <para>
59732 This function checks for a match in a domain list. Domains are always
59733 matched caselessly. The return value is one of the following:
59734 </para>
59735 <literallayout>
59736 <literal>OK     </literal> match succeeded
59737 <literal>FAIL   </literal> match failed
59738 <literal>DEFER  </literal> match deferred
59739 </literallayout>
59740 <para>
59741 DEFER is usually caused by some kind of lookup defer, such as the
59742 inability to contact a database.
59743 </para>
59744 </listitem></varlistentry>
59745 <varlistentry>
59746 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
59747 <listitem>
59748 <para>
59749 This function checks for a match in a local part list. The third argument
59750 controls case-sensitivity. The return values are as for
59751 <emphasis>lss_match_domain()</emphasis>.
59752 </para>
59753 </listitem></varlistentry>
59754 <varlistentry>
59755 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
59756 <listitem>
59757 <para>
59758 This function checks for a match in an address list. The third argument
59759 controls the case-sensitivity of the local part match. The domain is always
59760 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
59761 </para>
59762 </listitem></varlistentry>
59763 <varlistentry>
59764 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
59765 <listitem>
59766 <para>
59767 This function checks for a match in a host list. The most common usage is
59768 expected to be
59769 </para>
59770 <literallayout class="monospaced">
59771 lss_match_host(sender_host_name, sender_host_address, ...)
59772 </literallayout>
59773 <para>
59774 <indexterm role="variable">
59775 <primary><varname>$sender_host_address</varname></primary>
59776 </indexterm>
59777 An empty address field matches an empty item in the host list. If the host name
59778 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
59779 looked up if a host name is required to match an item in the list. The return
59780 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
59781 returns ERROR in the case when it had to look up a host name, but the lookup
59782 failed.
59783 </para>
59784 </listitem></varlistentry>
59785 <varlistentry>
59786 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
59787 <listitem>
59788 <para>
59789 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
59790 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
59791 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
59792 them. It specifies to which log or logs the message is written. The remaining
59793 arguments are a format and relevant insertion arguments. The string should not
59794 contain any newlines, not even at the end.
59795 </para>
59796 </listitem></varlistentry>
59797 <varlistentry>
59798 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
59799 <listitem>
59800 <para>
59801 This function adds an additional recipient to the message. The first argument
59802 is the recipient address. If it is unqualified (has no domain), it is qualified
59803 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
59804 </para>
59805 <para>
59806 This function does not allow you to specify a private <option>errors_to</option> address (as
59807 described with the structure of <option>recipient_item</option> above), because it pre-dates
59808 the addition of that field to the structure. However, it is easy to add such a
59809 value afterwards. For example:
59810 </para>
59811 <literallayout class="monospaced">
59812  receive_add_recipient(US"monitor@mydom.example", -1);
59813  recipients_list[recipients_count-1].errors_to =
59814    US"postmaster@mydom.example";
59815 </literallayout>
59816 </listitem></varlistentry>
59817 <varlistentry>
59818 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
59819 <listitem>
59820 <para>
59821 This is a convenience function to remove a named recipient from the list of
59822 recipients. It returns true if a recipient was removed, and false if no
59823 matching recipient could be found. The argument must be a complete email
59824 address.
59825 </para>
59826 </listitem></varlistentry>
59827 </variablelist>
59828 <para>
59829 <indexterm role="concept">
59830 <primary>RFC 2047</primary>
59831 </indexterm>
59832 </para>
59833 <variablelist>
59834 <varlistentry>
59835 <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>
59836 <listitem>
59837 <para>
59838 This function decodes strings that are encoded according to RFC 2047. Typically
59839 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
59840 from the Q or B encoding into a byte-string. Then, if provided with the name of
59841 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
59842 made  to translate the result to the named character set. If this fails, the
59843 binary string is returned with an error message.
59844 </para>
59845 <para>
59846 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
59847 maximum MIME word length is enforced. The third argument is the target
59848 encoding, or NULL if no translation is wanted.
59849 </para>
59850 <para>
59851 <indexterm role="concept">
59852 <primary>binary zero</primary>
59853 <secondary>in RFC 2047 decoding</secondary>
59854 </indexterm>
59855 <indexterm role="concept">
59856 <primary>RFC 2047</primary>
59857 <secondary>binary zero in</secondary>
59858 </indexterm>
59859 If a binary zero is encountered in the decoded string, it is replaced by the
59860 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
59861 not be 0 because header lines are handled as zero-terminated strings.
59862 </para>
59863 <para>
59864 The function returns the result of processing the string, zero-terminated; if
59865 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
59866 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
59867 </para>
59868 <para>
59869 If an error is encountered, the function returns NULL and uses the <option>error</option>
59870 argument to return an error message. The variable pointed to by <option>error</option> is
59871 set to NULL if there is no error; it may be set non-NULL even when the function
59872 returns a non-NULL value if decoding was successful, but there was a problem
59873 with translation.
59874 </para>
59875 </listitem></varlistentry>
59876 <varlistentry>
59877 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
59878 <listitem>
59879 <para>
59880 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
59881 below.
59882 </para>
59883 </listitem></varlistentry>
59884 <varlistentry>
59885 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
59886 <listitem>
59887 <para>
59888 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
59889 output stream. You should use this function only when there is an SMTP output
59890 stream, that is, when the incoming message is being received via interactive
59891 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
59892 is FALSE. If you want to test for an incoming message from another host (as
59893 opposed to a local process that used the <option>-bs</option> command line option), you can
59894 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
59895 is involved.
59896 </para>
59897 <para>
59898 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
59899 output function, so it can be used for all forms of SMTP connection.
59900 </para>
59901 <para>
59902 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
59903 must start with an appropriate response code: 550 if you are going to return
59904 LOCAL_SCAN_REJECT, 451 if you are going to return
59905 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
59906 initial lines of a multi-line response, the code must be followed by a hyphen
59907 to indicate that the line is not the final response line. You must also ensure
59908 that the lines you write terminate with CRLF. For example:
59909 </para>
59910 <literallayout class="monospaced">
59911 smtp_printf("550-this is some extra info\r\n");
59912 return LOCAL_SCAN_REJECT;
59913 </literallayout>
59914 <para>
59915 Note that you can also create multi-line responses by including newlines in
59916 the data returned via the <option>return_text</option> argument. The added value of using
59917 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
59918 multiple output lines.
59919 </para>
59920 <para>
59921 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
59922 does not automatically flush pending output, and therefore does not test
59923 the state of the stream. (In the main code of Exim, flushing and error
59924 detection is done when Exim is ready for the next SMTP input command.) If
59925 you want to flush the output and check for an error (for example, the
59926 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
59927 arguments. It flushes the output stream, and returns a non-zero value if there
59928 is an error.
59929 </para>
59930 </listitem></varlistentry>
59931 <varlistentry>
59932 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
59933 <listitem>
59934 <para>
59935 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
59936 chunk of memory whose size is given by the argument. Exim bombs out if it ever
59937 runs out of memory. See the next section for a discussion of memory handling.
59938 </para>
59939 </listitem></varlistentry>
59940 <varlistentry>
59941 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
59942 <listitem>
59943 <para>
59944 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
59945 permanent pool. See the next section for a discussion of memory handling.
59946 </para>
59947 </listitem></varlistentry>
59948 <varlistentry>
59949 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
59950 <listitem>
59951 <para>
59952 See below.
59953 </para>
59954 </listitem></varlistentry>
59955 <varlistentry>
59956 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
59957 <listitem>
59958 <para>
59959 See below.
59960 </para>
59961 </listitem></varlistentry>
59962 <varlistentry>
59963 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
59964 <listitem>
59965 <para>
59966 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
59967 The first makes a copy of an entire string. The second copies up to a maximum
59968 number of characters, indicated by the second argument. The third uses a format
59969 and insertion arguments to create a new string. In each case, the result is a
59970 pointer to a new string in the current memory pool. See the next section for
59971 more discussion.
59972 </para>
59973 </listitem></varlistentry>
59974 </variablelist>
59975 </section>
59976 <section id="SECTmemhanloc">
59977 <title>More about Exim&#x2019;s memory handling</title>
59978 <para>
59979 <indexterm role="concept">
59980 <primary><function>local_scan()</function> function</primary>
59981 <secondary>memory handling</secondary>
59982 </indexterm>
59983 No function is provided for freeing memory, because that is never needed.
59984 The dynamic memory that Exim uses when receiving a message is automatically
59985 recycled if another message is received by the same process (this applies only
59986 to incoming SMTP connections &ndash; other input methods can supply only one
59987 message at a time). After receiving the last message, a reception process
59988 terminates.
59989 </para>
59990 <para>
59991 Because it is recycled, the normal dynamic memory cannot be used for holding
59992 data that must be preserved over a number of incoming messages on the same SMTP
59993 connection. However, Exim in fact uses two pools of dynamic memory; the second
59994 one is not recycled, and can be used for this purpose.
59995 </para>
59996 <para>
59997 If you want to allocate memory that remains available for subsequent messages
59998 in the same SMTP connection, you should set
59999 </para>
60000 <literallayout class="monospaced">
60001 store_pool = POOL_PERM
60002 </literallayout>
60003 <para>
60004 before calling the function that does the allocation. There is no need to
60005 restore the value if you do not need to; however, if you do want to revert to
60006 the normal pool, you can either restore the previous value of <option>store_pool</option> or
60007 set it explicitly to POOL_MAIN.
60008 </para>
60009 <para>
60010 The pool setting applies to all functions that get dynamic memory, including
60011 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
60012 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
60013 block of memory from the permanent pool while preserving the value of
60014 <option>store_pool</option>.
60015 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
60016 </para>
60017 </section>
60018 </chapter>
60019
60020 <chapter id="CHAPsystemfilter">
60021 <title>System-wide message filtering</title>
60022 <para>
60023 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
60024 <primary>filter</primary>
60025 <secondary>system filter</secondary>
60026 </indexterm>
60027 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
60028 <primary>filtering all mail</primary>
60029 </indexterm>
60030 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
60031 <primary>system filter</primary>
60032 </indexterm>
60033 The previous chapters (on ACLs and the local scan function) describe checks
60034 that can be applied to messages before they are accepted by a host. There is
60035 also a mechanism for checking messages once they have been received, but before
60036 they are delivered. This is called the <emphasis>system filter</emphasis>.
60037 </para>
60038 <para>
60039 The system filter operates in a similar manner to users&#x2019; filter files, but it
60040 is run just once per message (however many recipients the message has).
60041 It should not normally be used as a substitute for routing, because <option>deliver</option>
60042 commands in a system router provide new envelope recipient addresses.
60043 The system filter must be an Exim filter. It cannot be a Sieve filter.
60044 </para>
60045 <para>
60046 The system filter is run at the start of a delivery attempt, before any routing
60047 is done. If a message fails to be completely delivered at the first attempt,
60048 the system filter is run again at the start of every retry.
60049 If you want your filter to do something only once per message, you can make use
60050 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
60051 prevent it happening on retries.
60052 </para>
60053 <para>
60054 <indexterm role="variable">
60055 <primary><varname>$domain</varname></primary>
60056 </indexterm>
60057 <indexterm role="variable">
60058 <primary><varname>$local_part</varname></primary>
60059 </indexterm>
60060 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
60061 specific to individual recipient addresses, such as <varname>$local_part</varname> and
60062 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
60063 you want to run a centrally-specified filter for each recipient address
60064 independently, you can do so by setting up a suitable <command>redirect</command> router, as
60065 described in section <xref linkend="SECTperaddfil"/> below.
60066 </para>
60067 <section id="SECID212">
60068 <title>Specifying a system filter</title>
60069 <para>
60070 <indexterm role="concept">
60071 <primary>uid (user id)</primary>
60072 <secondary>system filter</secondary>
60073 </indexterm>
60074 <indexterm role="concept">
60075 <primary>gid (group id)</primary>
60076 <secondary>system filter</secondary>
60077 </indexterm>
60078 The name of the file that contains the system filter must be specified by
60079 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
60080 other than root, you must also set <option>system_filter_user</option> and
60081 <option>system_filter_group</option> as appropriate. For example:
60082 </para>
60083 <literallayout class="monospaced">
60084 system_filter = /etc/mail/exim.filter
60085 system_filter_user = exim
60086 </literallayout>
60087 <para>
60088 If a system filter generates any deliveries directly to files or pipes (via the
60089 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
60090 specified by setting <option>system_filter_file_transport</option> and
60091 <option>system_filter_pipe_transport</option>, respectively. Similarly,
60092 <option>system_filter_reply_transport</option> must be set to handle any messages generated
60093 by the <option>reply</option> command.
60094 </para>
60095 </section>
60096 <section id="SECID213">
60097 <title>Testing a system filter</title>
60098 <para>
60099 You can run simple tests of a system filter in the same way as for a user
60100 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
60101 are permitted only in system filters are recognized.
60102 </para>
60103 <para>
60104 If you want to test the combined effect of a system filter and a user filter,
60105 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
60106 </para>
60107 </section>
60108 <section id="SECID214">
60109 <title>Contents of a system filter</title>
60110 <para>
60111 The language used to specify system filters is the same as for users&#x2019; filter
60112 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
60113 mail filtering</emphasis>. However, there are some additional features that are
60114 available only in system filters; these are described in subsequent sections.
60115 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
60116 they cause errors.
60117 </para>
60118 <para>
60119 <indexterm role="concept">
60120 <primary>frozen messages</primary>
60121 <secondary>manual thaw; testing in filter</secondary>
60122 </indexterm>
60123 There are two special conditions which, though available in users&#x2019; filter
60124 files, are designed for use in system filters. The condition <option>first_delivery</option>
60125 is true only for the first attempt at delivering a message, and
60126 <option>manually_thawed</option> is true only if the message has been frozen, and
60127 subsequently thawed by an admin user. An explicit forced delivery counts as a
60128 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
60129 </para>
60130 <para>
60131 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
60132 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
60133 succeed, it will not be tried again.
60134 If you want Exim to retry an unseen delivery until it succeeds, you should
60135 arrange to set it up every time the filter runs.
60136 </para>
60137 <para>
60138 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
60139 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
60140 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
60141 to which users&#x2019; filter files can refer.
60142 </para>
60143 </section>
60144 <section id="SECID215">
60145 <title>Additional variable for system filters</title>
60146 <para>
60147 <indexterm role="variable">
60148 <primary><varname>$recipients</varname></primary>
60149 </indexterm>
60150 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
60151 of the message (separated by commas and white space), is available in system
60152 filters. It is not available in users&#x2019; filters for privacy reasons.
60153 </para>
60154 </section>
60155 <section id="SECID216">
60156 <title>Defer, freeze, and fail commands for system filters</title>
60157 <para>
60158 <indexterm role="concept">
60159 <primary>freezing messages</primary>
60160 </indexterm>
60161 <indexterm role="concept">
60162 <primary>message</primary>
60163 <secondary>freezing</secondary>
60164 </indexterm>
60165 <indexterm role="concept">
60166 <primary>message</primary>
60167 <secondary>forced failure</secondary>
60168 </indexterm>
60169 <indexterm role="concept">
60170 <primary><option>fail</option></primary>
60171 <secondary>in system filter</secondary>
60172 </indexterm>
60173 <indexterm role="concept">
60174 <primary><option>freeze</option> in system filter</primary>
60175 </indexterm>
60176 <indexterm role="concept">
60177 <primary><option>defer</option> in system filter</primary>
60178 </indexterm>
60179 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
60180 always available in system filters, but are not normally enabled in users&#x2019;
60181 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
60182 for the <command>redirect</command> router.) These commands can optionally be followed by the
60183 word <option>text</option> and a string containing an error message, for example:
60184 </para>
60185 <literallayout class="monospaced">
60186 fail text "this message looks like spam to me"
60187 </literallayout>
60188 <para>
60189 The keyword <option>text</option> is optional if the next character is a double quote.
60190 </para>
60191 <para>
60192 The <option>defer</option> command defers delivery of the original recipients of the
60193 message. The <option>fail</option> command causes all the original recipients to be failed,
60194 and a bounce message to be created. The <option>freeze</option> command suspends all
60195 delivery attempts for the original recipients. In all cases, any new deliveries
60196 that are specified by the filter are attempted as normal after the filter has
60197 run.
60198 </para>
60199 <para>
60200 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
60201 not manually frozen since. This means that automatic freezing by a system
60202 filter can be used as a way of checking out suspicious messages. If a message
60203 is found to be all right, manually unfreezing it allows it to be delivered.
60204 </para>
60205 <para>
60206 <indexterm role="concept">
60207 <primary>log</primary>
60208 <secondary><option>fail</option> command log line</secondary>
60209 </indexterm>
60210 <indexterm role="concept">
60211 <primary><option>fail</option></primary>
60212 <secondary>log line; reducing</secondary>
60213 </indexterm>
60214 The text given with a fail command is used as part of the bounce message as
60215 well as being written to the log. If the message is quite long, this can fill
60216 up a lot of log space when such failures are common. To reduce the size of the
60217 log message, Exim interprets the text in a special way if it starts with the
60218 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
60219 strings is written to the log, and the rest of the text is used in the bounce
60220 message. For example:
60221 </para>
60222 <literallayout class="monospaced">
60223 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
60224      because it contains attachments that we are \
60225      not prepared to receive."
60226 </literallayout>
60227 <para>
60228 <indexterm role="concept">
60229 <primary>loop</primary>
60230 <secondary>caused by <option>fail</option></secondary>
60231 </indexterm>
60232 Take great care with the <option>fail</option> command when basing the decision to fail on
60233 the contents of the message, because the bounce message will of course include
60234 the contents of the original message and will therefore trigger the <option>fail</option>
60235 command again (causing a mail loop) unless steps are taken to prevent this.
60236 Testing the <option>error_message</option> condition is one way to prevent this. You could
60237 use, for example
60238 </para>
60239 <literallayout class="monospaced">
60240 if $message_body contains "this is spam" and not error_message
60241 then fail text "spam is not wanted here" endif
60242 </literallayout>
60243 <para>
60244 though of course that might let through unwanted bounce messages. The
60245 alternative is clever checking of the body and/or headers to detect bounces
60246 generated by the filter.
60247 </para>
60248 <para>
60249 The interpretation of a system filter file ceases after a
60250 <option>defer</option>,
60251 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
60252 set up earlier in the filter file are honoured, so you can use a sequence such
60253 as
60254 </para>
60255 <literallayout class="monospaced">
60256 mail ...
60257 freeze
60258 </literallayout>
60259 <para>
60260 to send a specified message when the system filter is freezing (or deferring or
60261 failing) a message. The normal deliveries for the message do not, of course,
60262 take place.
60263 </para>
60264 </section>
60265 <section id="SECTaddremheasys">
60266 <title>Adding and removing headers in a system filter</title>
60267 <para>
60268 <indexterm role="concept">
60269 <primary>header lines</primary>
60270 <secondary>adding; in system filter</secondary>
60271 </indexterm>
60272 <indexterm role="concept">
60273 <primary>header lines</primary>
60274 <secondary>removing; in system filter</secondary>
60275 </indexterm>
60276 <indexterm role="concept">
60277 <primary>filter</primary>
60278 <secondary>header lines; adding/removing</secondary>
60279 </indexterm>
60280 Two filter commands that are available only in system filters are:
60281 </para>
60282 <literallayout class="monospaced">
60283 headers add &lt;string&gt;
60284 headers remove &lt;string&gt;
60285 </literallayout>
60286 <para>
60287 The argument for the <option>headers add</option> is a string that is expanded and then
60288 added to the end of the message&#x2019;s headers. It is the responsibility of the
60289 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
60290 space is ignored, and if the string is otherwise empty, or if the expansion is
60291 forced to fail, the command has no effect.
60292 </para>
60293 <para>
60294 You can use <quote>\n</quote> within the string, followed by white space, to specify
60295 continued header lines. More than one header may be added in one command by
60296 including <quote>\n</quote> within the string without any following white space. For
60297 example:
60298 </para>
60299 <literallayout class="monospaced">
60300 headers add "X-header-1: ....\n  \
60301              continuation of X-header-1 ...\n\
60302              X-header-2: ...."
60303 </literallayout>
60304 <para>
60305 Note that the header line continuation white space after the first newline must
60306 be placed before the backslash that continues the input string, because white
60307 space after input continuations is ignored.
60308 </para>
60309 <para>
60310 The argument for <option>headers remove</option> is a colon-separated list of header names.
60311 This command applies only to those headers that are stored with the message;
60312 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
60313 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
60314 header with the same name, they are all removed.
60315 </para>
60316 <para>
60317 The <option>headers</option> command in a system filter makes an immediate change to the set
60318 of header lines that was received with the message (with possible additions
60319 from ACL processing). Subsequent commands in the system filter operate on the
60320 modified set, which also forms the basis for subsequent message delivery.
60321 Unless further modified during routing or transporting, this set of headers is
60322 used for all recipients of the message.
60323 </para>
60324 <para>
60325 During routing and transporting, the variables that refer to the contents of
60326 header lines refer only to those lines that are in this set. Thus, header lines
60327 that are added by a system filter are visible to users&#x2019; filter files and to all
60328 routers and transports. This contrasts with the manipulation of header lines by
60329 routers and transports, which is not immediate, but which instead is saved up
60330 until the message is actually being written (see section
60331 <xref linkend="SECTheadersaddrem"/>).
60332 </para>
60333 <para>
60334 If the message is not delivered at the first attempt, header lines that were
60335 added by the system filter are stored with the message, and so are still
60336 present at the next delivery attempt. Header lines that were removed are still
60337 present, but marked <quote>deleted</quote> so that they are not transported with the
60338 message. For this reason, it is usual to make the <option>headers</option> command
60339 conditional on <option>first_delivery</option> so that the set of header lines is not
60340 modified more than once.
60341 </para>
60342 <para>
60343 Because header modification in a system filter acts immediately, you have to
60344 use an indirect approach if you want to modify the contents of a header line.
60345 For example:
60346 </para>
60347 <literallayout class="monospaced">
60348 headers add "Old-Subject: $h_subject:"
60349 headers remove "Subject"
60350 headers add "Subject: new subject (was: $h_old-subject:)"
60351 headers remove "Old-Subject"
60352 </literallayout>
60353 </section>
60354 <section id="SECID217">
60355 <title>Setting an errors address in a system filter</title>
60356 <para>
60357 <indexterm role="concept">
60358 <primary>envelope sender</primary>
60359 </indexterm>
60360 In a system filter, if a <option>deliver</option> command is followed by
60361 </para>
60362 <literallayout class="monospaced">
60363 errors_to &lt;some address&gt;
60364 </literallayout>
60365 <para>
60366 in order to change the envelope sender (and hence the error reporting) for that
60367 delivery, any address may be specified. (In a user filter, only the current
60368 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
60369 might use
60370 </para>
60371 <literallayout class="monospaced">
60372 unseen deliver monitor@spying.example errors_to root@local.example
60373 </literallayout>
60374 <para>
60375 to take a copy which would not be sent back to the normal error reporting
60376 address if its delivery failed.
60377 </para>
60378 </section>
60379 <section id="SECTperaddfil">
60380 <title>Per-address filtering</title>
60381 <para>
60382 <indexterm role="variable">
60383 <primary><varname>$domain</varname></primary>
60384 </indexterm>
60385 <indexterm role="variable">
60386 <primary><varname>$local_part</varname></primary>
60387 </indexterm>
60388 In contrast to the system filter, which is run just once per message for each
60389 delivery attempt, it is also possible to set up a system-wide filtering
60390 operation that runs once for each recipient address. In this case, variables
60391 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
60392 filter file could be made dependent on them. This is an example of a router
60393 which implements such a filter:
60394 </para>
60395 <literallayout class="monospaced">
60396 central_filter:
60397   check_local_user
60398   driver = redirect
60399   domains = +local_domains
60400   file = /central/filters/$local_part
60401   no_verify
60402   allow_filter
60403   allow_freeze
60404 </literallayout>
60405 <para>
60406 The filter is run in a separate process under its own uid. Therefore, either
60407 <option>check_local_user</option> must be set (as above), in which case the filter is run as
60408 the local user, or the <option>user</option> option must be used to specify which user to
60409 use. If both are set, <option>user</option> overrides.
60410 </para>
60411 <para>
60412 Care should be taken to ensure that none of the commands in the filter file
60413 specify a significant delivery if the message is to go on to be delivered to
60414 its intended recipient. The router will not then claim to have dealt with the
60415 address, so it will be passed on to subsequent routers to be delivered in the
60416 normal way.
60417 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
60418 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
60419 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
60420 </para>
60421 </section>
60422 </chapter>
60423
60424 <chapter id="CHAPmsgproc">
60425 <title>Message processing</title>
60426 <para>
60427 <indexterm role="concept" id="IIDmesproc" class="startofrange">
60428 <primary>message</primary>
60429 <secondary>general processing</secondary>
60430 </indexterm>
60431 Exim performs various transformations on the sender and recipient addresses of
60432 all messages that it handles, and also on the messages&#x2019; header lines. Some of
60433 these are optional and configurable, while others always take place. All of
60434 this processing, except rewriting as a result of routing, and the addition or
60435 removal of header lines while delivering, happens when a message is received,
60436 before it is placed on Exim&#x2019;s queue.
60437 </para>
60438 <para>
60439 Some of the automatic processing takes place by default only for
60440 <quote>locally-originated</quote> messages. This adjective is used to describe messages
60441 that are not received over TCP/IP, but instead are passed to an Exim process on
60442 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
60443 set up by the <option>-bs</option> command line option.
60444 </para>
60445 <para>
60446 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
60447 or ::1) are not considered to be locally-originated. Exim does not treat the
60448 loopback interface specially in any way.
60449 </para>
60450 <para>
60451 If you want the loopback interface to be treated specially, you must ensure
60452 that there are appropriate entries in your ACLs.
60453 </para>
60454 <section id="SECTsubmodnon">
60455 <title>Submission mode for non-local messages</title>
60456 <para>
60457 <indexterm role="concept">
60458 <primary>message</primary>
60459 <secondary>submission</secondary>
60460 </indexterm>
60461 <indexterm role="concept">
60462 <primary>submission mode</primary>
60463 </indexterm>
60464 Processing that happens automatically for locally-originated messages (unless
60465 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
60466 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
60467 state. Submission mode is set by the modifier
60468 </para>
60469 <literallayout class="monospaced">
60470 control = submission
60471 </literallayout>
60472 <para>
60473 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
60474 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
60475 a local submission, and is normally used when the source of the message is
60476 known to be an MUA running on a client host (as opposed to an MTA). For
60477 example, to set submission mode for messages originating on the IPv4 loopback
60478 interface, you could include the following in the MAIL ACL:
60479 </para>
60480 <literallayout class="monospaced">
60481 warn  hosts = 127.0.0.1
60482       control = submission
60483 </literallayout>
60484 <para>
60485 <indexterm role="concept">
60486 <primary><option>sender_retain</option> submission option</primary>
60487 </indexterm>
60488 There are some options that can be used when setting submission mode. A slash
60489 is used to separate options. For example:
60490 </para>
60491 <literallayout class="monospaced">
60492 control = submission/sender_retain
60493 </literallayout>
60494 <para>
60495 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
60496 true and <option>local_from_check</option> false for the current incoming message. The first
60497 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
60498 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
60499 authenticated sender. With this setting, Exim still fixes up messages by adding
60500 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
60501 attempt to check sender authenticity in header lines.
60502 </para>
60503 <para>
60504 When <option>sender_retain</option> is not set, a submission mode setting may specify a
60505 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
60506 example:
60507 </para>
60508 <literallayout class="monospaced">
60509 control = submission/domain=some.domain
60510 </literallayout>
60511 <para>
60512 The domain may be empty. How this value is used is described in sections
60513 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
60514 that allows you to specify the user&#x2019;s full name for inclusion in a created
60515 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
60516 </para>
60517 <literallayout class="monospaced">
60518 accept authenticated = *
60519        control = submission/domain=wonderland.example/\
60520                             name=${lookup {$authenticated_id} \
60521                                    lsearch {/etc/exim/namelist}}
60522 </literallayout>
60523 <para>
60524 Because the name may contain any characters, including slashes, the <option>name</option>
60525 option must be given last. The remainder of the string is used as the name. For
60526 the example above, if <filename>/etc/exim/namelist</filename> contains:
60527 </para>
60528 <literallayout class="monospaced">
60529 bigegg:  Humpty Dumpty
60530 </literallayout>
60531 <para>
60532 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
60533 line would be:
60534 </para>
60535 <literallayout class="monospaced">
60536 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
60537 </literallayout>
60538 <para>
60539 <indexterm role="concept">
60540 <primary>return path</primary>
60541 <secondary>in submission mode</secondary>
60542 </indexterm>
60543 By default, submission mode forces the return path to the same address as is
60544 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
60545 specified, the return path is also left unchanged.
60546 </para>
60547 <para>
60548 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
60549 ACL. This means that any sender checks performed before the fix-ups use the
60550 untrusted sender address specified by the user, not the trusted sender address
60551 specified by submission mode. Although this might be slightly unexpected, it
60552 does mean that you can configure ACL checks to spot that a user is trying to
60553 spoof another&#x2019;s address.
60554 </para>
60555 </section>
60556 <section id="SECTlineendings">
60557 <title>Line endings</title>
60558 <para>
60559 <indexterm role="concept">
60560 <primary>line endings</primary>
60561 </indexterm>
60562 <indexterm role="concept">
60563 <primary>carriage return</primary>
60564 </indexterm>
60565 <indexterm role="concept">
60566 <primary>linefeed</primary>
60567 </indexterm>
60568 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
60569 linefeed) is the line ending for messages transmitted over the Internet using
60570 SMTP over TCP/IP. However, within individual operating systems, different
60571 conventions are used. For example, Unix-like systems use just LF, but others
60572 use CRLF or just CR.
60573 </para>
60574 <para>
60575 Exim was designed for Unix-like systems, and internally, it stores messages
60576 using the system&#x2019;s convention of a single LF as a line terminator. When
60577 receiving a message, all line endings are translated to this standard format.
60578 Originally, it was thought that programs that passed messages directly to an
60579 MTA within an operating system would use that system&#x2019;s convention. Experience
60580 has shown that this is not the case; for example, there are Unix applications
60581 that use CRLF in this circumstance. For this reason, and for compatibility with
60582 other MTAs, the way Exim handles line endings for all messages is now as
60583 follows:
60584 </para>
60585 <itemizedlist>
60586 <listitem>
60587 <para>
60588 LF not preceded by CR is treated as a line ending.
60589 </para>
60590 </listitem>
60591 <listitem>
60592 <para>
60593 CR is treated as a line ending; if it is immediately followed by LF, the LF
60594 is ignored.
60595 </para>
60596 </listitem>
60597 <listitem>
60598 <para>
60599 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
60600 nor a local message in the state where a line containing only a dot is a
60601 terminator.
60602 </para>
60603 </listitem>
60604 <listitem>
60605 <para>
60606 If a bare CR is encountered within a header line, an extra space is added after
60607 the line terminator so as not to end the header line. The reasoning behind this
60608 is that bare CRs in header lines are most likely either to be mistakes, or
60609 people trying to play silly games.
60610 </para>
60611 </listitem>
60612 <listitem>
60613 <para>
60614 If the first header line received in a message ends with CRLF, a subsequent
60615 bare LF in a header line is treated in the same way as a bare CR in a header
60616 line.
60617 </para>
60618 </listitem>
60619 </itemizedlist>
60620 </section>
60621 <section id="SECID218">
60622 <title>Unqualified addresses</title>
60623 <para>
60624 <indexterm role="concept">
60625 <primary>unqualified addresses</primary>
60626 </indexterm>
60627 <indexterm role="concept">
60628 <primary>address</primary>
60629 <secondary>qualification</secondary>
60630 </indexterm>
60631 By default, Exim expects every envelope address it receives from an external
60632 host to be fully qualified. Unqualified addresses cause negative responses to
60633 SMTP commands. However, because SMTP is used as a means of transporting
60634 messages from MUAs running on personal workstations, there is sometimes a
60635 requirement to accept unqualified addresses from specific hosts or IP networks.
60636 </para>
60637 <para>
60638 Exim has two options that separately control which hosts may send unqualified
60639 sender or recipient addresses in SMTP commands, namely
60640 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
60641 cases, if an unqualified address is accepted, it is qualified by adding the
60642 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
60643 </para>
60644 <para>
60645 <indexterm role="option">
60646 <primary><option>qualify_domain</option></primary>
60647 </indexterm>
60648 <indexterm role="option">
60649 <primary><option>qualify_recipient</option></primary>
60650 </indexterm>
60651 Unqualified addresses in header lines are automatically qualified for messages
60652 that are locally originated, unless the <option>-bnq</option> option is given on the command
60653 line. For messages received over SMTP, unqualified addresses in header lines
60654 are qualified only if unqualified addresses are permitted in SMTP commands. In
60655 other words, such qualification is also controlled by
60656 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
60657 </para>
60658 </section>
60659 <section id="SECID219">
60660 <title>The UUCP From line</title>
60661 <para>
60662 <indexterm role="concept">
60663 <primary><quote>From</quote> line</primary>
60664 </indexterm>
60665 <indexterm role="concept">
60666 <primary>UUCP</primary>
60667 <secondary><quote>From</quote> line</secondary>
60668 </indexterm>
60669 <indexterm role="concept">
60670 <primary>sender</primary>
60671 <secondary>address</secondary>
60672 </indexterm>
60673 <indexterm role="option">
60674 <primary><option>uucp_from_pattern</option></primary>
60675 </indexterm>
60676 <indexterm role="option">
60677 <primary><option>uucp_from_sender</option></primary>
60678 </indexterm>
60679 <indexterm role="concept">
60680 <primary>envelope sender</primary>
60681 </indexterm>
60682 <indexterm role="concept">
60683 <primary>Sendmail compatibility</primary>
60684 <secondary><quote>From</quote> line</secondary>
60685 </indexterm>
60686 Messages that have come from UUCP (and some other applications) often begin
60687 with a line containing the envelope sender and a timestamp, following the word
60688 <quote>From</quote>. Examples of two common formats are:
60689 </para>
60690 <literallayout class="monospaced">
60691 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
60692 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
60693 </literallayout>
60694 <para>
60695 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
60696 Exim recognizes such lines at the start of messages that are submitted to it
60697 via the command line (that is, on the standard input). It does not recognize
60698 such lines in incoming SMTP messages, unless the sending host matches
60699 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
60700 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
60701 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
60702 default value matches the two common cases shown above and puts the address
60703 that follows <quote>From</quote> into <varname>$1</varname>.
60704 </para>
60705 <para>
60706 <indexterm role="concept">
60707 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
60708 <secondary>in <quote>From </quote> line handling</secondary>
60709 </indexterm>
60710 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
60711 a trusted user, the message&#x2019;s sender address is constructed by expanding the
60712 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
60713 then parsed as an RFC 2822 address. If there is no domain, the local part is
60714 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
60715 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
60716 </para>
60717 <para>
60718 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
60719 sender address is not changed. This is also the case for incoming SMTP messages
60720 that are permitted to contain <quote>From</quote> lines.
60721 </para>
60722 <para>
60723 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
60724 treated as a data line that starts the body of the message, as it is not valid
60725 as a header line. This also happens if a <quote>From</quote> line is present in an
60726 incoming SMTP message from a source that is not permitted to send them.
60727 </para>
60728 </section>
60729 <section id="SECID220">
60730 <title>Resent- header lines</title>
60731 <para>
60732 <indexterm role="concept">
60733 <primary><option>Resent-</option> header lines</primary>
60734 </indexterm>
60735 RFC 2822 makes provision for sets of header lines starting with the string
60736 <literal>Resent-</literal> to be added to a message when it is resent by the original
60737 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
60738 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
60739 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
60740 </para>
60741 <blockquote>
60742 <para>
60743 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
60744 processing of replies or other such automatic actions on messages.</emphasis>
60745 </para>
60746 </blockquote>
60747 <para>
60748 This leaves things a bit vague as far as other processing actions such as
60749 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
60750 follows:
60751 </para>
60752 <itemizedlist>
60753 <listitem>
60754 <para>
60755 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
60756 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
60757 </para>
60758 </listitem>
60759 <listitem>
60760 <para>
60761 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
60762 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
60763 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
60764 </para>
60765 </listitem>
60766 <listitem>
60767 <para>
60768 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
60769 also removed.
60770 </para>
60771 </listitem>
60772 <listitem>
60773 <para>
60774 For a locally-submitted message,
60775 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
60776 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
60777 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
60778 included in log lines in this case.
60779 </para>
60780 </listitem>
60781 <listitem>
60782 <para>
60783 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
60784 <option>Resent-</option> header lines are present.
60785 </para>
60786 </listitem>
60787 </itemizedlist>
60788 </section>
60789 <section id="SECID221">
60790 <title>The Auto-Submitted: header line</title>
60791 <para>
60792 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
60793 includes the header line:
60794 </para>
60795 <literallayout class="monospaced">
60796 Auto-Submitted: auto-replied
60797 </literallayout>
60798 </section>
60799 <section id="SECID222">
60800 <title>The Bcc: header line</title>
60801 <para>
60802 <indexterm role="concept">
60803 <primary><emphasis>Bcc:</emphasis> header line</primary>
60804 </indexterm>
60805 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
60806 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
60807 extracting its addresses). If <option>-t</option> is not present on the command line, any
60808 existing <emphasis>Bcc:</emphasis> is not removed.
60809 </para>
60810 </section>
60811 <section id="SECID223">
60812 <title>The Date: header line</title>
60813 <para>
60814 <indexterm role="concept">
60815 <primary><emphasis>Date:</emphasis> header line</primary>
60816 </indexterm>
60817 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
60818 Exim adds one, using the current date and time, unless the
60819 <option>suppress_local_fixups</option> control has been specified.
60820 </para>
60821 </section>
60822 <section id="SECID224">
60823 <title>The Delivery-date: header line</title>
60824 <para>
60825 <indexterm role="concept">
60826 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
60827 </indexterm>
60828 <indexterm role="option">
60829 <primary><option>delivery_date_remove</option></primary>
60830 </indexterm>
60831 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
60832 set. Exim can be configured to add them to the final delivery of messages. (See
60833 the generic <option>delivery_date_add</option> transport option.) They should not be present
60834 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
60835 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
60836 messages.
60837 </para>
60838 </section>
60839 <section id="SECID225">
60840 <title>The Envelope-to: header line</title>
60841 <para>
60842 <indexterm role="concept">
60843 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
60844 </indexterm>
60845 <indexterm role="option">
60846 <primary><option>envelope_to_remove</option></primary>
60847 </indexterm>
60848 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
60849 Exim can be configured to add them to the final delivery of messages. (See the
60850 generic <option>envelope_to_add</option> transport option.) They should not be present in
60851 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
60852 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
60853 messages.
60854 </para>
60855 </section>
60856 <section id="SECTthefrohea">
60857 <title>The From: header line</title>
60858 <para>
60859 <indexterm role="concept">
60860 <primary><emphasis>From:</emphasis> header line</primary>
60861 </indexterm>
60862 <indexterm role="concept">
60863 <primary>Sendmail compatibility</primary>
60864 <secondary><quote>From</quote> line</secondary>
60865 </indexterm>
60866 <indexterm role="concept">
60867 <primary>message</primary>
60868 <secondary>submission</secondary>
60869 </indexterm>
60870 <indexterm role="concept">
60871 <primary>submission mode</primary>
60872 </indexterm>
60873 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
60874 adds one if either of the following conditions is true:
60875 </para>
60876 <itemizedlist>
60877 <listitem>
60878 <para>
60879 The envelope sender address is not empty (that is, this is not a bounce
60880 message). The added header line copies the envelope sender address.
60881 </para>
60882 </listitem>
60883 <listitem>
60884 <para>
60885 <indexterm role="variable">
60886 <primary><varname>$authenticated_id</varname></primary>
60887 </indexterm>
60888 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
60889 </para>
60890 <orderedlist numeration="arabic">
60891 <listitem>
60892 <para>
60893 <indexterm role="variable">
60894 <primary><varname>$qualify_domain</varname></primary>
60895 </indexterm>
60896 If no domain is specified by the submission control, the local part is
60897 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
60898 </para>
60899 </listitem>
60900 <listitem>
60901 <para>
60902 If a non-empty domain is specified by the submission control, the local
60903 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
60904 </para>
60905 </listitem>
60906 <listitem>
60907 <para>
60908 If an empty domain is specified by the submission control,
60909 <varname>$authenticated_id</varname> is assumed to be the complete address.
60910 </para>
60911 </listitem>
60912 </orderedlist>
60913 </listitem>
60914 </itemizedlist>
60915 <para>
60916 A non-empty envelope sender takes precedence.
60917 </para>
60918 <para>
60919 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
60920 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
60921 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
60922 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
60923 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
60924 <option>unknown_login</option> configuration option). The address is qualified with
60925 <option>qualify_domain</option>.
60926 </para>
60927 <para>
60928 For compatibility with Sendmail, if an incoming, non-SMTP message has a
60929 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
60930 user, this is replaced by an address containing the user&#x2019;s login name and full
60931 name as described in section <xref linkend="SECTconstr"/>.
60932 </para>
60933 </section>
60934 <section id="SECID226">
60935 <title>The Message-ID: header line</title>
60936 <para>
60937 <indexterm role="concept">
60938 <primary><emphasis>Message-ID:</emphasis> header line</primary>
60939 </indexterm>
60940 <indexterm role="concept">
60941 <primary>message</primary>
60942 <secondary>submission</secondary>
60943 </indexterm>
60944 <indexterm role="option">
60945 <primary><option>message_id_header_text</option></primary>
60946 </indexterm>
60947 If a locally-generated or submission-mode incoming message does not contain a
60948 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
60949 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
60950 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
60951 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
60952 message id, preceded by the letter E to ensure it starts with a letter, and
60953 followed by @ and the primary host name. Additional information can be included
60954 in this header line by setting the <option>message_id_header_text</option> and/or
60955 <option>message_id_header_domain</option> options.
60956 </para>
60957 </section>
60958 <section id="SECID227">
60959 <title>The Received: header line</title>
60960 <para>
60961 <indexterm role="concept">
60962 <primary><emphasis>Received:</emphasis> header line</primary>
60963 </indexterm>
60964 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
60965 contents are defined by the <option>received_header_text</option> configuration option, and
60966 Exim automatically adds a semicolon and a timestamp to the configured string.
60967 </para>
60968 <para>
60969 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
60970 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
60971 line is the time that the message started to be received. This is the value
60972 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
60973 </para>
60974 <para>
60975 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
60976 changed to the time of acceptance, which is (apart from a small delay while the
60977 -H spool file is written) the earliest time at which delivery could start.
60978 </para>
60979 </section>
60980 <section id="SECID228">
60981 <title>The References: header line</title>
60982 <para>
60983 <indexterm role="concept">
60984 <primary><emphasis>References:</emphasis> header line</primary>
60985 </indexterm>
60986 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
60987 header line. This is constructed according to the rules that are described in
60988 section 3.64 of RFC 2822 (which states that replies should contain such a
60989 header line), and section 3.14 of RFC 3834 (which states that automatic
60990 responses are not different in this respect). However, because some mail
60991 processing software does not cope well with very long header lines, no more
60992 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
60993 incoming message. If there are more than 12, the first one and then the final
60994 11 are copied, before adding the message ID of the incoming message.
60995 </para>
60996 </section>
60997 <section id="SECID229">
60998 <title>The Return-path: header line</title>
60999 <para>
61000 <indexterm role="concept">
61001 <primary><emphasis>Return-path:</emphasis> header line</primary>
61002 </indexterm>
61003 <indexterm role="option">
61004 <primary><option>return_path_remove</option></primary>
61005 </indexterm>
61006 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
61007 it does the final delivery of messages. (See the generic <option>return_path_add</option>
61008 transport option.) Therefore, they should not be present in messages in
61009 transit. If the <option>return_path_remove</option> configuration option is set (the
61010 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
61011 </para>
61012 </section>
61013 <section id="SECTthesenhea">
61014 <title>The Sender: header line</title>
61015 <para>
61016 <indexterm role="concept">
61017 <primary><emphasis>Sender:</emphasis> header line</primary>
61018 </indexterm>
61019 <indexterm role="concept">
61020 <primary>message</primary>
61021 <secondary>submission</secondary>
61022 </indexterm>
61023 For a locally-originated message from an untrusted user, Exim may remove an
61024 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
61025 these actions by setting the <option>local_sender_retain</option> option true, the
61026 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
61027 control setting.
61028 </para>
61029 <para>
61030 When a local message is received from an untrusted user and
61031 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
61032 control has not been set, a check is made to see if the address given in the
61033 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
61034 that is expected has the login name as the local part and the value of
61035 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
61036 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
61037 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
61038 line is added to the message.
61039 </para>
61040 <para>
61041 If you set <option>local_from_check</option> false, this checking does not occur. However,
61042 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
61043 <option>local_sender_retain</option> to be true. It is not possible to set both of these
61044 options true at the same time.
61045 </para>
61046 <para>
61047 <indexterm role="concept">
61048 <primary>submission mode</primary>
61049 </indexterm>
61050 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
61051 received over TCP/IP or for messages submitted by trusted users. However, when
61052 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
61053 not specified on the submission control, the following processing takes place:
61054 </para>
61055 <para>
61056 <indexterm role="variable">
61057 <primary><varname>$authenticated_id</varname></primary>
61058 </indexterm>
61059 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
61060 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
61061 created as follows:
61062 </para>
61063 <itemizedlist>
61064 <listitem>
61065 <para>
61066 <indexterm role="variable">
61067 <primary><varname>$qualify_domain</varname></primary>
61068 </indexterm>
61069 If no domain is specified by the submission control, the local part is
61070 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
61071 </para>
61072 </listitem>
61073 <listitem>
61074 <para>
61075 If a non-empty domain is specified by the submission control, the local part
61076 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
61077 </para>
61078 </listitem>
61079 <listitem>
61080 <para>
61081 If an empty domain is specified by the submission control,
61082 <varname>$authenticated_id</varname> is assumed to be the complete address.
61083 </para>
61084 </listitem>
61085 </itemizedlist>
61086 <para>
61087 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
61088 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
61089 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
61090 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
61091 </para>
61092 <para>
61093 <indexterm role="concept">
61094 <primary>return path</primary>
61095 <secondary>created from <emphasis>Sender:</emphasis></secondary>
61096 </indexterm>
61097 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
61098 the message (the envelope sender address) is changed to be the same address,
61099 except in the case of submission mode when <option>sender_retain</option> is specified.
61100 </para>
61101 </section>
61102 <section id="SECTheadersaddrem">
61103 <title>Adding and removing header lines in routers and transports</title>
61104 <para>
61105 <indexterm role="concept">
61106 <primary>header lines</primary>
61107 <secondary>adding; in router or transport</secondary>
61108 </indexterm>
61109 <indexterm role="concept">
61110 <primary>header lines</primary>
61111 <secondary>removing; in router or transport</secondary>
61112 </indexterm>
61113 When a message is delivered, the addition and removal of header lines can be
61114 specified in a system filter, or on any of the routers and transports that
61115 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
61116 modifying headers in a system filter. Header lines can also be added in an ACL
61117 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
61118 </para>
61119 <para>
61120 In contrast to what happens in a system filter, header modifications that are
61121 specified on routers and transports apply only to the particular recipient
61122 addresses that are being processed by those routers and transports. These
61123 changes do not actually take place until a copy of the message is being
61124 transported. Therefore, they do not affect the basic set of header lines, and
61125 they do not affect the values of the variables that refer to header lines.
61126 </para>
61127 <para>
61128 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
61129 the transport cannot refer to the modified header lines, because such
61130 expansions all occur before the message is actually transported.
61131 </para>
61132 <para>
61133 For both routers and transports, the argument of a <option>headers_add</option>
61134 option must be in the form of one or more RFC 2822 header lines, separated by
61135 newlines (coded as <quote>\n</quote>). For example:
61136 </para>
61137 <literallayout class="monospaced">
61138 headers_add = X-added-header: added by $primary_hostname\n\
61139               X-added-second: another added header line
61140 </literallayout>
61141 <para>
61142 Exim does not check the syntax of these added header lines.
61143 </para>
61144 <para>
61145 Multiple <option>headers_add</option> options for a single router or transport can be
61146 specified; the values will append to a single list of header lines.
61147 Each header-line is separately expanded.
61148 </para>
61149 <para>
61150 The argument of a <option>headers_remove</option> option must consist of a colon-separated
61151 list of header names. This is confusing, because header names themselves are
61152 often terminated by colons. In this case, the colons are the list separators,
61153 not part of the names. For example:
61154 </para>
61155 <literallayout class="monospaced">
61156 headers_remove = return-receipt-to:acknowledge-to
61157 </literallayout>
61158 <para>
61159 Multiple <option>headers_remove</option> options for a single router or transport can be
61160 specified; the arguments will append to a single header-names list.
61161 Each item is separately expanded.
61162 Note that colons in complex expansions which are used to
61163 form all or part of a <option>headers_remove</option> list
61164 will act as list separators.
61165 </para>
61166 <para>
61167 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
61168 items are expanded at routing time,
61169 and then associated with all addresses that are
61170 accepted by that router, and also with any new addresses that it generates. If
61171 an address passes through several routers as a result of aliasing or
61172 forwarding, the changes are cumulative.
61173 </para>
61174 <para>
61175 <indexterm role="option">
61176 <primary><option>unseen</option></primary>
61177 </indexterm>
61178 However, this does not apply to multiple routers that result from the use of
61179 the <option>unseen</option> option. Any header modifications that were specified by the
61180 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
61181 </para>
61182 <para>
61183 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
61184 settings cannot be delivered together in a batch, so a transport is always
61185 dealing with a set of addresses that have the same header-processing
61186 requirements.
61187 </para>
61188 <para>
61189 The transport starts by writing the original set of header lines that arrived
61190 with the message, possibly modified by the system filter. As it writes out
61191 these lines, it consults the list of header names that were attached to the
61192 recipient address(es) by <option>headers_remove</option> options in routers, and it also
61193 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
61194 names are on either of these lists are not written out. If there are multiple
61195 instances of any listed header, they are all skipped.
61196 </para>
61197 <para>
61198 After the remaining original header lines have been written, new header
61199 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
61200 the order in which they were attached to the address. These are followed by any
61201 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
61202 </para>
61203 <para>
61204 This way of handling header line modifications in routers and transports has
61205 the following consequences:
61206 </para>
61207 <itemizedlist>
61208 <listitem>
61209 <para>
61210 The original set of header lines, possibly modified by the system filter,
61211 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
61212 to it, at all times.
61213 </para>
61214 </listitem>
61215 <listitem>
61216 <para>
61217 Header lines that are added by a router&#x2019;s
61218 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
61219 expansion syntax in subsequent routers or the transport.
61220 </para>
61221 </listitem>
61222 <listitem>
61223 <para>
61224 Conversely, header lines that are specified for removal by <option>headers_remove</option>
61225 in a router remain visible to subsequent routers and the transport.
61226 </para>
61227 </listitem>
61228 <listitem>
61229 <para>
61230 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
61231 a later router or by a transport.
61232 </para>
61233 </listitem>
61234 <listitem>
61235 <para>
61236 An added header can refer to the contents of an original header that is to be
61237 removed, even it has the same name as the added header. For example:
61238 </para>
61239 <literallayout class="monospaced">
61240 headers_remove = subject
61241 headers_add = Subject: new subject (was: $h_subject:)
61242 </literallayout>
61243 </listitem>
61244 </itemizedlist>
61245 <para>
61246 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
61247 for a <command>redirect</command> router that has the <option>one_time</option> option set.
61248 </para>
61249 </section>
61250 <section id="SECTconstr">
61251 <title>Constructed addresses</title>
61252 <para>
61253 <indexterm role="concept">
61254 <primary>address</primary>
61255 <secondary>constructed</secondary>
61256 </indexterm>
61257 <indexterm role="concept">
61258 <primary>constructed address</primary>
61259 </indexterm>
61260 When Exim constructs a sender address for a locally-generated message, it uses
61261 the form
61262 </para>
61263 <literallayout>
61264 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
61265 </literallayout>
61266 <para>
61267 For example:
61268 </para>
61269 <literallayout class="monospaced">
61270 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
61271 </literallayout>
61272 <para>
61273 The user name is obtained from the <option>-F</option> command line option if set, or
61274 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
61275 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
61276 ampersand character, this is replaced by the login name with the first letter
61277 upper cased, as is conventional in a number of operating systems. See the
61278 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
61279 The <option>unknown_username</option> option can be used to specify user names in cases when
61280 there is no password file entry.
61281 </para>
61282 <para>
61283 <indexterm role="concept">
61284 <primary>RFC 2047</primary>
61285 </indexterm>
61286 In all cases, the user name is made to conform to RFC 2822 by quoting all or
61287 parts of it if necessary. In addition, if it contains any non-printing
61288 characters, it is encoded as described in RFC 2047, which defines a way of
61289 including non-ASCII characters in header lines. The value of the
61290 <option>headers_charset</option> option specifies the name of the encoding that is used (the
61291 characters are assumed to be in this encoding). The setting of
61292 <option>print_topbitchars</option> controls whether characters with the top bit set (that
61293 is, with codes greater than 127) count as printing characters or not.
61294 </para>
61295 </section>
61296 <section id="SECID230">
61297 <title>Case of local parts</title>
61298 <para>
61299 <indexterm role="concept">
61300 <primary>case of local parts</primary>
61301 </indexterm>
61302 <indexterm role="concept">
61303 <primary>local part</primary>
61304 <secondary>case of</secondary>
61305 </indexterm>
61306 RFC 2822 states that the case of letters in the local parts of addresses cannot
61307 be assumed to be non-significant. Exim preserves the case of local parts of
61308 addresses, but by default it uses a lower-cased form when it is routing,
61309 because on most Unix systems, usernames are in lower case and case-insensitive
61310 routing is required. However, any particular router can be made to use the
61311 original case for local parts by setting the <option>caseful_local_part</option> generic
61312 router option.
61313 </para>
61314 <para>
61315 <indexterm role="concept">
61316 <primary>mixed-case login names</primary>
61317 </indexterm>
61318 If you must have mixed-case user names on your system, the best way to proceed,
61319 assuming you want case-independent handling of incoming email, is to set up
61320 your first router to convert incoming local parts in your domains to the
61321 correct case by means of a file lookup. For example:
61322 </para>
61323 <literallayout class="monospaced">
61324 correct_case:
61325   driver = redirect
61326   domains = +local_domains
61327   data = ${lookup{$local_part}cdb\
61328               {/etc/usercased.cdb}{$value}fail}\
61329               @$domain
61330 </literallayout>
61331 <para>
61332 For this router, the local part is forced to lower case by the default action
61333 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
61334 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
61335 on any subsequent routers which process your domains, they will operate on
61336 local parts with the correct case in a case-sensitive manner.
61337 </para>
61338 </section>
61339 <section id="SECID231">
61340 <title>Dots in local parts</title>
61341 <para>
61342 <indexterm role="concept">
61343 <primary>dot</primary>
61344 <secondary>in local part</secondary>
61345 </indexterm>
61346 <indexterm role="concept">
61347 <primary>local part</primary>
61348 <secondary>dots in</secondary>
61349 </indexterm>
61350 RFC 2822 forbids empty components in local parts. That is, an unquoted local
61351 part may not begin or end with a dot, nor have two consecutive dots in the
61352 middle. However, it seems that many MTAs do not enforce this, so Exim permits
61353 empty components for compatibility.
61354 </para>
61355 </section>
61356 <section id="SECID232">
61357 <title>Rewriting addresses</title>
61358 <para>
61359 <indexterm role="concept">
61360 <primary>rewriting</primary>
61361 <secondary>addresses</secondary>
61362 </indexterm>
61363 Rewriting of sender and recipient addresses, and addresses in headers, can
61364 happen automatically, or as the result of configuration options, as described
61365 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
61366 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
61367 </para>
61368 <para>
61369 Automatic rewriting includes qualification, as mentioned above. The other case
61370 in which it can happen is when an incomplete non-local domain is given. The
61371 routing process may cause this to be expanded into the full domain name. For
61372 example, a header such as
61373 </para>
61374 <literallayout class="monospaced">
61375 To: hare@teaparty
61376 </literallayout>
61377 <para>
61378 might get rewritten as
61379 </para>
61380 <literallayout class="monospaced">
61381 To: hare@teaparty.wonderland.fict.example
61382 </literallayout>
61383 <para>
61384 Rewriting as a result of routing is the one kind of message processing that
61385 does not happen at input time, as it cannot be done until the address has
61386 been routed.
61387 </para>
61388 <para>
61389 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
61390 addresses have been routed, in case any of the headers get changed as a
61391 result of routing. However, doing this in practice would hold up many
61392 deliveries for unreasonable amounts of time, just because one address could not
61393 immediately be routed. Exim therefore does not delay other deliveries when
61394 routing of one or more addresses is deferred.
61395 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
61396 </para>
61397 </section>
61398 </chapter>
61399
61400 <chapter id="CHAPSMTP">
61401 <title>SMTP processing</title>
61402 <para>
61403 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
61404 <primary>SMTP</primary>
61405 <secondary>processing details</secondary>
61406 </indexterm>
61407 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
61408 <primary>LMTP</primary>
61409 <secondary>processing details</secondary>
61410 </indexterm>
61411 Exim supports a number of different ways of using the SMTP protocol, and its
61412 LMTP variant, which is an interactive protocol for transferring messages into a
61413 closed mail store application. This chapter contains details of how SMTP is
61414 processed. For incoming mail, the following are available:
61415 </para>
61416 <itemizedlist>
61417 <listitem>
61418 <para>
61419 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
61420 </para>
61421 </listitem>
61422 <listitem>
61423 <para>
61424 SMTP over the standard input and output (the <option>-bs</option> option);
61425 </para>
61426 </listitem>
61427 <listitem>
61428 <para>
61429 Batched SMTP on the standard input (the <option>-bS</option> option).
61430 </para>
61431 </listitem>
61432 </itemizedlist>
61433 <para>
61434 For mail delivery, the following are available:
61435 </para>
61436 <itemizedlist>
61437 <listitem>
61438 <para>
61439 SMTP over TCP/IP (the <command>smtp</command> transport);
61440 </para>
61441 </listitem>
61442 <listitem>
61443 <para>
61444 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
61445 <quote>lmtp</quote>);
61446 </para>
61447 </listitem>
61448 <listitem>
61449 <para>
61450 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
61451 transport);
61452 </para>
61453 </listitem>
61454 <listitem>
61455 <para>
61456 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
61457 the <option>use_bsmtp</option> option set).
61458 </para>
61459 </listitem>
61460 </itemizedlist>
61461 <para>
61462 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
61463 stored in or read from files (or pipes), in a format in which SMTP commands are
61464 used to contain the envelope information.
61465 </para>
61466 <section id="SECToutSMTPTCP">
61467 <title>Outgoing SMTP and LMTP over TCP/IP</title>
61468 <para>
61469 <indexterm role="concept">
61470 <primary>SMTP</primary>
61471 <secondary>outgoing over TCP/IP</secondary>
61472 </indexterm>
61473 <indexterm role="concept">
61474 <primary>outgoing SMTP over TCP/IP</primary>
61475 </indexterm>
61476 <indexterm role="concept">
61477 <primary>LMTP</primary>
61478 <secondary>over TCP/IP</secondary>
61479 </indexterm>
61480 <indexterm role="concept">
61481 <primary>outgoing LMTP over TCP/IP</primary>
61482 </indexterm>
61483 <indexterm role="concept">
61484 <primary>EHLO</primary>
61485 </indexterm>
61486 <indexterm role="concept">
61487 <primary>HELO</primary>
61488 </indexterm>
61489 <indexterm role="concept">
61490 <primary>SIZE option on MAIL command</primary>
61491 </indexterm>
61492 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
61493 The <option>protocol</option> option selects which protocol is to be used, but the actual
61494 processing is the same in both cases.
61495 </para>
61496 <para>
61497 If, in response to its EHLO command, Exim is told that the SIZE
61498 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
61499 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
61500 <option>size_addition</option> option (default 1024) to allow for additions to the message
61501 such as per-transport header lines, or changes made in a
61502 <indexterm role="concept">
61503 <primary>transport</primary>
61504 <secondary>filter</secondary>
61505 </indexterm>
61506 <indexterm role="concept">
61507 <primary>filter</primary>
61508 <secondary>transport filter</secondary>
61509 </indexterm>
61510 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
61511 suppressed.
61512 </para>
61513 <para>
61514 If the remote server advertises support for PIPELINING, Exim uses the
61515 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
61516 required for the transaction.
61517 </para>
61518 <para>
61519 If the remote server advertises support for the STARTTLS command, and Exim
61520 was built to support TLS encryption, it tries to start a TLS session unless the
61521 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
61522 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
61523 is called for verification.
61524 </para>
61525 <para>
61526 If the remote server advertises support for the AUTH command, Exim scans
61527 the authenticators configuration for any suitable client settings, as described
61528 in chapter <xref linkend="CHAPSMTPAUTH"/>.
61529 </para>
61530 <para>
61531 <indexterm role="concept">
61532 <primary>carriage return</primary>
61533 </indexterm>
61534 <indexterm role="concept">
61535 <primary>linefeed</primary>
61536 </indexterm>
61537 Responses from the remote host are supposed to be terminated by CR followed by
61538 LF. However, there are known to be hosts that do not send CR characters, so in
61539 order to be able to interwork with such hosts, Exim treats LF on its own as a
61540 line terminator.
61541 </para>
61542 <para>
61543 If a message contains a number of different addresses, all those with the same
61544 characteristics (for example, the same envelope sender) that resolve to the
61545 same set of hosts, in the same order, are sent in a single SMTP transaction,
61546 even if they are for different domains, unless there are more than the setting
61547 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
61548 they are split into groups containing no more than <option>max_rcpt</option>s addresses
61549 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
61550 in parallel sessions. The order of hosts with identical MX values is not
61551 significant when checking whether addresses can be batched in this way.
61552 </para>
61553 <para>
61554 When the <command>smtp</command> transport suffers a temporary failure that is not
61555 message-related, Exim updates its transport-specific database, which contains
61556 records indexed by host name that remember which messages are waiting for each
61557 particular host. It also updates the retry database with new retry times.
61558 </para>
61559 <para>
61560 <indexterm role="concept">
61561 <primary>hints database</primary>
61562 <secondary>retry keys</secondary>
61563 </indexterm>
61564 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
61565 a multi-homed host is broken, it will soon be skipped most of the time.
61566 See the next section for more detail about error handling.
61567 </para>
61568 <para>
61569 <indexterm role="concept">
61570 <primary>SMTP</primary>
61571 <secondary>passed connection</secondary>
61572 </indexterm>
61573 <indexterm role="concept">
61574 <primary>SMTP</primary>
61575 <secondary>batching over TCP/IP</secondary>
61576 </indexterm>
61577 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
61578 looks in the hints database for the transport to see if there are any queued
61579 messages waiting for the host to which it is connected. If it finds one, it
61580 creates a new Exim process using the <option>-MC</option> option (which can only be used by
61581 a process running as root or the Exim user) and passes the TCP/IP socket to it
61582 so that it can deliver another message using the same socket. The new process
61583 does only those deliveries that are routed to the connected host, and may in
61584 turn pass the socket on to a third process, and so on.
61585 </para>
61586 <para>
61587 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
61588 limit the number of messages sent down a single TCP/IP connection.
61589 </para>
61590 <para>
61591 <indexterm role="concept">
61592 <primary>asterisk</primary>
61593 <secondary>after IP address</secondary>
61594 </indexterm>
61595 The second and subsequent messages delivered down an existing connection are
61596 identified in the main log by the addition of an asterisk after the closing
61597 square bracket of the IP address.
61598 </para>
61599 </section>
61600 <section id="SECToutSMTPerr">
61601 <title>Errors in outgoing SMTP</title>
61602 <para>
61603 <indexterm role="concept">
61604 <primary>error</primary>
61605 <secondary>in outgoing SMTP</secondary>
61606 </indexterm>
61607 <indexterm role="concept">
61608 <primary>SMTP</primary>
61609 <secondary>errors in outgoing</secondary>
61610 </indexterm>
61611 <indexterm role="concept">
61612 <primary>host</primary>
61613 <secondary>error</secondary>
61614 </indexterm>
61615 Three different kinds of error are recognized for outgoing SMTP: host errors,
61616 message errors, and recipient errors.
61617 </para>
61618 <variablelist>
61619 <varlistentry>
61620 <term><emphasis role="bold">Host errors</emphasis></term>
61621 <listitem>
61622 <para>
61623 A host error is not associated with a particular message or with a
61624 particular recipient of a message. The host errors are:
61625 </para>
61626 <itemizedlist>
61627 <listitem>
61628 <para>
61629 Connection refused or timed out,
61630 </para>
61631 </listitem>
61632 <listitem>
61633 <para>
61634 Any error response code on connection,
61635 </para>
61636 </listitem>
61637 <listitem>
61638 <para>
61639 Any error response code to EHLO or HELO,
61640 </para>
61641 </listitem>
61642 <listitem>
61643 <para>
61644 Loss of connection at any time, except after <quote>.</quote>,
61645 </para>
61646 </listitem>
61647 <listitem>
61648 <para>
61649 I/O errors at any time,
61650 </para>
61651 </listitem>
61652 <listitem>
61653 <para>
61654 Timeouts during the session, other than in response to MAIL, RCPT or
61655 the <quote>.</quote> at the end of the data.
61656 </para>
61657 </listitem>
61658 </itemizedlist>
61659 <para>
61660 For a host error, a permanent error response on connection, or in response to
61661 EHLO, causes all addresses routed to the host to be failed. Any other host
61662 error causes all addresses to be deferred, and retry data to be created for the
61663 host. It is not tried again, for any message, until its retry time arrives. If
61664 the current set of addresses are not all delivered in this run (to some
61665 alternative host), the message is added to the list of those waiting for this
61666 host, so if it is still undelivered when a subsequent successful delivery is
61667 made to the host, it will be sent down the same SMTP connection.
61668 </para>
61669 </listitem></varlistentry>
61670 <varlistentry>
61671 <term><emphasis role="bold">Message errors</emphasis></term>
61672 <listitem>
61673 <para>
61674 <indexterm role="concept">
61675 <primary>message</primary>
61676 <secondary>error</secondary>
61677 </indexterm>
61678 A message error is associated with a particular message when sent to a
61679 particular host, but not with a particular recipient of the message. The
61680 message errors are:
61681 </para>
61682 <itemizedlist>
61683 <listitem>
61684 <para>
61685 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
61686 the data,
61687 </para>
61688 </listitem>
61689 <listitem>
61690 <para>
61691 Timeout after MAIL,
61692 </para>
61693 </listitem>
61694 <listitem>
61695 <para>
61696 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
61697 timeout after the DATA command itself is treated as a host error, as is loss of
61698 connection at any other time.
61699 </para>
61700 </listitem>
61701 </itemizedlist>
61702 <para>
61703 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
61704 to be failed, and a delivery error report to be returned to the sender. A
61705 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
61706 addresses to be deferred. Retry data is not created for the host, but instead,
61707 a retry record for the combination of host plus message id is created. The
61708 message is not added to the list of those waiting for this host. This ensures
61709 that the failing message will not be sent to this host again until the retry
61710 time arrives. However, other messages that are routed to the host are not
61711 affected, so if it is some property of the message that is causing the error,
61712 it will not stop the delivery of other mail.
61713 </para>
61714 <para>
61715 If the remote host specified support for the SIZE parameter in its response
61716 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
61717 over-large message will cause a message error because the error arrives as a
61718 response to MAIL.
61719 </para>
61720 </listitem></varlistentry>
61721 <varlistentry>
61722 <term><emphasis role="bold">Recipient errors</emphasis></term>
61723 <listitem>
61724 <para>
61725 <indexterm role="concept">
61726 <primary>recipient</primary>
61727 <secondary>error</secondary>
61728 </indexterm>
61729 A recipient error is associated with a particular recipient of a message. The
61730 recipient errors are:
61731 </para>
61732 <itemizedlist>
61733 <listitem>
61734 <para>
61735 Any error response to RCPT,
61736 </para>
61737 </listitem>
61738 <listitem>
61739 <para>
61740 Timeout after RCPT.
61741 </para>
61742 </listitem>
61743 </itemizedlist>
61744 <para>
61745 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
61746 recipient address to be failed, and a bounce message to be returned to the
61747 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
61748 address to be deferred, and routing retry data to be created for it. This is
61749 used to delay processing of the address in subsequent queue runs, until its
61750 routing retry time arrives. This applies to all messages, but because it
61751 operates only in queue runs, one attempt will be made to deliver a new message
61752 to the failing address before the delay starts to operate. This ensures that,
61753 if the failure is really related to the message rather than the recipient
61754 (<quote>message too big for this recipient</quote> is a possible example), other messages
61755 have a chance of getting delivered. If a delivery to the address does succeed,
61756 the retry information gets cleared, so all stuck messages get tried again, and
61757 the retry clock is reset.
61758 </para>
61759 <para>
61760 The message is not added to the list of those waiting for this host. Use of the
61761 host for other messages is unaffected, and except in the case of a timeout,
61762 other recipients are processed independently, and may be successfully delivered
61763 in the current SMTP session. After a timeout it is of course impossible to
61764 proceed with the session, so all addresses get deferred. However, those other
61765 than the one that failed do not suffer any subsequent retry delays. Therefore,
61766 if one recipient is causing trouble, the others have a chance of getting
61767 through when a subsequent delivery attempt occurs before the failing
61768 recipient&#x2019;s retry time.
61769 </para>
61770 </listitem></varlistentry>
61771 </variablelist>
61772 <para>
61773 In all cases, if there are other hosts (or IP addresses) available for the
61774 current set of addresses (for example, from multiple MX records), they are
61775 tried in this run for any undelivered addresses, subject of course to their
61776 own retry data. In other words, recipient error retry data does not take effect
61777 until the next delivery attempt.
61778 </para>
61779 <para>
61780 Some hosts have been observed to give temporary error responses to every
61781 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
61782 would be nice if such circumstances could be recognized, and defer data for the
61783 host itself created, but this is not possible within the current Exim design.
61784 What actually happens is that retry data for every (host, message) combination
61785 is created.
61786 </para>
61787 <para>
61788 The reason that timeouts after MAIL and RCPT are treated specially is that
61789 these can sometimes arise as a result of the remote host&#x2019;s verification
61790 procedures. Exim makes this assumption, and treats them as if a temporary error
61791 response had been received. A timeout after <quote>.</quote> is treated specially because
61792 it is known that some broken implementations fail to recognize the end of the
61793 message if the last character of the last line is a binary zero. Thus, it is
61794 helpful to treat this case as a message error.
61795 </para>
61796 <para>
61797 Timeouts at other times are treated as host errors, assuming a problem with the
61798 host, or the connection to it. If a timeout after MAIL, RCPT,
61799 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
61800 the timeout is likely to occur at some other point in the dialogue, causing it
61801 then to be treated as a host error.
61802 </para>
61803 <para>
61804 There is experimental evidence that some MTAs drop the connection after the
61805 terminating <quote>.</quote> if they do not like the contents of the message for some
61806 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
61807 should be given. That is why Exim treats this case as a message rather than a
61808 host error, in order not to delay other messages to the same host.
61809 </para>
61810 </section>
61811 <section id="SECID233">
61812 <title>Incoming SMTP messages over TCP/IP</title>
61813 <para>
61814 <indexterm role="concept">
61815 <primary>SMTP</primary>
61816 <secondary>incoming over TCP/IP</secondary>
61817 </indexterm>
61818 <indexterm role="concept">
61819 <primary>incoming SMTP over TCP/IP</primary>
61820 </indexterm>
61821 <indexterm role="concept">
61822 <primary>inetd</primary>
61823 </indexterm>
61824 <indexterm role="concept">
61825 <primary>daemon</primary>
61826 </indexterm>
61827 Incoming SMTP messages can be accepted in one of two ways: by running a
61828 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
61829 <filename>/etc/inetd.conf</filename> should be like this:
61830 </para>
61831 <literallayout class="monospaced">
61832 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
61833 </literallayout>
61834 <para>
61835 Exim distinguishes between this case and the case of a locally running user
61836 agent using the <option>-bs</option> option by checking whether or not the standard input is
61837 a socket. When it is, either the port must be privileged (less than 1024), or
61838 the caller must be root or the Exim user. If any other user passes a socket
61839 with an unprivileged port number, Exim prints a message on the standard error
61840 stream and exits with an error code.
61841 </para>
61842 <para>
61843 By default, Exim does not make a log entry when a remote host connects or
61844 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
61845 unexpected. It can be made to write such log entries by setting the
61846 <option>smtp_connection</option> log selector.
61847 </para>
61848 <para>
61849 <indexterm role="concept">
61850 <primary>carriage return</primary>
61851 </indexterm>
61852 <indexterm role="concept">
61853 <primary>linefeed</primary>
61854 </indexterm>
61855 Commands from the remote host are supposed to be terminated by CR followed by
61856 LF. However, there are known to be hosts that do not send CR characters. In
61857 order to be able to interwork with such hosts, Exim treats LF on its own as a
61858 line terminator.
61859 Furthermore, because common code is used for receiving messages from all
61860 sources, a CR on its own is also interpreted as a line terminator. However, the
61861 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
61862 </para>
61863 <para>
61864 <indexterm role="concept">
61865 <primary>EHLO</primary>
61866 <secondary>invalid data</secondary>
61867 </indexterm>
61868 <indexterm role="concept">
61869 <primary>HELO</primary>
61870 <secondary>invalid data</secondary>
61871 </indexterm>
61872 One area that sometimes gives rise to problems concerns the EHLO or
61873 HELO commands. Some clients send syntactically invalid versions of these
61874 commands, which Exim rejects by default. (This is nothing to do with verifying
61875 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
61876 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
61877 match the broken hosts that send invalid commands.
61878 </para>
61879 <para>
61880 <indexterm role="concept">
61881 <primary>SIZE option on MAIL command</primary>
61882 </indexterm>
61883 <indexterm role="concept">
61884 <primary>MAIL</primary>
61885 <secondary>SIZE option</secondary>
61886 </indexterm>
61887 The amount of disk space available is checked whenever SIZE is received on
61888 a MAIL command, independently of whether <option>message_size_limit</option> or
61889 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
61890 false. A temporary error is given if there is not enough space. If
61891 <option>check_spool_space</option> is set, the check is for that amount of space plus the
61892 value given with SIZE, that is, it checks that the addition of the incoming
61893 message will not reduce the space below the threshold.
61894 </para>
61895 <para>
61896 When a message is successfully received, Exim includes the local message id in
61897 its response to the final <quote>.</quote> that terminates the data. If the remote host
61898 logs this text it can help with tracing what has happened to a message.
61899 </para>
61900 <para>
61901 The Exim daemon can limit the number of simultaneous incoming connections it is
61902 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
61903 number of simultaneous incoming connections from a single remote host (see the
61904 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
61905 rejected using the SMTP temporary error code 421.
61906 </para>
61907 <para>
61908 The Exim daemon does not rely on the SIGCHLD signal to detect when a
61909 subprocess has finished, as this can get lost at busy times. Instead, it looks
61910 for completed subprocesses every time it wakes up. Provided there are other
61911 things happening (new incoming calls, starts of queue runs), completed
61912 processes will be noticed and tidied away. On very quiet systems you may
61913 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
61914 it will be noticed when the daemon next wakes up.
61915 </para>
61916 <para>
61917 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
61918 and can also be set up to reject SMTP calls from non-reserved hosts at times of
61919 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
61920 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
61921 applies in both the daemon and <emphasis>inetd</emphasis> cases.
61922 </para>
61923 <para>
61924 Exim normally starts a delivery process for each message received, though this
61925 can be varied by means of the <option>-odq</option> command line option and the
61926 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
61927 number of simultaneously running delivery processes started in this way from
61928 SMTP input can be limited by the <option>smtp_accept_queue</option> and
61929 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
61930 subsequently received messages are just put on the input queue without starting
61931 a delivery process.
61932 </para>
61933 <para>
61934 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
61935 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
61936 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
61937 handled by an entirely independent Exim process. Control by load average is,
61938 however, available with <emphasis>inetd</emphasis>.
61939 </para>
61940 <para>
61941 Exim can be configured to verify addresses in incoming SMTP commands as they
61942 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
61943 to rewrite addresses at this time &ndash; before any syntax checking is done. See
61944 section <xref linkend="SECTrewriteS"/>.
61945 </para>
61946 <para>
61947 Exim can also be configured to limit the rate at which a client host submits
61948 MAIL and RCPT commands in a single SMTP session. See the
61949 <option>smtp_ratelimit_hosts</option> option.
61950 </para>
61951 </section>
61952 <section id="SECID234">
61953 <title>Unrecognized SMTP commands</title>
61954 <para>
61955 <indexterm role="concept">
61956 <primary>SMTP</primary>
61957 <secondary>unrecognized commands</secondary>
61958 </indexterm>
61959 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
61960 commands during a single SMTP connection, it drops the connection after sending
61961 the error response to the last command. The default value for
61962 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
61963 abuse that subvert web servers into making connections to SMTP ports; in these
61964 circumstances, a number of non-SMTP lines are sent first.
61965 </para>
61966 </section>
61967 <section id="SECID235">
61968 <title>Syntax and protocol errors in SMTP commands</title>
61969 <para>
61970 <indexterm role="concept">
61971 <primary>SMTP</primary>
61972 <secondary>syntax errors</secondary>
61973 </indexterm>
61974 <indexterm role="concept">
61975 <primary>SMTP</primary>
61976 <secondary>protocol errors</secondary>
61977 </indexterm>
61978 A syntax error is detected if an SMTP command is recognized, but there is
61979 something syntactically wrong with its data, for example, a malformed email
61980 address in a RCPT command. Protocol errors include invalid command
61981 sequencing such as RCPT before MAIL. If Exim receives more than
61982 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
61983 drops the connection after sending the error response to the last command. The
61984 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
61985 broken clients that loop sending bad commands (yes, it has been seen).
61986 </para>
61987 </section>
61988 <section id="SECID236">
61989 <title>Use of non-mail SMTP commands</title>
61990 <para>
61991 <indexterm role="concept">
61992 <primary>SMTP</primary>
61993 <secondary>non-mail commands</secondary>
61994 </indexterm>
61995 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
61996 DATA. Exim counts such commands, and drops the connection if there are too
61997 many of them in a single SMTP session. This action catches some
61998 denial-of-service attempts and things like repeated failing AUTHs, or a mad
61999 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
62000 defines what <quote>too many</quote> means. Its default value is 10.
62001 </para>
62002 <para>
62003 When a new message is expected, one occurrence of RSET is not counted. This
62004 allows a client to send one RSET between messages (this is not necessary,
62005 but some clients do it). Exim also allows one uncounted occurrence of HELO
62006 or EHLO, and one occurrence of STARTTLS between messages. After
62007 starting up a TLS session, another EHLO is expected, and so it too is not
62008 counted.
62009 </para>
62010 <para>
62011 The first occurrence of AUTH in a connection, or immediately following
62012 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
62013 RCPT, DATA, and QUIT are counted.
62014 </para>
62015 <para>
62016 You can control which hosts are subject to the limit set by
62017 <option>smtp_accept_max_nonmail</option> by setting
62018 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
62019 the limit apply to all hosts. This option means that you can exclude any
62020 specific badly-behaved hosts that you have to live with.
62021 </para>
62022 </section>
62023 <section id="SECID237">
62024 <title>The VRFY and EXPN commands</title>
62025 <para>
62026 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
62027 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
62028 appropriate) in order to decide whether the command should be accepted or not.
62029 If no ACL is defined, the command is rejected.
62030 </para>
62031 <para>
62032 <indexterm role="concept">
62033 <primary>VRFY</primary>
62034 <secondary>processing</secondary>
62035 </indexterm>
62036 When VRFY is accepted, it runs exactly the same code as when Exim is
62037 called with the <option>-bv</option> option.
62038 </para>
62039 <para>
62040 <indexterm role="concept">
62041 <primary>EXPN</primary>
62042 <secondary>processing</secondary>
62043 </indexterm>
62044 When EXPN is accepted, a single-level expansion of the address is done.
62045 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
62046 than a verification (the <option>-bv</option> option). If an unqualified local part is given
62047 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
62048 of VRFY and EXPN commands are logged on the main and reject logs, and
62049 VRFY verification failures are logged on the main log for consistency with
62050 RCPT failures.
62051 </para>
62052 </section>
62053 <section id="SECTETRN">
62054 <title>The ETRN command</title>
62055 <para>
62056 <indexterm role="concept">
62057 <primary>ETRN</primary>
62058 <secondary>processing</secondary>
62059 </indexterm>
62060 RFC 1985 describes an SMTP command called ETRN that is designed to
62061 overcome the security problems of the TURN command (which has fallen into
62062 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
62063 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
62064 should be accepted or not. If no ACL is defined, the command is rejected.
62065 </para>
62066 <para>
62067 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
62068 delivery to certain hosts. As Exim does not organize its message queue by host,
62069 the only form of ETRN that is supported by default is the one where the
62070 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
62071 specific to the SMTP server. A valid ETRN command causes a run of Exim with
62072 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
62073 argument. For example,
62074 </para>
62075 <literallayout class="monospaced">
62076 ETRN #brigadoon
62077 </literallayout>
62078 <para>
62079 runs the command
62080 </para>
62081 <literallayout class="monospaced">
62082 exim -R brigadoon
62083 </literallayout>
62084 <para>
62085 which causes a delivery attempt on all messages with undelivered addresses
62086 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
62087 default), Exim prevents the simultaneous execution of more than one queue run
62088 for the same argument string as a result of an ETRN command. This stops
62089 a misbehaving client from starting more than one queue runner at once.
62090 </para>
62091 <para>
62092 <indexterm role="concept">
62093 <primary>hints database</primary>
62094 <secondary>ETRN serialization</secondary>
62095 </indexterm>
62096 Exim implements the serialization by means of a hints database in which a
62097 record is written whenever a process is started by ETRN, and deleted when
62098 the process completes. However, Exim does not keep the SMTP session waiting for
62099 the ETRN process to complete. Once ETRN is accepted, the client is sent
62100 a <quote>success</quote> return code. Obviously there is scope for hints records to get
62101 left lying around if there is a system or program crash. To guard against this,
62102 Exim ignores any records that are more than six hours old.
62103 </para>
62104 <para>
62105 <indexterm role="option">
62106 <primary><option>smtp_etrn_command</option></primary>
62107 </indexterm>
62108 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
62109 used. This specifies a command that is run whenever ETRN is received,
62110 whatever the form of its argument. For
62111 example:
62112 </para>
62113 <literallayout class="monospaced">
62114 smtp_etrn_command = /etc/etrn_command $domain \
62115                     $sender_host_address
62116 </literallayout>
62117 <para>
62118 <indexterm role="variable">
62119 <primary><varname>$domain</varname></primary>
62120 </indexterm>
62121 The string is split up into arguments which are independently expanded. The
62122 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
62123 and no syntax checking is done on the contents of this argument. Exim does not
62124 wait for the command to complete, so its status code is not checked. Exim runs
62125 under its own uid and gid when receiving incoming SMTP, so it is not possible
62126 for it to change them before running the command.
62127 </para>
62128 </section>
62129 <section id="SECID238">
62130 <title>Incoming local SMTP</title>
62131 <para>
62132 <indexterm role="concept">
62133 <primary>SMTP</primary>
62134 <secondary>local incoming</secondary>
62135 </indexterm>
62136 Some user agents use SMTP to pass messages to their local MTA using the
62137 standard input and output, as opposed to passing the envelope on the command
62138 line and writing the message to the standard input. This is supported by the
62139 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
62140 messages over TCP/IP (including the use of ACLs), except that the envelope
62141 sender given in a MAIL command is ignored unless the caller is trusted. In
62142 an ACL you can detect this form of SMTP input by testing for an empty host
62143 identification. It is common to have this as the first line in the ACL that
62144 runs for RCPT commands:
62145 </para>
62146 <literallayout class="monospaced">
62147 accept hosts = :
62148 </literallayout>
62149 <para>
62150 This accepts SMTP messages from local processes without doing any other tests.
62151 </para>
62152 </section>
62153 <section id="SECTbatchSMTP">
62154 <title>Outgoing batched SMTP</title>
62155 <para>
62156 <indexterm role="concept">
62157 <primary>SMTP</primary>
62158 <secondary>batched outgoing</secondary>
62159 </indexterm>
62160 <indexterm role="concept">
62161 <primary>batched SMTP output</primary>
62162 </indexterm>
62163 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
62164 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
62165 be output in BSMTP format. No SMTP responses are possible for this form of
62166 delivery. All it is doing is using SMTP commands as a way of transmitting the
62167 envelope along with the message.
62168 </para>
62169 <para>
62170 The message is written to the file or pipe preceded by the SMTP commands
62171 MAIL and RCPT, and followed by a line containing a single dot. Lines in
62172 the message that start with a dot have an extra dot added. The SMTP command
62173 HELO is not normally used. If it is required, the <option>message_prefix</option> option
62174 can be used to specify it.
62175 </para>
62176 <para>
62177 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
62178 one recipient address at a time by default. However, you can arrange for them
62179 to handle several addresses at once by setting the <option>batch_max</option> option. When
62180 this is done for BSMTP, messages may contain multiple RCPT commands. See
62181 chapter <xref linkend="CHAPbatching"/> for more details.
62182 </para>
62183 <para>
62184 <indexterm role="variable">
62185 <primary><varname>$host</varname></primary>
62186 </indexterm>
62187 When one or more addresses are routed to a BSMTP transport by a router that
62188 sets up a host list, the name of the first host on the list is available to the
62189 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
62190 router:
62191 </para>
62192 <literallayout class="monospaced">
62193 begin routers
62194 route_append:
62195   driver = manualroute
62196   transport = smtp_appendfile
62197   route_list = domain.example  batch.host.example
62198
62199 begin transports
62200 smtp_appendfile:
62201   driver = appendfile
62202   directory = /var/bsmtp/$host
62203   batch_max = 1000
62204   use_bsmtp
62205   user = exim
62206 </literallayout>
62207 <para>
62208 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
62209 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
62210 message (unless there are more than 1000 recipients).
62211 </para>
62212 </section>
62213 <section id="SECTincomingbatchedSMTP">
62214 <title>Incoming batched SMTP</title>
62215 <para>
62216 <indexterm role="concept">
62217 <primary>SMTP</primary>
62218 <secondary>batched incoming</secondary>
62219 </indexterm>
62220 <indexterm role="concept">
62221 <primary>batched SMTP input</primary>
62222 </indexterm>
62223 The <option>-bS</option> command line option causes Exim to accept one or more messages by
62224 reading SMTP on the standard input, but to generate no responses. If the caller
62225 is trusted, the senders in the MAIL commands are believed; otherwise the
62226 sender is always the caller of Exim. Unqualified senders and receivers are not
62227 rejected (there seems little point) but instead just get qualified. HELO
62228 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
62229 as NOOP; QUIT quits.
62230 </para>
62231 <para>
62232 Minimal policy checking is done for BSMTP input. Only the non-SMTP
62233 ACL is run in the same way as for non-SMTP local input.
62234 </para>
62235 <para>
62236 If an error is detected while reading a message, including a missing <quote>.</quote> at
62237 the end, Exim gives up immediately. It writes details of the error to the
62238 standard output in a stylized way that the calling program should be able to
62239 make some use of automatically, for example:
62240 </para>
62241 <literallayout class="monospaced">
62242 554 Unexpected end of file
62243 Transaction started in line 10
62244 Error detected in line 14
62245 </literallayout>
62246 <para>
62247 It writes a more verbose version, for human consumption, to the standard error
62248 file, for example:
62249 </para>
62250 <literallayout class="monospaced">
62251 An error was detected while processing a file of BSMTP input.
62252 The error message was:
62253
62254 501 '&gt;' missing at end of address
62255
62256 The SMTP transaction started in line 10.
62257 The error was detected in line 12.
62258 The SMTP command at fault was:
62259
62260 rcpt to:&lt;malformed@in.com.plete
62261
62262 1 previous message was successfully processed.
62263 The rest of the batch was abandoned.
62264 </literallayout>
62265 <para>
62266 The return code from Exim is zero only if there were no errors. It is 1 if some
62267 messages were accepted before an error was detected, and 2 if no messages were
62268 accepted.
62269 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
62270 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
62271 </para>
62272 </section>
62273 </chapter>
62274
62275 <chapter id="CHAPemsgcust">
62276 <title>Customizing bounce and warning messages</title>
62277 <titleabbrev>Customizing messages</titleabbrev>
62278 <para>
62279 When a message fails to be delivered, or remains on the queue for more than a
62280 configured amount of time, Exim sends a message to the original sender, or
62281 to an alternative configured address. The text of these messages is built into
62282 the code of Exim, but it is possible to change it, either by adding a single
62283 string, or by replacing each of the paragraphs by text supplied in a file.
62284 </para>
62285 <para>
62286 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
62287 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
62288 option. Exim also adds the line
62289 </para>
62290 <literallayout class="monospaced">
62291 Auto-Submitted: auto-generated
62292 </literallayout>
62293 <para>
62294 to all warning and bounce messages,
62295 </para>
62296 <section id="SECID239">
62297 <title>Customizing bounce messages</title>
62298 <para>
62299 <indexterm role="concept">
62300 <primary>customizing</primary>
62301 <secondary>bounce message</secondary>
62302 </indexterm>
62303 <indexterm role="concept">
62304 <primary>bounce message</primary>
62305 <secondary>customizing</secondary>
62306 </indexterm>
62307 If <option>bounce_message_text</option> is set, its contents are included in the default
62308 message immediately after <quote>This message was created automatically by mail
62309 delivery software.</quote> The string is not expanded. It is not used if
62310 <option>bounce_message_file</option> is set.
62311 </para>
62312 <para>
62313 When <option>bounce_message_file</option> is set, it must point to a template file for
62314 constructing error messages. The file consists of a series of text items,
62315 separated by lines consisting of exactly four asterisks. If the file cannot be
62316 opened, default text is used and a message is written to the main and panic
62317 logs. If any text item in the file is empty, default text is used for that
62318 item.
62319 </para>
62320 <para>
62321 <indexterm role="variable">
62322 <primary><varname>$bounce_recipient</varname></primary>
62323 </indexterm>
62324 <indexterm role="variable">
62325 <primary><varname>$bounce_return_size_limit</varname></primary>
62326 </indexterm>
62327 Each item of text that is read from the file is expanded, and there are two
62328 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
62329 the recipient of an error message while it is being created, and
62330 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
62331 option, rounded to a whole number.
62332 </para>
62333 <para>
62334 The items must appear in the file in the following order:
62335 </para>
62336 <itemizedlist>
62337 <listitem>
62338 <para>
62339 The first item is included in the headers, and should include at least a
62340 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
62341 </para>
62342 </listitem>
62343 <listitem>
62344 <para>
62345 The second item forms the start of the error message. After it, Exim lists the
62346 failing addresses with their error messages.
62347 </para>
62348 </listitem>
62349 <listitem>
62350 <para>
62351 The third item is used to introduce any text from pipe transports that is to be
62352 returned to the sender. It is omitted if there is no such text.
62353 </para>
62354 </listitem>
62355 <listitem>
62356 <para revisionflag="changed">
62357 The fourth, fifth and sixth items will be ignored and may be empty.
62358 The fields exist for back-compatibility
62359 </para>
62360 </listitem>
62361 </itemizedlist>
62362 <para>
62363 The default state (<option>bounce_message_file</option> unset) is equivalent to the
62364 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
62365 other lines have been split in order to fit them on the page:
62366 </para>
62367 <literallayout class="monospaced">
62368 Subject: Mail delivery failed
62369   ${if eq{$sender_address}{$bounce_recipient}
62370   {: returning message to sender}}
62371 ****
62372 This message was created automatically by mail delivery software.
62373
62374 A message ${if eq{$sender_address}{$bounce_recipient}
62375   {that you sent }{sent by
62376
62377 &lt;$sender_address&gt;
62378
62379 }}could not be delivered to all of its recipients.
62380 This is a permanent error. The following address(es) failed:
62381 ****
62382 The following text was generated during the delivery attempt(s):
62383 ****
62384 ------ This is a copy of the message, including all the headers.
62385   ------
62386 ****
62387 ------ The body of the message is $message_size characters long;
62388   only the first
62389 ------ $bounce_return_size_limit or so are included here.
62390 ****
62391 </literallayout>
62392 </section>
62393 <section id="SECTcustwarn">
62394 <title>Customizing warning messages</title>
62395 <para>
62396 <indexterm role="concept">
62397 <primary>customizing</primary>
62398 <secondary>warning message</secondary>
62399 </indexterm>
62400 <indexterm role="concept">
62401 <primary>warning of delay</primary>
62402 <secondary>customizing the message</secondary>
62403 </indexterm>
62404 The option <option>warn_message_file</option> can be pointed at a template file for use when
62405 warnings about message delays are created. In this case there are only three
62406 text sections:
62407 </para>
62408 <itemizedlist>
62409 <listitem>
62410 <para>
62411 The first item is included in the headers, and should include at least a
62412 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
62413 </para>
62414 </listitem>
62415 <listitem>
62416 <para>
62417 The second item forms the start of the warning message. After it, Exim lists
62418 the delayed addresses.
62419 </para>
62420 </listitem>
62421 <listitem>
62422 <para>
62423 The third item then ends the message.
62424 </para>
62425 </listitem>
62426 </itemizedlist>
62427 <para>
62428 The default state is equivalent to the following file, except that some lines
62429 have been split here, in order to fit them on the page:
62430 </para>
62431 <literallayout class="monospaced">
62432 Subject: Warning: message $message_exim_id delayed
62433   $warn_message_delay
62434 ****
62435 This message was created automatically by mail delivery software.
62436
62437 A message ${if eq{$sender_address}{$warn_message_recipients}
62438 {that you sent }{sent by
62439
62440 &lt;$sender_address&gt;
62441
62442 }}has not been delivered to all of its recipients after
62443 more than $warn_message_delay on the queue on $primary_hostname.
62444
62445 The message identifier is:     $message_exim_id
62446 The subject of the message is: $h_subject
62447 The date of the message is:    $h_date
62448
62449 The following address(es) have not yet been delivered:
62450 ****
62451 No action is required on your part. Delivery attempts will
62452 continue for some time, and this warning may be repeated at
62453 intervals if the message remains undelivered. Eventually the
62454 mail delivery software will give up, and when that happens,
62455 the message will be returned to you.
62456 </literallayout>
62457 <para>
62458 <indexterm role="variable">
62459 <primary><varname>$warn_message_delay</varname></primary>
62460 </indexterm>
62461 <indexterm role="variable">
62462 <primary><varname>$warn_message_recipients</varname></primary>
62463 </indexterm>
62464 However, in the default state the subject and date lines are omitted if no
62465 appropriate headers exist. During the expansion of this file,
62466 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
62467 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
62468 of recipients for the warning message. There may be more than one if there are
62469 multiple addresses with different <option>errors_to</option> settings on the routers that
62470 handled them.
62471 </para>
62472 </section>
62473 </chapter>
62474
62475 <chapter id="CHAPcomconreq">
62476 <title>Some common configuration settings</title>
62477 <para>
62478 This chapter discusses some configuration settings that seem to be fairly
62479 common. More examples and discussion can be found in the Exim book.
62480 </para>
62481 <section id="SECID240">
62482 <title>Sending mail to a smart host</title>
62483 <para>
62484 <indexterm role="concept">
62485 <primary>smart host</primary>
62486 <secondary>example router</secondary>
62487 </indexterm>
62488 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
62489 should replace the default <command>dnslookup</command> router with a router which does the
62490 routing explicitly:
62491 </para>
62492 <literallayout class="monospaced">
62493 send_to_smart_host:
62494   driver = manualroute
62495   route_list = !+local_domains smart.host.name
62496   transport = remote_smtp
62497 </literallayout>
62498 <para>
62499 You can use the smart host&#x2019;s IP address instead of the name if you wish.
62500 If you are using Exim only to submit messages to a smart host, and not for
62501 receiving incoming messages, you can arrange for it to do the submission
62502 synchronously by setting the <option>mua_wrapper</option> option (see chapter
62503 <xref linkend="CHAPnonqueueing"/>).
62504 </para>
62505 </section>
62506 <section id="SECTmailinglists">
62507 <title>Using Exim to handle mailing lists</title>
62508 <para>
62509 <indexterm role="concept">
62510 <primary>mailing lists</primary>
62511 </indexterm>
62512 Exim can be used to run simple mailing lists, but for large and/or complicated
62513 requirements, the use of additional specialized mailing list software such as
62514 Majordomo or Mailman is recommended.
62515 </para>
62516 <para>
62517 The <command>redirect</command> router can be used to handle mailing lists where each list
62518 is maintained in a separate file, which can therefore be managed by an
62519 independent manager. The <option>domains</option> router option can be used to run these
62520 lists in a separate domain from normal mail. For example:
62521 </para>
62522 <literallayout class="monospaced">
62523 lists:
62524   driver = redirect
62525   domains = lists.example
62526   file = /usr/lists/$local_part
62527   forbid_pipe
62528   forbid_file
62529   errors_to = $local_part-request@lists.example
62530   no_more
62531 </literallayout>
62532 <para>
62533 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
62534 in that domain, it looks for a file that matches the local part. If there is no
62535 such file, the router declines, but because <option>no_more</option> is set, no subsequent
62536 routers are tried, and so the whole delivery fails.
62537 </para>
62538 <para>
62539 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
62540 expanded into a file name or a pipe delivery, which is usually inappropriate in
62541 a mailing list.
62542 </para>
62543 <para>
62544 <indexterm role="option">
62545 <primary><option>errors_to</option></primary>
62546 </indexterm>
62547 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
62548 taken from a mailing list are to be sent to the given address rather than the
62549 original sender of the message. However, before acting on this, Exim verifies
62550 the error address, and ignores it if verification fails.
62551 </para>
62552 <para>
62553 For example, using the configuration above, mail sent to
62554 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
62555 <filename>/usr/lists/dicts</filename>, with error reports directed to
62556 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
62557 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
62558 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
62559 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
62560 or <option>local_part_suffix</option> options) to handle addresses of the form
62561 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
62562 </para>
62563 </section>
62564 <section id="SECID241">
62565 <title>Syntax errors in mailing lists</title>
62566 <para>
62567 <indexterm role="concept">
62568 <primary>mailing lists</primary>
62569 <secondary>syntax errors in</secondary>
62570 </indexterm>
62571 If an entry in redirection data contains a syntax error, Exim normally defers
62572 delivery of the original address. That means that a syntax error in a mailing
62573 list holds up all deliveries to the list. This may not be appropriate when a
62574 list is being maintained automatically from data supplied by users, and the
62575 addresses are not rigorously checked.
62576 </para>
62577 <para>
62578 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
62579 entries that fail to parse, noting the incident in the log. If in addition
62580 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
62581 whenever a broken address is skipped. It is usually appropriate to set
62582 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
62583 </para>
62584 </section>
62585 <section id="SECID242">
62586 <title>Re-expansion of mailing lists</title>
62587 <para>
62588 <indexterm role="concept">
62589 <primary>mailing lists</primary>
62590 <secondary>re-expansion of</secondary>
62591 </indexterm>
62592 Exim remembers every individual address to which a message has been delivered,
62593 in order to avoid duplication, but it normally stores only the original
62594 recipient addresses with a message. If all the deliveries to a mailing list
62595 cannot be done at the first attempt, the mailing list is re-expanded when the
62596 delivery is next tried. This means that alterations to the list are taken into
62597 account at each delivery attempt, so addresses that have been added to
62598 the list since the message arrived will therefore receive a copy of the
62599 message, even though it pre-dates their subscription.
62600 </para>
62601 <para>
62602 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
62603 on the <command>redirect</command> router. If this is done, any addresses generated by the
62604 router that fail to deliver at the first attempt are added to the message as
62605 <quote>top level</quote> addresses, and the parent address that generated them is marked
62606 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
62607 subsequent delivery attempts. The disadvantage of this is that if any of the
62608 failing addresses are incorrect, correcting them in the file has no effect on
62609 pre-existing messages.
62610 </para>
62611 <para>
62612 The original top-level address is remembered with each of the generated
62613 addresses, and is output in any log messages. However, any intermediate parent
62614 addresses are not recorded. This makes a difference to the log only if the
62615 <option>all_parents</option> selector is set, but for mailing lists there is normally only
62616 one level of expansion anyway.
62617 </para>
62618 </section>
62619 <section id="SECID243">
62620 <title>Closed mailing lists</title>
62621 <para>
62622 <indexterm role="concept">
62623 <primary>mailing lists</primary>
62624 <secondary>closed</secondary>
62625 </indexterm>
62626 The examples so far have assumed open mailing lists, to which anybody may
62627 send mail. It is also possible to set up closed lists, where mail is accepted
62628 from specified senders only. This is done by making use of the generic
62629 <option>senders</option> option to restrict the router that handles the list.
62630 </para>
62631 <para>
62632 The following example uses the same file as a list of recipients and as a list
62633 of permitted senders. It requires three routers:
62634 </para>
62635 <literallayout class="monospaced">
62636 lists_request:
62637   driver = redirect
62638   domains = lists.example
62639   local_part_suffix = -request
62640   file = /usr/lists/$local_part$local_part_suffix
62641   no_more
62642
62643 lists_post:
62644   driver = redirect
62645   domains = lists.example
62646   senders = ${if exists {/usr/lists/$local_part}\
62647              {lsearch;/usr/lists/$local_part}{*}}
62648   file = /usr/lists/$local_part
62649   forbid_pipe
62650   forbid_file
62651   errors_to = $local_part-request@lists.example
62652   no_more
62653
62654 lists_closed:
62655   driver = redirect
62656   domains = lists.example
62657   allow_fail
62658   data = :fail: $local_part@lists.example is a closed mailing list
62659 </literallayout>
62660 <para>
62661 All three routers have the same <option>domains</option> setting, so for any other domains,
62662 they are all skipped. The first router runs only if the local part ends in
62663 <option>-request</option>. It handles messages to the list manager(s) by means of an open
62664 mailing list.
62665 </para>
62666 <para>
62667 The second router runs only if the <option>senders</option> precondition is satisfied. It
62668 checks for the existence of a list that corresponds to the local part, and then
62669 checks that the sender is on the list by means of a linear search. It is
62670 necessary to check for the existence of the file before trying to search it,
62671 because otherwise Exim thinks there is a configuration error. If the file does
62672 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
62673 means that the router runs, but because there is no list, declines, and
62674 <option>no_more</option> ensures that no further routers are run. The address fails with an
62675 <quote>unrouteable address</quote> error.
62676 </para>
62677 <para>
62678 The third router runs only if the second router is skipped, which happens when
62679 a mailing list exists, but the sender is not on it. This router forcibly fails
62680 the address, giving a suitable error message.
62681 </para>
62682 </section>
62683 <section id="SECTverp">
62684 <title>Variable Envelope Return Paths (VERP)</title>
62685 <para>
62686 <indexterm role="concept">
62687 <primary>VERP</primary>
62688 </indexterm>
62689 <indexterm role="concept">
62690 <primary>Variable Envelope Return Paths</primary>
62691 </indexterm>
62692 <indexterm role="concept">
62693 <primary>envelope sender</primary>
62694 </indexterm>
62695 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;
62696 are a way of helping mailing list administrators discover which subscription
62697 address is the cause of a particular delivery failure. The idea is to encode
62698 the original recipient address in the outgoing envelope sender address, so that
62699 if the message is forwarded by another host and then subsequently bounces, the
62700 original recipient can be extracted from the recipient address of the bounce.
62701 </para>
62702 <para>
62703 <indexterm role="option">
62704 <primary><option>errors_to</option></primary>
62705 </indexterm>
62706 <indexterm role="option">
62707 <primary><option>return_path</option></primary>
62708 </indexterm>
62709 Envelope sender addresses can be modified by Exim using two different
62710 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
62711 list examples), or the <option>return_path</option> option on a transport. The second of
62712 these is effective only if the message is successfully delivered to another
62713 host; it is not used for errors detected on the local host (see the description
62714 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
62715 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
62716 </para>
62717 <literallayout class="monospaced">
62718 verp_smtp:
62719   driver = smtp
62720   max_rcpt = 1
62721   return_path = \
62722     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
62723       {$1-request+$local_part=$domain@your.dom.example}fail}
62724 </literallayout>
62725 <para>
62726 This has the effect of rewriting the return path (envelope sender) on outgoing
62727 SMTP messages, if the local part of the original return path ends in
62728 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
62729 local part and domain of the recipient into the return path. Suppose, for
62730 example, that a message whose return path has been set to
62731 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
62732 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
62733 rewritten as
62734 </para>
62735 <literallayout class="monospaced">
62736 somelist-request+subscriber=other.dom.example@your.dom.example
62737 </literallayout>
62738 <para>
62739 <indexterm role="variable">
62740 <primary><varname>$local_part</varname></primary>
62741 </indexterm>
62742 For this to work, you must tell Exim to send multiple copies of messages that
62743 have more than one recipient, so that each copy has just one recipient. This is
62744 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
62745 might be sent to several different recipients in the same domain, in which case
62746 <varname>$local_part</varname> is not available in the transport, because it is not unique.
62747 </para>
62748 <para>
62749 Unless your host is doing nothing but mailing list deliveries, you should
62750 probably use a separate transport for the VERP deliveries, so as not to use
62751 extra resources in making one-per-recipient copies for other deliveries. This
62752 can easily be done by expanding the <option>transport</option> option in the router:
62753 </para>
62754 <literallayout class="monospaced">
62755 dnslookup:
62756   driver = dnslookup
62757   domains = ! +local_domains
62758   transport = \
62759     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
62760       {verp_smtp}{remote_smtp}}
62761   no_more
62762 </literallayout>
62763 <para>
62764 If you want to change the return path using <option>errors_to</option> in a router instead
62765 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
62766 routers that handle mailing list addresses. This will ensure that all delivery
62767 errors, including those detected on the local host, are sent to the VERP
62768 address.
62769 </para>
62770 <para>
62771 On a host that does no local deliveries and has no manual routing, only the
62772 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
62773 SMTP deliveries. Every mailing list recipient has its own return path value,
62774 and so Exim must hand them to the transport one at a time. Here is an example
62775 of a <command>dnslookup</command> router that implements VERP:
62776 </para>
62777 <literallayout class="monospaced">
62778 verp_dnslookup:
62779   driver = dnslookup
62780   domains = ! +local_domains
62781   transport = remote_smtp
62782   errors_to = \
62783     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
62784      {$1-request+$local_part=$domain@your.dom.example}fail}
62785   no_more
62786 </literallayout>
62787 <para>
62788 Before you start sending out messages with VERPed return paths, you must also
62789 configure Exim to accept the bounce messages that come back to those paths.
62790 Typically this is done by setting a <option>local_part_suffix</option> option for a
62791 router, and using this to route the messages to wherever you want to handle
62792 them.
62793 </para>
62794 <para>
62795 The overhead incurred in using VERP depends very much on the size of the
62796 message, the number of recipient addresses that resolve to the same remote
62797 host, and the speed of the connection over which the message is being sent. If
62798 a lot of addresses resolve to the same host and the connection is slow, sending
62799 a separate copy of the message for each address may take substantially longer
62800 than sending a single copy with many recipients (for which VERP cannot be
62801 used).
62802 </para>
62803 </section>
62804 <section id="SECTvirtualdomains">
62805 <title>Virtual domains</title>
62806 <para>
62807 <indexterm role="concept">
62808 <primary>virtual domains</primary>
62809 </indexterm>
62810 <indexterm role="concept">
62811 <primary>domain</primary>
62812 <secondary>virtual</secondary>
62813 </indexterm>
62814 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
62815 meanings:
62816 </para>
62817 <itemizedlist>
62818 <listitem>
62819 <para>
62820 A domain for which there are no real mailboxes; all valid local parts are
62821 aliases for other email addresses. Common examples are organizational
62822 top-level domains and <quote>vanity</quote> domains.
62823 </para>
62824 </listitem>
62825 <listitem>
62826 <para>
62827 One of a number of independent domains that are all handled by the same host,
62828 with mailboxes on that host, but where the mailbox owners do not necessarily
62829 have login accounts on that host.
62830 </para>
62831 </listitem>
62832 </itemizedlist>
62833 <para>
62834 The first usage is probably more common, and does seem more <quote>virtual</quote> than
62835 the second. This kind of domain can be handled in Exim with a straightforward
62836 aliasing router. One approach is to create a separate alias file for each
62837 virtual domain. Exim can test for the existence of the alias file to determine
62838 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
62839 to a router of this form:
62840 </para>
62841 <literallayout class="monospaced">
62842 virtual:
62843   driver = redirect
62844   domains = dsearch;/etc/mail/virtual
62845   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
62846   no_more
62847 </literallayout>
62848 <para>
62849 The <option>domains</option> option specifies that the router is to be skipped, unless there
62850 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
62851 domain that is being processed. When the router runs, it looks up the local
62852 part in the file to find a new address (or list of addresses). The <option>no_more</option>
62853 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
62854 string), Exim gives up on the address without trying any subsequent routers.
62855 </para>
62856 <para>
62857 This one router can handle all the virtual domains because the alias file names
62858 follow a fixed pattern. Permissions can be arranged so that appropriate people
62859 can edit the different alias files. A successful aliasing operation results in
62860 a new envelope recipient address, which is then routed from scratch.
62861 </para>
62862 <para>
62863 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
62864 way. One approach is to create a file for each domain containing a list of
62865 valid local parts, and use it in a router like this:
62866 </para>
62867 <literallayout class="monospaced">
62868 my_domains:
62869   driver = accept
62870   domains = dsearch;/etc/mail/domains
62871   local_parts = lsearch;/etc/mail/domains/$domain
62872   transport = my_mailboxes
62873 </literallayout>
62874 <para>
62875 The address is accepted if there is a file for the domain, and the local part
62876 can be found in the file. The <option>domains</option> option is used to check for the
62877 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
62878 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
62879 because that option is tested after <option>local_parts</option>. The transport is as
62880 follows:
62881 </para>
62882 <literallayout class="monospaced">
62883 my_mailboxes:
62884   driver = appendfile
62885   file = /var/mail/$domain/$local_part
62886   user = mail
62887 </literallayout>
62888 <para>
62889 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
62890 required, to specify which uid is to be used for writing to the mailboxes.
62891 </para>
62892 <para>
62893 The configuration shown here is just one example of how you might support this
62894 requirement. There are many other ways this kind of configuration can be set
62895 up, for example, by using a database instead of separate files to hold all the
62896 information about the domains.
62897 </para>
62898 </section>
62899 <section id="SECTmulbox">
62900 <title>Multiple user mailboxes</title>
62901 <para>
62902 <indexterm role="concept">
62903 <primary>multiple mailboxes</primary>
62904 </indexterm>
62905 <indexterm role="concept">
62906 <primary>mailbox</primary>
62907 <secondary>multiple</secondary>
62908 </indexterm>
62909 <indexterm role="concept">
62910 <primary>local part</primary>
62911 <secondary>prefix</secondary>
62912 </indexterm>
62913 <indexterm role="concept">
62914 <primary>local part</primary>
62915 <secondary>suffix</secondary>
62916 </indexterm>
62917 Heavy email users often want to operate with multiple mailboxes, into which
62918 incoming mail is automatically sorted. A popular way of handling this is to
62919 allow users to use multiple sender addresses, so that replies can easily be
62920 identified. Users are permitted to add prefixes or suffixes to their local
62921 parts for this purpose. The wildcard facility of the generic router options
62922 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
62923 example, consider this router:
62924 </para>
62925 <literallayout class="monospaced">
62926 userforward:
62927   driver = redirect
62928   check_local_user
62929   file = $home/.forward
62930   local_part_suffix = -*
62931   local_part_suffix_optional
62932   allow_filter
62933 </literallayout>
62934 <para>
62935 <indexterm role="variable">
62936 <primary><varname>$local_part_suffix</varname></primary>
62937 </indexterm>
62938 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
62939 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
62940 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
62941 </para>
62942 <literallayout class="monospaced">
62943 if $local_part_suffix contains -special then
62944 save /home/$local_part/Mail/special
62945 endif
62946 </literallayout>
62947 <para>
62948 If the filter file does not exist, or does not deal with such addresses, they
62949 fall through to subsequent routers, and, assuming no subsequent use of the
62950 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
62951 control over which suffixes are valid.
62952 </para>
62953 <para>
62954 Alternatively, a suffix can be used to trigger the use of a different
62955 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
62956 another MTA:
62957 </para>
62958 <literallayout class="monospaced">
62959 userforward:
62960   driver = redirect
62961   check_local_user
62962   file = $home/.forward$local_part_suffix
62963   local_part_suffix = -*
62964   local_part_suffix_optional
62965   allow_filter
62966 </literallayout>
62967 <para>
62968 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
62969 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
62970 does not exist, or does not deal with the address, it is passed on to
62971 subsequent routers, which could, if required, look for an unqualified
62972 <filename>.forward</filename> file to use as a default.
62973 </para>
62974 </section>
62975 <section id="SECID244">
62976 <title>Simplified vacation processing</title>
62977 <para>
62978 <indexterm role="concept">
62979 <primary>vacation processing</primary>
62980 </indexterm>
62981 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
62982 a pipe command in a <filename>.forward</filename> file
62983 (see section <xref linkend="SECTspecitredli"/> for syntax details).
62984 This is prone to error by inexperienced users. There are two features of Exim
62985 that can be used to make this process simpler for users:
62986 </para>
62987 <itemizedlist>
62988 <listitem>
62989 <para>
62990 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
62991 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
62992 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
62993 <filename>.forward</filename> file are then much simpler. For example:
62994 </para>
62995 <literallayout class="monospaced">
62996 spqr, vacation-spqr
62997 </literallayout>
62998 </listitem>
62999 <listitem>
63000 <para>
63001 The <option>require_files</option> generic router option can be used to trigger a
63002 vacation delivery by checking for the existence of a certain file in the
63003 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
63004 ensure that the original delivery also proceeds. In this case, all the user has
63005 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
63006 message.
63007 </para>
63008 </listitem>
63009 </itemizedlist>
63010 <para>
63011 Another advantage of both these methods is that they both work even when the
63012 use of arbitrary pipes by users is locked out.
63013 </para>
63014 </section>
63015 <section id="SECID245">
63016 <title>Taking copies of mail</title>
63017 <para>
63018 <indexterm role="concept">
63019 <primary>message</primary>
63020 <secondary>copying every</secondary>
63021 </indexterm>
63022 Some installations have policies that require archive copies of all messages to
63023 be made. A single copy of each message can easily be taken by an appropriate
63024 command in a system filter, which could, for example, use a different file for
63025 each day&#x2019;s messages.
63026 </para>
63027 <para>
63028 There is also a shadow transport mechanism that can be used to take copies of
63029 messages that are successfully delivered by local transports, one copy per
63030 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
63031 notification of delivery by sites that insist on doing such things.
63032 </para>
63033 </section>
63034 <section id="SECID246">
63035 <title>Intermittently connected hosts</title>
63036 <para>
63037 <indexterm role="concept">
63038 <primary>intermittently connected hosts</primary>
63039 </indexterm>
63040 It has become quite common (because it is cheaper) for hosts to connect to the
63041 Internet periodically rather than remain connected all the time. The normal
63042 arrangement is that mail for such hosts accumulates on a system that is
63043 permanently connected.
63044 </para>
63045 <para>
63046 Exim was designed for use on permanently connected hosts, and so it is not
63047 particularly well-suited to use in an intermittently connected environment.
63048 Nevertheless there are some features that can be used.
63049 </para>
63050 </section>
63051 <section id="SECID247">
63052 <title>Exim on the upstream server host</title>
63053 <para>
63054 It is tempting to arrange for incoming mail for the intermittently connected
63055 host to remain on Exim&#x2019;s queue until the client connects. However, this
63056 approach does not scale very well. Two different kinds of waiting message are
63057 being mixed up in the same queue &ndash; those that cannot be delivered because of
63058 some temporary problem, and those that are waiting for their destination host
63059 to connect. This makes it hard to manage the queue, as well as wasting
63060 resources, because each queue runner scans the entire queue.
63061 </para>
63062 <para>
63063 A better approach is to separate off those messages that are waiting for an
63064 intermittently connected host. This can be done by delivering these messages
63065 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
63066 format, from where they are transmitted by other software when their
63067 destination connects. This makes it easy to collect all the mail for one host
63068 in a single directory, and to apply local timeout rules on a per-message basis
63069 if required.
63070 </para>
63071 <para>
63072 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
63073 you are doing this, you should configure Exim with a long retry period for the
63074 intermittent host. For example:
63075 </para>
63076 <literallayout class="monospaced">
63077 cheshire.wonderland.fict.example    *   F,5d,24h
63078 </literallayout>
63079 <para>
63080 This stops a lot of failed delivery attempts from occurring, but Exim remembers
63081 which messages it has queued up for that host. Once the intermittent host comes
63082 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
63083 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
63084 causes all the queued up messages to be delivered, often down a single SMTP
63085 connection. While the host remains connected, any new messages get delivered
63086 immediately.
63087 </para>
63088 <para>
63089 If the connecting hosts do not have fixed IP addresses, that is, if a host is
63090 issued with a different IP address each time it connects, Exim&#x2019;s retry
63091 mechanisms on the holding host get confused, because the IP address is normally
63092 used as part of the key string for holding retry information. This can be
63093 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
63094 Since this has disadvantages for permanently connected hosts, it is best to
63095 arrange a separate transport for the intermittently connected ones.
63096 </para>
63097 </section>
63098 <section id="SECID248">
63099 <title>Exim on the intermittently connected client host</title>
63100 <para>
63101 The value of <option>smtp_accept_queue_per_connection</option> should probably be
63102 increased, or even set to zero (that is, disabled) on the intermittently
63103 connected host, so that all incoming messages down a single connection get
63104 delivered immediately.
63105 </para>
63106 <para>
63107 <indexterm role="concept">
63108 <primary>SMTP</primary>
63109 <secondary>passed connection</secondary>
63110 </indexterm>
63111 <indexterm role="concept">
63112 <primary>SMTP</primary>
63113 <secondary>multiple deliveries</secondary>
63114 </indexterm>
63115 <indexterm role="concept">
63116 <primary>multiple SMTP deliveries</primary>
63117 </indexterm>
63118 Mail waiting to be sent from an intermittently connected host will probably
63119 not have been routed, because without a connection DNS lookups are not
63120 possible. This means that if a normal queue run is done at connection time,
63121 each message is likely to be sent in a separate SMTP session. This can be
63122 avoided by starting the queue run with a command line option beginning with
63123 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
63124 first pass, routing is done but no deliveries take place. The second pass is a
63125 normal queue run; since all the messages have been previously routed, those
63126 destined for the same host are likely to get sent as multiple deliveries in a
63127 single SMTP connection.
63128 </para>
63129 </section>
63130 </chapter>
63131
63132 <chapter id="CHAPnonqueueing">
63133 <title>Using Exim as a non-queueing client</title>
63134 <titleabbrev>Exim as a non-queueing client</titleabbrev>
63135 <para>
63136 <indexterm role="concept">
63137 <primary>client, non-queueing</primary>
63138 </indexterm>
63139 <indexterm role="concept">
63140 <primary>smart host</primary>
63141 <secondary>suppressing queueing</secondary>
63142 </indexterm>
63143 On a personal computer, it is a common requirement for all
63144 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
63145 configured to operate that way, for all the popular operating systems.
63146 However, there are some MUAs for Unix-like systems that cannot be so
63147 configured: they submit messages using the command line interface of
63148 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
63149 messages this way.
63150 </para>
63151 <para>
63152 If the personal computer runs continuously, there is no problem, because it can
63153 run a conventional MTA that handles delivery to the smart host, and deal with
63154 any delays via its queueing mechanism. However, if the computer does not run
63155 continuously or runs different operating systems at different times, queueing
63156 email is not desirable.
63157 </para>
63158 <para>
63159 There is therefore a requirement for something that can provide the
63160 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
63161 any queueing or retrying facilities. Furthermore, the delivery to the smart
63162 host should be synchronous, so that if it fails, the sending MUA is immediately
63163 informed. In other words, we want something that extends an MUA that submits
63164 to a local MTA via the command line so that it behaves like one that submits
63165 to a remote smart host using TCP/SMTP.
63166 </para>
63167 <para>
63168 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
63169 that do this job. However, people have found them to be lacking in various
63170 ways. For instance, you might want to allow aliasing and forwarding to be done
63171 before sending a message to the smart host.
63172 </para>
63173 <para>
63174 Exim already had the necessary infrastructure for doing this job. Just a few
63175 tweaks were needed to make it behave as required, though it is somewhat of an
63176 overkill to use a fully-featured MTA for this purpose.
63177 </para>
63178 <para>
63179 <indexterm role="option">
63180 <primary><option>mua_wrapper</option></primary>
63181 </indexterm>
63182 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
63183 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
63184 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
63185 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
63186 compatible router and transport configuration. Typically there will be just one
63187 router and one transport, sending everything to a smart host.
63188 </para>
63189 <para>
63190 When run in MUA wrapping mode, the behaviour of Exim changes in the
63191 following ways:
63192 </para>
63193 <itemizedlist>
63194 <listitem>
63195 <para>
63196 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
63197 In other words, the only way to submit messages is via the command line.
63198 </para>
63199 </listitem>
63200 <listitem>
63201 <para>
63202 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
63203 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
63204 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
63205 does not finish until the delivery attempt is complete. If the delivery is
63206 successful, a zero return code is given.
63207 </para>
63208 </listitem>
63209 <listitem>
63210 <para>
63211 Address redirection is permitted, but the final routing for all addresses must
63212 be to the same remote transport, and to the same list of hosts. Furthermore,
63213 the return address (envelope sender) must be the same for all recipients, as
63214 must any added or deleted header lines. In other words, it must be possible to
63215 deliver the message in a single SMTP transaction, however many recipients there
63216 are.
63217 </para>
63218 </listitem>
63219 <listitem>
63220 <para>
63221 If these conditions are not met, or if routing any address results in a
63222 failure or defer status, or if Exim is unable to deliver all the recipients
63223 successfully to one of the smart hosts, delivery of the entire message fails.
63224 </para>
63225 </listitem>
63226 <listitem>
63227 <para>
63228 Because no queueing is allowed, all failures are treated as permanent; there
63229 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
63230 smart host. Furthermore, because only a single yes/no response can be given to
63231 the caller, it is not possible to deliver to some recipients and not others. If
63232 there is an error (temporary or permanent) for any recipient, all are failed.
63233 </para>
63234 </listitem>
63235 <listitem>
63236 <para>
63237 If more than one smart host is listed, Exim will try another host after a
63238 connection failure or a timeout, in the normal way. However, if this kind of
63239 failure happens for all the hosts, the delivery fails.
63240 </para>
63241 </listitem>
63242 <listitem>
63243 <para>
63244 When delivery fails, an error message is written to the standard error stream
63245 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
63246 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
63247 are ever generated.
63248 </para>
63249 </listitem>
63250 <listitem>
63251 <para>
63252 No retry data is maintained, and any retry rules are ignored.
63253 </para>
63254 </listitem>
63255 <listitem>
63256 <para>
63257 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
63258 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
63259 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
63260 </para>
63261 </listitem>
63262 </itemizedlist>
63263 <para>
63264 The overall effect is that Exim makes a single synchronous attempt to deliver
63265 the message, failing if there is any kind of problem. Because no local
63266 deliveries are done and no daemon can be run, Exim does not need root
63267 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
63268 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
63269 the advantages and disadvantages of running without root privilege.
63270 </para>
63271 </chapter>
63272
63273 <chapter id="CHAPlog">
63274 <title>Log files</title>
63275 <para>
63276 <indexterm role="concept" id="IIDloggen" class="startofrange">
63277 <primary>log</primary>
63278 <secondary>general description</secondary>
63279 </indexterm>
63280 <indexterm role="concept">
63281 <primary>log</primary>
63282 <secondary>types of</secondary>
63283 </indexterm>
63284 Exim writes three different logs, referred to as the main log, the reject log,
63285 and the panic log:
63286 </para>
63287 <itemizedlist>
63288 <listitem>
63289 <para>
63290 <indexterm role="concept">
63291 <primary>main log</primary>
63292 </indexterm>
63293 The main log records the arrival of each message and each delivery in a single
63294 line in each case. The format is as compact as possible, in an attempt to keep
63295 down the size of log files. Two-character flag sequences make it easy to pick
63296 out these lines. A number of other events are recorded in the main log. Some of
63297 them are optional, in which case the <option>log_selector</option> option controls whether
63298 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
63299 analysis of main log files, is provided in the Exim distribution (see section
63300 <xref linkend="SECTmailstat"/>).
63301 </para>
63302 </listitem>
63303 <listitem>
63304 <para>
63305 <indexterm role="concept">
63306 <primary>reject log</primary>
63307 </indexterm>
63308 The reject log records information from messages that are rejected as a result
63309 of a configuration option (that is, for policy reasons).
63310 The first line of each rejection is a copy of the line that is also written to
63311 the main log. Then, if the message&#x2019;s header has been read at the time the log
63312 is written, its contents are written to this log. Only the original header
63313 lines are available; header lines added by ACLs are not logged. You can use the
63314 reject log to check that your policy controls are working correctly; on a busy
63315 host this may be easier than scanning the main log for rejection messages. You
63316 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
63317 false.
63318 </para>
63319 </listitem>
63320 <listitem>
63321 <para>
63322 <indexterm role="concept">
63323 <primary>panic log</primary>
63324 </indexterm>
63325 <indexterm role="concept">
63326 <primary>system log</primary>
63327 </indexterm>
63328 When certain serious errors occur, Exim writes entries to its panic log. If the
63329 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
63330 are usually written to the main log as well, but can get lost amid the mass of
63331 other entries. The panic log should be empty under normal circumstances. It is
63332 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
63333 regularly, in order to become aware of any problems. When Exim cannot open its
63334 panic log, it tries as a last resort to write to the system log (syslog). This
63335 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
63336 message itself is written at priority LOG_CRIT.
63337 </para>
63338 </listitem>
63339 </itemizedlist>
63340 <para>
63341 Every log line starts with a timestamp, in the format shown in the following
63342 example. Note that many of the examples shown in this chapter are line-wrapped.
63343 In the log file, this would be all on one line:
63344 </para>
63345 <literallayout class="monospaced">
63346 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
63347   by QUIT
63348 </literallayout>
63349 <para>
63350 By default, the timestamps are in the local timezone. There are two
63351 ways of changing this:
63352 </para>
63353 <itemizedlist>
63354 <listitem>
63355 <para>
63356 You can set the <option>timezone</option> option to a different time zone; in particular, if
63357 you set
63358 </para>
63359 <literallayout class="monospaced">
63360 timezone = UTC
63361 </literallayout>
63362 <para>
63363 the timestamps will be in UTC (aka GMT).
63364 </para>
63365 </listitem>
63366 <listitem>
63367 <para>
63368 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
63369 example:
63370 </para>
63371 <literallayout class="monospaced">
63372 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
63373 </literallayout>
63374 </listitem>
63375 </itemizedlist>
63376 <para>
63377 <indexterm role="concept">
63378 <primary>log</primary>
63379 <secondary>process ids in</secondary>
63380 </indexterm>
63381 <indexterm role="concept">
63382 <primary>pid (process id)</primary>
63383 <secondary>in log lines</secondary>
63384 </indexterm>
63385 Exim does not include its process id in log lines by default, but you can
63386 request that it does so by specifying the <literal>pid</literal> log selector (see section
63387 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
63388 brackets, immediately after the time and date.
63389 </para>
63390 <section id="SECTwhelogwri">
63391 <title>Where the logs are written</title>
63392 <para>
63393 <indexterm role="concept">
63394 <primary>log</primary>
63395 <secondary>destination</secondary>
63396 </indexterm>
63397 <indexterm role="concept">
63398 <primary>log</primary>
63399 <secondary>to file</secondary>
63400 </indexterm>
63401 <indexterm role="concept">
63402 <primary>log</primary>
63403 <secondary>to syslog</secondary>
63404 </indexterm>
63405 <indexterm role="concept">
63406 <primary>syslog</primary>
63407 </indexterm>
63408 The logs may be written to local files, or to syslog, or both. However, it
63409 should be noted that many syslog implementations use UDP as a transport, and
63410 are therefore unreliable in the sense that messages are not guaranteed to
63411 arrive at the loghost, nor is the ordering of messages necessarily maintained.
63412 It has also been reported that on large log files (tens of megabytes) you may
63413 need to tweak syslog to prevent it syncing the file with each write &ndash; on
63414 Linux this has been seen to make syslog take 90% plus of CPU time.
63415 </para>
63416 <para>
63417 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
63418 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
63419 configuration. This latter string is expanded, so it can contain, for example,
63420 references to the host name:
63421 </para>
63422 <literallayout class="monospaced">
63423 log_file_path = /var/log/$primary_hostname/exim_%slog
63424 </literallayout>
63425 <para>
63426 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
63427 rather than at run time, because then the setting is available right from the
63428 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
63429 before it has read the configuration file (for example, an error in the
63430 configuration file) it will not use the path you want, and may not be able to
63431 log at all.
63432 </para>
63433 <para>
63434 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
63435 list, currently limited to at most two items. This is one option where the
63436 facility for changing a list separator may not be used. The list must always be
63437 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
63438 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
63439 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
63440 implying the use of a default path.
63441 </para>
63442 <para>
63443 When Exim encounters an empty item in the list, it searches the list defined by
63444 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
63445 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
63446 mean <quote>use the path specified at build time</quote>. It no such item exists, log
63447 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
63448 equivalent to the setting:
63449 </para>
63450 <literallayout class="monospaced">
63451 log_file_path = $spool_directory/log/%slog
63452 </literallayout>
63453 <para>
63454 If you do not specify anything at build time or run time,
63455 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
63456 that is where the logs are written.
63457 </para>
63458 <para>
63459 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
63460 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
63461 </para>
63462 <para>
63463 Here are some examples of possible settings:
63464 </para>
63465 <literallayout>
63466 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
63467 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
63468 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
63469 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
63470 </literallayout>
63471 <para>
63472 If there are more than two paths in the list, the first is used and a panic
63473 error is logged.
63474 </para>
63475 </section>
63476 <section id="SECID285">
63477 <title>Logging to local files that are periodically <quote>cycled</quote></title>
63478 <para>
63479 <indexterm role="concept">
63480 <primary>log</primary>
63481 <secondary>cycling local files</secondary>
63482 </indexterm>
63483 <indexterm role="concept">
63484 <primary>cycling logs</primary>
63485 </indexterm>
63486 <indexterm role="concept">
63487 <primary><emphasis>exicyclog</emphasis></primary>
63488 </indexterm>
63489 <indexterm role="concept">
63490 <primary>log</primary>
63491 <secondary>local files; writing to</secondary>
63492 </indexterm>
63493 Some operating systems provide centralized and standardized methods for cycling
63494 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
63495 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
63496 main and reject logs each time it is called. The maximum number of old logs to
63497 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
63498 </para>
63499 <para>
63500 An Exim delivery process opens the main log when it first needs to write to it,
63501 and it keeps the file open in case subsequent entries are required &ndash; for
63502 example, if a number of different deliveries are being done for the same
63503 message. However, remote SMTP deliveries can take a long time, and this means
63504 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
63505 something similar is being used to rename log files on a regular basis. To
63506 ensure that a switch of log files is noticed as soon as possible, Exim calls
63507 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
63508 does not exist, or its inode has changed, the old file is closed and Exim
63509 tries to open the main log from scratch. Thus, an old log file may remain open
63510 for quite some time, but no Exim processes should write to it once it has been
63511 renamed.
63512 </para>
63513 </section>
63514 <section id="SECTdatlogfil">
63515 <title>Datestamped log files</title>
63516 <para>
63517 <indexterm role="concept">
63518 <primary>log</primary>
63519 <secondary>datestamped files</secondary>
63520 </indexterm>
63521 Instead of cycling the main and reject log files by renaming them
63522 periodically, some sites like to use files whose names contain a datestamp,
63523 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
63524 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
63525 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
63526 point where the datestamp is required. For example:
63527 </para>
63528 <literallayout class="monospaced">
63529 log_file_path = /var/spool/exim/log/%slog-%D
63530 log_file_path = /var/log/exim-%s-%D.log
63531 log_file_path = /var/spool/exim/log/%D-%slog
63532 log_file_path = /var/log/exim/%s.%M
63533 </literallayout>
63534 <para>
63535 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
63536 examples of names generated by the above examples:
63537 </para>
63538 <literallayout class="monospaced">
63539 /var/spool/exim/log/mainlog-20021225
63540 /var/log/exim-reject-20021225.log
63541 /var/spool/exim/log/20021225-mainlog
63542 /var/log/exim/main.200212
63543 </literallayout>
63544 <para>
63545 When this form of log file is specified, Exim automatically switches to new
63546 files at midnight. It does not make any attempt to compress old logs; you
63547 will need to write your own script if you require this. You should not
63548 run <emphasis>exicyclog</emphasis> with this form of logging.
63549 </para>
63550 <para>
63551 The location of the panic log is also determined by <option>log_file_path</option>, but it
63552 is not datestamped, because rotation of the panic log does not make sense.
63553 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
63554 the string. In addition, if it immediately follows a slash, a following
63555 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
63556 character is removed. Thus, the four examples above would give these panic
63557 log names:
63558 </para>
63559 <literallayout class="monospaced">
63560 /var/spool/exim/log/paniclog
63561 /var/log/exim-panic.log
63562 /var/spool/exim/log/paniclog
63563 /var/log/exim/panic
63564 </literallayout>
63565 </section>
63566 <section id="SECID249">
63567 <title>Logging to syslog</title>
63568 <para>
63569 <indexterm role="concept">
63570 <primary>log</primary>
63571 <secondary>syslog; writing to</secondary>
63572 </indexterm>
63573 The use of syslog does not change what Exim logs or the format of its messages,
63574 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
63575 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
63576 that, the same strings are written to syslog as to log files. The syslog
63577 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
63578 by default, but you can change these by setting the <option>syslog_facility</option> and
63579 <option>syslog_processname</option> options, respectively. If Exim was compiled with
63580 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
63581 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
63582 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
63583 the time and host name to each line.
63584 The three log streams are mapped onto syslog priorities as follows:
63585 </para>
63586 <itemizedlist>
63587 <listitem>
63588 <para>
63589 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
63590 </para>
63591 </listitem>
63592 <listitem>
63593 <para>
63594 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
63595 </para>
63596 </listitem>
63597 <listitem>
63598 <para>
63599 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
63600 </para>
63601 </listitem>
63602 </itemizedlist>
63603 <para>
63604 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
63605 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
63606 these are routed by syslog to the same place. You can suppress this duplication
63607 by setting <option>syslog_duplication</option> false.
63608 </para>
63609 <para>
63610 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
63611 entries contain multiple lines when headers are included. To cope with both
63612 these cases, entries written to syslog are split into separate <function>syslog()</function>
63613 calls at each internal newline, and also after a maximum of
63614 870 data characters. (This allows for a total syslog line length of 1024, when
63615 additions such as timestamps are added.) If you are running a syslog
63616 replacement that can handle lines longer than the 1024 characters allowed by
63617 RFC 3164, you should set
63618 </para>
63619 <literallayout class="monospaced">
63620 SYSLOG_LONG_LINES=yes
63621 </literallayout>
63622 <para>
63623 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
63624 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
63625 </para>
63626 <para>
63627 To make it easy to re-assemble split lines later, each component of a split
63628 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;]
63629 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
63630 components in the entry. The / delimiter is used when the line was split
63631 because it was too long; if it was split because of an internal newline, the \
63632 delimiter is used. For example, supposing the length limit to be 50 instead of
63633 870, the following would be the result of a typical rejection message to
63634 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
63635 name, and pid as added by syslog:
63636 </para>
63637 <literallayout class="monospaced">
63638 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
63639 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
63640 [3/5]  when scanning for sender: missing or malformed lo
63641 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
63642 [5/5] mple&gt;)
63643 </literallayout>
63644 <para>
63645 The same error might cause the following lines to be written to <quote>rejectlog</quote>
63646 (LOG_NOTICE):
63647 </para>
63648 <literallayout class="monospaced">
63649 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
63650 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
63651 [3/18] er when scanning for sender: missing or malformed
63652 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
63653 [5\18] .example&gt;)
63654 [6\18] Recipients: ph10@some.domain.cam.example
63655 [7\18] P Received: from [127.0.0.1] (ident=ph10)
63656 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
63657 [9\18]        id 16RdAL-0006pc-00
63658 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
63659 [11\18] 09:43 +0100
63660 [12\18] F From: &lt;&gt;
63661 [13\18]   Subject: this is a test header
63662 [18\18]   X-something: this is another header
63663 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
63664 [16\18] le&gt;
63665 [17\18] B Bcc:
63666 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
63667 </literallayout>
63668 <para>
63669 Log lines that are neither too long nor contain newlines are written to syslog
63670 without modification.
63671 </para>
63672 <para>
63673 If only syslog is being used, the Exim monitor is unable to provide a log tail
63674 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
63675 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
63676 where it is.
63677 </para>
63678 </section>
63679 <section id="SECID250">
63680 <title>Log line flags</title>
63681 <para>
63682 One line is written to the main log for each message received, and for each
63683 successful, unsuccessful, and delayed delivery. These lines can readily be
63684 picked out by the distinctive two-character flags that immediately follow the
63685 timestamp. The flags are:
63686 </para>
63687 <literallayout>
63688 <literal>&lt;=</literal>     message arrival
63689 <literal>=&gt;</literal>     normal message delivery
63690 <literal>-&gt;</literal>     additional address in same delivery
63691 <literal>&gt;&gt;</literal>     cutthrough message delivery
63692 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
63693 <literal>**</literal>     delivery failed; address bounced
63694 <literal>==</literal>     delivery deferred; temporary problem
63695 </literallayout>
63696 </section>
63697 <section id="SECID251">
63698 <title>Logging message reception</title>
63699 <para>
63700 <indexterm role="concept">
63701 <primary>log</primary>
63702 <secondary>reception line</secondary>
63703 </indexterm>
63704 The format of the single-line entry in the main log that is written for every
63705 message received is shown in the basic example below, which is split over
63706 several lines in order to fit it on the page:
63707 </para>
63708 <literallayout class="monospaced">
63709 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
63710   H=mailer.fict.example [192.168.123.123] U=exim
63711   P=smtp S=5678 id=&lt;incoming message id&gt;
63712 </literallayout>
63713 <para>
63714 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
63715 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
63716 generated, this is followed by an item of the form
63717 </para>
63718 <literallayout class="monospaced">
63719 R=&lt;message id&gt;
63720 </literallayout>
63721 <para>
63722 which is a reference to the message that caused the bounce to be sent.
63723 </para>
63724 <para>
63725 <indexterm role="concept">
63726 <primary>HELO</primary>
63727 </indexterm>
63728 <indexterm role="concept">
63729 <primary>EHLO</primary>
63730 </indexterm>
63731 For messages from other hosts, the H and U fields identify the remote host and
63732 record the RFC 1413 identity of the user that sent the message, if one was
63733 received. The number given in square brackets is the IP address of the sending
63734 host. If there is a single, unparenthesized  host name in the H field, as
63735 above, it has been verified to correspond to the IP address (see the
63736 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
63737 by the remote host in the SMTP HELO or EHLO command, and has not been
63738 verified. If verification yields a different name to that given for HELO or
63739 EHLO, the verified name appears first, followed by the HELO or EHLO
63740 name in parentheses.
63741 </para>
63742 <para>
63743 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
63744 without brackets, in the HELO or EHLO command, leading to entries in
63745 the log containing text like these examples:
63746 </para>
63747 <literallayout class="monospaced">
63748 H=(10.21.32.43) [192.168.8.34]
63749 H=([10.21.32.43]) [192.168.8.34]
63750 </literallayout>
63751 <para>
63752 This can be confusing. Only the final address in square brackets can be relied
63753 on.
63754 </para>
63755 <para>
63756 For locally generated messages (that is, messages not received over TCP/IP),
63757 the H field is omitted, and the U field contains the login name of the caller
63758 of Exim.
63759 </para>
63760 <para>
63761 <indexterm role="concept">
63762 <primary>authentication</primary>
63763 <secondary>logging</secondary>
63764 </indexterm>
63765 <indexterm role="concept">
63766 <primary>AUTH</primary>
63767 <secondary>logging</secondary>
63768 </indexterm>
63769 For all messages, the P field specifies the protocol used to receive the
63770 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
63771 of incoming SMTP messages, the value indicates whether or not any SMTP
63772 extensions (ESMTP), encryption, or authentication were used. If the SMTP
63773 session was encrypted, there is an additional X field that records the cipher
63774 suite that was used.
63775 </para>
63776 <para>
63777 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
63778 hosts that have authenticated themselves using the SMTP AUTH command. The first
63779 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
63780 there is an additional item A= followed by the name of the authenticator that
63781 was used. If an authenticated identification was set up by the authenticator&#x2019;s
63782 <option>server_set_id</option> option, this is logged too, separated by a colon from the
63783 authenticator name.
63784 </para>
63785 <para>
63786 <indexterm role="concept">
63787 <primary>size</primary>
63788 <secondary>of message</secondary>
63789 </indexterm>
63790 The id field records the existing message id, if present. The size of the
63791 received message is given by the S field. When the message is delivered,
63792 headers may be removed or added, so that the size of delivered copies of the
63793 message may not correspond with this value (and indeed may be different to each
63794 other).
63795 </para>
63796 <para>
63797 The <option>log_selector</option> option can be used to request the logging of additional
63798 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
63799 </para>
63800 </section>
63801 <section id="SECID252">
63802 <title>Logging deliveries</title>
63803 <para>
63804 <indexterm role="concept">
63805 <primary>log</primary>
63806 <secondary>delivery line</secondary>
63807 </indexterm>
63808 The format of the single-line entry in the main log that is written for every
63809 delivery is shown in one of the examples below, for local and remote
63810 deliveries, respectively. Each example has been split into two lines in order
63811 to fit it on the page:
63812 </para>
63813 <literallayout class="monospaced">
63814 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
63815   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
63816 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
63817   monk@holistic.fict.example R=dnslookup T=remote_smtp
63818   H=holistic.fict.example [192.168.234.234]
63819 </literallayout>
63820 <para>
63821 For ordinary local deliveries, the original address is given in angle brackets
63822 after the final delivery address, which might be a pipe or a file. If
63823 intermediate address(es) exist between the original and the final address, the
63824 last of these is given in parentheses after the final address. The R and T
63825 fields record the router and transport that were used to process the address.
63826 </para>
63827 <para>
63828 If SMTP AUTH was used for the delivery there is an additional item A=
63829 followed by the name of the authenticator that was used.
63830 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
63831 option, this is logged too, separated by a colon from the authenticator name.
63832 </para>
63833 <para>
63834 If a shadow transport was run after a successful local delivery, the log line
63835 for the successful delivery has an item added on the end, of the form
63836 </para>
63837 <literallayout>
63838 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
63839 </literallayout>
63840 <para>
63841 If the shadow transport did not succeed, the error message is put in
63842 parentheses afterwards.
63843 </para>
63844 <para>
63845 <indexterm role="concept">
63846 <primary>asterisk</primary>
63847 <secondary>after IP address</secondary>
63848 </indexterm>
63849 When more than one address is included in a single delivery (for example, two
63850 SMTP RCPT commands in one transaction) the second and subsequent addresses are
63851 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
63852 down a single SMTP connection, an asterisk follows the IP address in the log
63853 lines for the second and subsequent messages.
63854 </para>
63855 <para>
63856 <indexterm role="concept">
63857 <primary>delivery</primary>
63858 <secondary>cutthrough; logging</secondary>
63859 </indexterm>
63860 <indexterm role="concept">
63861 <primary>cutthrough</primary>
63862 <secondary>logging</secondary>
63863 </indexterm>
63864 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
63865 line precedes the reception line, since cutthrough waits for a possible
63866 rejection from the destination in case it can reject the sourced item.
63867 </para>
63868 <para>
63869 The generation of a reply message by a filter file gets logged as a
63870 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
63871 </para>
63872 <para>
63873 The <option>log_selector</option> option can be used to request the logging of additional
63874 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
63875 </para>
63876 </section>
63877 <section id="SECID253">
63878 <title>Discarded deliveries</title>
63879 <para>
63880 <indexterm role="concept">
63881 <primary>discarded messages</primary>
63882 </indexterm>
63883 <indexterm role="concept">
63884 <primary>message</primary>
63885 <secondary>discarded</secondary>
63886 </indexterm>
63887 <indexterm role="concept">
63888 <primary>delivery</primary>
63889 <secondary>discarded; logging</secondary>
63890 </indexterm>
63891 When a message is discarded as a result of the command <quote>seen finish</quote> being
63892 obeyed in a filter file which generates no deliveries, a log entry of the form
63893 </para>
63894 <literallayout class="monospaced">
63895 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
63896   &lt;low.club@bridge.example&gt; R=userforward
63897 </literallayout>
63898 <para>
63899 is written, to record why no deliveries are logged. When a message is discarded
63900 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
63901 </para>
63902 <literallayout class="monospaced">
63903 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
63904   &lt;hole@nowhere.example&gt; R=blackhole_router
63905 </literallayout>
63906 </section>
63907 <section id="SECID254">
63908 <title>Deferred deliveries</title>
63909 <para>
63910 When a delivery is deferred, a line of the following form is logged:
63911 </para>
63912 <literallayout class="monospaced">
63913 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
63914   R=dnslookup T=smtp defer (146): Connection refused
63915 </literallayout>
63916 <para>
63917 In the case of remote deliveries, the error is the one that was given for the
63918 last IP address that was tried. Details of individual SMTP failures are also
63919 written to the log, so the above line would be preceded by something like
63920 </para>
63921 <literallayout class="monospaced">
63922 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
63923   mail1.endrest.example [192.168.239.239]: Connection refused
63924 </literallayout>
63925 <para>
63926 When a deferred address is skipped because its retry time has not been reached,
63927 a message is written to the log, but this can be suppressed by setting an
63928 appropriate value in <option>log_selector</option>.
63929 </para>
63930 </section>
63931 <section id="SECID255">
63932 <title>Delivery failures</title>
63933 <para>
63934 <indexterm role="concept">
63935 <primary>delivery</primary>
63936 <secondary>failure; logging</secondary>
63937 </indexterm>
63938 If a delivery fails because an address cannot be routed, a line of the
63939 following form is logged:
63940 </para>
63941 <literallayout class="monospaced">
63942 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
63943   &lt;jim@trek99.example&gt;: unknown mail domain
63944 </literallayout>
63945 <para>
63946 If a delivery fails at transport time, the router and transport are shown, and
63947 the response from the remote host is included, as in this example:
63948 </para>
63949 <literallayout class="monospaced">
63950 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
63951   R=dnslookup T=remote_smtp: SMTP error from remote mailer
63952   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
63953   pbmail3.py.example [192.168.63.111]: 553 5.3.0
63954   &lt;ace400@pb.example&gt;...Addressee unknown
63955 </literallayout>
63956 <para>
63957 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
63958 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
63959 disabling PIPELINING. The log lines for all forms of delivery failure are
63960 flagged with <literal>**</literal>.
63961 </para>
63962 </section>
63963 <section id="SECID256">
63964 <title>Fake deliveries</title>
63965 <para>
63966 <indexterm role="concept">
63967 <primary>delivery</primary>
63968 <secondary>fake; logging</secondary>
63969 </indexterm>
63970 If a delivery does not actually take place because the <option>-N</option> option has been
63971 used to suppress it, a normal delivery line is written to the log, except that
63972 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
63973 </para>
63974 </section>
63975 <section id="SECID257">
63976 <title>Completion</title>
63977 <para>
63978 A line of the form
63979 </para>
63980 <literallayout class="monospaced">
63981 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
63982 </literallayout>
63983 <para>
63984 is written to the main log when a message is about to be removed from the spool
63985 at the end of its processing.
63986 </para>
63987 </section>
63988 <section id="SECID258">
63989 <title>Summary of Fields in Log Lines</title>
63990 <para>
63991 <indexterm role="concept">
63992 <primary>log</primary>
63993 <secondary>summary of fields</secondary>
63994 </indexterm>
63995 A summary of the field identifiers that are used in log lines is shown in
63996 the following table:
63997 </para>
63998 <literallayout>
63999 <literal>A   </literal>        authenticator name (and optional id and sender)
64000 <literal>C   </literal>        SMTP confirmation on delivery
64001 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
64002 <literal>CV  </literal>        certificate verification status
64003 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
64004 <literal>DN  </literal>        distinguished name from peer certificate
64005 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
64006 <literal>F   </literal>        sender address (on delivery lines)
64007 <literal>H   </literal>        host name and IP address
64008 <literal>I   </literal>        local interface used
64009 <literal>id  </literal>        message id for incoming message
64010 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
64011 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
64012 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
64013 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
64014 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
64015 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
64016 <literal>S   </literal>        size of message
64017 <literal>SNI </literal>        server name indication from TLS client hello
64018 <literal>ST  </literal>        shadow transport name
64019 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
64020 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
64021 <literal>U   </literal>        local user or RFC 1413 identity
64022 <literal>X   </literal>        TLS cipher suite
64023 </literallayout>
64024 </section>
64025 <section id="SECID259">
64026 <title>Other log entries</title>
64027 <para>
64028 Various other types of log entry are written from time to time. Most should be
64029 self-explanatory. Among the more common are:
64030 </para>
64031 <itemizedlist>
64032 <listitem>
64033 <para>
64034 <indexterm role="concept">
64035 <primary>retry</primary>
64036 <secondary>time not reached</secondary>
64037 </indexterm>
64038 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
64039 during routing or local delivery, and the time to retry has not yet arrived.
64040 This message is not written to an individual message log file unless it happens
64041 during the first delivery attempt.
64042 </para>
64043 </listitem>
64044 <listitem>
64045 <para>
64046 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
64047 temporary errors during remote delivery, and the retry time has not yet arrived
64048 for any of the hosts to which it is routed.
64049 </para>
64050 </listitem>
64051 <listitem>
64052 <para>
64053 <indexterm role="concept">
64054 <primary>spool directory</primary>
64055 <secondary>file locked</secondary>
64056 </indexterm>
64057 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
64058 some other Exim process is already working on the message. This can be quite
64059 common if queue running processes are started at frequent intervals. The
64060 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
64061 doing.
64062 </para>
64063 </listitem>
64064 <listitem>
64065 <para>
64066 <indexterm role="concept">
64067 <primary>error</primary>
64068 <secondary>ignored</secondary>
64069 </indexterm>
64070 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
64071 message:
64072 </para>
64073 <orderedlist numeration="arabic">
64074 <listitem>
64075 <para>
64076 Exim failed to deliver a bounce message whose age was greater than
64077 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
64078 </para>
64079 </listitem>
64080 <listitem>
64081 <para>
64082 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
64083 failed. The delivery was discarded.
64084 </para>
64085 </listitem>
64086 <listitem>
64087 <para>
64088 A delivery set up by a router configured with
64089 </para>
64090 <literallayout class="monospaced">
64091     errors_to = &lt;&gt;
64092 </literallayout>
64093 <para>
64094 failed. The delivery was discarded.
64095 </para>
64096 </listitem>
64097 </orderedlist>
64098 </listitem>
64099 </itemizedlist>
64100 </section>
64101 <section id="SECTlogselector">
64102 <title>Reducing or increasing what is logged</title>
64103 <para>
64104 <indexterm role="concept">
64105 <primary>log</primary>
64106 <secondary>selectors</secondary>
64107 </indexterm>
64108 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
64109 default logging, or you can request additional logging. The value of
64110 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
64111 example:
64112 </para>
64113 <literallayout class="monospaced">
64114 log_selector = +arguments -retry_defer
64115 </literallayout>
64116 <para>
64117 The list of optional log items is in the following table, with the default
64118 selection marked by asterisks:
64119 </para>
64120 <literallayout>
64121 <literal> 8bitmime                   </literal>  received 8BITMIME status
64122 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
64123 <literal> address_rewrite            </literal>  address rewriting
64124 <literal> all_parents                </literal>  all parents in =&gt; lines
64125 <literal> arguments                  </literal>  command line arguments
64126 <literal>*connection_reject          </literal>  connection rejections
64127 <literal>*delay_delivery             </literal>  immediate delivery delayed
64128 <literal> deliver_time               </literal>  time taken to perform delivery
64129 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
64130 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
64131 <literal>*etrn                       </literal>  ETRN commands
64132 <literal>*host_lookup_failed         </literal>  as it says
64133 <literal> ident_timeout              </literal>  timeout for ident connection
64134 <phrase revisionflag="changed"><literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
64135 </phrase><literal> incoming_port              </literal>  remote port on &lt;= lines
64136 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
64137 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
64138 <literal>*queue_run                  </literal>  start and end queue runs
64139 <literal> queue_time                 </literal>  time on queue for one recipient
64140 <literal> queue_time_overall         </literal>  time on queue for whole message
64141 <literal> pid                        </literal>  Exim process id
64142 <literal> received_recipients        </literal>  recipients on &lt;= lines
64143 <literal> received_sender            </literal>  sender on &lt;= lines
64144 <literal>*rejected_header            </literal>  header contents on reject log
64145 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
64146 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
64147 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
64148 <literal>*sender_verify_fail         </literal>  sender verification failures
64149 <literal>*size_reject                </literal>  rejection because too big
64150 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
64151 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
64152 <literal> smtp_connection            </literal>  incoming SMTP connections
64153 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
64154 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
64155 <literal> smtp_no_mail               </literal>  session with no MAIL commands
64156 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
64157 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
64158 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
64159 <phrase revisionflag="changed"><literal>*tls_certificate_verified   </literal>  certificate verification status
64160 </phrase><literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
64161 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
64162 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
64163 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
64164
64165 <literal> all                        </literal>  all of the above
64166 </literallayout>
64167 <para>
64168 More details on each of these items follows:
64169 </para>
64170 <itemizedlist>
64171 <listitem>
64172 <para>
64173 <indexterm role="concept">
64174 <primary>8BITMIME</primary>
64175 </indexterm>
64176 <indexterm role="concept">
64177 <primary>log</primary>
64178 <secondary>8BITMIME</secondary>
64179 </indexterm>
64180 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
64181 which may help in tracking down interoperability issues with ancient MTAs
64182 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
64183 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
64184 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
64185 </para>
64186 </listitem>
64187 <listitem>
64188 <para>
64189 <indexterm role="concept">
64190 <primary><option>warn</option> ACL verb</primary>
64191 <secondary>log when skipping</secondary>
64192 </indexterm>
64193 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
64194 its conditions cannot be evaluated, a log line to this effect is written if
64195 this log selector is set.
64196 </para>
64197 </listitem>
64198 <listitem>
64199 <para>
64200 <indexterm role="concept">
64201 <primary>log</primary>
64202 <secondary>rewriting</secondary>
64203 </indexterm>
64204 <indexterm role="concept">
64205 <primary>rewriting</primary>
64206 <secondary>logging</secondary>
64207 </indexterm>
64208 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
64209 rewrites, but not to rewrites in filters run as an unprivileged user (because
64210 such users cannot access the log).
64211 </para>
64212 </listitem>
64213 <listitem>
64214 <para>
64215 <indexterm role="concept">
64216 <primary>log</primary>
64217 <secondary>full parentage</secondary>
64218 </indexterm>
64219 <option>all_parents</option>: Normally only the original and final addresses are logged on
64220 delivery lines; with this selector, intermediate parents are given in
64221 parentheses between them.
64222 </para>
64223 </listitem>
64224 <listitem>
64225 <para>
64226 <indexterm role="concept">
64227 <primary>log</primary>
64228 <secondary>Exim arguments</secondary>
64229 </indexterm>
64230 <indexterm role="concept">
64231 <primary>Exim arguments, logging</primary>
64232 </indexterm>
64233 <option>arguments</option>: This causes Exim to write the arguments with which it was called
64234 to the main log, preceded by the current working directory. This is a debugging
64235 feature, added to make it easier to find out how certain MUAs call
64236 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
64237 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
64238 that are empty or that contain white space are quoted. Non-printing characters
64239 are shown as escape sequences. This facility cannot log unrecognized arguments,
64240 because the arguments are checked before the configuration file is read. The
64241 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
64242 between the caller and Exim.
64243 </para>
64244 </listitem>
64245 <listitem>
64246 <para>
64247 <indexterm role="concept">
64248 <primary>log</primary>
64249 <secondary>connection rejections</secondary>
64250 </indexterm>
64251 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
64252 connection is rejected, for whatever reason.
64253 </para>
64254 </listitem>
64255 <listitem>
64256 <para>
64257 <indexterm role="concept">
64258 <primary>log</primary>
64259 <secondary>delayed delivery</secondary>
64260 </indexterm>
64261 <indexterm role="concept">
64262 <primary>delayed delivery, logging</primary>
64263 </indexterm>
64264 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
64265 started for an incoming message because the load is too high or too many
64266 messages were received on one connection. Logging does not occur if no delivery
64267 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
64268 </para>
64269 </listitem>
64270 <listitem>
64271 <para>
64272 <indexterm role="concept">
64273 <primary>log</primary>
64274 <secondary>delivery duration</secondary>
64275 </indexterm>
64276 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
64277 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
64278 </para>
64279 </listitem>
64280 <listitem>
64281 <para>
64282 <indexterm role="concept">
64283 <primary>log</primary>
64284 <secondary>message size on delivery</secondary>
64285 </indexterm>
64286 <indexterm role="concept">
64287 <primary>size</primary>
64288 <secondary>of message</secondary>
64289 </indexterm>
64290 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
64291 the <quote>=&gt;</quote> line, tagged with S=.
64292 </para>
64293 </listitem>
64294 <listitem>
64295 <para>
64296 <indexterm role="concept">
64297 <primary>log</primary>
64298 <secondary>dnslist defer</secondary>
64299 </indexterm>
64300 <indexterm role="concept">
64301 <primary>DNS list</primary>
64302 <secondary>logging defer</secondary>
64303 </indexterm>
64304 <indexterm role="concept">
64305 <primary>black list (DNS)</primary>
64306 </indexterm>
64307 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
64308 DNS black list suffers a temporary error.
64309 </para>
64310 </listitem>
64311 <listitem>
64312 <para>
64313 <indexterm role="concept">
64314 <primary>log</primary>
64315 <secondary>ETRN commands</secondary>
64316 </indexterm>
64317 <indexterm role="concept">
64318 <primary>ETRN</primary>
64319 <secondary>logging</secondary>
64320 </indexterm>
64321 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
64322 is run to determine whether or not it is actually accepted. An invalid ETRN
64323 command, or one received within a message transaction is not logged by this
64324 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
64325 </para>
64326 </listitem>
64327 <listitem>
64328 <para>
64329 <indexterm role="concept">
64330 <primary>log</primary>
64331 <secondary>host lookup failure</secondary>
64332 </indexterm>
64333 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
64334 any addresses, or when a lookup of an IP address fails to find a host name, a
64335 log line is written. This logging does not apply to direct DNS lookups when
64336 routing email addresses, but it does apply to <quote>byname</quote> lookups.
64337 </para>
64338 </listitem>
64339 <listitem>
64340 <para>
64341 <indexterm role="concept">
64342 <primary>log</primary>
64343 <secondary>ident timeout</secondary>
64344 </indexterm>
64345 <indexterm role="concept">
64346 <primary>RFC 1413</primary>
64347 <secondary>logging timeout</secondary>
64348 </indexterm>
64349 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
64350 client&#x2019;s ident port times out.
64351 </para>
64352 </listitem>
64353 <listitem>
64354 <para>
64355 <indexterm role="concept">
64356 <primary>log</primary>
64357 <secondary>incoming interface</secondary>
64358 </indexterm>
64359 <indexterm role="concept">
64360 <primary>log</primary>
64361 <secondary>local interface</secondary>
64362 </indexterm>
64363 <indexterm role="concept">
64364 <primary>log</primary>
64365 <secondary>local address and port</secondary>
64366 </indexterm>
64367 <indexterm role="concept">
64368 <primary>TCP/IP</primary>
64369 <secondary>logging local address and port</secondary>
64370 </indexterm>
64371 <indexterm role="concept">
64372 <primary>interface</primary>
64373 <secondary>logging</secondary>
64374 </indexterm>
64375 <option>incoming_interface</option>: The interface on which a message was received is added
64376 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
64377 followed by a colon and the port number. The local interface and port are also
64378 added to other SMTP log lines, for example <quote>SMTP connection from</quote> and to
64379 rejection lines
64380 </para>
64381 <para revisionflag="changed">
64382 and (despite the name) the local interface is added to <quote>=&gt;</quote> lines..
64383 </para>
64384 </listitem>
64385 <listitem>
64386 <para>
64387 <indexterm role="concept">
64388 <primary>log</primary>
64389 <secondary>incoming remote port</secondary>
64390 </indexterm>
64391 <indexterm role="concept">
64392 <primary>port</primary>
64393 <secondary>logging remote</secondary>
64394 </indexterm>
64395 <indexterm role="concept">
64396 <primary>TCP/IP</primary>
64397 <secondary>logging incoming remote port</secondary>
64398 </indexterm>
64399 <indexterm role="variable">
64400 <primary><varname>$sender_fullhost</varname></primary>
64401 </indexterm>
64402 <indexterm role="variable">
64403 <primary><varname>$sender_rcvhost</varname></primary>
64404 </indexterm>
64405 <option>incoming_port</option>: The remote port number from which a message was received is
64406 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
64407 in square brackets, and separated from it by a colon. This is implemented by
64408 changing the value that is put in the <varname>$sender_fullhost</varname> and
64409 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
64410 important with the widening use of NAT (see RFC 2505).
64411 </para>
64412 </listitem>
64413 <listitem>
64414 <para>
64415 <indexterm role="concept">
64416 <primary>log</primary>
64417 <secondary>dropped connection</secondary>
64418 </indexterm>
64419 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
64420 connection is unexpectedly dropped.
64421 </para>
64422 </listitem>
64423 <listitem>
64424 <para>
64425 <indexterm role="concept">
64426 <primary>log</primary>
64427 <secondary>outgoing remote port</secondary>
64428 </indexterm>
64429 <indexterm role="concept">
64430 <primary>port</primary>
64431 <secondary>logging outgoint remote</secondary>
64432 </indexterm>
64433 <indexterm role="concept">
64434 <primary>TCP/IP</primary>
64435 <secondary>logging ougtoing remote port</secondary>
64436 </indexterm>
64437 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
64438 containing =&gt; tags) following the IP address. This option is not included in
64439 the default setting, because for most ordinary configurations, the remote port
64440 number is always 25 (the SMTP port).
64441 </para>
64442 </listitem>
64443 <listitem>
64444 <para>
64445 <indexterm role="concept">
64446 <primary>log</primary>
64447 <secondary>process ids in</secondary>
64448 </indexterm>
64449 <indexterm role="concept">
64450 <primary>pid (process id)</primary>
64451 <secondary>in log lines</secondary>
64452 </indexterm>
64453 <option>pid</option>: The current process id is added to every log line, in square brackets,
64454 immediately after the time and date.
64455 </para>
64456 </listitem>
64457 <listitem>
64458 <para>
64459 <indexterm role="concept">
64460 <primary>log</primary>
64461 <secondary>queue run</secondary>
64462 </indexterm>
64463 <indexterm role="concept">
64464 <primary>queue runner</primary>
64465 <secondary>logging</secondary>
64466 </indexterm>
64467 <option>queue_run</option>: The start and end of every queue run are logged.
64468 </para>
64469 </listitem>
64470 <listitem>
64471 <para>
64472 <indexterm role="concept">
64473 <primary>log</primary>
64474 <secondary>queue time</secondary>
64475 </indexterm>
64476 <option>queue_time</option>: The amount of time the message has been in the queue on the
64477 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
64478 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
64479 includes reception time as well as the delivery time for the current address.
64480 This means that it may be longer than the difference between the arrival and
64481 delivery log line times, because the arrival log line is not written until the
64482 message has been successfully received.
64483 </para>
64484 </listitem>
64485 <listitem>
64486 <para>
64487 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
64488 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
64489 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
64490 message, so it includes reception time as well as the total delivery time.
64491 </para>
64492 </listitem>
64493 <listitem>
64494 <para>
64495 <indexterm role="concept">
64496 <primary>log</primary>
64497 <secondary>recipients</secondary>
64498 </indexterm>
64499 <option>received_recipients</option>: The recipients of a message are listed in the main log
64500 as soon as the message is received. The list appears at the end of the log line
64501 that is written when a message is received, preceded by the word <quote>for</quote>. The
64502 addresses are listed after they have been qualified, but before any rewriting
64503 has taken place.
64504 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
64505 in the list.
64506 </para>
64507 </listitem>
64508 <listitem>
64509 <para>
64510 <indexterm role="concept">
64511 <primary>log</primary>
64512 <secondary>sender reception</secondary>
64513 </indexterm>
64514 <option>received_sender</option>: The unrewritten original sender of a message is added to
64515 the end of the log line that records the message&#x2019;s arrival, after the word
64516 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
64517 </para>
64518 </listitem>
64519 <listitem>
64520 <para>
64521 <indexterm role="concept">
64522 <primary>log</primary>
64523 <secondary>header lines for rejection</secondary>
64524 </indexterm>
64525 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
64526 rejection is written to the reject log, the complete header is added to the
64527 log. Header logging can be turned off individually for messages that are
64528 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
64529 </para>
64530 </listitem>
64531 <listitem>
64532 <para>
64533 <indexterm role="concept">
64534 <primary>log</primary>
64535 <secondary>retry defer</secondary>
64536 </indexterm>
64537 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
64538 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
64539 message is always omitted from individual message logs after the first delivery
64540 attempt.
64541 </para>
64542 </listitem>
64543 <listitem>
64544 <para>
64545 <indexterm role="concept">
64546 <primary>log</primary>
64547 <secondary>return path</secondary>
64548 </indexterm>
64549 <option>return_path_on_delivery</option>: The return path that is being transmitted with
64550 the message is included in delivery and bounce lines, using the tag P=.
64551 This is omitted if no delivery actually happens, for example, if routing fails,
64552 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
64553 </para>
64554 </listitem>
64555 <listitem>
64556 <para>
64557 <indexterm role="concept">
64558 <primary>log</primary>
64559 <secondary>sender on delivery</secondary>
64560 </indexterm>
64561 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
64562 and bounce line, tagged by F= (for <quote>from</quote>).
64563 This is the original sender that was received with the message; it is not
64564 necessarily the same as the outgoing return path.
64565 </para>
64566 </listitem>
64567 <listitem>
64568 <para>
64569 <indexterm role="concept">
64570 <primary>log</primary>
64571 <secondary>sender verify failure</secondary>
64572 </indexterm>
64573 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
64574 gives details of a sender verification failure is not written. Log lines for
64575 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
64576 detail is lost.
64577 </para>
64578 </listitem>
64579 <listitem>
64580 <para>
64581 <indexterm role="concept">
64582 <primary>log</primary>
64583 <secondary>size rejection</secondary>
64584 </indexterm>
64585 <option>size_reject</option>: A log line is written whenever a message is rejected because
64586 it is too big.
64587 </para>
64588 </listitem>
64589 <listitem>
64590 <para>
64591 <indexterm role="concept">
64592 <primary>log</primary>
64593 <secondary>frozen messages; skipped</secondary>
64594 </indexterm>
64595 <indexterm role="concept">
64596 <primary>frozen messages</primary>
64597 <secondary>logging skipping</secondary>
64598 </indexterm>
64599 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
64600 queue run because it is frozen or because another process is already delivering
64601 it.
64602 <indexterm role="concept">
64603 <primary><quote>spool file is locked</quote></primary>
64604 </indexterm>
64605 The message that is written is <quote>spool file is locked</quote>.
64606 </para>
64607 </listitem>
64608 <listitem>
64609 <para>
64610 <indexterm role="concept">
64611 <primary>log</primary>
64612 <secondary>smtp confirmation</secondary>
64613 </indexterm>
64614 <indexterm role="concept">
64615 <primary>SMTP</primary>
64616 <secondary>logging confirmation</secondary>
64617 </indexterm>
64618 <indexterm role="concept">
64619 <primary>LMTP</primary>
64620 <secondary>logging confirmation</secondary>
64621 </indexterm>
64622 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
64623 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
64624 A number of MTAs (including Exim) return an identifying string in this
64625 response.
64626 </para>
64627 </listitem>
64628 <listitem>
64629 <para>
64630 <indexterm role="concept">
64631 <primary>log</primary>
64632 <secondary>SMTP connections</secondary>
64633 </indexterm>
64634 <indexterm role="concept">
64635 <primary>SMTP</primary>
64636 <secondary>logging connections</secondary>
64637 </indexterm>
64638 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
64639 established or closed, unless the connection is from a host that matches
64640 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
64641 only when the closure is unexpected.) This applies to connections from local
64642 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
64643 dropped in the middle of a message, a log line is always written, whether or
64644 not this selector is set, but otherwise nothing is written at the start and end
64645 of connections unless this selector is enabled.
64646 </para>
64647 <para>
64648 For TCP/IP connections to an Exim daemon, the current number of connections is
64649 included in the log message for each new connection, but note that the count is
64650 reset if the daemon is restarted.
64651 Also, because connections are closed (and the closure is logged) in
64652 subprocesses, the count may not include connections that have been closed but
64653 whose termination the daemon has not yet noticed. Thus, while it is possible to
64654 match up the opening and closing of connections in the log, the value of the
64655 logged counts may not be entirely accurate.
64656 </para>
64657 </listitem>
64658 <listitem>
64659 <para>
64660 <indexterm role="concept">
64661 <primary>log</primary>
64662 <secondary>SMTP transaction; incomplete</secondary>
64663 </indexterm>
64664 <indexterm role="concept">
64665 <primary>SMTP</primary>
64666 <secondary>logging incomplete transactions</secondary>
64667 </indexterm>
64668 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
64669 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
64670 and the message sender plus any accepted recipients are included in the log
64671 line. This can provide evidence of dictionary attacks.
64672 </para>
64673 </listitem>
64674 <listitem>
64675 <para>
64676 <indexterm role="concept">
64677 <primary>log</primary>
64678 <secondary>non-MAIL SMTP sessions</secondary>
64679 </indexterm>
64680 <indexterm role="concept">
64681 <primary>MAIL</primary>
64682 <secondary>logging session without</secondary>
64683 </indexterm>
64684 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
64685 connection terminates without having issued a MAIL command. This includes both
64686 the case when the connection is dropped, and the case when QUIT is used. It
64687 does not include cases where the connection is rejected right at the start (by
64688 an ACL, or because there are too many connections, or whatever). These cases
64689 already have their own log lines.
64690 </para>
64691 <para>
64692 The log line that is written contains the identity of the client in the usual
64693 way, followed by D= and a time, which records the duration of the connection.
64694 If the connection was authenticated, this fact is logged exactly as it is for
64695 an incoming message, with an A= item. If the connection was encrypted, CV=,
64696 DN=, and X= items may appear as they do for an incoming message, controlled by
64697 the same logging options.
64698 </para>
64699 <para>
64700 Finally, if any SMTP commands were issued during the connection, a C= item
64701 is added to the line, listing the commands that were used. For example,
64702 </para>
64703 <literallayout class="monospaced">
64704 C=EHLO,QUIT
64705 </literallayout>
64706 <para>
64707 shows that the client issued QUIT straight after EHLO. If there were fewer
64708 than 20 commands, they are all listed. If there were more than 20 commands,
64709 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
64710 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
64711 have been aborted before 20 non-mail commands are processed.
64712 </para>
64713 </listitem>
64714 <listitem>
64715 <para>
64716 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
64717 colon-separated, is appended to the A= item for a message arrival or delivery
64718 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
64719 was accepted or used.
64720 </para>
64721 </listitem>
64722 <listitem>
64723 <para>
64724 <indexterm role="concept">
64725 <primary>log</primary>
64726 <secondary>SMTP protocol error</secondary>
64727 </indexterm>
64728 <indexterm role="concept">
64729 <primary>SMTP</primary>
64730 <secondary>logging protocol error</secondary>
64731 </indexterm>
64732 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
64733 encountered. Exim does not have perfect detection of all protocol errors
64734 because of transmission delays and the use of pipelining. If PIPELINING has
64735 been advertised to a client, an Exim server assumes that the client will use
64736 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
64737 received after rejecting MAIL) as protocol errors.
64738 </para>
64739 </listitem>
64740 <listitem>
64741 <para>
64742 <indexterm role="concept">
64743 <primary>SMTP</primary>
64744 <secondary>logging syntax errors</secondary>
64745 </indexterm>
64746 <indexterm role="concept">
64747 <primary>SMTP</primary>
64748 <secondary>syntax errors; logging</secondary>
64749 </indexterm>
64750 <indexterm role="concept">
64751 <primary>SMTP</primary>
64752 <secondary>unknown command; logging</secondary>
64753 </indexterm>
64754 <indexterm role="concept">
64755 <primary>log</primary>
64756 <secondary>unknown SMTP command</secondary>
64757 </indexterm>
64758 <indexterm role="concept">
64759 <primary>log</primary>
64760 <secondary>SMTP syntax error</secondary>
64761 </indexterm>
64762 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
64763 encountered. An unrecognized command is treated as a syntax error. For an
64764 external connection, the host identity is given; for an internal connection
64765 using <option>-bs</option> the sender identification (normally the calling user) is given.
64766 </para>
64767 </listitem>
64768 <listitem>
64769 <para>
64770 <indexterm role="concept">
64771 <primary>log</primary>
64772 <secondary>subject</secondary>
64773 </indexterm>
64774 <indexterm role="concept">
64775 <primary>subject, logging</primary>
64776 </indexterm>
64777 <option>subject</option>: The subject of the message is added to the arrival log line,
64778 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
64779 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
64780 specifies whether characters with values greater than 127 should be logged
64781 unchanged, or whether they should be rendered as escape sequences.
64782 </para>
64783 </listitem>
64784 <listitem>
64785 <para>
64786 <indexterm role="concept">
64787 <primary>log</primary>
64788 <secondary>certificate verification</secondary>
64789 </indexterm>
64790 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
64791 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
64792 verified, and <literal>CV=no</literal> if not.
64793 </para>
64794 </listitem>
64795 <listitem>
64796 <para>
64797 <indexterm role="concept">
64798 <primary>log</primary>
64799 <secondary>TLS cipher</secondary>
64800 </indexterm>
64801 <indexterm role="concept">
64802 <primary>TLS</primary>
64803 <secondary>logging cipher</secondary>
64804 </indexterm>
64805 <option>tls_cipher</option>: When a message is sent or received over an encrypted
64806 connection, the cipher suite used is added to the log line, preceded by X=.
64807 </para>
64808 </listitem>
64809 <listitem>
64810 <para>
64811 <indexterm role="concept">
64812 <primary>log</primary>
64813 <secondary>TLS peer DN</secondary>
64814 </indexterm>
64815 <indexterm role="concept">
64816 <primary>TLS</primary>
64817 <secondary>logging peer DN</secondary>
64818 </indexterm>
64819 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
64820 connection, and a certificate is supplied by the remote host, the peer DN is
64821 added to the log line, preceded by DN=.
64822 </para>
64823 </listitem>
64824 <listitem>
64825 <para>
64826 <indexterm role="concept">
64827 <primary>log</primary>
64828 <secondary>TLS SNI</secondary>
64829 </indexterm>
64830 <indexterm role="concept">
64831 <primary>TLS</primary>
64832 <secondary>logging SNI</secondary>
64833 </indexterm>
64834 <option>tls_sni</option>: When a message is received over an encrypted connection, and
64835 the remote host provided the Server Name Indication extension, the SNI is
64836 added to the log line, preceded by SNI=.
64837 </para>
64838 </listitem>
64839 <listitem>
64840 <para>
64841 <indexterm role="concept">
64842 <primary>log</primary>
64843 <secondary>DNS failure in list</secondary>
64844 </indexterm>
64845 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
64846 result of a list match is failure because a DNS lookup failed.
64847 </para>
64848 </listitem>
64849 </itemizedlist>
64850 </section>
64851 <section id="SECID260">
64852 <title>Message log</title>
64853 <para>
64854 <indexterm role="concept">
64855 <primary>message</primary>
64856 <secondary>log file for</secondary>
64857 </indexterm>
64858 <indexterm role="concept">
64859 <primary>log</primary>
64860 <secondary>message log; description of</secondary>
64861 </indexterm>
64862 <indexterm role="concept">
64863 <primary><filename>msglog</filename> directory</primary>
64864 </indexterm>
64865 <indexterm role="option">
64866 <primary><option>preserve_message_logs</option></primary>
64867 </indexterm>
64868 In addition to the general log files, Exim writes a log file for each message
64869 that it handles. The names of these per-message logs are the message ids, and
64870 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
64871 message log contains copies of the log lines that apply to the message. This
64872 makes it easier to inspect the status of an individual message without having
64873 to search the main log. A message log is deleted when processing of the message
64874 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
64875 only with great care because they can fill up your disk very quickly.
64876 </para>
64877 <para>
64878 On a heavily loaded system, it may be desirable to disable the use of
64879 per-message logs, in order to reduce disk I/O. This can be done by setting the
64880 <option>message_logs</option> option false.
64881 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
64882 </para>
64883 </section>
64884 </chapter>
64885
64886 <chapter id="CHAPutils">
64887 <title>Exim utilities</title>
64888 <para>
64889 <indexterm role="concept" id="IIDutils" class="startofrange">
64890 <primary>utilities</primary>
64891 </indexterm>
64892 A number of utility scripts and programs are supplied with Exim and are
64893 described in this chapter. There is also the Exim Monitor, which is covered in
64894 the next chapter. The utilities described here are:
64895 </para>
64896 <informaltable frame="none">
64897 <tgroup cols="3" colsep="0" rowsep="0">
64898 <colspec colwidth="7*" align="left"/>
64899 <colspec colwidth="15*" align="left"/>
64900 <colspec colwidth="40*" align="left"/>
64901 <tbody>
64902 <row>
64903 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
64904 <entry><emphasis>exiwhat</emphasis></entry>
64905 <entry>list what Exim processes are doing</entry>
64906 </row>
64907 <row>
64908 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
64909 <entry><emphasis>exiqgrep</emphasis></entry>
64910 <entry>grep the queue</entry>
64911 </row>
64912 <row>
64913 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
64914 <entry><emphasis>exiqsumm</emphasis></entry>
64915 <entry>summarize the queue</entry>
64916 </row>
64917 <row>
64918 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
64919 <entry><emphasis>exigrep</emphasis></entry>
64920 <entry>search the main log</entry>
64921 </row>
64922 <row>
64923 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
64924 <entry><emphasis>exipick</emphasis></entry>
64925 <entry>select messages on various criteria</entry>
64926 </row>
64927 <row>
64928 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
64929 <entry><emphasis>exicyclog</emphasis></entry>
64930 <entry>cycle (rotate) log files</entry>
64931 </row>
64932 <row>
64933 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
64934 <entry><emphasis>eximstats</emphasis></entry>
64935 <entry>extract statistics from the log</entry>
64936 </row>
64937 <row>
64938 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
64939 <entry><emphasis>exim_checkaccess</emphasis></entry>
64940 <entry>check address acceptance from given IP</entry>
64941 </row>
64942 <row>
64943 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
64944 <entry><emphasis>exim_dbmbuild</emphasis></entry>
64945 <entry>build a DBM file</entry>
64946 </row>
64947 <row>
64948 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
64949 <entry><emphasis>exinext</emphasis></entry>
64950 <entry>extract retry information</entry>
64951 </row>
64952 <row>
64953 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
64954 <entry><emphasis>exim_dumpdb</emphasis></entry>
64955 <entry>dump a hints database</entry>
64956 </row>
64957 <row>
64958 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
64959 <entry><emphasis>exim_tidydb</emphasis></entry>
64960 <entry>clean up a hints database</entry>
64961 </row>
64962 <row>
64963 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
64964 <entry><emphasis>exim_fixdb</emphasis></entry>
64965 <entry>patch a hints database</entry>
64966 </row>
64967 <row>
64968 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
64969 <entry><emphasis>exim_lock</emphasis></entry>
64970 <entry>lock a mailbox file</entry>
64971 </row>
64972 </tbody>
64973 </tgroup>
64974 </informaltable>
64975 <para>
64976 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
64977 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
64978 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
64979 </para>
64980 <section id="SECTfinoutwha">
64981 <title>Finding out what Exim processes are doing (exiwhat)</title>
64982 <para>
64983 <indexterm role="concept">
64984 <primary><emphasis>exiwhat</emphasis></primary>
64985 </indexterm>
64986 <indexterm role="concept">
64987 <primary>process, querying</primary>
64988 </indexterm>
64989 <indexterm role="concept">
64990 <primary>SIGUSR1</primary>
64991 </indexterm>
64992 On operating systems that can restart a system call after receiving a signal
64993 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
64994 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
64995 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
64996 processes it can find, having first emptied the file. It then waits for one
64997 second to allow the Exim processes to react before displaying the results. In
64998 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
64999 send the signal to the Exim processes, so it is normally run as root.
65000 </para>
65001 <para>
65002 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
65003 use by system administrators. It is not sensible, for example, to set up a
65004 script that sends SIGUSR1 signals to Exim processes at short intervals.
65005 </para>
65006 <para>
65007 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
65008 varies in different operating systems. Not only are different options used,
65009 but the format of the output is different. For this reason, there are some
65010 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
65011 it doesn&#x2019;t seem to be working for you, check the following compile-time
65012 options:
65013 </para>
65014 <literallayout>
65015 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
65016 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
65017 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
65018 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
65019 </literallayout>
65020 <para>
65021 An example of typical output from <emphasis>exiwhat</emphasis> is
65022 </para>
65023 <literallayout class="monospaced">
65024 164 daemon: -q1h, listening on port 25
65025 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
65026 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
65027   [10.19.42.42] (editor@ref.example)
65028 10592 handling incoming call from [192.168.243.242]
65029 10628 accepting a local non-SMTP message
65030 </literallayout>
65031 <para>
65032 The first number in the output line is the process number. The third line has
65033 been split here, in order to fit it on the page.
65034 </para>
65035 </section>
65036 <section id="SECTgreptheque">
65037 <title>Selective queue listing (exiqgrep)</title>
65038 <para>
65039 <indexterm role="concept">
65040 <primary><emphasis>exiqgrep</emphasis></primary>
65041 </indexterm>
65042 <indexterm role="concept">
65043 <primary>queue</primary>
65044 <secondary>grepping</secondary>
65045 </indexterm>
65046 This utility is a Perl script contributed by Matt Hubbard. It runs
65047 </para>
65048 <literallayout class="monospaced">
65049 exim -bpu
65050 </literallayout>
65051 <para>
65052 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
65053 </para>
65054 <literallayout class="monospaced">
65055 exim -bp
65056 </literallayout>
65057 <para>
65058 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
65059 contain alternate exim configuration the queue management might be using.
65060 </para>
65061 <para>
65062 to obtain a queue listing, and then greps the output to select messages
65063 that match given criteria. The following selection options are available:
65064 </para>
65065 <variablelist>
65066 <varlistentry>
65067 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
65068 <listitem>
65069 <para>
65070 Match the sender address using a case-insensitive search. The field that is
65071 tested is enclosed in angle brackets, so you can test for bounce messages with
65072 </para>
65073 <literallayout class="monospaced">
65074 exiqgrep -f '^&lt;&gt;$'
65075 </literallayout>
65076 </listitem></varlistentry>
65077 <varlistentry>
65078 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
65079 <listitem>
65080 <para>
65081 Match a recipient address using a case-insensitive search. The field that is
65082 tested is not enclosed in angle brackets.
65083 </para>
65084 </listitem></varlistentry>
65085 <varlistentry>
65086 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
65087 <listitem>
65088 <para>
65089 Match against the size field.
65090 </para>
65091 </listitem></varlistentry>
65092 <varlistentry>
65093 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
65094 <listitem>
65095 <para>
65096 Match messages that are younger than the given time.
65097 </para>
65098 </listitem></varlistentry>
65099 <varlistentry>
65100 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
65101 <listitem>
65102 <para>
65103 Match messages that are older than the given time.
65104 </para>
65105 </listitem></varlistentry>
65106 <varlistentry>
65107 <term><emphasis role="bold">-z</emphasis></term>
65108 <listitem>
65109 <para>
65110 Match only frozen messages.
65111 </para>
65112 </listitem></varlistentry>
65113 <varlistentry>
65114 <term><emphasis role="bold">-x</emphasis></term>
65115 <listitem>
65116 <para>
65117 Match only non-frozen messages.
65118 </para>
65119 </listitem></varlistentry>
65120 </variablelist>
65121 <para>
65122 The following options control the format of the output:
65123 </para>
65124 <variablelist>
65125 <varlistentry>
65126 <term><emphasis role="bold">-c</emphasis></term>
65127 <listitem>
65128 <para>
65129 Display only the count of matching messages.
65130 </para>
65131 </listitem></varlistentry>
65132 <varlistentry>
65133 <term><emphasis role="bold">-l</emphasis></term>
65134 <listitem>
65135 <para>
65136 Long format &ndash; display the full message information as output by Exim. This is
65137 the default.
65138 </para>
65139 </listitem></varlistentry>
65140 <varlistentry>
65141 <term><emphasis role="bold">-i</emphasis></term>
65142 <listitem>
65143 <para>
65144 Display message ids only.
65145 </para>
65146 </listitem></varlistentry>
65147 <varlistentry>
65148 <term><emphasis role="bold">-b</emphasis></term>
65149 <listitem>
65150 <para>
65151 Brief format &ndash; one line per message.
65152 </para>
65153 </listitem></varlistentry>
65154 <varlistentry>
65155 <term><emphasis role="bold">-R</emphasis></term>
65156 <listitem>
65157 <para>
65158 Display messages in reverse order.
65159 </para>
65160 </listitem></varlistentry>
65161 <varlistentry>
65162 <term><emphasis role="bold">-a</emphasis></term>
65163 <listitem>
65164 <para>
65165 Include delivered recipients in queue listing.
65166 </para>
65167 </listitem></varlistentry>
65168 </variablelist>
65169 <para>
65170 There is one more option, <option>-h</option>, which outputs a list of options.
65171 </para>
65172 </section>
65173 <section id="SECTsumtheque">
65174 <title>Summarizing the queue (exiqsumm)</title>
65175 <para>
65176 <indexterm role="concept">
65177 <primary><emphasis>exiqsumm</emphasis></primary>
65178 </indexterm>
65179 <indexterm role="concept">
65180 <primary>queue</primary>
65181 <secondary>summary</secondary>
65182 </indexterm>
65183 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
65184 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
65185 running a command such as
65186 </para>
65187 <literallayout class="monospaced">
65188 exim -bp | exiqsumm
65189 </literallayout>
65190 <para>
65191 The output consists of one line for each domain that has messages waiting for
65192 it, as in the following example:
65193 </para>
65194 <literallayout class="monospaced">
65195 3   2322   74m   66m  msn.com.example
65196 </literallayout>
65197 <para>
65198 Each line lists the number of pending deliveries for a domain, their total
65199 volume, and the length of time that the oldest and the newest messages have
65200 been waiting. Note that the number of pending deliveries is greater than the
65201 number of messages when messages have more than one recipient.
65202 </para>
65203 <para>
65204 A summary line is output at the end. By default the output is sorted on the
65205 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
65206 the output to be sorted by oldest message and by count of messages,
65207 respectively. There are also three options that split the messages for each
65208 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
65209 separates frozen messages, and <option>-s</option> separates messages according to their
65210 sender.
65211 </para>
65212 <para>
65213 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
65214 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
65215 generated by aliasing or forwarding are included (unless the <option>one_time</option>
65216 option of the <command>redirect</command> router has been used to convert them into <quote>top
65217 level</quote> addresses).
65218 </para>
65219 </section>
65220 <section id="SECTextspeinf">
65221 <title>Extracting specific information from the log (exigrep)</title>
65222 <para>
65223 <indexterm role="concept">
65224 <primary><emphasis>exigrep</emphasis></primary>
65225 </indexterm>
65226 <indexterm role="concept">
65227 <primary>log</primary>
65228 <secondary>extracts; grepping for</secondary>
65229 </indexterm>
65230 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
65231 files for entries that match a given pattern. When it finds a match, it
65232 extracts all the log entries for the relevant message, not just those that
65233 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
65234 given message, or all mail for a given user, or for a given host, for example.
65235 The input files can be in Exim log format or syslog format.
65236 If a matching log line is not associated with a specific message, it is
65237 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
65238 </para>
65239 <literallayout>
65240 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-M] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
65241 </literallayout>
65242 <para>
65243 If no log file names are given on the command line, the standard input is read.
65244 </para>
65245 <para>
65246 The <option>-t</option> argument specifies a number of seconds. It adds an additional
65247 condition for message selection. Messages that are complete are shown only if
65248 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
65249 </para>
65250 <para>
65251 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
65252 makes it case-sensitive. This may give a performance improvement when searching
65253 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
65254 option; with <option>-I</option> they do not. In both cases it is possible to change the
65255 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
65256 </para>
65257 <para>
65258 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
65259 pattern as standing for themselves. Otherwise the pattern must be a Perl
65260 regular expression.
65261 </para>
65262 <para>
65263 The <option>-v</option> option inverts the matching condition. That is, a line is selected
65264 if it does <emphasis>not</emphasis> match the pattern.
65265 </para>
65266 <para>
65267 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
65268 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
65269 normally.
65270 </para>
65271 <para>
65272 Example of <option>-M</option>:
65273 user_a sends a message to user_b, which generates a bounce back to user_b. If
65274 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
65275 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
65276 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
65277 when searching for <quote>user_a</quote> will show both messages since the bounce is
65278 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
65279 search term.
65280 </para>
65281 <para>
65282 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
65283 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
65284 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
65285 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
65286 autodetection of some well known compression extensions.
65287 </para>
65288 </section>
65289 <section id="SECTexipick">
65290 <title>Selecting messages by various criteria (exipick)</title>
65291 <para>
65292 <indexterm role="concept">
65293 <primary><emphasis>exipick</emphasis></primary>
65294 </indexterm>
65295 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
65296 lists messages from the queue according to a variety of criteria. For details
65297 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
65298 <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
65299 the <option>--help</option> option.
65300 </para>
65301 </section>
65302 <section id="SECTcyclogfil">
65303 <title>Cycling log files (exicyclog)</title>
65304 <para>
65305 <indexterm role="concept">
65306 <primary>log</primary>
65307 <secondary>cycling local files</secondary>
65308 </indexterm>
65309 <indexterm role="concept">
65310 <primary>cycling logs</primary>
65311 </indexterm>
65312 <indexterm role="concept">
65313 <primary><emphasis>exicyclog</emphasis></primary>
65314 </indexterm>
65315 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
65316 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
65317 you are using log files with datestamps in their names (see section
65318 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
65319 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
65320 There are two command line options for <emphasis>exicyclog</emphasis>:
65321 </para>
65322 <itemizedlist>
65323 <listitem>
65324 <para>
65325 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
65326 default that is set when Exim is built. The default default is 10.
65327 </para>
65328 </listitem>
65329 <listitem>
65330 <para>
65331 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
65332 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
65333 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
65334 configuration.
65335 </para>
65336 </listitem>
65337 </itemizedlist>
65338 <para>
65339 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
65340 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
65341 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
65342 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
65343 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
65344 logs are handled similarly.
65345 </para>
65346 <para>
65347 If the limit is greater than 99, the script uses 3-digit numbers such as
65348 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
65349 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
65350 any existing log files.
65351 </para>
65352 <para>
65353 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
65354 the end are deleted. All files with numbers greater than 01 are compressed,
65355 using a compression command which is configured by the COMPRESS_COMMAND
65356 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
65357 root <option>crontab</option> entry of the form
65358 </para>
65359 <literallayout class="monospaced">
65360 1 0 * * * su exim -c /usr/exim/bin/exicyclog
65361 </literallayout>
65362 <para>
65363 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
65364 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
65365 </para>
65366 </section>
65367 <section id="SECTmailstat">
65368 <title>Mail statistics (eximstats)</title>
65369 <para>
65370 <indexterm role="concept">
65371 <primary>statistics</primary>
65372 </indexterm>
65373 <indexterm role="concept">
65374 <primary><emphasis>eximstats</emphasis></primary>
65375 </indexterm>
65376 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
65377 information from log files. The output is either plain text, or HTML.
65378 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
65379 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
65380 </para>
65381 <para>
65382 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
65383 latest version is the result of some extensive revision by Steve Campbell. A
65384 lot of information is given by default, but there are options for suppressing
65385 various parts of it. Following any options, the arguments to the script are a
65386 list of files, which should be main log files. For example:
65387 </para>
65388 <literallayout class="monospaced">
65389 eximstats -nr /var/spool/exim/log/mainlog.01
65390 </literallayout>
65391 <para>
65392 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
65393 messages received from or delivered to various hosts. The information is sorted
65394 both by message count and by volume, and the top fifty hosts in each category
65395 are listed on the standard output. Similar information, based on email
65396 addresses or domains instead of hosts can be requested by means of various
65397 options. For messages delivered and received locally, similar statistics are
65398 also produced per user.
65399 </para>
65400 <para>
65401 The output also includes total counts and statistics about delivery errors, and
65402 histograms showing the number of messages received and deliveries made in each
65403 hour of the day. A delivery with more than one address in its envelope (for
65404 example, an SMTP transaction with more than one RCPT command) is counted
65405 as a single delivery by <emphasis>eximstats</emphasis>.
65406 </para>
65407 <para>
65408 Though normally more deliveries than receipts are reported (as messages may
65409 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
65410 messages received than delivered, even though the queue is empty at the start
65411 and end of the period in question. If an incoming message contains no valid
65412 recipients, no deliveries are recorded for it. A bounce message is handled as
65413 an entirely separate message.
65414 </para>
65415 <para>
65416 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
65417 of messages received and deliveries made, and the number of hosts involved in
65418 each case. It also outputs the number of messages that were delayed (that is,
65419 not completely delivered at the first attempt), and the number that had at
65420 least one address that failed.
65421 </para>
65422 <para>
65423 The remainder of the output is in sections that can be independently disabled
65424 or modified by various options. It consists of a summary of deliveries by
65425 transport, histograms of messages received and delivered per time interval
65426 (default per hour), information about the time messages spent on the queue,
65427 a list of relayed messages, lists of the top fifty sending hosts, local
65428 senders, destination hosts, and destination local users by count and by volume,
65429 and a list of delivery errors that occurred.
65430 </para>
65431 <para>
65432 The relay information lists messages that were actually relayed, that is, they
65433 came from a remote host and were directly delivered to some other remote host,
65434 without being processed (for example, for aliasing or forwarding) locally.
65435 </para>
65436 <para>
65437 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
65438 outputs. These are documented in the Perl script itself, and can be extracted
65439 by running the command <command>perldoc</command> on the script. For example:
65440 </para>
65441 <literallayout class="monospaced">
65442 perldoc /usr/exim/bin/eximstats
65443 </literallayout>
65444 </section>
65445 <section id="SECTcheckaccess">
65446 <title>Checking access policy (exim_checkaccess)</title>
65447 <para>
65448 <indexterm role="concept">
65449 <primary><emphasis>exim_checkaccess</emphasis></primary>
65450 </indexterm>
65451 <indexterm role="concept">
65452 <primary>policy control</primary>
65453 <secondary>checking access</secondary>
65454 </indexterm>
65455 <indexterm role="concept">
65456 <primary>checking access</primary>
65457 </indexterm>
65458 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
65459 debugging output, in order to check what Exim is doing when it is applying
65460 policy controls to incoming SMTP mail. However, not everybody is sufficiently
65461 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
65462 sometimes you just want to answer the question <quote>Does this address have
65463 access?</quote> without bothering with any further details.
65464 </para>
65465 <para>
65466 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
65467 two arguments, an IP address and an email address:
65468 </para>
65469 <literallayout class="monospaced">
65470 exim_checkaccess 10.9.8.7 A.User@a.domain.example
65471 </literallayout>
65472 <para>
65473 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
65474 given email address would be accepted in a RCPT command in a TCP/IP
65475 connection from the host with the given IP address. The output of the utility
65476 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
65477 </para>
65478 <literallayout class="monospaced">
65479 Rejected:
65480 550 Relay not permitted
65481 </literallayout>
65482 <para>
65483 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
65484 for the MAIL command, but you can change this by providing additional
65485 options. These are passed directly to the Exim command. For example, to specify
65486 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
65487 you can use:
65488 </para>
65489 <literallayout class="monospaced">
65490 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
65491                  -f himself@there.example
65492 </literallayout>
65493 <para>
65494 Note that these additional Exim command line items must be given after the two
65495 mandatory arguments.
65496 </para>
65497 <para>
65498 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
65499 while running its checks. You can run checks that include callouts by using
65500 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
65501 </para>
65502 </section>
65503 <section id="SECTdbmbuild">
65504 <title>Making DBM files (exim_dbmbuild)</title>
65505 <para>
65506 <indexterm role="concept">
65507 <primary>DBM</primary>
65508 <secondary>building dbm files</secondary>
65509 </indexterm>
65510 <indexterm role="concept">
65511 <primary>building DBM files</primary>
65512 </indexterm>
65513 <indexterm role="concept">
65514 <primary><emphasis>exim_dbmbuild</emphasis></primary>
65515 </indexterm>
65516 <indexterm role="concept">
65517 <primary>lower casing</primary>
65518 </indexterm>
65519 <indexterm role="concept">
65520 <primary>binary zero</primary>
65521 <secondary>in lookup key</secondary>
65522 </indexterm>
65523 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
65524 the format used by the <command>lsearch</command> lookup (see section
65525 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
65526 names as keys and the remainder of the information as data. The lower-casing
65527 can be prevented by calling the program with the <option>-nolc</option> option.
65528 </para>
65529 <para>
65530 A terminating zero is included as part of the key string. This is expected by
65531 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
65532 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
65533 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
65534 files.
65535 </para>
65536 <para>
65537 The program requires two arguments: the name of the input file (which can be a
65538 single hyphen to indicate the standard input), and the name of the output file.
65539 It creates the output under a temporary name, and then renames it if all went
65540 well.
65541 </para>
65542 <para>
65543 <indexterm role="concept">
65544 <primary>USE_DB</primary>
65545 </indexterm>
65546 If the native DB interface is in use (USE_DB is set in a compile-time
65547 configuration file &ndash; this is common in free versions of Unix) the two file
65548 names must be different, because in this mode the Berkeley DB functions create
65549 a single output file using exactly the name given. For example,
65550 </para>
65551 <literallayout class="monospaced">
65552 exim_dbmbuild /etc/aliases /etc/aliases.db
65553 </literallayout>
65554 <para>
65555 reads the system alias file and creates a DBM version of it in
65556 <filename>/etc/aliases.db</filename>.
65557 </para>
65558 <para>
65559 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
65560 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
65561 environment, the suffixes are added to the second argument of
65562 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
65563 when the Berkeley functions are used in compatibility mode (though this is not
65564 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
65565 </para>
65566 <para>
65567 If a duplicate key is encountered, the program outputs a warning, and when it
65568 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
65569 option is used. By default, only the first of a set of duplicates is used &ndash;
65570 this makes it compatible with <command>lsearch</command> lookups. There is an option
65571 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
65572 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
65573 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
65574 return code is 2.
65575 </para>
65576 </section>
65577 <section id="SECTfinindret">
65578 <title>Finding individual retry times (exinext)</title>
65579 <para>
65580 <indexterm role="concept">
65581 <primary>retry</primary>
65582 <secondary>times</secondary>
65583 </indexterm>
65584 <indexterm role="concept">
65585 <primary><emphasis>exinext</emphasis></primary>
65586 </indexterm>
65587 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
65588 fish specific information out of the retry database. Given a mail domain (or a
65589 complete address), it looks up the hosts for that domain, and outputs any retry
65590 information for the hosts or for the domain. At present, the retry information
65591 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
65592 output. For example:
65593 </para>
65594 <literallayout class="monospaced">
65595 $ exinext piglet@milne.fict.example
65596 kanga.milne.example:192.168.8.1 error 146: Connection refused
65597   first failed: 21-Feb-1996 14:57:34
65598   last tried:   21-Feb-1996 14:57:34
65599   next try at:  21-Feb-1996 15:02:34
65600 roo.milne.example:192.168.8.3 error 146: Connection refused
65601   first failed: 20-Jan-1996 13:12:08
65602   last tried:   21-Feb-1996 11:42:03
65603   next try at:  21-Feb-1996 19:42:03
65604   past final cutoff time
65605 </literallayout>
65606 <para>
65607 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
65608 will give any retry information for that local part in your default domain.
65609 A message id can be used to obtain retry information pertaining to a specific
65610 message. This exists only when an attempt to deliver a message to a remote host
65611 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
65612 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
65613 run very often.
65614 </para>
65615 <para>
65616 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
65617 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
65618 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
65619 configuration file, and the second sets macros for use within the configuration
65620 file. These features are mainly to help in testing, but might also be useful in
65621 environments where more than one configuration file is in use.
65622 </para>
65623 </section>
65624 <section id="SECThindatmai">
65625 <title>Hints database maintenance</title>
65626 <para>
65627 <indexterm role="concept">
65628 <primary>hints database</primary>
65629 <secondary>maintenance</secondary>
65630 </indexterm>
65631 <indexterm role="concept">
65632 <primary>maintaining Exim&#x2019;s hints database</primary>
65633 </indexterm>
65634 Three utility programs are provided for maintaining the DBM files that Exim
65635 uses to contain its delivery hint information. Each program requires two
65636 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
65637 second is the name of the database it is to operate on. These are as follows:
65638 </para>
65639 <itemizedlist>
65640 <listitem>
65641 <para>
65642 <emphasis>retry</emphasis>: the database of retry information
65643 </para>
65644 </listitem>
65645 <listitem>
65646 <para>
65647 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
65648 for remote hosts
65649 </para>
65650 </listitem>
65651 <listitem>
65652 <para>
65653 <emphasis>callout</emphasis>: the callout cache
65654 </para>
65655 </listitem>
65656 <listitem>
65657 <para>
65658 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
65659 </para>
65660 </listitem>
65661 <listitem>
65662 <para>
65663 <emphasis>misc</emphasis>: other hints data
65664 </para>
65665 </listitem>
65666 </itemizedlist>
65667 <para>
65668 The <emphasis>misc</emphasis> database is used for
65669 </para>
65670 <itemizedlist>
65671 <listitem>
65672 <para>
65673 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
65674 </para>
65675 </listitem>
65676 <listitem>
65677 <para>
65678 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
65679 <command>smtp</command> transport)
65680 </para>
65681 </listitem>
65682 </itemizedlist>
65683 </section>
65684 <section id="SECID261">
65685 <title>exim_dumpdb</title>
65686 <para>
65687 <indexterm role="concept">
65688 <primary><emphasis>exim_dumpdb</emphasis></primary>
65689 </indexterm>
65690 The entire contents of a database are written to the standard output by the
65691 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
65692 spool and database names. For example, to dump the retry database:
65693 </para>
65694 <literallayout class="monospaced">
65695 exim_dumpdb /var/spool/exim retry
65696 </literallayout>
65697 <para>
65698 Two lines of output are produced for each entry:
65699 </para>
65700 <literallayout class="monospaced">
65701 T:mail.ref.example:192.168.242.242 146 77 Connection refused
65702 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
65703 </literallayout>
65704 <para>
65705 The first item on the first line is the key of the record. It starts with one
65706 of the letters R, or T, depending on whether it refers to a routing or
65707 transport retry. For a local delivery, the next part is the local address; for
65708 a remote delivery it is the name of the remote host, followed by its failing IP
65709 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
65710 transport). If the remote port is not the standard one (port 25), it is added
65711 to the IP address. Then there follows an error code, an additional error code,
65712 and a textual description of the error.
65713 </para>
65714 <para>
65715 The three times on the second line are the time of first failure, the time of
65716 the last delivery attempt, and the computed time for the next attempt. The line
65717 ends with an asterisk if the cutoff time for the last retry rule has been
65718 exceeded.
65719 </para>
65720 <para>
65721 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
65722 consists of a host name followed by a list of ids for messages that are or were
65723 waiting to be delivered to that host. If there are a very large number for any
65724 one host, continuation records, with a sequence number added to the host name,
65725 may be seen. The data in these records is often out of date, because a message
65726 may be routed to several alternative hosts, and Exim makes no effort to keep
65727 cross-references.
65728 </para>
65729 </section>
65730 <section id="SECID262">
65731 <title>exim_tidydb</title>
65732 <para>
65733 <indexterm role="concept">
65734 <primary><emphasis>exim_tidydb</emphasis></primary>
65735 </indexterm>
65736 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
65737 database. If run with no options, it removes all records that are more than 30
65738 days old. The age is calculated from the date and time that the record was last
65739 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
65740 since the first delivery failure. Information about a host that has been down
65741 for more than 30 days will remain in the database, provided that the record is
65742 updated sufficiently often.
65743 </para>
65744 <para>
65745 The cutoff date can be altered by means of the <option>-t</option> option, which must be
65746 followed by a time. For example, to remove all records older than a week from
65747 the retry database:
65748 </para>
65749 <literallayout class="monospaced">
65750 exim_tidydb -t 7d /var/spool/exim retry
65751 </literallayout>
65752 <para>
65753 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
65754 message ids. In the former these appear as data in records keyed by host &ndash;
65755 they were messages that were waiting for that host &ndash; and in the latter they
65756 are the keys for retry information for messages that have suffered certain
65757 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
65758 message ids in database records are those of messages that are still on the
65759 queue. Message ids for messages that no longer exist are removed from
65760 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
65761 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
65762 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
65763 whenever it removes information from the database.
65764 </para>
65765 <para>
65766 Certain records are automatically removed by Exim when they are no longer
65767 needed, but others are not. For example, if all the MX hosts for a domain are
65768 down, a retry record is created for each one. If the primary MX host comes back
65769 first, its record is removed when Exim successfully delivers to it, but the
65770 records for the others remain because Exim has not tried to use those hosts.
65771 </para>
65772 <para>
65773 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
65774 hints databases. You should do this at a quiet time of day, because it requires
65775 a database to be locked (and therefore inaccessible to Exim) while it does its
65776 work. Removing records from a DBM file does not normally make the file smaller,
65777 but all the common DBM libraries are able to re-use the space that is released.
65778 After an initial phase of increasing in size, the databases normally reach a
65779 point at which they no longer get any bigger, as long as they are regularly
65780 tidied.
65781 </para>
65782 <para>
65783 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
65784 databases is likely to keep on increasing.
65785 </para>
65786 </section>
65787 <section id="SECID263">
65788 <title>exim_fixdb</title>
65789 <para>
65790 <indexterm role="concept">
65791 <primary><emphasis>exim_fixdb</emphasis></primary>
65792 </indexterm>
65793 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
65794 Its main use is for testing Exim, but it might also be occasionally useful for
65795 getting round problems in a live system. It has no options, and its interface
65796 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
65797 key of a database record can then be entered, and the data for that record is
65798 displayed.
65799 </para>
65800 <para>
65801 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
65802 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
65803 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
65804 data for individual fields can be changed by typing the field number followed
65805 by new data, for example:
65806 </para>
65807 <literallayout class="monospaced">
65808 &gt; 4 951102:1000
65809 </literallayout>
65810 <para>
65811 resets the time of the next delivery attempt. Time values are given as a
65812 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
65813 used as optional separators.
65814 </para>
65815 </section>
65816 <section id="SECTmailboxmaint">
65817 <title>Mailbox maintenance (exim_lock)</title>
65818 <para>
65819 <indexterm role="concept">
65820 <primary>mailbox</primary>
65821 <secondary>maintenance</secondary>
65822 </indexterm>
65823 <indexterm role="concept">
65824 <primary><emphasis>exim_lock</emphasis></primary>
65825 </indexterm>
65826 <indexterm role="concept">
65827 <primary>locking mailboxes</primary>
65828 </indexterm>
65829 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
65830 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
65831 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
65832 a user agent while investigating a problem. The utility requires the name of
65833 the file as its first argument. If the locking is successful, the second
65834 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
65835 second argument, the value of the SHELL environment variable is used; if this
65836 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
65837 is unlocked and the utility ends. The following options are available:
65838 </para>
65839 <variablelist>
65840 <varlistentry>
65841 <term><option>-fcntl</option></term>
65842 <listitem>
65843 <para>
65844 Use <function>fcntl()</function> locking on the open mailbox.
65845 </para>
65846 </listitem></varlistentry>
65847 <varlistentry>
65848 <term><option>-flock</option></term>
65849 <listitem>
65850 <para>
65851 Use <function>flock()</function> locking on the open mailbox, provided the operating system
65852 supports it.
65853 </para>
65854 </listitem></varlistentry>
65855 <varlistentry>
65856 <term><option>-interval</option></term>
65857 <listitem>
65858 <para>
65859 This must be followed by a number, which is a number of seconds; it sets the
65860 interval to sleep between retries (default 3).
65861 </para>
65862 </listitem></varlistentry>
65863 <varlistentry>
65864 <term><option>-lockfile</option></term>
65865 <listitem>
65866 <para>
65867 Create a lock file before opening the mailbox.
65868 </para>
65869 </listitem></varlistentry>
65870 <varlistentry>
65871 <term><option>-mbx</option></term>
65872 <listitem>
65873 <para>
65874 Lock the mailbox using MBX rules.
65875 </para>
65876 </listitem></varlistentry>
65877 <varlistentry>
65878 <term><option>-q</option></term>
65879 <listitem>
65880 <para>
65881 Suppress verification output.
65882 </para>
65883 </listitem></varlistentry>
65884 <varlistentry>
65885 <term><option>-retries</option></term>
65886 <listitem>
65887 <para>
65888 This must be followed by a number; it sets the number of times to try to get
65889 the lock (default 10).
65890 </para>
65891 </listitem></varlistentry>
65892 <varlistentry>
65893 <term><option>-restore_time</option></term>
65894 <listitem>
65895 <para>
65896 This option causes <option>exim_lock</option> to restore the modified and read times to the
65897 locked file before exiting. This allows you to access a locked mailbox (for
65898 example, to take a backup copy) without disturbing the times that the user
65899 subsequently sees.
65900 </para>
65901 </listitem></varlistentry>
65902 <varlistentry>
65903 <term><option>-timeout</option></term>
65904 <listitem>
65905 <para>
65906 This must be followed by a number, which is a number of seconds; it sets a
65907 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
65908 default), a non-blocking call is used.
65909 </para>
65910 </listitem></varlistentry>
65911 <varlistentry>
65912 <term><option>-v</option></term>
65913 <listitem>
65914 <para>
65915 Generate verbose output.
65916 </para>
65917 </listitem></varlistentry>
65918 </variablelist>
65919 <para>
65920 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
65921 default is to create a lock file and also to use <function>fcntl()</function> locking on the
65922 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
65923 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
65924 requires that the directory containing the file be writeable. Locking by lock
65925 file does not last for ever; Exim assumes that a lock file is expired if it is
65926 more than 30 minutes old.
65927 </para>
65928 <para>
65929 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
65930 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
65931 to be taken out on the open mailbox, and an exclusive lock on the file
65932 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
65933 number of the mailbox file. When the locking is released, if an exclusive lock
65934 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
65935 </para>
65936 <para>
65937 The default output contains verification of the locking that takes place. The
65938 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
65939 suppresses all output except error messages.
65940 </para>
65941 <para>
65942 A command such as
65943 </para>
65944 <literallayout class="monospaced">
65945 exim_lock /var/spool/mail/spqr
65946 </literallayout>
65947 <para>
65948 runs an interactive shell while the file is locked, whereas
65949 </para>
65950 <literallayout>
65951 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
65952 &lt;<emphasis>some commands</emphasis>&gt;
65953 <literal>End</literal>
65954 </literallayout>
65955 <para>
65956 runs a specific non-interactive sequence of commands while the file is locked,
65957 suppressing all verification output. A single command can be run by a command
65958 such as
65959 </para>
65960 <literallayout class="monospaced">
65961 exim_lock -q /var/spool/mail/spqr \
65962   "cp /var/spool/mail/spqr /some/where"
65963 </literallayout>
65964 <para>
65965 Note that if a command is supplied, it must be entirely contained within the
65966 second argument &ndash; hence the quotes.
65967 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
65968 </para>
65969 </section>
65970 </chapter>
65971
65972 <chapter id="CHAPeximon">
65973 <title>The Exim monitor</title>
65974 <para>
65975 <indexterm role="concept" id="IIDeximon" class="startofrange">
65976 <primary>Exim monitor</primary>
65977 <secondary>description</secondary>
65978 </indexterm>
65979 <indexterm role="concept">
65980 <primary>X-windows</primary>
65981 </indexterm>
65982 <indexterm role="concept">
65983 <primary><emphasis>eximon</emphasis></primary>
65984 </indexterm>
65985 <indexterm role="concept">
65986 <primary>Local/eximon.conf</primary>
65987 </indexterm>
65988 <indexterm role="concept">
65989 <primary><filename>exim_monitor/EDITME</filename></primary>
65990 </indexterm>
65991 The Exim monitor is an application which displays in an X window information
65992 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
65993 perform certain operations on messages from this GUI interface; however all
65994 such facilities are also available from the command line, and indeed, the
65995 monitor itself makes use of the command line to perform any actions requested.
65996 </para>
65997 <section id="SECID264">
65998 <title>Running the monitor</title>
65999 <para>
66000 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
66001 script that sets up a number of environment variables, and then runs the
66002 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
66003 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
66004 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
66005 parameters are for.
66006 </para>
66007 <para>
66008 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
66009 a particular invocation by setting up environment variables of the same names,
66010 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
66011 </para>
66012 <literallayout class="monospaced">
66013 EXIMON_LOG_DEPTH=400 eximon
66014 </literallayout>
66015 <para>
66016 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
66017 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
66018 overrides the Exim log file configuration. This makes it possible to have
66019 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
66020 syslog messages are routed to a file on the local host.
66021 </para>
66022 <para>
66023 X resources can be used to change the appearance of the window in the normal
66024 way. For example, a resource setting of the form
66025 </para>
66026 <literallayout class="monospaced">
66027 Eximon*background: gray94
66028 </literallayout>
66029 <para>
66030 changes the colour of the background to light grey rather than white. The
66031 stripcharts are drawn with both the data lines and the reference lines in
66032 black. This means that the reference lines are not visible when on top of the
66033 data. However, their colour can be changed by setting a resource called
66034 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
66035 For example, if your X server is running Unix, you could set up lighter
66036 reference lines in the stripcharts by obeying
66037 </para>
66038 <literallayout class="monospaced">
66039 xrdb -merge &lt;&lt;End
66040 Eximon*highlight: gray
66041 End
66042 </literallayout>
66043 <para>
66044 <indexterm role="concept">
66045 <primary>admin user</primary>
66046 </indexterm>
66047 In order to see the contents of messages on the queue, and to operate on them,
66048 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
66049 </para>
66050 <para>
66051 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
66052 contain X11 resource parameters interpreted by the X11 library.  In addition,
66053 if the first parameter starts with the string "gdb" then it is removed and the
66054 binary is invoked under gdb (the parameter is used as the gdb command-name, so
66055 versioned variants of gdb can be invoked).
66056 </para>
66057 <para>
66058 The monitor&#x2019;s window is divided into three parts. The first contains one or
66059 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
66060 main log file, and the third is a display of the queue of messages awaiting
66061 delivery, with two more action buttons. The following sections describe these
66062 different parts of the display.
66063 </para>
66064 </section>
66065 <section id="SECID265">
66066 <title>The stripcharts</title>
66067 <para>
66068 <indexterm role="concept">
66069 <primary>stripchart</primary>
66070 </indexterm>
66071 The first stripchart is always a count of messages on the queue. Its name can
66072 be configured by setting QUEUE_STRIPCHART_NAME in the
66073 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
66074 configuration script by regular expression matches on log file entries, making
66075 it possible to display, for example, counts of messages delivered to certain
66076 hosts or using certain transports. The supplied defaults display counts of
66077 received and delivered messages, and of local and SMTP deliveries. The default
66078 period between stripchart updates is one minute; this can be adjusted by a
66079 parameter in the <filename>Local/eximon.conf</filename> file.
66080 </para>
66081 <para>
66082 The stripchart displays rescale themselves automatically as the value they are
66083 displaying changes. There are always 10 horizontal lines in each chart; the
66084 title string indicates the value of each division when it is greater than one.
66085 For example, <quote>x2</quote> means that each division represents a value of 2.
66086 </para>
66087 <para>
66088 It is also possible to have a stripchart which shows the percentage fullness of
66089 a particular disk partition, which is useful when local deliveries are confined
66090 to a single partition.
66091 </para>
66092 <para>
66093 <indexterm role="concept">
66094 <primary><option>statvfs</option> function</primary>
66095 </indexterm>
66096 This relies on the availability of the <function>statvfs()</function> function or equivalent in
66097 the operating system. Most, but not all versions of Unix that support Exim have
66098 this. For this particular stripchart, the top of the chart always represents
66099 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
66100 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
66101 <filename>Local/eximon.conf</filename> file.
66102 </para>
66103 </section>
66104 <section id="SECID266">
66105 <title>Main action buttons</title>
66106 <para>
66107 <indexterm role="concept">
66108 <primary>size</primary>
66109 <secondary>of monitor window</secondary>
66110 </indexterm>
66111 <indexterm role="concept">
66112 <primary>Exim monitor</primary>
66113 <secondary>window size</secondary>
66114 </indexterm>
66115 <indexterm role="concept">
66116 <primary>window size</primary>
66117 </indexterm>
66118 Below the stripcharts there is an action button for quitting the monitor. Next
66119 to this is another button marked <quote>Size</quote>. They are placed here so that
66120 shrinking the window to its default minimum size leaves just the queue count
66121 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
66122 the window to expand to its maximum size, unless it is already at the maximum,
66123 in which case it is reduced to its minimum.
66124 </para>
66125 <para>
66126 When expanding to the maximum, if the window cannot be fully seen where it
66127 currently is, it is moved back to where it was the last time it was at full
66128 size. When it is expanding from its minimum size, the old position is
66129 remembered, and next time it is reduced to the minimum it is moved back there.
66130 </para>
66131 <para>
66132 The idea is that you can keep a reduced window just showing one or two
66133 stripcharts at a convenient place on your screen, easily expand it to show
66134 the full window when required, and just as easily put it back to what it was.
66135 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
66136 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
66137 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
66138 </para>
66139 <para>
66140 Normally, the monitor starts up with the window at its full size, but it can be
66141 built so that it starts up with the window at its smallest size, by setting
66142 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
66143 </para>
66144 </section>
66145 <section id="SECID267">
66146 <title>The log display</title>
66147 <para>
66148 <indexterm role="concept">
66149 <primary>log</primary>
66150 <secondary>tail of; in monitor</secondary>
66151 </indexterm>
66152 The second section of the window is an area in which a display of the tail of
66153 the main log is maintained.
66154 To save space on the screen, the timestamp on each log line is shortened by
66155 removing the date and, if <option>log_timezone</option> is set, the timezone.
66156 The log tail is not available when the only destination for logging data is
66157 syslog, unless the syslog lines are routed to a local file whose name is passed
66158 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
66159 </para>
66160 <para>
66161 The log sub-window has a scroll bar at its lefthand side which can be used to
66162 move back to look at earlier text, and the up and down arrow keys also have a
66163 scrolling effect. The amount of log that is kept depends on the setting of
66164 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
66165 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
66166 much more efficient than throwing it away line by line. The sub-window also has
66167 a horizontal scroll bar for accessing the ends of long log lines. This is the
66168 only means of horizontal scrolling; the right and left arrow keys are not
66169 available. Text can be cut from this part of the window using the mouse in the
66170 normal way. The size of this subwindow is controlled by parameters in the
66171 configuration file <filename>Local/eximon.conf</filename>.
66172 </para>
66173 <para>
66174 Searches of the text in the log window can be carried out by means of the ^R
66175 and ^S keystrokes, which default to a reverse and a forward search,
66176 respectively. The search covers only the text that is displayed in the window.
66177 It cannot go further back up the log.
66178 </para>
66179 <para>
66180 The point from which the search starts is indicated by a caret marker. This is
66181 normally at the end of the text in the window, but can be positioned explicitly
66182 by pointing and clicking with the left mouse button, and is moved automatically
66183 by a successful search. If new text arrives in the window when it is scrolled
66184 back, the caret remains where it is, but if the window is not scrolled back,
66185 the caret is moved to the end of the new text.
66186 </para>
66187 <para>
66188 Pressing ^R or ^S pops up a window into which the search text can be typed.
66189 There are buttons for selecting forward or reverse searching, for carrying out
66190 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
66191 happens and the window remains so that further searches can be done. If the
66192 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
66193 ^C is typed the search is cancelled.
66194 </para>
66195 <para>
66196 The searching facility is implemented using the facilities of the Athena text
66197 widget. By default this pops up a window containing both <quote>search</quote> and
66198 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
66199 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
66200 However, the linkers in BSDI and HP-UX seem unable to handle an externally
66201 provided version of <option>TextPop</option> when the remaining parts of the text widget
66202 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
66203 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
66204 on these systems, at the expense of having unwanted items in the search popup
66205 window.
66206 </para>
66207 </section>
66208 <section id="SECID268">
66209 <title>The queue display</title>
66210 <para>
66211 <indexterm role="concept">
66212 <primary>queue</primary>
66213 <secondary>display in monitor</secondary>
66214 </indexterm>
66215 The bottom section of the monitor window contains a list of all messages that
66216 are on the queue, which includes those currently being received or delivered,
66217 as well as those awaiting delivery. The size of this subwindow is controlled by
66218 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
66219 at which it is updated is controlled by another parameter in the same file &ndash;
66220 the default is 5 minutes, since queue scans can be quite expensive. However,
66221 there is an <quote>Update</quote> action button just above the display which can be used
66222 to force an update of the queue display at any time.
66223 </para>
66224 <para>
66225 When a host is down for some time, a lot of pending mail can build up for it,
66226 and this can make it hard to deal with other messages on the queue. To help
66227 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
66228 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
66229 type anything in here and press <quote>Return</quote>, the text is added to a chain of
66230 such texts, and if every undelivered address in a message matches at least one
66231 of the texts, the message is not displayed.
66232 </para>
66233 <para>
66234 If there is an address that does not match any of the texts, all the addresses
66235 are displayed as normal. The matching happens on the ends of addresses so, for
66236 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
66237 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
66238 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
66239 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
66240 a hide request is automatically cancelled after one hour.
66241 </para>
66242 <para>
66243 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
66244 else to the monitor window. For this reason, if you want to cut text from the
66245 queue display to use in the dialogue box, you have to do the cutting before
66246 pressing the <quote>Hide</quote> button.
66247 </para>
66248 <para>
66249 The queue display contains, for each unhidden queued message, the length of
66250 time it has been on the queue, the size of the message, the message id, the
66251 message sender, and the first undelivered recipient, all on one line. If it is
66252 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
66253 recipient to which the message has not yet been delivered, subsequent ones are
66254 listed on additional lines, up to a maximum configured number, following which
66255 an ellipsis is displayed. Recipients that have already received the message are
66256 not shown.
66257 </para>
66258 <para>
66259 <indexterm role="concept">
66260 <primary>frozen messages</primary>
66261 <secondary>display</secondary>
66262 </indexterm>
66263 If a message is frozen, an asterisk is displayed at the left-hand side.
66264 </para>
66265 <para>
66266 The queue display has a vertical scroll bar, and can also be scrolled by means
66267 of the arrow keys. Text can be cut from it using the mouse in the normal way.
66268 The text searching facilities, as described above for the log window, are also
66269 available, but the caret is always moved to the end of the text when the queue
66270 display is updated.
66271 </para>
66272 </section>
66273 <section id="SECID269">
66274 <title>The queue menu</title>
66275 <para>
66276 <indexterm role="concept">
66277 <primary>queue</primary>
66278 <secondary>menu in monitor</secondary>
66279 </indexterm>
66280 If the <option>shift</option> key is held down and the left button is clicked when the mouse
66281 pointer is over the text for any message, an action menu pops up, and the first
66282 line of the queue display for the message is highlighted. This does not affect
66283 any selected text.
66284 </para>
66285 <para>
66286 If you want to use some other event for popping up the menu, you can set the
66287 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
66288 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
66289 value set in this parameter is a standard X event description. For example, to
66290 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
66291 </para>
66292 <literallayout class="monospaced">
66293 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
66294 </literallayout>
66295 <para>
66296 The title of the menu is the message id, and it contains entries which act as
66297 follows:
66298 </para>
66299 <itemizedlist>
66300 <listitem>
66301 <para>
66302 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
66303 in a new text window.
66304 </para>
66305 </listitem>
66306 <listitem>
66307 <para>
66308 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
66309 information and headers is displayed in a new text window. See chapter
66310 <xref linkend="CHAPspool"/> for a description of the format of spool files.
66311 </para>
66312 </listitem>
66313 <listitem>
66314 <para>
66315 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
66316 displayed in a new text window. There is a default limit of 20,000 bytes to the
66317 amount of data displayed. This can be changed by setting the BODY_MAX
66318 option at compile time, or the EXIMON_BODY_MAX option at run time.
66319 </para>
66320 </listitem>
66321 <listitem>
66322 <para>
66323 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
66324 delivery of the message. This causes an automatic thaw if the message is
66325 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
66326 a new text window. The delivery is run in a separate process, to avoid holding
66327 up the monitor while the delivery proceeds.
66328 </para>
66329 </listitem>
66330 <listitem>
66331 <para>
66332 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
66333 that the message be frozen.
66334 </para>
66335 </listitem>
66336 <listitem>
66337 <para>
66338 <indexterm role="concept">
66339 <primary>thawing messages</primary>
66340 </indexterm>
66341 <indexterm role="concept">
66342 <primary>unfreezing messages</primary>
66343 </indexterm>
66344 <indexterm role="concept">
66345 <primary>frozen messages</primary>
66346 <secondary>thawing</secondary>
66347 </indexterm>
66348 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
66349 that the message be thawed.
66350 </para>
66351 </listitem>
66352 <listitem>
66353 <para>
66354 <indexterm role="concept">
66355 <primary>delivery</primary>
66356 <secondary>forcing failure</secondary>
66357 </indexterm>
66358 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
66359 that Exim gives up trying to deliver the message. A bounce message is generated
66360 for any remaining undelivered addresses.
66361 </para>
66362 </listitem>
66363 <listitem>
66364 <para>
66365 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
66366 that the message be deleted from the system without generating a bounce
66367 message.
66368 </para>
66369 </listitem>
66370 <listitem>
66371 <para>
66372 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
66373 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
66374 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
66375 Otherwise it must be entered as a fully qualified address. Pressing RETURN
66376 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
66377 additional recipient be added to the message, unless the entry box is empty, in
66378 which case no action is taken.
66379 </para>
66380 </listitem>
66381 <listitem>
66382 <para>
66383 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
66384 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
66385 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
66386 Otherwise it must be entered as a fully qualified address. Pressing RETURN
66387 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
66388 recipient address as already delivered, unless the entry box is empty, in which
66389 case no action is taken.
66390 </para>
66391 </listitem>
66392 <listitem>
66393 <para>
66394 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
66395 mark all recipient addresses as already delivered.
66396 </para>
66397 </listitem>
66398 <listitem>
66399 <para>
66400 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
66401 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
66402 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
66403 in which case no action is taken. If you want to set an empty sender (as in
66404 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
66405 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
66406 the address is qualified with that domain.
66407 </para>
66408 </listitem>
66409 </itemizedlist>
66410 <para>
66411 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
66412 other cases when a call to Exim is made, if there is any output from Exim (in
66413 particular, if the command fails) a window containing the command and the
66414 output is displayed. Otherwise, the results of the action are normally apparent
66415 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
66416 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
66417 if no output is generated.
66418 </para>
66419 <para>
66420 The queue display is automatically updated for actions such as freezing and
66421 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
66422 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
66423 force an update of the display after one of these actions.
66424 </para>
66425 <para>
66426 In any text window that is displayed as result of a menu action, the normal
66427 cut-and-paste facility is available, and searching can be carried out using ^R
66428 and ^S, as described above for the log tail window.
66429 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
66430 </para>
66431 </section>
66432 </chapter>
66433
66434 <chapter id="CHAPsecurity">
66435 <title>Security considerations</title>
66436 <para>
66437 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
66438 <primary>security</primary>
66439 <secondary>discussion of</secondary>
66440 </indexterm>
66441 This chapter discusses a number of issues concerned with security, some of
66442 which are also covered in other parts of this manual.
66443 </para>
66444 <para>
66445 For reasons that this author does not understand, some people have promoted
66446 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
66447 existence of this chapter in the documentation. However, the intent of the
66448 chapter is simply to describe the way Exim works in relation to certain
66449 security concerns, not to make any specific claims about the effectiveness of
66450 its security as compared with other MTAs.
66451 </para>
66452 <para>
66453 What follows is a description of the way Exim is supposed to be. Best efforts
66454 have been made to try to ensure that the code agrees with the theory, but an
66455 absence of bugs can never be guaranteed. Any that are reported will get fixed
66456 as soon as possible.
66457 </para>
66458 <section id="SECID286">
66459 <title>Building a more <quote>hardened</quote> Exim</title>
66460 <para>
66461 <indexterm role="concept">
66462 <primary>security</primary>
66463 <secondary>build-time features</secondary>
66464 </indexterm>
66465 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
66466 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
66467 Exim administrator who does not have the root password, or by someone who has
66468 penetrated the Exim (but not the root) account. These options are as follows:
66469 </para>
66470 <itemizedlist>
66471 <listitem>
66472 <para>
66473 ALT_CONFIG_PREFIX can be set to a string that is required to match the
66474 start of any file names used with the <option>-C</option> option. When it is set, these file
66475 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
66476 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
66477 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
66478 default setting for <option>ALT_CONFIG_PREFIX</option>.
66479 </para>
66480 <para>
66481 If the permitted configuration files are confined to a directory to
66482 which only root has access, this guards against someone who has broken
66483 into the Exim account from running a privileged Exim with an arbitrary
66484 configuration file, and using it to break into other accounts.
66485 </para>
66486 </listitem>
66487 <listitem>
66488 <para>
66489 If a non-trusted configuration file (i.e. not the default configuration file
66490 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
66491 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
66492 the next item), then root privilege is retained only if the caller of Exim is
66493 root. This locks out the possibility of testing a configuration using <option>-C</option>
66494 right through message reception and delivery, even if the caller is root. The
66495 reception works, but by that time, Exim is running as the Exim user, so when
66496 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
66497 privilege to be lost. However, root can test reception and delivery using two
66498 separate commands.
66499 </para>
66500 </listitem>
66501 <listitem>
66502 <para>
66503 The WHITELIST_D_MACROS build option declares some macros to be safe to override
66504 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
66505 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
66506 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
66507 the restrictive side.  Requiring build-time selection of safe macros is onerous
66508 but this option is intended solely as a transition mechanism to permit
66509 previously-working configurations to continue to work after release 4.73.
66510 </para>
66511 </listitem>
66512 <listitem>
66513 <para>
66514 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
66515 is disabled.
66516 </para>
66517 </listitem>
66518 <listitem>
66519 <para>
66520 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
66521 never to be used for any deliveries. This is like the <option>never_users</option> runtime
66522 option, but it cannot be overridden; the runtime option adds additional users
66523 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
66524 is permitted to modify the runtime file from using Exim as a way to get root.
66525 </para>
66526 </listitem>
66527 </itemizedlist>
66528 </section>
66529 <section id="SECID270">
66530 <title>Root privilege</title>
66531 <para>
66532 <indexterm role="concept">
66533 <primary>setuid</primary>
66534 </indexterm>
66535 <indexterm role="concept">
66536 <primary>root privilege</primary>
66537 </indexterm>
66538 The Exim binary is normally setuid to root, which means that it gains root
66539 privilege (runs as root) when it starts execution. In some special cases (for
66540 example, when the daemon is not in use and there are no local deliveries), it
66541 may be possible to run Exim setuid to some user other than root. This is
66542 discussed in the next section. However, in most installations, root privilege
66543 is required for two things:
66544 </para>
66545 <itemizedlist>
66546 <listitem>
66547 <para>
66548 To set up a socket connected to the standard SMTP port (25) when initialising
66549 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
66550 not required.
66551 </para>
66552 </listitem>
66553 <listitem>
66554 <para>
66555 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
66556 perform local deliveries as the receiving user or as specified in the
66557 configuration.
66558 </para>
66559 </listitem>
66560 </itemizedlist>
66561 <para>
66562 It is not necessary to be root to do any of the other things Exim does, such as
66563 receiving messages and delivering them externally over SMTP, and it is
66564 obviously more secure if Exim does not run as root except when necessary.
66565 For this reason, a user and group for Exim to use must be defined in
66566 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
66567 group</quote>. Their values can be changed by the run time configuration, though this
66568 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
66569 <emphasis>mail</emphasis> or another user name altogether.
66570 </para>
66571 <para>
66572 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
66573 abdication; the process cannot regain root afterwards. Prior to release 4.00,
66574 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
66575 </para>
66576 <para>
66577 After a new Exim process has interpreted its command line options, it changes
66578 uid and gid in the following cases:
66579 </para>
66580 <itemizedlist>
66581 <listitem>
66582 <para>
66583 <indexterm role="option">
66584 <primary><option>-C</option></primary>
66585 </indexterm>
66586 <indexterm role="option">
66587 <primary><option>-D</option></primary>
66588 </indexterm>
66589 If the <option>-C</option> option is used to specify an alternate configuration file, or if
66590 the <option>-D</option> option is used to define macro values for the configuration, and the
66591 calling process is not running as root, the uid and gid are changed to those of
66592 the calling process.
66593 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
66594 option may not be used at all.
66595 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
66596 can be supplied if the calling process is running as root, the Exim run-time
66597 user or CONFIGURE_OWNER, if defined.
66598 </para>
66599 </listitem>
66600 <listitem>
66601 <para>
66602 <indexterm role="option">
66603 <primary><option>-be</option></primary>
66604 </indexterm>
66605 <indexterm role="option">
66606 <primary><option>-bf</option></primary>
66607 </indexterm>
66608 <indexterm role="option">
66609 <primary><option>-bF</option></primary>
66610 </indexterm>
66611 If the expansion test option (<option>-be</option>) or one of the filter testing options
66612 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
66613 calling process.
66614 </para>
66615 </listitem>
66616 <listitem>
66617 <para>
66618 If the process is not a daemon process or a queue runner process or a delivery
66619 process or a process for testing address routing (started with <option>-bt</option>), the
66620 uid and gid are changed to the Exim user and group. This means that Exim always
66621 runs under its own uid and gid when receiving messages. This also applies when
66622 testing address verification
66623 <indexterm role="option">
66624 <primary><option>-bv</option></primary>
66625 </indexterm>
66626 <indexterm role="option">
66627 <primary><option>-bh</option></primary>
66628 </indexterm>
66629 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
66630 option).
66631 </para>
66632 </listitem>
66633 <listitem>
66634 <para>
66635 For a daemon, queue runner, delivery, or address testing process, the uid
66636 remains as root at this stage, but the gid is changed to the Exim group.
66637 </para>
66638 </listitem>
66639 </itemizedlist>
66640 <para>
66641 The processes that initially retain root privilege behave as follows:
66642 </para>
66643 <itemizedlist>
66644 <listitem>
66645 <para>
66646 A daemon process changes the gid to the Exim group and the uid to the Exim
66647 user after setting up one or more listening sockets. The <function>initgroups()</function>
66648 function is called, so that if the Exim user is in any additional groups, they
66649 will be used during message reception.
66650 </para>
66651 </listitem>
66652 <listitem>
66653 <para>
66654 A queue runner process retains root privilege throughout its execution. Its
66655 job is to fork a controlled sequence of delivery processes.
66656 </para>
66657 </listitem>
66658 <listitem>
66659 <para>
66660 A delivery process retains root privilege throughout most of its execution,
66661 but any actual deliveries (that is, the transports themselves) are run in
66662 subprocesses which always change to a non-root uid and gid. For local
66663 deliveries this is typically the uid and gid of the owner of the mailbox; for
66664 remote deliveries, the Exim uid and gid are used. Once all the delivery
66665 subprocesses have been run, a delivery process changes to the Exim uid and gid
66666 while doing post-delivery tidying up such as updating the retry database and
66667 generating bounce and warning messages.
66668 </para>
66669 <para>
66670 While the recipient addresses in a message are being routed, the delivery
66671 process runs as root. However, if a user&#x2019;s filter file has to be processed,
66672 this is done in a subprocess that runs under the individual user&#x2019;s uid and
66673 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
66674 </para>
66675 </listitem>
66676 <listitem>
66677 <para>
66678 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
66679 the routing is done in the same environment as a message delivery.
66680 </para>
66681 </listitem>
66682 </itemizedlist>
66683 </section>
66684 <section id="SECTrunexiwitpri">
66685 <title>Running Exim without privilege</title>
66686 <para>
66687 <indexterm role="concept">
66688 <primary>privilege, running without</primary>
66689 </indexterm>
66690 <indexterm role="concept">
66691 <primary>unprivileged running</primary>
66692 </indexterm>
66693 <indexterm role="concept">
66694 <primary>root privilege</primary>
66695 <secondary>running without</secondary>
66696 </indexterm>
66697 Some installations like to run Exim in an unprivileged state for more of its
66698 operation, for added security. Support for this mode of operation is provided
66699 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
66700 gid are changed to the Exim user and group at the start of a delivery process
66701 (and also queue runner and address testing processes). This means that address
66702 routing is no longer run as root, and the deliveries themselves cannot change
66703 to any other uid.
66704 </para>
66705 <para>
66706 <indexterm role="concept">
66707 <primary>SIGHUP</primary>
66708 </indexterm>
66709 <indexterm role="concept">
66710 <primary>daemon</primary>
66711 <secondary>restarting</secondary>
66712 </indexterm>
66713 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
66714 that the daemon can still be started in the usual way, and it can respond
66715 correctly to SIGHUP because the re-invocation regains root privilege.
66716 </para>
66717 <para>
66718 An alternative approach is to make Exim setuid to the Exim user and also setgid
66719 to the Exim group. If you do this, the daemon must be started from a root
66720 process. (Calling Exim from a root process makes it behave in the way it does
66721 when it is setuid root.) However, the daemon cannot restart itself after a
66722 SIGHUP signal because it cannot regain privilege.
66723 </para>
66724 <para>
66725 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
66726 stops Exim from trying to re-invoke itself to do a delivery after a message has
66727 been received. Such a re-invocation is a waste of resources because it has no
66728 effect.
66729 </para>
66730 <para>
66731 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
66732 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
66733 to the Exim user seems a clean approach, but there is one complication:
66734 </para>
66735 <para>
66736 In this style of operation, Exim is running with the real uid and gid set to
66737 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
66738 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
66739 that is, the real uid/gid should be reset to the effective values so as to
66740 discard any privileges that the caller may have. While some operating systems
66741 have a function that permits this action for a non-root effective uid, quite a
66742 number of them do not. Because of this lack of standardization, Exim does not
66743 address this problem at this time.
66744 </para>
66745 <para>
66746 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
66747 is to keep the Exim binary setuid to root, and to set
66748 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
66749 be used in the most straightforward way.
66750 </para>
66751 <para>
66752 If you configure Exim not to run delivery processes as root, there are a
66753 number of restrictions on what you can do:
66754 </para>
66755 <itemizedlist>
66756 <listitem>
66757 <para>
66758 You can deliver only as the Exim user/group. You should  explicitly use the
66759 <option>user</option> and <option>group</option> options to override routers or local transports that
66760 normally deliver as the recipient. This makes sure that configurations that
66761 work in this mode function the same way in normal mode. Any implicit or
66762 explicit specification of another user causes an error.
66763 </para>
66764 </listitem>
66765 <listitem>
66766 <para>
66767 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
66768 not worthwhile to include them in the configuration.
66769 </para>
66770 </listitem>
66771 <listitem>
66772 <para>
66773 Users who wish to use <filename>.forward</filename> would have to make their home directory and
66774 the file itself accessible to the Exim user. Pipe and append-to-file entries,
66775 and their equivalents in Exim filters, cannot be used. While they could be
66776 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
66777 </para>
66778 </listitem>
66779 <listitem>
66780 <para>
66781 Unless the local user mailboxes are all owned by the Exim user (possible in
66782 some POP3 or IMAP-only environments):
66783 </para>
66784 <orderedlist numeration="arabic">
66785 <listitem>
66786 <para>
66787 They must be owned by the Exim group and be writeable by that group. This
66788 implies you must set <option>mode</option> in the appendfile configuration, as well as the
66789 mode of the mailbox files themselves.
66790 </para>
66791 </listitem>
66792 <listitem>
66793 <para>
66794 You must set <option>no_check_owner</option>, since most or all of the files will not be
66795 owned by the Exim user.
66796 </para>
66797 </listitem>
66798 <listitem>
66799 <para>
66800 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
66801 on a newly created mailbox when unprivileged. This also implies that new
66802 mailboxes need to be created manually.
66803 </para>
66804 </listitem>
66805 </orderedlist>
66806 </listitem>
66807 </itemizedlist>
66808 <para>
66809 These restrictions severely restrict what can be done in local deliveries.
66810 However, there are no restrictions on remote deliveries. If you are running a
66811 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
66812 gives more security at essentially no cost.
66813 </para>
66814 <para>
66815 If you are using the <option>mua_wrapper</option> facility (see chapter
66816 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
66817 </para>
66818 </section>
66819 <section id="SECID271">
66820 <title>Delivering to local files</title>
66821 <para>
66822 Full details of the checks applied by <command>appendfile</command> before it writes to a file
66823 are given in chapter <xref linkend="CHAPappendfile"/>.
66824 </para>
66825 </section>
66826 <section id="SECTsecconslocalcmds">
66827 <title>Running local commands</title>
66828 <para>
66829 <indexterm role="concept">
66830 <primary>security</primary>
66831 <secondary>local commands</secondary>
66832 </indexterm>
66833 <indexterm role="concept">
66834 <primary>security</primary>
66835 <secondary>command injection attacks</secondary>
66836 </indexterm>
66837 There are a number of ways in which an administrator can configure Exim to run
66838 commands based upon received, untrustworthy, data. Further, in some
66839 configurations a user who can control a <filename>.forward</filename> file can also arrange to
66840 run commands. Configuration to check includes, but is not limited to:
66841 </para>
66842 <itemizedlist>
66843 <listitem>
66844 <para>
66845 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
66846 injection may be possible with this option present. It is dangerous and should
66847 be used only with considerable caution. Consider constraints which whitelist
66848 allowed characters in a variable which is to be used in a pipe transport that
66849 has <option>use_shell</option> enabled.
66850 </para>
66851 </listitem>
66852 <listitem>
66853 <para>
66854 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
66855 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
66856 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
66857 hub to which ordinary users do not have shell access, but home directories are
66858 NFS mounted (for instance) then administrators should review the list of these
66859 forbid options available, and should bear in mind that the options that may
66860 need forbidding can change as new features are added between releases.
66861 </para>
66862 </listitem>
66863 <listitem>
66864 <para>
66865 The <option>${run...}</option> expansion item does not use a shell by default, but
66866 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
66867 Such invocations should be viewed with prejudicial suspicion.
66868 </para>
66869 </listitem>
66870 <listitem>
66871 <para>
66872 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
66873 taint checking might apply to their usage.
66874 </para>
66875 </listitem>
66876 <listitem>
66877 <para>
66878 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
66879 administrators are well advised to view its use with suspicion, in case (for
66880 instance) it allows a local-part to contain embedded Exim directives.
66881 </para>
66882 </listitem>
66883 <listitem>
66884 <para>
66885 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
66886 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
66887 each can reference arbitrary lists and files, rather than just being a list
66888 of opaque strings.
66889 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
66890 real-world security vulnerabilities caused by its use with untrustworthy data
66891 injected in, for SQL injection attacks.
66892 Consider the use of the <option>inlisti</option> expansion condition instead.
66893 </para>
66894 </listitem>
66895 </itemizedlist>
66896 </section>
66897 <section id="SECTsecconfdata">
66898 <title>Trust in configuration data</title>
66899 <para>
66900 <indexterm role="concept">
66901 <primary>security</primary>
66902 <secondary>data sources</secondary>
66903 </indexterm>
66904 <indexterm role="concept">
66905 <primary>security</primary>
66906 <secondary>regular expressions</secondary>
66907 </indexterm>
66908 <indexterm role="concept">
66909 <primary>regular expressions</primary>
66910 <secondary>security</secondary>
66911 </indexterm>
66912 <indexterm role="concept">
66913 <primary>PCRE</primary>
66914 <secondary>security</secondary>
66915 </indexterm>
66916 If configuration data for Exim can come from untrustworthy sources, there
66917 are some issues to be aware of:
66918 </para>
66919 <itemizedlist>
66920 <listitem>
66921 <para>
66922 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
66923 </para>
66924 </listitem>
66925 <listitem>
66926 <para>
66927 Letting untrusted data provide a regular expression is unwise.
66928 </para>
66929 </listitem>
66930 <listitem>
66931 <para>
66932 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
66933 data may result in pathological behaviour within PCRE.  Be aware of what
66934 "backtracking" means and consider options for being more strict with a regular
66935 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
66936 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
66937 possessive quantifiers or just not using regular expressions against untrusted
66938 data.
66939 </para>
66940 </listitem>
66941 <listitem>
66942 <para>
66943 It can be important to correctly use <option>${quote:...}</option>,
66944 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
66945 items to ensure that data is correctly constructed.
66946 </para>
66947 </listitem>
66948 <listitem>
66949 <para>
66950 Some lookups might return multiple results, even though normal usage is only
66951 expected to yield one result.
66952 </para>
66953 </listitem>
66954 </itemizedlist>
66955 </section>
66956 <section id="SECID272">
66957 <title>IPv4 source routing</title>
66958 <para>
66959 <indexterm role="concept">
66960 <primary>source routing</primary>
66961 <secondary>in IP packets</secondary>
66962 </indexterm>
66963 <indexterm role="concept">
66964 <primary>IP source routing</primary>
66965 </indexterm>
66966 Many operating systems suppress IP source-routed packets in the kernel, but
66967 some cannot be made to do this, so Exim does its own check. It logs incoming
66968 IPv4 source-routed TCP calls, and then drops them. Things are all different in
66969 IPv6. No special checking is currently done.
66970 </para>
66971 </section>
66972 <section id="SECID273">
66973 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
66974 <para>
66975 Support for these SMTP commands is disabled by default. If required, they can
66976 be enabled by defining suitable ACLs.
66977 </para>
66978 </section>
66979 <section id="SECID274">
66980 <title>Privileged users</title>
66981 <para>
66982 <indexterm role="concept">
66983 <primary>trusted users</primary>
66984 </indexterm>
66985 <indexterm role="concept">
66986 <primary>admin user</primary>
66987 </indexterm>
66988 <indexterm role="concept">
66989 <primary>privileged user</primary>
66990 </indexterm>
66991 <indexterm role="concept">
66992 <primary>user</primary>
66993 <secondary>trusted</secondary>
66994 </indexterm>
66995 <indexterm role="concept">
66996 <primary>user</primary>
66997 <secondary>admin</secondary>
66998 </indexterm>
66999 Exim recognizes two sets of users with special privileges. Trusted users are
67000 able to submit new messages to Exim locally, but supply their own sender
67001 addresses and information about a sending host. For other users submitting
67002 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
67003 permit a remote host to be specified.
67004 </para>
67005 <para>
67006 <indexterm role="option">
67007 <primary><option>-f</option></primary>
67008 </indexterm>
67009 However, an untrusted user is permitted to use the <option>-f</option> command line option
67010 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
67011 message should not cause an error report. This affects the message&#x2019;s envelope,
67012 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
67013 permitted to use specific forms of address with the <option>-f</option> option by setting
67014 the <option>untrusted_set_sender</option> option.
67015 </para>
67016 <para>
67017 Trusted users are used to run processes that receive mail messages from some
67018 other mail domain and pass them on to Exim for delivery either locally, or over
67019 the Internet. Exim trusts a caller that is running as root, as the Exim user,
67020 as any user listed in the <option>trusted_users</option> configuration option, or under any
67021 group listed in the <option>trusted_groups</option> option.
67022 </para>
67023 <para>
67024 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
67025 can freeze or thaw messages, cause them to be returned to their senders, remove
67026 them entirely, or modify them in various ways. In addition, admin users can run
67027 the Exim monitor and see all the information it is capable of providing, which
67028 includes the contents of files on the spool.
67029 </para>
67030 <para>
67031 <indexterm role="option">
67032 <primary><option>-M</option></primary>
67033 </indexterm>
67034 <indexterm role="option">
67035 <primary><option>-q</option></primary>
67036 </indexterm>
67037 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
67038 delivery of messages on its queue is restricted to admin users. This
67039 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
67040 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
67041 queue is also restricted to admin users. This restriction can be relaxed by
67042 setting <option>no_queue_list_requires_admin</option>.
67043 </para>
67044 <para>
67045 Exim recognizes an admin user if the calling process is running as root or as
67046 the Exim user or if any of the groups associated with the calling process is
67047 the Exim group. It is not necessary actually to be running under the Exim
67048 group. However, if admin users who are not root or the Exim user are to access
67049 the contents of files on the spool via the Exim monitor (which runs
67050 unprivileged), Exim must be built to allow group read access to its spool
67051 files.
67052 </para>
67053 </section>
67054 <section id="SECID275">
67055 <title>Spool files</title>
67056 <para>
67057 <indexterm role="concept">
67058 <primary>spool directory</primary>
67059 <secondary>files</secondary>
67060 </indexterm>
67061 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
67062 set to the Exim group. The mode for spool files is defined in the
67063 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
67064 any user who is a member of the Exim group can access these files.
67065 </para>
67066 </section>
67067 <section id="SECID276">
67068 <title>Use of argv[0]</title>
67069 <para>
67070 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
67071 of specific strings, Exim assumes certain options. For example, calling Exim
67072 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
67073 to calling it with the option <option>-bS</option>. There are no security implications in
67074 this.
67075 </para>
67076 </section>
67077 <section id="SECID277">
67078 <title>Use of %f formatting</title>
67079 <para>
67080 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
67081 are actually stored in integer variables as 1000 times the load average.
67082 Consequently, their range is limited and so therefore is the length of the
67083 converted output.
67084 </para>
67085 </section>
67086 <section id="SECID278">
67087 <title>Embedded Exim path</title>
67088 <para>
67089 Exim uses its own path name, which is embedded in the code, only when it needs
67090 to re-exec in order to regain root privilege. Therefore, it is not root when it
67091 does so. If some bug allowed the path to get overwritten, it would lead to an
67092 arbitrary program&#x2019;s being run as exim, not as root.
67093 </para>
67094 </section>
67095 <section id="SECTdynmoddir">
67096 <title>Dynamic module directory</title>
67097 <para>
67098 Any dynamically loadable modules must be installed into the directory
67099 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
67100 loading it.
67101 </para>
67102 </section>
67103 <section id="SECID279">
67104 <title>Use of sprintf()</title>
67105 <para>
67106 <indexterm role="concept">
67107 <primary><function>sprintf()</function></primary>
67108 </indexterm>
67109 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
67110 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
67111 The intermediate formatting is done into a large fixed buffer by a function
67112 that runs through the format string itself, and checks the length of each
67113 conversion before performing it, thus preventing buffer overruns.
67114 </para>
67115 <para>
67116 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
67117 the output buffer is known to be sufficiently long to contain the converted
67118 string.
67119 </para>
67120 </section>
67121 <section id="SECID280">
67122 <title>Use of debug_printf() and log_write()</title>
67123 <para>
67124 Arbitrary strings are passed to both these functions, but they do their
67125 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
67126 the format string itself, and checks the length of each conversion.
67127 </para>
67128 </section>
67129 <section id="SECID281">
67130 <title>Use of strcat() and strcpy()</title>
67131 <para>
67132 These are used only in cases where the output buffer is known to be large
67133 enough to hold the result.
67134 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
67135 </para>
67136 </section>
67137 </chapter>
67138
67139 <chapter id="CHAPspool">
67140 <title>Format of spool files</title>
67141 <para>
67142 <indexterm role="concept" id="IIDforspo1" class="startofrange">
67143 <primary>format</primary>
67144 <secondary>spool files</secondary>
67145 </indexterm>
67146 <indexterm role="concept" id="IIDforspo2" class="startofrange">
67147 <primary>spool directory</primary>
67148 <secondary>format of files</secondary>
67149 </indexterm>
67150 <indexterm role="concept" id="IIDforspo3" class="startofrange">
67151 <primary>spool files</primary>
67152 <secondary>format of</secondary>
67153 </indexterm>
67154 <indexterm role="concept">
67155 <primary>spool files</primary>
67156 <secondary>editing</secondary>
67157 </indexterm>
67158 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
67159 followed by -D and -H, respectively. The data portion of the message is kept in
67160 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
67161 kept in the -H file, whose format is described in this chapter. Each of these
67162 two files contains the final component of its own name as its first line. This
67163 is insurance against disk crashes where the directory is lost but the files
67164 themselves are recoverable.
67165 </para>
67166 <para>
67167 Some people are tempted into editing -D files in order to modify messages. You
67168 need to be extremely careful if you do this; it is not recommended and you are
67169 on your own if you do it. Here are some of the pitfalls:
67170 </para>
67171 <itemizedlist>
67172 <listitem>
67173 <para>
67174 You must ensure that Exim does not try to deliver the message while you are
67175 fiddling with it. The safest way is to take out a write lock on the -D file,
67176 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
67177 place, the lock will be retained. If you write a new file and rename it, the
67178 lock will be lost at the instant of rename.
67179 </para>
67180 </listitem>
67181 <listitem>
67182 <para>
67183 <indexterm role="variable">
67184 <primary><varname>$body_linecount</varname></primary>
67185 </indexterm>
67186 If you change the number of lines in the file, the value of
67187 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
67188 present, this value is not used by Exim, but there is no guarantee that this
67189 will always be the case.
67190 </para>
67191 </listitem>
67192 <listitem>
67193 <para>
67194 If the message is in MIME format, you must take care not to break it.
67195 </para>
67196 </listitem>
67197 <listitem>
67198 <para>
67199 If the message is cryptographically signed, any change will invalidate the
67200 signature.
67201 </para>
67202 </listitem>
67203 </itemizedlist>
67204 <para>
67205 All in all, modifying -D files is fraught with danger.
67206 </para>
67207 <para>
67208 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
67209 its subdirectories when <option>split_spool_directory</option> is set). These are journal
67210 files, used to record addresses to which the message has been delivered during
67211 the course of a delivery attempt. If there are still undelivered recipients at
67212 the end, the -H file is updated, and the -J file is deleted. If, however, there
67213 is some kind of crash (for example, a power outage) before this happens, the -J
67214 file remains in existence. When Exim next processes the message, it notices the
67215 -J file and uses it to update the -H file before starting the next delivery
67216 attempt.
67217 </para>
67218 <section id="SECID282">
67219 <title>Format of the -H file</title>
67220 <para>
67221 <indexterm role="concept">
67222 <primary>uid (user id)</primary>
67223 <secondary>in spool file</secondary>
67224 </indexterm>
67225 <indexterm role="concept">
67226 <primary>gid (group id)</primary>
67227 <secondary>in spool file</secondary>
67228 </indexterm>
67229 The second line of the -H file contains the login name for the uid of the
67230 process that called Exim to read the message, followed by the numerical uid and
67231 gid. For a locally generated message, this is normally the user who sent the
67232 message. For a message received over TCP/IP via the daemon, it is
67233 normally the Exim user.
67234 </para>
67235 <para>
67236 The third line of the file contains the address of the message&#x2019;s sender as
67237 transmitted in the envelope, contained in angle brackets. The sender address is
67238 empty for bounce messages. For incoming SMTP mail, the sender address is given
67239 in the MAIL command. For locally generated mail, the sender address is
67240 created by Exim from the login name of the current user and the configured
67241 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
67242 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
67243 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
67244 </para>
67245 <para>
67246 The fourth line contains two numbers. The first is the time that the message
67247 was received, in the conventional Unix form &ndash; the number of seconds since the
67248 start of the epoch. The second number is a count of the number of messages
67249 warning of delayed delivery that have been sent to the sender.
67250 </para>
67251 <para>
67252 There follow a number of lines starting with a hyphen. These can appear in any
67253 order, and are omitted when not relevant:
67254 </para>
67255 <variablelist>
67256 <varlistentry>
67257 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
67258 <listitem>
67259 <para>
67260 This item is obsolete, and is not generated from Exim release 4.61 onwards;
67261 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
67262 recognized, to provide backward compatibility. In the old format, a line of
67263 this form is present for every ACL variable that is not empty. The number
67264 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
67265 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
67266 the data string for the variable. The string itself starts at the beginning of
67267 the next line, and is followed by a newline character. It may contain internal
67268 newlines.
67269 </para>
67270 </listitem></varlistentry>
67271 <varlistentry>
67272 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
67273 <listitem>
67274 <para>
67275 A line of this form is present for every ACL connection variable that is
67276 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
67277 The length is the length of the data string for the variable. The string itself
67278 starts at the beginning of the next line, and is followed by a newline
67279 character. It may contain internal newlines.
67280 </para>
67281 </listitem></varlistentry>
67282 <varlistentry>
67283 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
67284 <listitem>
67285 <para>
67286 A line of this form is present for every ACL message variable that is defined.
67287 Note that there is a space between <option>-aclm</option> and the rest of the name. The
67288 length is the length of the data string for the variable. The string itself
67289 starts at the beginning of the next line, and is followed by a newline
67290 character. It may contain internal newlines.
67291 </para>
67292 </listitem></varlistentry>
67293 <varlistentry>
67294 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
67295 <listitem>
67296 <para>
67297 This is present if, when the message was received over SMTP, the value of
67298 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
67299 </para>
67300 </listitem></varlistentry>
67301 <varlistentry>
67302 <term><option>-allow_unqualified_recipient</option></term>
67303 <listitem>
67304 <para>
67305 This is present if unqualified recipient addresses are permitted in header
67306 lines (to stop such addresses from being qualified if rewriting occurs at
67307 transport time). Local messages that were input using <option>-bnq</option> and remote
67308 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
67309 </para>
67310 </listitem></varlistentry>
67311 <varlistentry>
67312 <term><option>-allow_unqualified_sender</option></term>
67313 <listitem>
67314 <para>
67315 This is present if unqualified sender addresses are permitted in header lines
67316 (to stop such addresses from being qualified if rewriting occurs at transport
67317 time). Local messages that were input using <option>-bnq</option> and remote messages from
67318 hosts that match <option>sender_unqualified_hosts</option> set this flag.
67319 </para>
67320 </listitem></varlistentry>
67321 <varlistentry>
67322 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67323 <listitem>
67324 <para>
67325 The id information for a message received on an authenticated SMTP connection
67326 &ndash; the value of the <varname>$authenticated_id</varname> variable.
67327 </para>
67328 </listitem></varlistentry>
67329 <varlistentry>
67330 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
67331 <listitem>
67332 <para>
67333 The address of an authenticated sender &ndash; the value of the
67334 <varname>$authenticated_sender</varname> variable.
67335 </para>
67336 </listitem></varlistentry>
67337 <varlistentry>
67338 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
67339 <listitem>
67340 <para>
67341 This records the number of lines in the body of the message, and is always
67342 present.
67343 </para>
67344 </listitem></varlistentry>
67345 <varlistentry>
67346 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
67347 <listitem>
67348 <para>
67349 This records the number of binary zero bytes in the body of the message, and is
67350 present if the number is greater than zero.
67351 </para>
67352 </listitem></varlistentry>
67353 <varlistentry>
67354 <term><option>-deliver_firsttime</option></term>
67355 <listitem>
67356 <para>
67357 This is written when a new message is first added to the spool. When the spool
67358 file is updated after a deferral, it is omitted.
67359 </para>
67360 </listitem></varlistentry>
67361 <varlistentry>
67362 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
67363 <listitem>
67364 <para>
67365 <indexterm role="concept">
67366 <primary>frozen messages</primary>
67367 <secondary>spool data</secondary>
67368 </indexterm>
67369 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
67370 </para>
67371 </listitem></varlistentry>
67372 <varlistentry>
67373 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67374 <listitem>
67375 <para>
67376 This records the host name as specified by a remote host in a HELO or EHLO
67377 command.
67378 </para>
67379 </listitem></varlistentry>
67380 <varlistentry>
67381 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
67382 <listitem>
67383 <para>
67384 This records the IP address of the host from which the message was received and
67385 the remote port number that was used. It is omitted for locally generated
67386 messages.
67387 </para>
67388 </listitem></varlistentry>
67389 <varlistentry>
67390 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67391 <listitem>
67392 <para>
67393 If the message was received on an authenticated SMTP connection, this records
67394 the name of the authenticator &ndash; the value of the
67395 <varname>$sender_host_authenticated</varname> variable.
67396 </para>
67397 </listitem></varlistentry>
67398 <varlistentry>
67399 <term><option>-host_lookup_failed</option></term>
67400 <listitem>
67401 <para>
67402 This is present if an attempt to look up the sending host&#x2019;s name from its IP
67403 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
67404 </para>
67405 </listitem></varlistentry>
67406 <varlistentry>
67407 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67408 <listitem>
67409 <para>
67410 <indexterm role="concept">
67411 <primary>reverse DNS lookup</primary>
67412 </indexterm>
67413 <indexterm role="concept">
67414 <primary>DNS</primary>
67415 <secondary>reverse lookup</secondary>
67416 </indexterm>
67417 This records the name of the remote host from which the message was received,
67418 if the host name was looked up from the IP address when the message was being
67419 received. It is not present if no reverse lookup was done.
67420 </para>
67421 </listitem></varlistentry>
67422 <varlistentry>
67423 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67424 <listitem>
67425 <para>
67426 For locally submitted messages, this records the login of the originating user,
67427 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
67428 ident value. For messages received over TCP/IP, this records the ident string
67429 supplied by the remote host, if any.
67430 </para>
67431 </listitem></varlistentry>
67432 <varlistentry>
67433 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
67434 <listitem>
67435 <para>
67436 This records the IP address of the local interface and the port number through
67437 which a message was received from a remote host. It is omitted for locally
67438 generated messages.
67439 </para>
67440 </listitem></varlistentry>
67441 <varlistentry>
67442 <term><option>-local</option></term>
67443 <listitem>
67444 <para>
67445 The message is from a local sender.
67446 </para>
67447 </listitem></varlistentry>
67448 <varlistentry>
67449 <term><option>-localerror</option></term>
67450 <listitem>
67451 <para>
67452 The message is a locally-generated bounce message.
67453 </para>
67454 </listitem></varlistentry>
67455 <varlistentry>
67456 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
67457 <listitem>
67458 <para>
67459 This records the data string that was returned by the <function>local_scan()</function> function
67460 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
67461 variable. It is omitted if no data was returned.
67462 </para>
67463 </listitem></varlistentry>
67464 <varlistentry>
67465 <term><option>-manual_thaw</option></term>
67466 <listitem>
67467 <para>
67468 The message was frozen but has been thawed manually, that is, by an explicit
67469 Exim command rather than via the auto-thaw process.
67470 </para>
67471 </listitem></varlistentry>
67472 <varlistentry>
67473 <term><option>-N</option></term>
67474 <listitem>
67475 <para>
67476 A testing delivery process was started using the <option>-N</option> option to suppress any
67477 actual deliveries, but delivery was deferred. At any further delivery attempts,
67478 <option>-N</option> is assumed.
67479 </para>
67480 </listitem></varlistentry>
67481 <varlistentry>
67482 <term><option>-received_protocol</option></term>
67483 <listitem>
67484 <para>
67485 This records the value of the <varname>$received_protocol</varname> variable, which contains
67486 the name of the protocol by which the message was received.
67487 </para>
67488 </listitem></varlistentry>
67489 <varlistentry>
67490 <term><option>-sender_set_untrusted</option></term>
67491 <listitem>
67492 <para>
67493 The envelope sender of this message was set by an untrusted local caller (used
67494 to ensure that the caller is displayed in queue listings).
67495 </para>
67496 </listitem></varlistentry>
67497 <varlistentry>
67498 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
67499 <listitem>
67500 <para>
67501 If a message was scanned by SpamAssassin, this is present. It records the value
67502 of <varname>$spam_score_int</varname>.
67503 </para>
67504 </listitem></varlistentry>
67505 <varlistentry>
67506 <term><option>-tls_certificate_verified</option></term>
67507 <listitem>
67508 <para>
67509 A TLS certificate was received from the client that sent this message, and the
67510 certificate was verified by the server.
67511 </para>
67512 </listitem></varlistentry>
67513 <varlistentry>
67514 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
67515 <listitem>
67516 <para>
67517 When the message was received over an encrypted connection, this records the
67518 name of the cipher suite that was used.
67519 </para>
67520 </listitem></varlistentry>
67521 <varlistentry>
67522 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
67523 <listitem>
67524 <para>
67525 When the message was received over an encrypted connection, and a certificate
67526 was received from the client, this records the Distinguished Name from that
67527 certificate.
67528 </para>
67529 </listitem></varlistentry>
67530 </variablelist>
67531 <para>
67532 Following the options there is a list of those addresses to which the message
67533 is not to be delivered. This set of addresses is initialized from the command
67534 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
67535 is set; otherwise it starts out empty. Whenever a successful delivery is made,
67536 the address is added to this set. The addresses are kept internally as a
67537 balanced binary tree, and it is a representation of that tree which is written
67538 to the spool file. If an address is expanded via an alias or forward file, the
67539 original address is added to the tree when deliveries to all its child
67540 addresses are complete.
67541 </para>
67542 <para>
67543 If the tree is empty, there is a single line in the spool file containing just
67544 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
67545 Y or N, followed by an address. The address is the value for the node of the
67546 tree, and the letters indicate whether the node has a left branch and/or a
67547 right branch attached to it, respectively. If branches exist, they immediately
67548 follow. Here is an example of a three-node tree:
67549 </para>
67550 <literallayout class="monospaced">
67551 YY darcy@austen.fict.example
67552 NN alice@wonderland.fict.example
67553 NN editor@thesaurus.ref.example
67554 </literallayout>
67555 <para>
67556 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
67557 This is a simple list, preceded by a count. It includes all the original
67558 recipients of the message, including those to whom the message has already been
67559 delivered. In the simplest case, the list contains one address per line. For
67560 example:
67561 </para>
67562 <literallayout class="monospaced">
67563 4
67564 editor@thesaurus.ref.example
67565 darcy@austen.fict.example
67566 rdo@foundation
67567 alice@wonderland.fict.example
67568 </literallayout>
67569 <para>
67570 However, when a child address has been added to the top-level addresses as a
67571 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
67572 line is of the following form:
67573 </para>
67574 <literallayout>
67575 &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;
67576 </literallayout>
67577 <para>
67578 The 01 flag bit indicates the presence of the three other fields that follow
67579 the top-level address. Other bits may be used in future to support additional
67580 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
67581 original parent of the <quote>one time</quote> address. The first two fields are the
67582 envelope sender that is associated with this address and its length. If the
67583 length is zero, there is no special envelope sender (there are then two space
67584 characters in the line). A non-empty field can arise from a <command>redirect</command> router
67585 that has an <option>errors_to</option> setting.
67586 </para>
67587 <para>
67588 A blank line separates the envelope and status information from the headers
67589 which follow. A header may occupy several lines of the file, and to save effort
67590 when reading it in, each header is preceded by a number and an identifying
67591 character. The number is the number of characters in the header, including any
67592 embedded newlines and the terminating newline. The character is one of the
67593 following:
67594 </para>
67595 <informaltable frame="none">
67596 <tgroup cols="2" colsep="0" rowsep="0">
67597 <colspec colwidth="50pt" align="left"/>
67598 <colspec colwidth="254pt" align="left"/>
67599 <tbody>
67600 <row>
67601 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
67602 <entry>header in which Exim has no special interest</entry>
67603 </row>
67604 <row>
67605 <entry><literal>B</literal></entry>
67606 <entry><emphasis>Bcc:</emphasis> header</entry>
67607 </row>
67608 <row>
67609 <entry><literal>C</literal></entry>
67610 <entry><emphasis>Cc:</emphasis> header</entry>
67611 </row>
67612 <row>
67613 <entry><literal>F</literal></entry>
67614 <entry><emphasis>From:</emphasis> header</entry>
67615 </row>
67616 <row>
67617 <entry><literal>I</literal></entry>
67618 <entry><emphasis>Message-id:</emphasis> header</entry>
67619 </row>
67620 <row>
67621 <entry><literal>P</literal></entry>
67622 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
67623 </row>
67624 <row>
67625 <entry><literal>R</literal></entry>
67626 <entry><emphasis>Reply-To:</emphasis> header</entry>
67627 </row>
67628 <row>
67629 <entry><literal>S</literal></entry>
67630 <entry><emphasis>Sender:</emphasis> header</entry>
67631 </row>
67632 <row>
67633 <entry><literal>T</literal></entry>
67634 <entry><emphasis>To:</emphasis> header</entry>
67635 </row>
67636 <row>
67637 <entry><literal>*</literal></entry>
67638 <entry>replaced or deleted header</entry>
67639 </row>
67640 </tbody>
67641 </tgroup>
67642 </informaltable>
67643 <para>
67644 Deleted or replaced (rewritten) headers remain in the spool file for debugging
67645 purposes. They are not transmitted when the message is delivered. Here is a
67646 typical set of headers:
67647 </para>
67648 <literallayout class="monospaced">
67649 111P Received: by hobbit.fict.example with local (Exim 4.00)
67650 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
67651 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
67652 038* X-rewrote-sender: bb@hobbit.fict.example
67653 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
67654 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
67655 099* To: alice@wonderland.fict.example, rdo@foundation,
67656 darcy@austen.fict.example, editor@thesaurus.ref.example
67657 104T To: alice@wonderland.fict.example, rdo@foundation.example,
67658 darcy@austen.fict.example, editor@thesaurus.ref.example
67659 038  Date: Fri, 11 May 2001 10:28:59 +0100
67660 </literallayout>
67661 <para>
67662 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
67663 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
67664 unqualified domain <emphasis>foundation</emphasis>.
67665 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
67666 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
67667 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
67668 </para>
67669 </section>
67670 </chapter>
67671
67672 <chapter id="CHAPdkim">
67673 <title>Support for DKIM (DomainKeys Identified Mail)</title>
67674 <titleabbrev>DKIM Support</titleabbrev>
67675 <para>
67676 <indexterm role="concept">
67677 <primary>DKIM</primary>
67678 </indexterm>
67679 </para>
67680 <para>
67681 DKIM is a mechanism by which messages sent by some entity can be provably
67682 linked to a domain which that entity controls.  It permits reputation to
67683 be tracked on a per-domain basis, rather than merely upon source IP address.
67684 DKIM is documented in RFC 4871.
67685 </para>
67686 <para>
67687 Since version 4.70, DKIM support is compiled into Exim by default. It can be
67688 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
67689 </para>
67690 <para>
67691 Exim&#x2019;s DKIM implementation allows to
67692 </para>
67693 <orderedlist numeration="arabic">
67694 <listitem>
67695 <para>
67696 Sign outgoing messages: This function is implemented in the SMTP transport.
67697 It can co-exist with all other Exim features
67698 (including transport filters)
67699 except cutthrough delivery.
67700 </para>
67701 </listitem>
67702 <listitem>
67703 <para>
67704 Verify signatures in incoming messages: This is implemented by an additional
67705 ACL (acl_smtp_dkim), which can be called several times per message, with
67706 different signature contexts.
67707 </para>
67708 </listitem>
67709 </orderedlist>
67710 <para>
67711 In typical Exim style, the verification implementation does not include any
67712 default "policy". Instead it enables you to build your own policy using
67713 Exim&#x2019;s standard controls.
67714 </para>
67715 <para>
67716 Please note that verification of DKIM signatures in incoming mail is turned
67717 on by default for logging purposes. For each signature in incoming email,
67718 exim will log a line displaying the most important signature details, and the
67719 signature status. Here is an example (with line-breaks added for clarity):
67720 </para>
67721 <literallayout class="monospaced">
67722 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
67723     d=facebookmail.com s=q1-2009b
67724     c=relaxed/relaxed a=rsa-sha1
67725     i=@facebookmail.com t=1252484542 [verification succeeded]
67726 </literallayout>
67727 <para>
67728 You might want to turn off DKIM verification processing entirely for internal
67729 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
67730 control modifier. This should typically be done in the RCPT ACL, at points
67731 where you accept mail from relay sources (internal hosts or authenticated
67732 senders).
67733 </para>
67734 <section id="SECID513">
67735 <title>Signing outgoing messages</title>
67736 <para>
67737 <indexterm role="concept">
67738 <primary>DKIM</primary>
67739 <secondary>signing</secondary>
67740 </indexterm>
67741 </para>
67742 <para>
67743 Signing is implemented by setting private options on the SMTP transport.
67744 These options take (expandable) strings as arguments.
67745 </para>
67746 <para>
67747 <indexterm role="option">
67748 <primary><option>dkim_domain</option></primary>
67749 </indexterm>
67750 </para>
67751 <informaltable frame="all">
67752 <tgroup cols="4" colsep="0" rowsep="0">
67753 <colspec colwidth="8*" align="left"/>
67754 <colspec colwidth="6*" align="center"/>
67755 <colspec colwidth="6*" align="center"/>
67756 <colspec colwidth="6*" align="right"/>
67757 <tbody>
67758 <row>
67759 <entry><option>dkim_domain</option></entry>
67760 <entry>Use: <emphasis>smtp</emphasis></entry>
67761 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67762 <entry>Default: <emphasis>unset</emphasis></entry>
67763 </row>
67764 </tbody>
67765 </tgroup>
67766 </informaltable>
67767 <para>
67768 MANDATORY:
67769 The domain you want to sign with. The result of this expanded
67770 option is put into the <option>$dkim_domain</option> expansion variable.
67771 </para>
67772 <para>
67773 <indexterm role="option">
67774 <primary><option>dkim_selector</option></primary>
67775 </indexterm>
67776 </para>
67777 <informaltable frame="all">
67778 <tgroup cols="4" colsep="0" rowsep="0">
67779 <colspec colwidth="8*" align="left"/>
67780 <colspec colwidth="6*" align="center"/>
67781 <colspec colwidth="6*" align="center"/>
67782 <colspec colwidth="6*" align="right"/>
67783 <tbody>
67784 <row>
67785 <entry><option>dkim_selector</option></entry>
67786 <entry>Use: <emphasis>smtp</emphasis></entry>
67787 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67788 <entry>Default: <emphasis>unset</emphasis></entry>
67789 </row>
67790 </tbody>
67791 </tgroup>
67792 </informaltable>
67793 <para>
67794 MANDATORY:
67795 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
67796 variable to look up a matching selector. The result is put in the expansion
67797 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
67798 option along with <option>$dkim_domain</option>.
67799 </para>
67800 <para>
67801 <indexterm role="option">
67802 <primary><option>dkim_private_key</option></primary>
67803 </indexterm>
67804 </para>
67805 <informaltable frame="all">
67806 <tgroup cols="4" colsep="0" rowsep="0">
67807 <colspec colwidth="8*" align="left"/>
67808 <colspec colwidth="6*" align="center"/>
67809 <colspec colwidth="6*" align="center"/>
67810 <colspec colwidth="6*" align="right"/>
67811 <tbody>
67812 <row>
67813 <entry><option>dkim_private_key</option></entry>
67814 <entry>Use: <emphasis>smtp</emphasis></entry>
67815 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67816 <entry>Default: <emphasis>unset</emphasis></entry>
67817 </row>
67818 </tbody>
67819 </tgroup>
67820 </informaltable>
67821 <para>
67822 MANDATORY:
67823 This sets the private key to use. You can use the <option>$dkim_domain</option> and
67824 <option>$dkim_selector</option> expansion variables to determine the private key to use.
67825 The result can either
67826 </para>
67827 <itemizedlist>
67828 <listitem>
67829 <para>
67830 be a valid RSA private key in ASCII armor, including line breaks.
67831 </para>
67832 </listitem>
67833 <listitem>
67834 <para>
67835 start with a slash, in which case it is treated as a file that contains
67836 the private key.
67837 </para>
67838 </listitem>
67839 <listitem>
67840 <para>
67841 be "0", "false" or the empty string, in which case the message will not
67842 be signed. This case will not result in an error, even if <option>dkim_strict</option>
67843 is set.
67844 </para>
67845 </listitem>
67846 </itemizedlist>
67847 <para>
67848 <indexterm role="option">
67849 <primary><option>dkim_canon</option></primary>
67850 </indexterm>
67851 </para>
67852 <informaltable frame="all">
67853 <tgroup cols="4" colsep="0" rowsep="0">
67854 <colspec colwidth="8*" align="left"/>
67855 <colspec colwidth="6*" align="center"/>
67856 <colspec colwidth="6*" align="center"/>
67857 <colspec colwidth="6*" align="right"/>
67858 <tbody>
67859 <row>
67860 <entry><option>dkim_canon</option></entry>
67861 <entry>Use: <emphasis>smtp</emphasis></entry>
67862 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67863 <entry>Default: <emphasis>unset</emphasis></entry>
67864 </row>
67865 </tbody>
67866 </tgroup>
67867 </informaltable>
67868 <para>
67869 OPTIONAL:
67870 This option sets the canonicalization method used when signing a message.
67871 The DKIM RFC currently supports two methods: "simple" and "relaxed".
67872 The option defaults to "relaxed" when unset. Note: the current implementation
67873 only supports using the same canonicalization method for both headers and body.
67874 </para>
67875 <para>
67876 <indexterm role="option">
67877 <primary><option>dkim_strict</option></primary>
67878 </indexterm>
67879 </para>
67880 <informaltable frame="all">
67881 <tgroup cols="4" colsep="0" rowsep="0">
67882 <colspec colwidth="8*" align="left"/>
67883 <colspec colwidth="6*" align="center"/>
67884 <colspec colwidth="6*" align="center"/>
67885 <colspec colwidth="6*" align="right"/>
67886 <tbody>
67887 <row>
67888 <entry><option>dkim_strict</option></entry>
67889 <entry>Use: <emphasis>smtp</emphasis></entry>
67890 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67891 <entry>Default: <emphasis>unset</emphasis></entry>
67892 </row>
67893 </tbody>
67894 </tgroup>
67895 </informaltable>
67896 <para>
67897 OPTIONAL:
67898 This  option  defines  how  Exim  behaves  when  signing a message that
67899 should be signed fails for some reason.  When the expansion evaluates to
67900 either "1" or "true", Exim will defer. Otherwise Exim will send the message
67901 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
67902 variables here.
67903 </para>
67904 <para>
67905 <indexterm role="option">
67906 <primary><option>dkim_sign_headers</option></primary>
67907 </indexterm>
67908 </para>
67909 <informaltable frame="all">
67910 <tgroup cols="4" colsep="0" rowsep="0">
67911 <colspec colwidth="8*" align="left"/>
67912 <colspec colwidth="6*" align="center"/>
67913 <colspec colwidth="6*" align="center"/>
67914 <colspec colwidth="6*" align="right"/>
67915 <tbody>
67916 <row>
67917 <entry><option>dkim_sign_headers</option></entry>
67918 <entry>Use: <emphasis>smtp</emphasis></entry>
67919 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67920 <entry>Default: <emphasis>unset</emphasis></entry>
67921 </row>
67922 </tbody>
67923 </tgroup>
67924 </informaltable>
67925 <para>
67926 OPTIONAL:
67927 When set, this option must expand to (or be specified as) a colon-separated
67928 list of header names. Headers with these names will be included in the message
67929 signature. When unspecified, the header names recommended in RFC4871 will be
67930 used.
67931 </para>
67932 </section>
67933 <section id="SECID514">
67934 <title>Verifying DKIM signatures in incoming mail</title>
67935 <para>
67936 <indexterm role="concept">
67937 <primary>DKIM</primary>
67938 <secondary>verification</secondary>
67939 </indexterm>
67940 </para>
67941 <para>
67942 Verification of DKIM signatures in incoming email is implemented via the
67943 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
67944 syntactically(!) correct signature in the incoming message.
67945 A missing ACL definition defaults to accept.
67946 If any ACL call does not accept, the message is not accepted.
67947 If a cutthrough delivery was in progress for the message it is
67948 summarily dropped (having wasted the transmission effort).
67949 </para>
67950 <para>
67951 To evaluate the signature in the ACL a large number of expansion variables
67952 containing the signature status and its details are set up during the
67953 runtime of the ACL.
67954 </para>
67955 <para>
67956 Calling the ACL only for existing signatures is not sufficient to build
67957 more advanced policies. For that reason, the global option
67958 <option>dkim_verify_signers</option>, and a global expansion variable
67959 <option>$dkim_signers</option> exist.
67960 </para>
67961 <para>
67962 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
67963 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
67964 called. It is expanded when the message has been received. At this point,
67965 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
67966 list of signer domains and identities for the message. When
67967 <option>dkim_verify_signers</option> is not specified in the main configuration,
67968 it defaults as:
67969 </para>
67970 <literallayout class="monospaced">
67971 dkim_verify_signers = $dkim_signers
67972 </literallayout>
67973 <para>
67974 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
67975 DKIM signature in the message. Current DKIM verifiers may want to explicitly
67976 call the ACL for known domains or identities. This would be achieved as follows:
67977 </para>
67978 <literallayout class="monospaced">
67979 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
67980 </literallayout>
67981 <para>
67982 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
67983 and "ebay.com", plus all domains and identities that have signatures in the message.
67984 You can also be more creative in constructing your policy. For example:
67985 </para>
67986 <literallayout class="monospaced">
67987 dkim_verify_signers = $sender_address_domain:$dkim_signers
67988 </literallayout>
67989 <para>
67990 If a domain or identity is listed several times in the (expanded) value of
67991 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
67992 </para>
67993 <para>
67994 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
67995 available (from most to least important):
67996 </para>
67997 <variablelist>
67998 <varlistentry>
67999 <term><option>$dkim_cur_signer</option></term>
68000 <listitem>
68001 <para>
68002 The signer that is being evaluated in this ACL run. This can be a domain or
68003 an identity. This is one of the list items from the expanded main option
68004 <option>dkim_verify_signers</option> (see above).
68005 </para>
68006 </listitem></varlistentry>
68007 <varlistentry>
68008 <term><option>$dkim_verify_status</option></term>
68009 <listitem>
68010 <para>
68011 A string describing the general status of the signature. One of
68012 </para>
68013 <itemizedlist>
68014 <listitem>
68015 <para>
68016 <option>none</option>: There is no signature in the message for the current domain or
68017 identity (as reflected by <option>$dkim_cur_signer</option>).
68018 </para>
68019 </listitem>
68020 <listitem>
68021 <para>
68022 <option>invalid</option>: The signature could not be verified due to a processing error.
68023 More detail is available in <option>$dkim_verify_reason</option>.
68024 </para>
68025 </listitem>
68026 <listitem>
68027 <para>
68028 <option>fail</option>: Verification of the signature failed.  More detail is
68029 available in <option>$dkim_verify_reason</option>.
68030 </para>
68031 </listitem>
68032 <listitem>
68033 <para>
68034 <option>pass</option>: The signature passed verification. It is valid.
68035 </para>
68036 </listitem>
68037 </itemizedlist>
68038 </listitem></varlistentry>
68039 <varlistentry>
68040 <term><option>$dkim_verify_reason</option></term>
68041 <listitem>
68042 <para>
68043 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
68044 "fail" or "invalid". One of
68045 </para>
68046 <itemizedlist>
68047 <listitem>
68048 <para>
68049 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
68050 key for the domain could not be retrieved. This may be a temporary problem.
68051 </para>
68052 </listitem>
68053 <listitem>
68054 <para>
68055 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
68056 record for the domain is syntactically invalid.
68057 </para>
68058 </listitem>
68059 <listitem>
68060 <para>
68061 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
68062 body hash does not match the one specified in the signature header. This
68063 means that the message body was modified in transit.
68064 </para>
68065 </listitem>
68066 <listitem>
68067 <para>
68068 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
68069 could not be verified. This may mean that headers were modified,
68070 re-written or otherwise changed in a way which is incompatible with
68071 DKIM verification. It may of course also mean that the signature is forged.
68072 </para>
68073 </listitem>
68074 </itemizedlist>
68075 </listitem></varlistentry>
68076 <varlistentry>
68077 <term><option>$dkim_domain</option></term>
68078 <listitem>
68079 <para>
68080 The signing domain. IMPORTANT: This variable is only populated if there is
68081 an actual signature in the message for the current domain or identity (as
68082 reflected by <option>$dkim_cur_signer</option>).
68083 </para>
68084 </listitem></varlistentry>
68085 <varlistentry>
68086 <term><option>$dkim_identity</option></term>
68087 <listitem>
68088 <para>
68089 The signing identity, if present. IMPORTANT: This variable is only populated
68090 if there is an actual signature in the message for the current domain or
68091 identity (as reflected by <option>$dkim_cur_signer</option>).
68092 </para>
68093 </listitem></varlistentry>
68094 <varlistentry>
68095 <term><option>$dkim_selector</option></term>
68096 <listitem>
68097 <para>
68098 The key record selector string.
68099 </para>
68100 </listitem></varlistentry>
68101 <varlistentry>
68102 <term><option>$dkim_algo</option></term>
68103 <listitem>
68104 <para>
68105 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
68106 </para>
68107 </listitem></varlistentry>
68108 <varlistentry>
68109 <term><option>$dkim_canon_body</option></term>
68110 <listitem>
68111 <para>
68112 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
68113 </para>
68114 </listitem></varlistentry>
68115 <varlistentry>
68116 <term><option>dkim_canon_headers</option></term>
68117 <listitem>
68118 <para>
68119 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
68120 </para>
68121 </listitem></varlistentry>
68122 <varlistentry>
68123 <term><option>$dkim_copiedheaders</option></term>
68124 <listitem>
68125 <para>
68126 A transcript of headers and their values which are included in the signature
68127 (copied from the &#x2019;z=&#x2019; tag of the signature).
68128 </para>
68129 </listitem></varlistentry>
68130 <varlistentry>
68131 <term><option>$dkim_bodylength</option></term>
68132 <listitem>
68133 <para>
68134 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
68135 limit was set by the signer, "9999999999999" is returned. This makes sure
68136 that this variable always expands to an integer value.
68137 </para>
68138 </listitem></varlistentry>
68139 <varlistentry>
68140 <term><option>$dkim_created</option></term>
68141 <listitem>
68142 <para>
68143 UNIX timestamp reflecting the date and time when the signature was created.
68144 When this was not specified by the signer, "0" is returned.
68145 </para>
68146 </listitem></varlistentry>
68147 <varlistentry>
68148 <term><option>$dkim_expires</option></term>
68149 <listitem>
68150 <para>
68151 UNIX timestamp reflecting the date and time when the signer wants the
68152 signature to be treated as "expired". When this was not specified by the
68153 signer, "9999999999999" is returned. This makes it possible to do useful
68154 integer size comparisons against this value.
68155 </para>
68156 </listitem></varlistentry>
68157 <varlistentry>
68158 <term><option>$dkim_headernames</option></term>
68159 <listitem>
68160 <para>
68161 A colon-separated list of names of headers included in the signature.
68162 </para>
68163 </listitem></varlistentry>
68164 <varlistentry>
68165 <term><option>$dkim_key_testing</option></term>
68166 <listitem>
68167 <para>
68168 "1" if the key record has the "testing" flag set, "0" if not.
68169 </para>
68170 </listitem></varlistentry>
68171 <varlistentry>
68172 <term><option>$dkim_key_nosubdomains</option></term>
68173 <listitem>
68174 <para>
68175 "1" if the key record forbids subdomaining, "0" otherwise.
68176 </para>
68177 </listitem></varlistentry>
68178 <varlistentry>
68179 <term><option>$dkim_key_srvtype</option></term>
68180 <listitem>
68181 <para>
68182 Service type (tag s=) from the key record. Defaults to "*" if not specified
68183 in the key record.
68184 </para>
68185 </listitem></varlistentry>
68186 <varlistentry>
68187 <term><option>$dkim_key_granularity</option></term>
68188 <listitem>
68189 <para>
68190 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
68191 in the key record.
68192 </para>
68193 </listitem></varlistentry>
68194 <varlistentry>
68195 <term><option>$dkim_key_notes</option></term>
68196 <listitem>
68197 <para>
68198 Notes from the key record (tag n=).
68199 </para>
68200 </listitem></varlistentry>
68201 </variablelist>
68202 <para>
68203 In addition, two ACL conditions are provided:
68204 </para>
68205 <variablelist>
68206 <varlistentry>
68207 <term><option>dkim_signers</option></term>
68208 <listitem>
68209 <para>
68210 ACL condition that checks a colon-separated list of domains or identities
68211 for a match against the domain or identity that the ACL is currently verifying
68212 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
68213 verb to a group of domains or identities. For example:
68214 </para>
68215 <literallayout class="monospaced">
68216 # Warn when Mail purportedly from GMail has no signature at all
68217 warn log_message = GMail sender without DKIM signature
68218      sender_domains = gmail.com
68219      dkim_signers = gmail.com
68220      dkim_status = none
68221 </literallayout>
68222 </listitem></varlistentry>
68223 <varlistentry>
68224 <term><option>dkim_status</option></term>
68225 <listitem>
68226 <para>
68227 ACL condition that checks a colon-separated list of possible DKIM verification
68228 results against the actual result of verification. This is typically used
68229 to restrict an ACL verb to a list of verification outcomes, for example:
68230 </para>
68231 <literallayout class="monospaced">
68232 deny message = Mail from Paypal with invalid/missing signature
68233      sender_domains = paypal.com:paypal.de
68234      dkim_signers = paypal.com:paypal.de
68235      dkim_status = none:invalid:fail
68236 </literallayout>
68237 <para>
68238 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
68239 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
68240 for more information of what they mean.
68241 </para>
68242 </listitem></varlistentry>
68243 </variablelist>
68244 </section>
68245 </chapter>
68246
68247 <chapter id="CHID13">
68248 <title>Adding new drivers or lookup types</title>
68249 <titleabbrev>Adding drivers or lookups</titleabbrev>
68250 <para>
68251 <indexterm role="concept">
68252 <primary>adding drivers</primary>
68253 </indexterm>
68254 <indexterm role="concept">
68255 <primary>new drivers, adding</primary>
68256 </indexterm>
68257 <indexterm role="concept">
68258 <primary>drivers</primary>
68259 <secondary>adding new</secondary>
68260 </indexterm>
68261 The following actions have to be taken in order to add a new router, transport,
68262 authenticator, or lookup type to Exim:
68263 </para>
68264 <orderedlist numeration="arabic">
68265 <listitem>
68266 <para>
68267 Choose a name for the driver or lookup type that does not conflict with any
68268 existing name; I will use <quote>newdriver</quote> in what follows.
68269 </para>
68270 </listitem>
68271 <listitem>
68272 <para>
68273 Add to <filename>src/EDITME</filename> the line:
68274 </para>
68275 <literallayout>
68276 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
68277 </literallayout>
68278 <para>
68279 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
68280 code is not to be included in the binary by default, comment this line out. You
68281 should also add any relevant comments about the driver or lookup type.
68282 </para>
68283 </listitem>
68284 <listitem>
68285 <para>
68286 Add to <filename>src/config.h.defaults</filename> the line:
68287 </para>
68288 <literallayout class="monospaced">
68289 #define &lt;type&gt;_NEWDRIVER
68290 </literallayout>
68291 </listitem>
68292 <listitem>
68293 <para>
68294 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
68295 and create a table entry as is done for all the other drivers and lookup types.
68296 </para>
68297 </listitem>
68298 <listitem>
68299 <para>
68300 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
68301 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
68302 Add your <literal>NEWDRIVER</literal> to that list.
68303 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
68304 simple form that most lookups have.
68305 </para>
68306 </listitem>
68307 <listitem>
68308 <para>
68309 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
68310 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
68311 driver or lookup type and add it to the definition of OBJ.
68312 </para>
68313 </listitem>
68314 <listitem>
68315 <para>
68316 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
68317 <filename>src</filename>.
68318 </para>
68319 </listitem>
68320 <listitem>
68321 <para>
68322 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
68323 as for other drivers and lookups.
68324 </para>
68325 </listitem>
68326 </orderedlist>
68327 <para>
68328 Then all you need to do is write the code! A good way to start is to make a
68329 proforma by copying an existing module of the same type, globally changing all
68330 occurrences of the name, and cutting out most of the code. Note that any
68331 options you create must be listed in alphabetical order, because the tables are
68332 searched using a binary chop procedure.
68333 </para>
68334 <para>
68335 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
68336 the interface that is expected.
68337 </para>
68338 <?sdop
68339   format="newpage"
68340   foot_right_recto="&chaptertitle;"
68341   foot_right_verso="&chaptertitle;"
68342 ?>
68343 </chapter>
68344
68345 <index role="option">
68346 <title>Options index</title>
68347 </index>
68348
68349 <index role="variable">
68350 <title>Variables index</title>
68351 </index>
68352
68353 <index role="concept">
68354 <title>Concept index</title>
68355 </index>
68356
68357 </book>